Skip to content

glsl: Use fb_fetch_output to detect FB fetches

Faith Ekstrand requested to merge gfxstrand/mesa:glsl/fb-fetch-msaa-fix into main

Instead of looking for outputs which are rvalues, just look for the fb_fetch_output decoration on the ir_variable. This is more robust because it is based on whether or not the extension is used (by declaring gl_LastFragData) not based on whether or not an output ever shows up in the RHS of something. In particular, we were triggering sample shading on cases with a simple output variable read like this:

out vec4 fs_out;
....
fs_out = vec4(...);
if (fs_out.w < alpha_test_value)
   discard;

When I wrote this pass, I had assumed copy-prop would clean up such cases but aparently they get missed sometimes. I was also unaware of the fb_fetch_output decoration or else I wouldn't have gone to all the effort to track rvalues.

Fixes: 1124bee4 ("glsl/nir: Set sample_shading if a FS output ever shows up as an rvalue")

Merge request reports