Mesa (main): nir: Don't assert on tg4 offset range.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 3 22:42:21 UTC 2022


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

Author: Emma Anholt <emma at anholt.net>
Date:   Sat Apr 30 07:40:59 2022 -0700

nir: Don't assert on tg4 offset range.

>From the GL 4.6 spec: "If the value of any non-ignored component of the
offset vector operand is outside implementation-dependent limits, the
results of the texture lookup are undefined."  We shouldn't assertion
fail, then.

GLSL-to-NIR shouldn't be enforcing limits on TG4 offsets, since it doesn't
for non-TG4 tex_src_offset either.  Leave it up to the driver to handle
it.

Fixes a crash in a piglit test on nouveau that supplies a negative random
number up to 10,000 as the first coordinate for some reason.  Other NIR
drivers lowered TG4 explicit offsets to tex_src_offset, so they weren't
affected.

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16261>

---

 src/compiler/glsl/glsl_to_nir.cpp                      | 1 -
 src/gallium/drivers/nouveau/ci/nouveau-gm206-fails.txt | 3 ---
 2 files changed, 4 deletions(-)

diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 47e9b0d3756..4113615c2b7 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -2536,7 +2536,6 @@ nir_visitor::visit(ir_texture *ir)
 
             for (unsigned j = 0; j < 2; ++j) {
                int val = c->get_int_component(j);
-               assert(val <= 31 && val >= -32);
                instr->tg4_offsets[i][j] = val;
             }
          }
diff --git a/src/gallium/drivers/nouveau/ci/nouveau-gm206-fails.txt b/src/gallium/drivers/nouveau/ci/nouveau-gm206-fails.txt
index 79bc66edeef..7457cf615ff 100644
--- a/src/gallium/drivers/nouveau/ci/nouveau-gm206-fails.txt
+++ b/src/gallium/drivers/nouveau/ci/nouveau-gm206-fails.txt
@@ -86,9 +86,6 @@ KHR-GL43.shader_ballot_tests.ShaderBallotBitmasks,Fail
 KHR-GL43.shader_ballot_tests.ShaderBallotFunctionBallot,Fail
 KHR-GL43.shader_ballot_tests.ShaderBallotFunctionRead,Fail
 
-# "../src/compiler/glsl/glsl_to_nir.cpp:2539: virtual void {anonymous}::nir_visitor::visit(ir_texture*): Assertion `val <= 31 && val >= -32' failed."
-shaders at glsl-bug-110796,Crash
-
 shaders at glsl-uniform-interstage-limits@subdivide 5- statechanges,Fail
 shaders at point-vertex-id gl_vertexid,Fail
 shaders at point-vertex-id gl_vertexid divisor,Fail



More information about the mesa-commit mailing list