summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-11-14 18:12:16 -0800
committerIan Romanick <[email protected]>2012-01-11 12:51:24 -0800
commit6a992c3288b6f7a5d94172c9ad1908e71e58233e (patch)
tree01de8311508d0034fc622393f2e7abcbef4742bd /src/mesa/main
parent32be81de39f7548e353afabf1215b0ea7c7b0916 (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/mesa/main')
-rw-r--r--src/mesa/main/ff_fragment_shader.cpp2
-rw-r--r--src/mesa/main/mtypes.h2
-rw-r--r--src/mesa/main/uniform_query.cpp2
-rw-r--r--src/mesa/main/uniforms.c7
-rw-r--r--src/mesa/main/uniforms.h3
5 files changed, 8 insertions, 8 deletions
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 165230c13b1..3596a3d3e0c 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -1540,7 +1540,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
_mesa_propagate_uniforms_to_driver_storage(storage, 0, 1);
}
}
- _mesa_update_shader_textures_used(fp);
+ _mesa_update_shader_textures_used(p.shader_program, fp);
(void) ctx->Driver.ProgramStringNotify(ctx, fp->Target, fp);
if (!p.shader_program->LinkStatus)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index aca47379ca1..25597950ede 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1894,8 +1894,6 @@ struct gl_program
/** Map from sampler unit to texture unit (set by glUniform1i()) */
GLubyte SamplerUnits[MAX_SAMPLERS];
- /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */
- gl_texture_index SamplerTargets[MAX_SAMPLERS];
/** Bitmask of which register files are read/written with indirect
* addressing. Mask of (1 << PROGRAM_x) bits.
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index a5a85cd9c13..d156cae5050 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -728,7 +728,7 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
shProg->SamplerUnits,
sizeof(shProg->SamplerUnits));
- _mesa_update_shader_textures_used(prog);
+ _mesa_update_shader_textures_used(shProg, prog);
(void) ctx->Driver.ProgramStringNotify(ctx, prog->Target, prog);
}
}
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index 685c0f13fcf..e0214a88a7a 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -60,7 +60,8 @@
* We'll use that info for state validation before rendering.
*/
void
-_mesa_update_shader_textures_used(struct gl_program *prog)
+_mesa_update_shader_textures_used(struct gl_shader_program *shProg,
+ struct gl_program *prog)
{
GLuint s;
@@ -68,8 +69,8 @@ _mesa_update_shader_textures_used(struct gl_program *prog)
for (s = 0; s < MAX_SAMPLERS; s++) {
if (prog->SamplersUsed & (1 << s)) {
- GLuint unit = prog->SamplerUnits[s];
- GLuint tgt = prog->SamplerTargets[s];
+ GLuint unit = shProg->SamplerUnits[s];
+ GLuint tgt = shProg->SamplerTargets[s];
assert(unit < Elements(prog->TexturesUsed));
assert(tgt < NUM_TEXTURE_TARGETS);
prog->TexturesUsed[unit] |= (1 << tgt);
diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h
index f796f82766e..7b512a52759 100644
--- a/src/mesa/main/uniforms.h
+++ b/src/mesa/main/uniforms.h
@@ -212,7 +212,8 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni,
unsigned count);
extern void
-_mesa_update_shader_textures_used(struct gl_program *prog);
+_mesa_update_shader_textures_used(struct gl_shader_program *shProg,
+ struct gl_program *prog);
extern bool
_mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg,