/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 6.5
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
static build_m_func build_m_tab[5] = {
- 0,
- 0,
+ NULL,
+ NULL,
build_m2,
build_m3,
build_m3
/* Just treat 4-vectors as 3-vectors.
*/
static build_f_func build_f_tab[5] = {
- 0,
- 0,
+ NULL,
+ NULL,
build_f2,
build_f3,
build_f3
GLuint unit )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLvector4f *in = VB->TexCoordPtr[unit];
+ GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit];
GLvector4f *out = &store->texcoord[unit];
build_f_tab[VB->EyePtr->size]( out->start,
out->stride,
- VB->NormalPtr,
+ VB->AttribPtr[_TNL_ATTRIB_NORMAL],
VB->EyePtr );
out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3;
GLuint unit )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLvector4f *in = VB->TexCoordPtr[unit];
+ GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit];
GLvector4f *out = &store->texcoord[unit];
- GLvector4f *normal = VB->NormalPtr;
+ GLvector4f *normal = VB->AttribPtr[_TNL_ATTRIB_NORMAL];
GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->start;
GLuint count = VB->Count;
GLuint i;
GLuint unit )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLvector4f *in = VB->TexCoordPtr[unit];
+ GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit];
GLvector4f *out = &store->texcoord[unit];
GLfloat (*texcoord)[4] = (GLfloat (*)[4]) out->start;
GLuint count = VB->Count;
(build_m_tab[VB->EyePtr->size])( store->tmp_f,
store->tmp_m,
- VB->NormalPtr,
+ VB->AttribPtr[_TNL_ATTRIB_NORMAL],
VB->EyePtr );
out->size = MAX2(in->size,2);
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLvector4f *in = VB->TexCoordPtr[unit];
+ GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit];
GLvector4f *out = &store->texcoord[unit];
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
const GLvector4f *obj = VB->ObjPtr;
const GLvector4f *eye = VB->EyePtr;
- const GLvector4f *normal = VB->NormalPtr;
+ const GLvector4f *normal = VB->AttribPtr[_TNL_ATTRIB_NORMAL];
const GLfloat *m = store->tmp_m;
const GLuint count = VB->Count;
GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data;
+
static GLboolean run_texgen_stage( GLcontext *ctx,
struct tnl_pipeline_stage *stage )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- struct texgen_stage_data *store = TEXGEN_STAGE_DATA( stage );
+ struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage);
GLuint i;
- for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
- if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i)) {
- if (stage->changed_inputs & (_TNL_BIT_POS | _TNL_BIT_NORMAL | _TNL_BIT_TEX(i)))
- store->TexgenFunc[i]( ctx, store, i );
+ if (!ctx->Texture._TexGenEnabled || ctx->VertexProgram._Current)
+ return GL_TRUE;
- VB->AttribPtr[VERT_ATTRIB_TEX0+i] =
- VB->TexCoordPtr[i] = &store->texcoord[i];
+ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) {
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
+
+ if (texUnit->TexGenEnabled) {
+
+ store->TexgenFunc[i]( ctx, store, i );
+
+ VB->TexCoordPtr[i] =
+ VB->AttribPtr[VERT_ATTRIB_TEX0 + i] = &store->texcoord[i];
}
+ }
return GL_TRUE;
}
-
-
-static GLboolean run_validate_texgen_stage( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
+static void validate_texgen_stage( GLcontext *ctx,
+ struct tnl_pipeline_stage *stage )
{
struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage);
GLuint i;
+ if (!ctx->Texture._TexGenEnabled || ctx->VertexProgram._Current)
+ return;
+
for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) {
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
}
}
}
-
- stage->run = run_texgen_stage;
- return stage->run( ctx, stage );
}
-static void check_texgen( GLcontext *ctx, struct tnl_pipeline_stage *stage )
-{
- GLuint i;
- stage->active = 0;
-
- if (ctx->Texture._TexGenEnabled && !ctx->VertexProgram._Enabled) {
- GLuint inputs = 0;
- GLuint outputs = 0;
-
- if (ctx->Texture._GenFlags & (TEXGEN_OBJ_LINEAR | TEXGEN_NEED_EYE_COORD))
- inputs |= _TNL_BIT_POS;
-
- if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS)
- inputs |= _TNL_BIT_NORMAL;
-
- for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
- if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i))
- {
- outputs |= _TNL_BIT_TEX(i);
-
- /* Need the original input in case it contains a Q coord:
- * (sigh)
- */
- inputs |= _TNL_BIT_TEX(i);
-
- /* Something for Feedback? */
- }
-
- if (stage->privatePtr)
- stage->run = run_validate_texgen_stage;
- stage->active = 1;
- stage->inputs = inputs;
- stage->outputs = outputs;
- }
-}
-
store->tmp_f = (GLfloat (*)[3]) MALLOC(VB->Size * sizeof(GLfloat) * 3);
store->tmp_m = (GLfloat *) MALLOC(VB->Size * sizeof(GLfloat));
- /* Now validate and run the stage.
- */
- stage->run = run_validate_texgen_stage;
- return stage->run( ctx, stage );
+ return GL_TRUE;
}
const struct tnl_pipeline_stage _tnl_texgen_stage =
{
"texgen", /* name */
- _NEW_TEXTURE|_NEW_PROGRAM, /* when to call check() */
- _NEW_TEXTURE, /* when to invalidate stored data */
- GL_FALSE, /* active? */
- 0, /* inputs */
- 0, /* outputs */
- 0, /* changed_inputs */
NULL, /* private data */
+ alloc_texgen_data, /* destructor */
free_texgen_data, /* destructor */
- check_texgen, /* check */
- alloc_texgen_data /* run -- initially set to alloc data */
+ validate_texgen_stage, /* check */
+ run_texgen_stage /* run -- initially set to alloc data */
};