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 <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17341>
This commit is contained in:
Rob Clark 2022-07-01 16:37:08 -07:00 committed by Marge Bot
parent 1fdddb1424
commit ff22be1110
2 changed files with 14 additions and 11 deletions

View file

@ -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
@ -462,27 +461,17 @@ spec@!opengl 2.0@gl-2.0-edgeflag-immediate,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

View file

@ -1001,6 +1001,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);