diff options
author | Kenneth Graunke <[email protected]> | 2017-09-09 00:19:57 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2017-10-12 17:22:39 -0700 |
commit | fbf4c2916c14d95209abc6b64737ad8528e62fae (patch) | |
tree | 5724a38c38e99de55fc824d828175b14e6a79dc7 /src | |
parent | fb972ed4e51f7570210b523264e927a378265a2a (diff) |
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/shader_info.h | 3 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 1 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_texture.c | 2 | ||||
-rw-r--r-- | 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 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; } } } |