Skip to content

v3d/compiler: handle VARYING_SLOT_CLIP_DIST0 as a compact scalar array

Iago Toral requested to merge itoral/mesa:v3d_vulkan_lower_clip_dist_fs into master

On the _NIR side, nir_lower_clip_fs assumes that fragment shaders don't have clip dist inputs and unconditionally inserts them, however, Vulkan allows fragment shaders to read gl_ClipDistance[], in which case the SPIR-V compiler adds a single VARYING_SLOT_CLIP_DIST0 variable defined as a compact scalar array, and in that case we don't want the lowering to insert its own variables, but rather, work in terms of the existing one.

On the V3D side, we teach the backend compiler how to handle compact varyings and then we make our fragment shader clip lowering always request to work with a compact array variable so we don't have to care about the API in use.

Merge request reports