summaryrefslogtreecommitdiff
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-11-29 08:12:33 -0700
committerBrian <brian.paul@tungstengraphics.com>2007-11-29 08:13:16 -0700
commit61fbc816570820757afdbc3cd04cd475b337ad4f (patch)
tree3ea8b8bfab2f4d3d0247f2492ccc8b5741f24dbf /src/mesa/tnl
parenta2ab143b751b85ecb6b9807982ef6dab254f4b93 (diff)
New ctx->Driver.Map/UnmapTexture() functions for accessing textures from t_vb_program.c
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_vb_program.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index cd49e9baf0..addaf76127 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -246,6 +246,50 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine)
/**
+ * Map the texture images which the vertex program will access (if any).
+ */
+static void
+map_textures(GLcontext *ctx, const struct gl_vertex_program *vp)
+{
+ GLuint u;
+
+ if (!ctx->Driver.MapTexture)
+ return;
+
+ for (u = 0; u < ctx->Const.MaxVertexTextureImageUnits; u++) {
+ if (vp->Base.TexturesUsed[u]) {
+ /* Note: _Current *should* correspond to the target indicated
+ * in TexturesUsed[u].
+ */
+ ctx->Driver.MapTexture(ctx, ctx->Texture.Unit[u]._Current);
+ }
+ }
+}
+
+
+/**
+ * Unmap the texture images which were used by the vertex program (if any).
+ */
+static void
+unmap_textures(GLcontext *ctx, const struct gl_vertex_program *vp)
+{
+ GLuint u;
+
+ if (!ctx->Driver.MapTexture)
+ return;
+
+ for (u = 0; u < ctx->Const.MaxVertexTextureImageUnits; u++) {
+ if (vp->Base.TexturesUsed[u]) {
+ /* Note: _Current *should* correspond to the target indicated
+ * in TexturesUsed[u].
+ */
+ ctx->Driver.UnmapTexture(ctx, ctx->Texture.Unit[u]._Current);
+ }
+ }
+}
+
+
+/**
* This function executes vertex programs
*/
static GLboolean
@@ -278,6 +322,8 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
}
}
+ map_textures(ctx, program);
+
for (i = 0; i < VB->Count; i++) {
GLuint attr;
@@ -329,6 +375,8 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
#endif
}
+ unmap_textures(ctx, program);
+
/* Fixup fog and point size results if needed */
if (program->IsNVProgram) {
if (ctx->Fog.Enabled &&