mesa: account for geometry shader texture fetches in update_texture_state
authorBryan Cain <bryancain3@gmail.com>
Fri, 15 Feb 2013 08:40:12 +0000 (02:40 -0600)
committerPaul Berry <stereotype441@gmail.com>
Fri, 2 Aug 2013 03:20:14 +0000 (20:20 -0700)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/texstate.c

index afff0135952e23d25f0df3bf91c21cfbf9c92856..dad69a8f62775d053c1208447cc8d7e895380813 100644 (file)
@@ -528,6 +528,7 @@ update_texture_state( struct gl_context *ctx )
    GLuint unit;
    struct gl_program *fprog = NULL;
    struct gl_program *vprog = NULL;
+   struct gl_program *gprog = NULL;
    GLbitfield enabledFragUnits = 0x0;
 
    if (ctx->Shader.CurrentVertexProgram &&
@@ -535,6 +536,11 @@ update_texture_state( struct gl_context *ctx )
       vprog = ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
    }
 
+   if (ctx->Shader.CurrentGeometryProgram &&
+       ctx->Shader.CurrentGeometryProgram->LinkStatus) {
+      gprog = ctx->Shader.CurrentGeometryProgram->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program;
+   }
+
    if (ctx->Shader.CurrentFragmentProgram &&
        ctx->Shader.CurrentFragmentProgram->LinkStatus) {
       fprog = ctx->Shader.CurrentFragmentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
@@ -543,10 +549,6 @@ update_texture_state( struct gl_context *ctx )
       fprog = &ctx->FragmentProgram.Current->Base;
    }
 
-   /* FINISHME: Geometry shader texture accesses should also be considered
-    * FINISHME: here.
-    */
-
    /* TODO: only set this if there are actual changes */
    ctx->NewState |= _NEW_TEXTURE;
 
@@ -562,6 +564,7 @@ update_texture_state( struct gl_context *ctx )
       struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
       GLbitfield enabledVertTargets = 0x0;
       GLbitfield enabledFragTargets = 0x0;
+      GLbitfield enabledGeomTargets = 0x0;
       GLbitfield enabledTargets = 0x0;
       GLuint texIndex;
 
@@ -575,6 +578,10 @@ update_texture_state( struct gl_context *ctx )
          enabledVertTargets |= vprog->TexturesUsed[unit];
       }
 
+      if (gprog) {
+         enabledGeomTargets |= gprog->TexturesUsed[unit];
+      }
+
       if (fprog) {
          enabledFragTargets |= fprog->TexturesUsed[unit];
       }
@@ -583,7 +590,8 @@ update_texture_state( struct gl_context *ctx )
          enabledFragTargets |= texUnit->Enabled;
       }
 
-      enabledTargets = enabledVertTargets | enabledFragTargets;
+      enabledTargets = enabledVertTargets | enabledFragTargets |
+                       enabledGeomTargets;
 
       texUnit->_ReallyEnabled = 0x0;