From 04bda46739beb0dab7c8820bdbe67136470d42be Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 17 Apr 2007 15:56:46 -0600 Subject: Enable texture sampling for vertex programs/shaders. This is a bit of a hack for now because the tnl module is using the swrast module to fetch texels. The texture fetch/filter code should probably be moved into the main/ module since it doesn't really depend upon other swrast code. --- src/mesa/main/texstate.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'src/mesa/main/texstate.c') diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 51e19b7f4e..197e8212ad 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -2921,17 +2921,24 @@ static void update_texture_state( GLcontext *ctx ) { GLuint unit; - struct gl_fragment_program *fprog; + struct gl_fragment_program *fprog = NULL; + struct gl_vertex_program *vprog = NULL; if (ctx->Shader.CurrentProgram && ctx->Shader.CurrentProgram->LinkStatus) { fprog = ctx->Shader.CurrentProgram->FragmentProgram; - } - else if (ctx->FragmentProgram._Enabled) { - fprog = ctx->FragmentProgram.Current; + vprog = ctx->Shader.CurrentProgram->VertexProgram; } else { - fprog = NULL; + if (ctx->FragmentProgram._Enabled) { + fprog = ctx->FragmentProgram.Current; + } + if (ctx->VertexProgram._Enabled) { + /* XXX enable this if/when non-shader vertex programs get + * texture fetches: + vprog = ctx->VertexProgram.Current; + */ + } } ctx->NewState |= _NEW_TEXTURE; /* TODO: only set this if there are @@ -2960,8 +2967,12 @@ update_texture_state( GLcontext *ctx ) * by a fragment shader/program. When multiple flags are set, we'll * settle on the one with highest priority (see texture_override below). */ - if (fprog) { - enableBits = fprog->Base.TexturesUsed[unit]; + if (fprog || vprog) { + enableBits = 0x0; + if (fprog) + enableBits |= fprog->Base.TexturesUsed[unit]; + if (vprog) + enableBits |= vprog->Base.TexturesUsed[unit]; } else { if (!texUnit->Enabled) -- cgit v1.2.3