Mesa (master): nir: add shader_info::last_msaa_image

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 9 21:14:17 UTC 2019


Module: Mesa
Branch: master
Commit: e26bd397a8fd818db3a72aef1d0e271fa24c3f7d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e26bd397a8fd818db3a72aef1d0e271fa24c3f7d

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Thu Sep 12 21:09:50 2019 -0400

nir: add shader_info::last_msaa_image

for radeonsi

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>

---

 src/compiler/nir/nir_gather_info.c | 6 ++++++
 src/compiler/shader_info.h         | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c
index 3bf0d448356..9267db95b77 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -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;
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index 740b75b756a..1de583e6010 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -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;




More information about the mesa-commit mailing list