mesa/glsl: set num_textures per stage directly in shader_info
authorTimothy Arceri <timothy.arceri@collabora.com>
Fri, 4 Nov 2016 00:40:10 +0000 (11:40 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Fri, 6 Jan 2017 00:21:42 +0000 (11:21 +1100)
Reviewed-by: Eric Anholt <eric@anholt.net>
src/compiler/glsl/glsl_to_nir.cpp
src/compiler/glsl/link_uniforms.cpp
src/compiler/glsl/linker.cpp
src/mesa/main/mtypes.h
src/mesa/main/uniform_query.cpp
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index cf3511e10b97e66d4a7ff6c93e8a837a36201286..6cf4f501ee822372c2cd3b6701da8b982a37f31e 100644 (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 =
index caee147aa1da58ca2fe983d762b3e1f842adbf35..f2fc7161f103b8a6ee47cc3522fe673aabb6d489 100644 (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;
index 327b7be80063d71fa5e0150c83c122cec03ebd49..d4a484fdea05bb8c13fd3a8e357df3bf9a5a9ae2 100644 (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));
       }
index ffd21ecea3bf4428927fd235719bf3308349f4e6..69241beadd1bca9d5dc1f2c630b3bf5c4b533cf9 100644 (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. */
    /*@}*/
index ec6d27748449cc4787f8cf35a715957fcd8cb771..73e7b0bfdfd1ee1e63b7d4efc96e1d11a4bbf9e8 100644 (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) {
index b4ccc5f052535ff8c77fa8ac3737638ecc9435f9..12a53ecb73df5bf938a7c5a21f330e8d91a68343 100644 (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)