mesa/glsl: set num_textures per stage directly in shader_info

Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Timothy Arceri
2016-11-04 11:40:10 +11:00
parent c46a630000
commit 4807a83da0
6 changed files with 5 additions and 6 deletions

View File

@@ -149,7 +149,6 @@ glsl_to_nir(const struct gl_shader_program *shader_prog,
shader->info->name = ralloc_asprintf(shader, "GLSL%d", shader_prog->Name);
if (shader_prog->Label)
shader->info->label = ralloc_strdup(shader, shader_prog->Label);
shader->info->num_textures = util_last_bit(sh->Program->SamplersUsed);
shader->info->clip_distance_array_size = sh->Program->ClipDistanceArraySize;
shader->info->cull_distance_array_size = sh->Program->CullDistanceArraySize;
shader->info->has_transform_feedback_varyings =

View File

@@ -1315,7 +1315,7 @@ link_assign_uniform_locations(struct gl_shader_program *prog,
uniform_size.process(var);
}
sh->num_samplers = uniform_size.num_shader_samplers;
sh->Program->info.num_textures = uniform_size.num_shader_samplers;
sh->NumImages = uniform_size.num_shader_images;
sh->num_uniform_components = uniform_size.num_shader_uniform_components;
sh->num_combined_uniform_components = sh->num_uniform_components;

View File

@@ -3067,7 +3067,8 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog)
if (sh == NULL)
continue;
if (sh->num_samplers > ctx->Const.Program[i].MaxTextureImageUnits) {
if (sh->Program->info.num_textures >
ctx->Const.Program[i].MaxTextureImageUnits) {
linker_error(prog, "Too many %s shader texture samplers\n",
_mesa_shader_stage_to_string(i));
}

View File

@@ -2356,7 +2356,6 @@ struct gl_linked_shader
* \note Each of these fields is only set post-linking.
*/
/*@{*/
unsigned num_samplers; /**< Number of samplers used by this shader. */
GLbitfield active_samplers; /**< Bitfield of which samplers are used */
GLbitfield shadow_samplers; /**< Samplers used for shadow sampling. */
/*@}*/

View File

@@ -1141,7 +1141,7 @@ _mesa_sampler_uniforms_pipeline_are_valid(struct gl_pipeline_object *pipeline)
TexturesUsed[unit] |= (1 << tgt);
}
active_samplers += shader->num_samplers;
active_samplers += shader->Program->info.num_textures;
}
if (active_samplers > MAX_COMBINED_TEXTURE_IMAGE_UNITS) {

View File

@@ -6636,7 +6636,7 @@ set_affected_state_flags(uint64_t *states,
if (prog->Parameters->NumParameters)
*states |= new_constants;
if (shader->num_samplers)
if (prog->info.num_textures)
*states |= new_sampler_views | new_samplers;
if (shader->NumImages)