diff options
author | Ian Romanick <[email protected]> | 2011-11-14 18:12:16 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2012-01-11 12:51:24 -0800 |
commit | 6a992c3288b6f7a5d94172c9ad1908e71e58233e (patch) | |
tree | 01de8311508d0034fc622393f2e7abcbef4742bd /src/glsl | |
parent | 32be81de39f7548e353afabf1215b0ea7c7b0916 (diff) |
linker: Calculate the sampler to texture target mapping during linking
Track the calculated data in gl_shader_program instead of the
individual assembly shaders.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/link_uniforms.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp index b331db705cf..47d34cf0b79 100644 --- a/src/glsl/link_uniforms.cpp +++ b/src/glsl/link_uniforms.cpp @@ -209,7 +209,7 @@ public: union gl_constant_value *values) : map(map), uniforms(uniforms), next_sampler(0), values(values) { - /* empty */ + memset(this->targets, 0, sizeof(this->targets)); } private: @@ -249,6 +249,14 @@ private: * array elements for arrays. */ this->next_sampler += MAX2(1, this->uniforms[id].array_elements); + + const gl_texture_index target = base_type->sampler_index(); + for (unsigned i = this->uniforms[id].sampler + ; i < this->next_sampler + ; i++) { + this->targets[i] = target; + } + } else { this->uniforms[id].sampler = ~0; } @@ -270,6 +278,8 @@ private: public: union gl_constant_value *values; + + gl_texture_index targets[MAX_SAMPLERS]; }; void @@ -361,6 +371,9 @@ link_assign_uniform_locations(struct gl_shader_program *prog) } } + assert(sizeof(prog->SamplerTargets) == sizeof(parcel.targets)); + memcpy(prog->SamplerTargets, parcel.targets, sizeof(prog->SamplerTargets)); + #ifndef NDEBUG for (unsigned i = 0; i < num_user_uniforms; i++) { assert(uniforms[i].storage != NULL); |