nir/lower_cl_images: record image_buffers and msaa_images

Cc: mesa-stable
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27385>
(cherry picked from commit 727cddd338)
This commit is contained in:
Karol Herbst
2024-01-31 15:57:31 +01:00
committed by Eric Engestrom
parent 4a1d925051
commit ba1737d799
2 changed files with 15 additions and 1 deletions

View File

@@ -744,7 +744,7 @@
"description": "nir/lower_cl_images: record image_buffers and msaa_images",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View File

@@ -114,6 +114,9 @@ nir_lower_cl_images(nir_shader *shader, bool lower_image_derefs, bool lower_samp
ASSERTED int last_loc = -1;
int num_rd_images = 0, num_wr_images = 0;
BITSET_ZERO(shader->info.image_buffers);
BITSET_ZERO(shader->info.msaa_images);
nir_foreach_variable_with_modes(var, shader, nir_var_image | nir_var_uniform) {
if (!glsl_type_is_image(var->type) && !glsl_type_is_texture(var->type))
continue;
@@ -128,6 +131,17 @@ nir_lower_cl_images(nir_shader *shader, bool lower_image_derefs, bool lower_samp
else
var->data.driver_location = num_wr_images++;
var->data.binding = var->data.driver_location;
switch (glsl_get_sampler_dim(var->type)) {
case GLSL_SAMPLER_DIM_BUF:
BITSET_SET(shader->info.image_buffers, var->data.binding);
break;
case GLSL_SAMPLER_DIM_MS:
BITSET_SET(shader->info.msaa_images, var->data.binding);
break;
default:
break;
}
}
shader->info.num_textures = num_rd_images;
BITSET_ZERO(shader->info.textures_used);