return NULL;
nir_ssa_def *dest = &tex->dest.ssa;
if (rewrite_depth && zs) {
- if (b->shader->info.stage == MESA_SHADER_FRAGMENT)
- flag_shadow_tex(var, zs);
- else
- mesa_loge("unhandled old-style shadow sampler in non-fragment stage!");
+ /* If only .x is used in the NIR, then it's effectively not a legacy depth
+ * sample anyway and we don't want to ask for shader recompiles. This is
+ * the typical path, since GL_DEPTH_TEXTURE_MODE defaults to either RED or
+ * LUMINANCE, so apps just use the first channel.
+ */
+ if (nir_ssa_def_components_read(dest) & ~1) {
+ if (b->shader->info.stage == MESA_SHADER_FRAGMENT)
+ flag_shadow_tex(var, zs);
+ else
+ mesa_loge("unhandled old-style shadow sampler in non-fragment stage!");
+ }
return NULL;
}
if (bit_size != dest_size) {
} non_fs;
struct {
- uint32_t legacy_shadow_mask; //is_new_style_shadow is false for these
+ /* Bitmask of textures that have shadow sampling result components
+ * other than RED accessed. This is a subset of !is_new_style_shadow
+ * (GLSL <1.30, ARB_fp) shadow sampling usage.
+ */
+ uint32_t legacy_shadow_mask;
nir_variable *fbfetch; //for fs output
} fs;
};