Module: Mesa Branch: staging/22.1 Commit: d0b724d238c45c196c5b4849a84eb58bd02ae397 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d0b724d238c45c196c5b4849a84eb58bd02ae397
Author: Rob Clark <[email protected]> Date: Fri Jul 1 16:37:08 2022 -0700 freedreno/ir3: Copy vars if needed on EndPrimitive() If we didn't EmitPrimitive() then the shadow (old) outputs would not get copied to the emit temps (to eventually be copied back to the real outputs. This isn't so bad except that means the realy vertex_flags output has an undefined value. Signed-off-by: Rob Clark <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17341> (cherry picked from commit ff22be1110ab7bef626b5f6948ca423cf741bb2d) --- .pick_status.json | 2 +- src/freedreno/ci/freedreno-a630-fails.txt | 11 ----------- src/freedreno/ir3/ir3_nir_lower_tess.c | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 33f180ff440..39b5b35183e 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -7690,7 +7690,7 @@ "description": "freedreno/ir3: Copy vars if needed on EndPrimitive()", "nominated": false, "nomination_type": null, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/freedreno/ci/freedreno-a630-fails.txt b/src/freedreno/ci/freedreno-a630-fails.txt index 364309fe096..04febca87ea 100644 --- a/src/freedreno/ci/freedreno-a630-fails.txt +++ b/src/freedreno/ci/freedreno-a630-fails.txt @@ -53,7 +53,6 @@ glx@glx-swap-pixmap-bad,Fail glx@glx-visuals-depth -pixmap,Crash glx@glx-visuals-stencil -pixmap,Crash shaders@glsl-fs-fogscale,Fail -shaders@glsl-fs-fogscale@gs-out and fs,Fail # "../src/freedreno/ir3/ir3_shader.h:968:ir3_link_add: Assertion `i < ARRAY_SIZE(l->var)' failed." shaders@glsl-max-varyings >max_varying_components,Crash @@ -540,27 +539,17 @@ spec@!opengl [email protected],Crash spec@!opengl 2.0@vertex-program-two-side back back2,Crash spec@!opengl 2.0@vertex-program-two-side back front2 back2,Fail -spec@!opengl 2.0@vertex-program-two-side back front2 back2@gs-out and fs,Fail spec@!opengl 2.0@vertex-program-two-side back front2,Fail -spec@!opengl 2.0@vertex-program-two-side back front2@gs-out and fs,Fail spec@!opengl 2.0@vertex-program-two-side back,Crash spec@!opengl 2.0@vertex-program-two-side back2,Crash spec@!opengl 2.0@vertex-program-two-side enabled back back2,Fail -spec@!opengl 2.0@vertex-program-two-side enabled back back2@gs-out and fs,Fail spec@!opengl 2.0@vertex-program-two-side enabled back front2 back2,Fail -spec@!opengl 2.0@vertex-program-two-side enabled back front2 back2@gs-out and fs,Fail spec@!opengl 2.0@vertex-program-two-side enabled back front2,Fail -spec@!opengl 2.0@vertex-program-two-side enabled back front2@gs-out and fs,Fail spec@!opengl 2.0@vertex-program-two-side enabled back,Fail -spec@!opengl 2.0@vertex-program-two-side enabled back@gs-out and fs,Fail spec@!opengl 2.0@vertex-program-two-side enabled back2,Fail -spec@!opengl 2.0@vertex-program-two-side enabled back2@gs-out and fs,Fail spec@!opengl 2.0@vertex-program-two-side enabled front back back2,Fail -spec@!opengl 2.0@vertex-program-two-side enabled front back back2@gs-out and fs,Fail spec@!opengl 2.0@vertex-program-two-side enabled front back front2 back2,Fail -spec@!opengl 2.0@vertex-program-two-side enabled front back front2 back2@gs-out and fs,Fail spec@!opengl 2.0@vertex-program-two-side enabled front back front2,Fail -spec@!opengl 2.0@vertex-program-two-side enabled front back front2@gs-out and fs,Fail spec@!opengl 2.0@vertex-program-two-side enabled front back,Fail spec@!opengl 2.0@vertex-program-two-side enabled front back@gs-out and fs,Fail spec@!opengl 2.0@vertex-program-two-side enabled front back2,Fail diff --git a/src/freedreno/ir3/ir3_nir_lower_tess.c b/src/freedreno/ir3/ir3_nir_lower_tess.c index 1ba39619ebd..63bb3e24c18 100644 --- a/src/freedreno/ir3/ir3_nir_lower_tess.c +++ b/src/freedreno/ir3/ir3_nir_lower_tess.c @@ -991,6 +991,20 @@ ir3_nir_lower_gs(nir_shader *shader) nir_ssa_def *cond = nir_ieq_imm(&b, nir_load_var(&b, state.emitted_vertex_var), 0); + /* If we haven't emitted any vertex we need to copy the shadow (old) + * outputs to emit outputs here. + * + * Also some piglit GS tests[1] don't have EndPrimitive() so throw + * in an extra vertex_flags write for good measure. If unneeded it + * will be optimized out. + * + * [1] ex, tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-const-accept.shader_test + */ + nir_push_if(&b, cond); + nir_store_var(&b, state.vertex_flags_out, nir_imm_int(&b, 4), 0x1); + copy_vars(&b, &state.emit_outputs, &state.old_outputs); + nir_pop_if(&b, NULL); + nir_discard_if(&b, cond); copy_vars(&b, &state.new_outputs, &state.emit_outputs);
