From 46b44cf941767d9d1cccefa6dc20789cbd8cdeea Mon Sep 17 00:00:00 2001 From: Lars-Ivar Hesselberg Simonsen Date: Fri, 14 Nov 2025 10:46:14 +0100 Subject: [PATCH] glsl/nir: Add texture_buffers to shader info While analyzing glsl shaders, keep a bitmask of texture buffers. This information is needed by panfrost. Reviewed-by: Boris Brezillon Part-of: --- src/compiler/glsl/gl_nir_lower_samplers_as_deref.c | 8 ++++++++ src/compiler/shader_info.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c b/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c index 76e6653eead..1fb451e8922 100644 --- a/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c +++ b/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c @@ -247,6 +247,14 @@ record_textures_used(struct shader_info *info, BITSET_SET_COUNT(info->textures_used_by_txf, var->data.binding, MAX2(size, 1)); } + + enum glsl_sampler_dim sampler_dim = + glsl_get_sampler_dim(glsl_without_array(var->type)); + if (sampler_dim == GLSL_SAMPLER_DIM_BUF) { + BITSET_SET_RANGE(info->texture_buffers, var->data.binding, + var->data.binding + (MAX2(size, 1) - 1)); + } + } static void diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index 77449a79043..df32b4e6938 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -138,6 +138,9 @@ typedef struct shader_info { /** Bitfield of which textures are used by texelFetch() */ BITSET_DECLARE(textures_used_by_txf, 128); + /** Bitfield of which textures are texel buffers */ + BITSET_DECLARE(texture_buffers, 128); + /** Bitfield of which samplers are used */ BITSET_DECLARE(samplers_used, 32);