Make shader precompile guess MSAA layout properly
Submitted by Kenneth Graunke
Assigned to Intel 3D Bugs Mailing List
Currently, brw_fs_precompile doesn't set compressed_multisample_layout_mask, leaving it at the default value of 0 (non-CMS).
This is dumb. Virtually all multisampled color buffers on Gen7+ use the CMS layout, not UMS or IMS. So, basically every shader that uses a sampler2DMS type (including most of WebGL) will require a recompile.
A better guess would be:
- 1 for sampler2DMS on Gen7+ (0 on Gen6)
- 0 for sampler2DMSShadow
- 0 for non-MS sampler types.
This should eliminate almost all recompiles due to compressed_multisample_layout_mask.
To accomplish this, we may want to create a bitfield similar to SamplersUsed or ShadowSamplers...SamplerIsMSAA or such. Then the precompile could easily check it. Alternatively, we could stop using bitfields and walk a list of NIR uniforms. It should be pretty simple.