[Mesa-dev] [PATCH v2 1.1/3] compiler: Move gl_program::TexelFetchSamplers to shader_info.
Kenneth Graunke
kenneth at whitecape.org
Thu Oct 12 07:44:25 UTC 2017
I'd like to put this sort of metadata in the shader_info structure,
rather than adding more things to gl_program.
---
src/compiler/shader_info.h | 3 +++
src/mesa/main/mtypes.h | 1 -
src/mesa/state_tracker/st_atom_texture.c | 2 +-
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 ++-
4 files changed, 6 insertions(+), 3 deletions(-)
Patches 1.1 and 1.2 here replace:
[PATCH 1/3] compiler: Track which textures are accessed via texelFetch().
now that Nicolai's patches have landed.
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index 38413940d67..cd044d86094 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -70,6 +70,9 @@ typedef struct shader_info {
/* Whether or not this shader ever uses textureGather() */
bool uses_texture_gather;
+ /** Bitfield of which textures are used by texelFetch() */
+ uint32_t textures_used_by_txf;
+
/* The size of the gl_ClipDistance[] array, if declared. */
unsigned clip_distance_array_size;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 8206793de9c..2802a0e3605 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2088,7 +2088,6 @@ struct gl_program
GLbitfield TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */
GLbitfield SamplersUsed; /**< Bitfield of which samplers are used */
GLbitfield ShadowSamplers; /**< Texture units used for shadow sampling. */
- GLbitfield TexelFetchSamplers; /**< Texture units used for texelFetch*(). */
GLbitfield ExternalSamplersUsed; /**< Texture units used for samplerExternalOES */
/* Fragement shader only fields */
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index c350a098097..6c26b7751b2 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -106,7 +106,7 @@ update_textures(struct st_context *st,
{
const GLuint old_max = *out_num_textures;
GLbitfield samplers_used = prog->SamplersUsed;
- GLbitfield texel_fetch_samplers = prog->TexelFetchSamplers;
+ GLbitfield texel_fetch_samplers = prog->info.textures_used_by_txf;
GLbitfield free_slots = ~prog->SamplersUsed;
GLbitfield external_samplers_used = prog->ExternalSamplersUsed;
GLuint unit;
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 573ce69d8fa..a45f0047a8a 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4460,6 +4460,7 @@ count_resources(glsl_to_tgsi_visitor *v, gl_program *prog)
{
v->samplers_used = 0;
v->images_used = 0;
+ prog->info.textures_used_by_txf = 0;
foreach_in_list(glsl_to_tgsi_instruction, inst, &v->instructions) {
if (inst->info->is_tex) {
@@ -4473,7 +4474,7 @@ count_resources(glsl_to_tgsi_visitor *v, gl_program *prog)
st_translate_texture_target(inst->tex_target, inst->tex_shadow);
if (inst->op == TGSI_OPCODE_TXF || inst->op == TGSI_OPCODE_TXF_LZ) {
- prog->TexelFetchSamplers |= 1u << idx;
+ prog->info.textures_used_by_txf |= 1u << idx;
}
}
}
--
2.14.2
More information about the mesa-dev
mailing list