mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 09:18:04 +02:00
nir/lower_blend: Handle undefs in stores
nir/lower_blend asserts:
assert(nir_intrinsic_write_mask(store) ==
nir_component_mask(store->num_components));
For the special blend shaders used in Panfrost, this holds. But for arbitrary
shaders coming out of GLSL-to-NIR (as used with Asahi), this does not hold. In
particular, after nir_opt_undef runs, undefined components can be trimmed.
Concretely, if we have the shader:
gl_FragColor.xyz = foo;
Then this becomes in NIR
gl_FragColor = vec4(foo.xyz, undef);
and then opt_undef will give the store_deref a wrmask of xyz but 4 components.
Then lower_blend asserts out.
Found in a gfxbench shader on asahi.
Closes: #6982
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20016>
This commit is contained in:
parent
8b83210ab3
commit
1fc25c8c79
1 changed files with 2 additions and 3 deletions
|
|
@ -512,11 +512,10 @@ nir_lower_blend_store(nir_builder *b, nir_intrinsic_instr *store,
|
|||
blended = nir_trim_vector(b, blended, num_components);
|
||||
|
||||
/* Grow or shrink the store destination as needed */
|
||||
assert(nir_intrinsic_write_mask(store) ==
|
||||
nir_component_mask(store->num_components));
|
||||
store->num_components = num_components;
|
||||
store->dest.ssa.num_components = num_components;
|
||||
nir_intrinsic_set_write_mask(store, nir_component_mask(num_components));
|
||||
nir_intrinsic_set_write_mask(store, nir_intrinsic_write_mask(store) &
|
||||
nir_component_mask(num_components));
|
||||
|
||||
/* Write out the final color instead of the input */
|
||||
nir_instr_rewrite_src_ssa(&store->instr, &store->src[1], blended);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue