diff options
author | Timothy Arceri <[email protected]> | 2016-11-09 09:49:59 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-01-06 11:21:42 +1100 |
commit | 076ab157ff2ed7a98b09363bce355247f4ed71e6 (patch) | |
tree | 1df981f143864f8a22871471fa6cd78f5e577f10 /src/mesa/main | |
parent | 937523971f42f37b40badb962e575ecd8258b2d5 (diff) |
st/mesa/glsl: move SamplerTargets to gl_program
This will help allow us to simplify the handling of samplers by
storing them in a single location rather than duplicating them in
both gl_linked_shader and gl_program.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/mtypes.h | 14 | ||||
-rw-r--r-- | src/mesa/main/uniform_query.cpp | 2 | ||||
-rw-r--r-- | src/mesa/main/uniforms.c | 2 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 6ab5cdeec4e..243c76ded14 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2004,6 +2004,11 @@ struct gl_program struct gl_uniform_block **UniformBlocks; struct gl_uniform_block **ShaderStorageBlocks; + /** Which texture target is being sampled + * (TEXTURE_1D/2D/3D/etc_INDEX) + */ + gl_texture_index SamplerTargets[MAX_SAMPLERS]; + union { struct { /** @@ -2359,9 +2364,6 @@ struct gl_linked_shader GLbitfield shadow_samplers; /**< Samplers used for shadow sampling. */ /*@}*/ - /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */ - gl_texture_index SamplerTargets[MAX_SAMPLERS]; - /** * Number of default uniform block components used by this shader. * @@ -2392,14 +2394,14 @@ struct gl_linked_shader struct gl_shader_info info; }; -static inline GLbitfield gl_external_samplers(struct gl_linked_shader *shader) +static inline GLbitfield gl_external_samplers(struct gl_program *prog) { GLbitfield external_samplers = 0; - GLbitfield mask = shader->Program->SamplersUsed; + GLbitfield mask = prog->SamplersUsed; while (mask) { int idx = u_bit_scan(&mask); - if (shader->SamplerTargets[idx] == TEXTURE_EXTERNAL_INDEX) + if (prog->sh.SamplerTargets[idx] == TEXTURE_EXTERNAL_INDEX) external_samplers |= (1 << idx); } diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index 047d21a85cf..145eff01756 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -1107,7 +1107,7 @@ _mesa_sampler_uniforms_pipeline_are_valid(struct gl_pipeline_object *pipeline) while (mask) { const int s = u_bit_scan(&mask); GLuint unit = shader->Program->SamplerUnits[s]; - GLuint tgt = shader->SamplerTargets[s]; + GLuint tgt = shader->Program->sh.SamplerTargets[s]; /* FIXME: Samplers are initialized to 0 and Mesa doesn't do a * great job of eliminating unused uniforms currently so for now diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index 5534fcf2abe..51db39e63a0 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -80,7 +80,7 @@ _mesa_update_shader_textures_used(struct gl_shader_program *shProg, while (mask) { const int s = u_bit_scan(&mask); GLuint unit = prog->SamplerUnits[s]; - GLuint tgt = shader->SamplerTargets[s]; + GLuint tgt = prog->sh.SamplerTargets[s]; assert(unit < ARRAY_SIZE(prog->TexturesUsed)); assert(tgt < NUM_TEXTURE_TARGETS); |