i915g: Mark program errors on setting up temps, constants, and immediates.
authorEmma Anholt <emma@anholt.net>
Sun, 27 Jun 2021 22:00:59 +0000 (15:00 -0700)
committerEmma Anholt <emma@anholt.net>
Mon, 28 Jun 2021 22:01:37 +0000 (15:01 -0700)
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>

src/gallium/drivers/i915/ci/deqp-i915-g33-fails.txt
src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt
src/gallium/drivers/i915/i915_fpc_translate.c

index fb82641..d0f7ceb 100644 (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
index aa7d173..d78d0f5 100644 (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
index 4f4b2ea..6c8291f 100644 (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;