Mesa (main): ttn: Populate the images/textures/samplers_used fields in shader_info

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 7 17:56:48 UTC 2022


Module: Mesa
Branch: main
Commit: 49234585772f49626435d3d9324ad144e27fc453
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=49234585772f49626435d3d9324ad144e27fc453

Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date:   Tue Jun  7 10:59:23 2022 -0500

ttn: Populate the images/textures/samplers_used fields in shader_info

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6630
Fixes: 625b352f14b7 ("nir: Set image_buffers and msaa_images in lower_samplers_as_deref")
Tested-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16910>

---

 src/gallium/auxiliary/nir/tgsi_to_nir.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 8daa55ba59b..3295151aa67 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -2281,6 +2281,12 @@ ttn_read_pipe_caps(struct ttn_compile *c,
    c->cap_integers = screen->get_shader_param(screen, c->scan->processor, PIPE_SHADER_CAP_INTEGERS);
 }
 
+#define BITSET_SET32(bitset, u32_mask) do { \
+   STATIC_ASSERT(sizeof((bitset)[0]) >= sizeof(u32_mask)); \
+   BITSET_ZERO(bitset); \
+   (bitset)[0] = (u32_mask); \
+} while (0)
+
 /**
  * Initializes a TGSI-to-NIR compiler.
  */
@@ -2326,7 +2332,13 @@ ttn_compile_init(const void *tgsi_tokens,
    s->info.num_ssbos = util_last_bit(scan.shader_buffers_declared);
    s->info.num_ubos = util_last_bit(scan.const_buffers_declared >> 1);
    s->info.num_images = util_last_bit(scan.images_declared);
+   BITSET_SET32(s->info.images_used, scan.images_declared);
+   BITSET_SET32(s->info.image_buffers, scan.images_buffers);
+   BITSET_SET32(s->info.msaa_images, scan.msaa_images_declared);
    s->info.num_textures = util_last_bit(scan.samplers_declared);
+   BITSET_SET32(s->info.textures_used, scan.samplers_declared);
+   BITSET_ZERO(s->info.textures_used_by_txf); /* No scan information yet */
+   BITSET_SET32(s->info.samplers_used, scan.samplers_declared);
    s->info.internal = false;
 
    for (unsigned i = 0; i < TGSI_PROPERTY_COUNT; i++) {



More information about the mesa-commit mailing list