Mesa (master): i915g: Don't write constants past I915_MAX_CONSTANT

Stephane Marchesin marcheu at kemper.freedesktop.org
Sat Nov 22 05:55:10 UTC 2014


Module: Mesa
Branch: master
Commit: a9b07870764db617f199745573bfccddf9b378f9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a9b07870764db617f199745573bfccddf9b378f9

Author: Stéphane Marchesin <marcheu at chromium.org>
Date:   Sat Nov 22 00:08:24 2014 -0800

i915g: Don't write constants past I915_MAX_CONSTANT

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 at chromium.org>

---

 src/gallium/drivers/i915/i915_fpc_translate.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c
index 124c586..4f5fdd8 100644
--- a/src/gallium/drivers/i915/i915_fpc_translate.c
+++ b/src/gallium/drivers/i915/i915_fpc_translate.c
@@ -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;




More information about the mesa-commit mailing list