Mesa (main): i915g: Make sure the 1D texture Y channel is initialized.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 2 21:27:53 UTC 2021


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

Author: Emma Anholt <emma at anholt.net>
Date:   Wed Jun 30 21:58:23 2021 -0700

i915g: Make sure the 1D texture Y channel is initialized.

Even with the wrap mode forced to REPEAT, we get undefined results in
CelShading when the Y channel is unwritten since the beginning of the
program.

I dropped the coords==0 case in the process, since that's not possible and
made the 1D case confusing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11457>

---

 src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt |  1 +
 src/gallium/drivers/i915/ci/traces-i915.yml           | 13 +++++--------
 src/gallium/drivers/i915/i915_fpc_emit.c              | 10 ++++++----
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt b/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt
index 98a515a6ed0..d8376f3dfab 100644
--- a/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt
+++ b/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt
@@ -735,6 +735,7 @@ spec at glsl-1.10@execution at loops@glsl-fs-unroll-side-effect,Fail
 spec at glsl-1.10@execution at samplers@glsl-fs-shadow1d,Fail
 spec at glsl-1.10@execution at samplers@glsl-fs-shadow1d-01,Fail
 spec at glsl-1.10@execution at samplers@glsl-fs-shadow1d-03,Fail
+spec at glsl-1.10@execution at samplers@glsl-fs-shadow1d-04,Fail
 spec at glsl-1.10@execution at samplers@glsl-fs-shadow1d-07,Fail
 spec at glsl-1.10@execution at samplers@glsl-fs-shadow1d-08,Fail
 spec at glsl-1.10@execution at samplers@glsl-fs-shadow1d-bias,Fail
diff --git a/src/gallium/drivers/i915/ci/traces-i915.yml b/src/gallium/drivers/i915/ci/traces-i915.yml
index 062085388f9..741df0b16b5 100644
--- a/src/gallium/drivers/i915/ci/traces-i915.yml
+++ b/src/gallium/drivers/i915/ci/traces-i915.yml
@@ -23,14 +23,11 @@ traces:
   #  expectations:
   #    - device: i915-g33
   #      checksum: 8d4c52f0af9c09710d358f24c73fae3c
-  #- path: humus/CelShading.trace
-  #  # The cel shading is pretty chunky, but maybe that's just precision stuff.
-  #  # Since the NIR change, 1D textures are getting undefined .y channels that
-  #  # could trigger the known bad 1D texture wrap behavior, and the rendering looks
-  #  # like undefined data.
-  #  expectations:
-  #    - device: i915-g33
-  #      checksum: 4605ceed2b5c3a03f9262c546d75a8d8
+  - path: humus/CelShading.trace
+    # The cel shading is pretty chunky, but maybe that's just precision stuff.
+    expectations:
+      - device: i915-g33
+        checksum: 86094ef6a40bfe48d4b7d66871af97a5
   # Requires GLSL 1.30
   #- path: humus/DynamicBranching3.trace
   #  expectations:
diff --git a/src/gallium/drivers/i915/i915_fpc_emit.c b/src/gallium/drivers/i915/i915_fpc_emit.c
index 93be86a344d..4ca73b18d64 100644
--- a/src/gallium/drivers/i915/i915_fpc_emit.c
+++ b/src/gallium/drivers/i915/i915_fpc_emit.c
@@ -186,11 +186,13 @@ i915_emit_texld(struct i915_fp_compile *p, uint32_t dest, uint32_t destmask,
    /* Eliminate the useless texture coordinates. Otherwise we end up generating
     * a swizzle for no reason below. */
    switch (num_coord) {
-   case 0:
-      ignore |= (0xf << UREG_CHANNEL_X_SHIFT);
-      FALLTHROUGH;
    case 1:
-      ignore |= (0xf << UREG_CHANNEL_Y_SHIFT);
+      /* For 1D textures, make sure that the Y coordinate is actually
+       * initialized. It seems that if the channel is never written during the
+       * program, texturing returns undefined results (even if the Y wrap is
+       * REPEAT).
+       */
+      coord = swizzle(coord, X, X, Y, Z);
       FALLTHROUGH;
    case 2:
       ignore |= (0xf << UREG_CHANNEL_Z_SHIFT);



More information about the mesa-commit mailing list