Exemplo n.º 1
0
static GLboolean run_texmat_stage( GLcontext *ctx,
				   struct tnl_pipeline_stage *stage )
{
   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) 
      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->TexCoordPtr[i] = 
	 VB->AttribPtr[VERT_ATTRIB_TEX0+i] = &store->texcoord[i];
      }
   }

   return GL_TRUE;
}
Exemplo n.º 2
0
static void free_texmat_data( struct gl_pipeline_stage *stage )
{
   struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage);
   GLuint i;

   if (store) {
      for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++)
	 if (store->texcoord[i].data)
	    _mesa_vector4f_free( &store->texcoord[i] );
      FREE( store );
      stage->privatePtr = 0;
   }
}
Exemplo n.º 3
0
/* Called the first time stage->run() is invoked.
 */
static GLboolean alloc_texmat_data( GLcontext *ctx,
				    struct tnl_pipeline_stage *stage )
{
   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 );

   return GL_TRUE;
}
Exemplo n.º 4
0
static GLboolean run_texmat_stage( GLcontext *ctx,
				   struct gl_pipeline_stage *stage )
{
   struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage);
   struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
   GLuint i;

   /* 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.MaxTextureUnits ; i++)
      if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) {
	 if (stage->changed_inputs & VERT_TEX(i))
	    (void) TransformRaw( &store->texcoord[i], &ctx->TextureMatrix[i],
				 VB->TexCoordPtr[i]);

	 VB->TexCoordPtr[i] = &store->texcoord[i];
      }
   return GL_TRUE;
}