i915g: Mark program errors on setting up temps, constants, and immediates.

We would proceed through the compiler, and usually fail for some other
reason (ALU ops, etc.), but best to be sure.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11617>
This commit is contained in:
Emma Anholt 2021-06-27 15:00:59 -07:00
parent 7ddebb0289
commit ccc9418b27
3 changed files with 25 additions and 16 deletions

View File

@ -928,7 +928,7 @@ dEQP-GLES2.functional.uniform_api.random.21,Fail
dEQP-GLES2.functional.uniform_api.random.24,Fail
dEQP-GLES2.functional.uniform_api.random.54,Fail
dEQP-GLES2.functional.uniform_api.random.71,Fail
dEQP-GLES2.functional.uniform_api.random.74,Crash
dEQP-GLES2.functional.uniform_api.random.74,Fail
dEQP-GLES2.functional.uniform_api.random.80,Fail
dEQP-GLES2.functional.uniform_api.random.81,Fail
dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.render.array_in_struct.int_ivec4_both,Fail

View File

@ -688,14 +688,14 @@ spec@glsl-1.10@execution@fs-frontfacing-ternary-0.0-neg-1.0,Fail
spec@glsl-1.10@execution@fs-frontfacing-ternary-1-neg-1,Fail
spec@glsl-1.10@execution@fs-frontfacing-ternary-1.0-neg-1.0,Fail
spec@glsl-1.10@execution@fs-frontfacing-ternary-neg-1.0-1.0,Fail
spec@glsl-1.10@execution@fs-loop-bounds-unrolled,Crash
spec@glsl-1.10@execution@fs-loop-bounds-unrolled,Fail
spec@glsl-1.10@execution@fs-notequal-of-expression,Fail
spec@glsl-1.10@execution@fs-sign-times-abs,Fail
spec@glsl-1.10@execution@fs-sign-times-neg,Fail
spec@glsl-1.10@execution@fs-sign-times-neg-abs,Fail
spec@glsl-1.10@execution@fs-sign-times-sign,Fail
spec@glsl-1.10@execution@gl_lightsource_indirect,Fail
spec@glsl-1.10@execution@glsl-1.10-built-in-matrix-state,Crash
spec@glsl-1.10@execution@glsl-1.10-built-in-matrix-state,Fail
spec@glsl-1.10@execution@glsl-1.10-built-in-uniform-state,Crash
spec@glsl-1.10@execution@glsl-clamp-vertex-color,Fail
spec@glsl-1.10@execution@glsl-fs-convolution-1,Fail

View File

@ -844,24 +844,29 @@ i915_translate_token(struct i915_fp_compile *p,
case TGSI_TOKEN_TYPE_DECLARATION:
if (token->FullDeclaration.Declaration.File == TGSI_FILE_CONSTANT) {
uint32_t i;
for (i = token->FullDeclaration.Range.First;
i <=
MIN2(token->FullDeclaration.Range.Last, I915_MAX_CONSTANT - 1);
i++) {
ifs->constant_flags[i] = I915_CONSTFLAG_USER;
ifs->num_constants = MAX2(ifs->num_constants, i + 1);
if (token->FullDeclaration.Range.Last >= I915_MAX_CONSTANT) {
i915_program_error(p, "Exceeded %d max uniforms",
I915_MAX_CONSTANT);
} else {
uint32_t i;
for (i = token->FullDeclaration.Range.First;
i <= token->FullDeclaration.Range.Last; i++) {
ifs->constant_flags[i] = I915_CONSTFLAG_USER;
ifs->num_constants = MAX2(ifs->num_constants, i + 1);
}
}
} else if (token->FullDeclaration.Declaration.File ==
TGSI_FILE_TEMPORARY) {
uint32_t i;
for (i = token->FullDeclaration.Range.First;
i <= token->FullDeclaration.Range.Last; i++) {
if (i >= I915_MAX_TEMPORARY)
debug_printf("Too many temps (%d)\n", i);
else
if (token->FullDeclaration.Range.Last >= I915_MAX_TEMPORARY) {
i915_program_error(p, "Exceeded %d max TGSI temps",
I915_MAX_TEMPORARY);
} else {
uint32_t i;
for (i = token->FullDeclaration.Range.First;
i <= token->FullDeclaration.Range.Last; i++) {
/* XXX just use shader->info->file_mask[TGSI_FILE_TEMPORARY] */
p->temp_flag |= (1 << i); /* mark temp as used */
}
}
}
break;
@ -893,6 +898,10 @@ i915_translate_token(struct i915_fp_compile *p,
break;
}
}
if (j == I915_MAX_CONSTANT) {
i915_program_error(p, "Exceeded %d max uniforms and immediates.",
I915_MAX_CONSTANT);
}
}
p->first_instruction = false;