compiler: Move gl_program::TexelFetchSamplers to shader_info.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 9 Sep 2017 07:19:57 +0000 (00:19 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 13 Oct 2017 00:22:39 +0000 (17:22 -0700)
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@amd.com>
src/compiler/shader_info.h
src/mesa/main/mtypes.h
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 38413940d678af17359ffe9a2af66c2f0e7f9271..cd044d8609460fcb965d4c805a404b05a93f73ed 100644 (file)
@@ -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;
 
index 8206793de9c7057b77e923a425f33cb923699278..2802a0e3605bb57da908ab6860ce3d6ae428be2b 100644 (file)
@@ -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 */
index c350a0980973edbd67e7455683d0c2c700c0c76d..6c26b7751b2a6a070651d3eee543916480406d11 100644 (file)
@@ -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;
index 573ce69d8fa9b76b066d3864fb7f4bafcd63de3f..a45f0047a8ab6b91498f82556e06d13f195e8511 100644 (file)
@@ -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;
             }
          }
       }