nir: add shader_info::last_msaa_image
authorMarek Olšák <marek.olsak@amd.com>
Fri, 13 Sep 2019 01:09:50 +0000 (21:09 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 9 Oct 2019 21:12:19 +0000 (17:12 -0400)
for radeonsi

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
src/compiler/nir/nir_gather_info.c
src/compiler/shader_info.h

index 3bf0d448356ef9077b4b6ba0edf2f9f6f20243a6..9267db95b7735054567030ebbe3a04e1793ac119 100644 (file)
@@ -360,6 +360,7 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
 {
    shader->info.num_textures = 0;
    shader->info.num_images = 0;
+   shader->info.last_msaa_image = -1;
    nir_foreach_variable(var, &shader->uniforms) {
       /* Bindless textures and images don't use non-bindless slots. */
       if (var->data.bindless)
@@ -367,6 +368,11 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
 
       shader->info.num_textures += glsl_type_get_sampler_count(var->type);
       shader->info.num_images += glsl_type_get_image_count(var->type);
+
+      /* Assuming image slots don't have holes (e.g. OpenGL) */
+      if (glsl_type_is_image(var->type) &&
+          glsl_get_sampler_dim(var->type) == GLSL_SAMPLER_DIM_MS)
+         shader->info.last_msaa_image = shader->info.num_images - 1;
    }
 
    shader->info.inputs_read = 0;
index 740b75b756ad669437e83a164ffbd2d8e8332064..1de583e60107ff879c8ea605b8d49cb847dfe09c 100644 (file)
@@ -105,6 +105,8 @@ typedef struct shader_info {
    unsigned num_ssbos;
    /* Number of images used by this shader */
    unsigned num_images;
+   /* Index of the last MSAA image. */
+   int last_msaa_image;
 
    /* Which inputs are actually read */
    uint64_t inputs_read;