[MESA]
[reactos.git] / reactos / dll / opengl / mesa / src / mesa / tnl / t_vb_texmat.c
index 38aa51f..b3ddc66 100644 (file)
@@ -46,7 +46,7 @@
  * is very appealing.
  */
 struct texmat_stage_data {
-   GLvector4f texcoord[MAX_TEXTURE_COORD_UNITS];
+   GLvector4f texcoord;
 };
 
 #define TEXMAT_STAGE_DATA(stage) ((struct texmat_stage_data *)stage->privatePtr)
@@ -58,22 +58,19 @@ static GLboolean run_texmat_stage( struct gl_context *ctx,
 {
    struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage);
    struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-   GLuint i;
 
-   if (!ctx->Texture._TexMatEnabled || ctx->VertexProgram._Current
+   if (!ctx->Texture._TexMatEnabled) 
       return GL_TRUE;
 
    /* ENABLE_TEXMAT implies that the texture matrix is not the
     * identity, so we don't have to check that here.
     */
-   for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) {
-      if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) {
-        (void) TransformRaw( &store->texcoord[i],
-                             ctx->TextureMatrixStack[i].Top,
-                             VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]);
-
-        VB->AttribPtr[VERT_ATTRIB_TEX0+i] = &store->texcoord[i];
-      }
+   if (ctx->Texture._TexMatEnabled) {
+      (void) TransformRaw( &store->texcoord,
+                  ctx->TextureMatrixStack.Top,
+                  VB->AttribPtr[_TNL_ATTRIB_TEX]);
+
+      VB->AttribPtr[VERT_ATTRIB_TEX] = &store->texcoord;
    }
 
    return GL_TRUE;
@@ -87,15 +84,13 @@ static GLboolean alloc_texmat_data( struct gl_context *ctx,
 {
    struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
    struct texmat_stage_data *store;
-   GLuint i;
 
    stage->privatePtr = CALLOC(sizeof(*store));
    store = TEXMAT_STAGE_DATA(stage);
    if (!store)
       return GL_FALSE;
 
-   for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
-      _mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 );
+   _mesa_vector4f_alloc( &store->texcoord, 0, VB->Size, 32 );
 
    return GL_TRUE;
 }
@@ -104,12 +99,10 @@ static GLboolean alloc_texmat_data( struct gl_context *ctx,
 static void free_texmat_data( struct tnl_pipeline_stage *stage )
 {
    struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage);
-   GLuint i;
 
    if (store) {
-      for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++)
-        if (store->texcoord[i].data)
-           _mesa_vector4f_free( &store->texcoord[i] );
+        if (store->texcoord.data)
+           _mesa_vector4f_free( &store->texcoord );
       FREE( store );
       stage->privatePtr = NULL;
    }