nir: Skip samplers and textures in lower_explicit_io

We have specialized lowering passes dealing with most of that already:
1. gl_nir_lower_samplers_as_deref
2. nir_lower_samplers
3. nir_lower_cl_images

If we need more than that, those passes can deal with following deref
chains as well.

We _might_ need to improve nir_lower_cl_images a bit for more complex
kernels, but CL also doesn't allow indirect images, so we are always able
to optimize the entire deref chain away.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20161>
This commit is contained in:
Karol Herbst 2023-02-15 22:34:46 +01:00 committed by Marge Bot
parent 186a22712f
commit 6e666c6303

View file

@ -2115,6 +2115,15 @@ static void
lower_explicit_io_deref(nir_builder *b, nir_deref_instr *deref,
nir_address_format addr_format)
{
/* Ignore samplers/textures, because they are handled by other passes like `nir_lower_samplers`.
* Also do it only for those being uniforms, otherwise it will break GL bindless textures handles
* stored in UBOs.
*/
if (nir_deref_mode_is_in_set(deref, nir_var_uniform) &&
(glsl_type_is_sampler(deref->type) ||
glsl_type_is_texture(deref->type)))
return;
/* Just delete the deref if it's not used. We can't use
* nir_deref_instr_remove_if_unused here because it may remove more than
* one deref which could break our list walking since we walk the list