Mesa (master): nvc0/ir: fix textureGather with a single offset

Ilia Mirkin imirkin at kemper.freedesktop.org
Wed Oct 12 17:22:23 UTC 2016


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

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Wed Oct 12 10:24:59 2016 -0400

nvc0/ir: fix textureGather with a single offset

Recent fix for non-const offsets broke the case of a single offset (vs 4
offsets). The later code relies on the offs array to contain null values
to tell whether they should be added onto the srcs list.

Fixes: 5239bd592 ("nvc0/ir: fix overwriting of value backing non-constant gather offset")
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Cc: mesa-stable at lists.freedesktop.org

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
index 4c013c4..dab3e2d 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
@@ -820,11 +820,11 @@ NVC0LoweringPass::handleTEX(TexInstruction *i)
          // Either there is 1 offset, which goes into the 2 low bytes of the
          // first source, or there are 4 offsets, which go into 2 sources (8
          // values, 1 byte each).
-         Value *offs[2] = {bld.getScratch(), bld.getScratch()};
+         Value *offs[2] = {NULL, NULL};
          for (n = 0; n < i->tex.useOffsets; n++) {
             for (c = 0; c < 2; ++c) {
                if ((n % 2) == 0 && c == 0)
-                  bld.mkMov(offs[n / 2], i->offset[n][c].get());
+                  bld.mkMov(offs[n / 2] = bld.getScratch(), i->offset[n][c].get());
                else
                   bld.mkOp3(OP_INSBF, TYPE_U32,
                             offs[n / 2],




More information about the mesa-commit mailing list