i915g: Don't write constants past I915_MAX_CONSTANT
authorStéphane Marchesin <marcheu@chromium.org>
Sat, 22 Nov 2014 08:08:24 +0000 (00:08 -0800)
committerStéphane Marchesin <marcheu@chromium.org>
Sat, 22 Nov 2014 08:13:39 +0000 (00:13 -0800)
This happens with glsl-convolution-1, where we have 64 constants. This
doesn't make the test pass (we don't have 64 constants anyway, only
32) but this prevents it from crashing.

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
src/gallium/drivers/i915/i915_fpc_translate.c

index 124c5866dc3efc27b8c52a11e6ee8979e46b9406..4f5fdd84e66fdb126ad85690277af28d449dd7fe 100644 (file)
@@ -1128,7 +1128,7 @@ static void i915_translate_token(struct i915_fp_compile *p,
                == TGSI_FILE_CONSTANT) {
          uint i;
          for (i = token->FullDeclaration.Range.First;
-              i <= token->FullDeclaration.Range.Last;
+              i <= MIN2(token->FullDeclaration.Range.Last, I915_MAX_CONSTANT - 1);
               i++) {
             assert(ifs->constant_flags[i] == 0x0);
             ifs->constant_flags[i] = I915_CONSTFLAG_USER;