summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_atom_texture.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-12-02 20:10:32 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-12-04 09:58:54 -0700
commit9271662ae9acda08ed6e444d1ee18384eebf8987 (patch)
treece57d42f9108540d015861bb0023d1bc657efcca /src/mesa/state_tracker/st_atom_texture.c
parent4371a24c320f3d26f07effa0c3e862078762c942 (diff)
gallium: check vertex shaders for samplers/texture usage as we do for fragment shaders
Diffstat (limited to 'src/mesa/state_tracker/st_atom_texture.c')
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index fb03766ff5..18ffc08c6b 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -44,22 +44,30 @@
static void
update_textures(struct st_context *st)
{
+ struct gl_vertex_program *vprog = st->ctx->VertexProgram._Current;
struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current;
+ const GLbitfield samplersUsed = (vprog->Base.SamplersUsed |
+ fprog->Base.SamplersUsed);
GLuint su;
st->state.num_textures = 0;
- /*printf("%s samplers used = 0x%x\n", __FUNCTION__, fprog->Base.SamplersUsed);*/
-
+ /* loop over sampler units (aka tex image units) */
for (su = 0; su < st->ctx->Const.MaxTextureCoordUnits; su++) {
struct pipe_texture *pt = NULL;
- if (fprog->Base.SamplersUsed & (1 << su)) {
- const GLuint texUnit = fprog->Base.SamplerUnits[su];
- struct gl_texture_object *texObj
- = st->ctx->Texture.Unit[texUnit]._Current;
+ if (samplersUsed & (1 << su)) {
+ struct gl_texture_object *texObj;
struct st_texture_object *stObj;
GLboolean flush, retval;
+ GLuint texUnit;
+
+ if (fprog->Base.SamplersUsed & (1 << su))
+ texUnit = fprog->Base.SamplerUnits[su];
+ else
+ texUnit = vprog->Base.SamplerUnits[su];
+
+ texObj = st->ctx->Texture.Unit[texUnit]._Current;
if (!texObj) {
texObj = st_get_default_texture(st);