zink: add function to check whether a shader has cube samplers

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18197>
This commit is contained in:
Mike Blumenkrantz 2022-08-15 12:57:08 -04:00 committed by Marge Bot
parent 5489b1a8ff
commit 3652ca08aa
2 changed files with 13 additions and 0 deletions

View file

@ -3369,3 +3369,14 @@ zink_shader_tcs_create(struct zink_screen *screen, struct zink_shader *vs, unsig
ret->is_generated = true;
return ret;
}
bool
zink_shader_has_cubes(nir_shader *nir)
{
nir_foreach_variable_with_modes(var, nir, nir_var_uniform) {
const struct glsl_type *type = glsl_without_array(var->type);
if (glsl_type_is_sampler(type) && glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_CUBE)
return true;
}
return false;
}

View file

@ -80,4 +80,6 @@ zink_shader_descriptor_is_buffer(struct zink_shader *zs, enum zink_descriptor_ty
zs->bindings[type][i].type == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER;
}
bool
zink_shader_has_cubes(nir_shader *nir);
#endif