Mesa (master): compiler: Move gl_program:: TexelFetchSamplers to shader_info.

Kenneth Graunke kwg at kemper.freedesktop.org
Fri Oct 13 00:24:13 UTC 2017


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sat Sep  9 00:19:57 2017 -0700

compiler: Move gl_program::TexelFetchSamplers to shader_info.

I'd like to put this sort of metadata in the shader_info structure,
rather than adding more things to gl_program.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 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(-)

diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index 38413940d6..cd044d8609 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 8206793de9..2802a0e360 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 c350a09809..6c26b7751b 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 573ce69d8f..a45f0047a8 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;
             }
          }
       }




More information about the mesa-commit mailing list