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@amd.com>
This commit is contained in:
Kenneth Graunke
2017-09-09 00:19:57 -07:00
parent fb972ed4e5
commit fbf4c2916c
4 changed files with 6 additions and 3 deletions

View File

@@ -70,6 +70,9 @@ typedef struct shader_info {
/* Whether or not this shader ever uses textureGather() */ /* Whether or not this shader ever uses textureGather() */
bool uses_texture_gather; 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. */ /* The size of the gl_ClipDistance[] array, if declared. */
unsigned clip_distance_array_size; unsigned clip_distance_array_size;

View File

@@ -2088,7 +2088,6 @@ struct gl_program
GLbitfield TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */ GLbitfield TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */
GLbitfield SamplersUsed; /**< Bitfield of which samplers are used */ GLbitfield SamplersUsed; /**< Bitfield of which samplers are used */
GLbitfield ShadowSamplers; /**< Texture units used for shadow sampling. */ GLbitfield ShadowSamplers; /**< Texture units used for shadow sampling. */
GLbitfield TexelFetchSamplers; /**< Texture units used for texelFetch*(). */
GLbitfield ExternalSamplersUsed; /**< Texture units used for samplerExternalOES */ GLbitfield ExternalSamplersUsed; /**< Texture units used for samplerExternalOES */
/* Fragement shader only fields */ /* Fragement shader only fields */

View File

@@ -106,7 +106,7 @@ update_textures(struct st_context *st,
{ {
const GLuint old_max = *out_num_textures; const GLuint old_max = *out_num_textures;
GLbitfield samplers_used = prog->SamplersUsed; 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 free_slots = ~prog->SamplersUsed;
GLbitfield external_samplers_used = prog->ExternalSamplersUsed; GLbitfield external_samplers_used = prog->ExternalSamplersUsed;
GLuint unit; GLuint unit;

View File

@@ -4460,6 +4460,7 @@ count_resources(glsl_to_tgsi_visitor *v, gl_program *prog)
{ {
v->samplers_used = 0; v->samplers_used = 0;
v->images_used = 0; v->images_used = 0;
prog->info.textures_used_by_txf = 0;
foreach_in_list(glsl_to_tgsi_instruction, inst, &v->instructions) { foreach_in_list(glsl_to_tgsi_instruction, inst, &v->instructions) {
if (inst->info->is_tex) { 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); st_translate_texture_target(inst->tex_target, inst->tex_shadow);
if (inst->op == TGSI_OPCODE_TXF || inst->op == TGSI_OPCODE_TXF_LZ) { if (inst->op == TGSI_OPCODE_TXF || inst->op == TGSI_OPCODE_TXF_LZ) {
prog->TexelFetchSamplers |= 1u << idx; prog->info.textures_used_by_txf |= 1u << idx;
} }
} }
} }