Mesa (main): i915g: Improve the explanation for the 1D Y swizzle.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 1 21:07:21 UTC 2021


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

Author: Emma Anholt <emma at anholt.net>
Date:   Thu Oct 28 10:20:01 2021 -0700

i915g: Improve the explanation for the 1D Y swizzle.

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

---

 src/gallium/drivers/i915/i915_fpc_translate.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c
index 345f8609805..7e36f2f0736 100644
--- a/src/gallium/drivers/i915/i915_fpc_translate.c
+++ b/src/gallium/drivers/i915/i915_fpc_translate.c
@@ -364,10 +364,9 @@ emit_tex(struct i915_fp_compile *p, const struct i915_full_instruction *inst,
    uint32_t sampler = i915_emit_decl(p, REG_TYPE_S, unit, tex);
    uint32_t coord = src_vector(p, &inst->Src[0], fs);
 
-   /* 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).
+   /* For 1D textures, set the Y coord to the same as X.  Otherwise, we could
+    * select the wrong LOD based on the uninitialized Y coord when we sample our
+    * 1D textures as 2D.
     */
    if (texture == TGSI_TEXTURE_1D || texture == TGSI_TEXTURE_SHADOW1D)
       coord = swizzle(coord, X, X, Z, W);



More information about the mesa-commit mailing list