Mesa (main): i915g: Force 1D textures to use wrap mode for the Y coordinate.

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


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

Author: Emma Anholt <emma at anholt.net>
Date:   Thu Jun 17 21:30:06 2021 -0700

i915g: Force 1D textures to use wrap mode for the Y coordinate.

There are no 1D textures in HW, so we use 2D, but at the shader level
there no Y coordinate to 1D sampling, so we need that value to be ignored.
WRAP mode can get us that.

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

---

 src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt | 6 ------
 src/gallium/drivers/i915/i915_state_sampler.c         | 8 ++++++++
 2 files changed, 8 insertions(+), 6 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 e066b512ffc..98a515a6ed0 100644
--- a/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt
+++ b/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt
@@ -140,12 +140,6 @@ spec@!opengl 1.2 at texwrap 3d proj at GL_RGBA8- NPOT- projected,Fail
 spec@!opengl 1.2 at texwrap 3d proj bordercolor,Fail
 spec@!opengl 1.2 at texwrap 3d proj bordercolor at GL_RGBA8- projected- border color only,Fail
 spec@!opengl 1.4 at gl-1.4-polygon-offset,Fail
-
-# 1D textures are treated as 2D, but we don't force
-# the Y clamp to repeat or edge, so you get interpolation, and we get
-# different undefined values in the y coordinate in the new shader.
-spec@!opengl 1.4 at gl-1.4-tex1d-2dborder,Fail
-
 spec@!opengl 1.4 at tex-miplevel-selection,Fail
 spec@!opengl 1.4 at tex-miplevel-selection-lod,Fail
 spec@!opengl 1.4 at tex-miplevel-selection-lod-bias,Fail
diff --git a/src/gallium/drivers/i915/i915_state_sampler.c b/src/gallium/drivers/i915/i915_state_sampler.c
index c04059dcc2e..f8d478ea00b 100644
--- a/src/gallium/drivers/i915/i915_state_sampler.c
+++ b/src/gallium/drivers/i915/i915_state_sampler.c
@@ -89,6 +89,14 @@ update_sampler(struct i915_context *i915, uint32_t unit,
       state[0] |= SS2_REVERSE_GAMMA_ENABLE;
    }
 
+   /* There is no HW support for 1D textures, so we just make them 2D textures
+    * with h=1, but that means we need to make the Y coordinate not contribute
+    * to bringing any border color in.  Clearing it sets it to WRAP.
+    */
+   if (pt->target == PIPE_TEXTURE_1D) {
+      state[1] &= ~SS3_TCY_ADDR_MODE_MASK;
+   }
+
    /* The GLES2 spec says textures are incomplete (return 0,0,0,1) if:
     *
     * "A cube map sampler is called, any of the corresponding texture images are



More information about the mesa-commit mailing list