When i index one vector by another unconstantly indexed integer vector, i get a crash. See https://www.shadertoy.com/view/ldGyzR as an example. I'm using mesa version 17.3.6-1 on Sandy Bridge.
I can reproduce this issue on Skylake with most mesa versions: 11.0.0-rc1 .. 17.3.6 .. latest git master in firefox, chrome and chromium browsers. The crash is caused by the unreachable("not reached"); trap in the end of void nir_visitor::visit(ir_expression *ir) (src/compiler/glsl/glsl_to_nir.cpp, line 1963). Issue can be fixed by adding empty case for ir_binop_vector_extract: diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index c4a6d52a5b..24acfa1f8d 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -1952,6 +1952,9 @@ nir_visitor::visit(ir_expression *ir) case ir_quadop_vector: result = nir_vec(&b, srcs, ir->type->vector_elements); break; + case ir_binop_vector_extract: + /* Prevent the unreachable trap */ + break; default: unreachable("not reached"); or by adding its handler to special cases: diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index c4a6d52a5b..d9efdd7170 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -1493,6 +1493,12 @@ nir_visitor::visit(ir_expression *ir) return; } + case ir_binop_vector_extract: + assert(ir->num_operands == 2); + ir->operands[0]->accept(this); + ir->operands[1]->accept(this); + return; + default: break; }
I've sent a Piglit test for this, Andriy please send your patch to mesa-dev mailing list.
Hi Tapani. As I can see, fix was sent https://patchwork.freedesktop.org/patch/214406/ but it is still in "New" state.
Do you mind to test if the following patch also fixes this issue: https://patchwork.freedesktop.org/patch/221815/
Piglit's glsl-fs-vec4-indexing-8.shader_test is exactly this bug. See the commit message: https://cgit.freedesktop.org/piglit/commit/?id=965b55efbdf37985c731d68259012fdc5cef3d09
Nice! Thanks for confirming.
Hello, Felix. Seems patch-fix was applied. Could you, please, close the issue?
Ah, i didn't notice that, thanks. I can confirm this is fixed with newest Mesa release.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.