summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-04-17 15:56:46 -0600
committerBrian <[email protected]>2007-04-17 15:56:46 -0600
commit04bda46739beb0dab7c8820bdbe67136470d42be (patch)
treeeafeeed40432d79fde7cd7e0608f7bd76a1b903c /src/mesa/main
parentd2d86a3f0b38716196ea2b3ffa4cbbd0420de1b3 (diff)
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.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/texstate.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 51e19b7f4e7..197e8212ad0 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)