summaryrefslogtreecommitdiff
path: root/src/mesa/tnl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_context.c35
-rw-r--r--src/mesa/tnl/t_context.h160
-rw-r--r--src/mesa/tnl/t_save_api.c32
-rw-r--r--src/mesa/tnl/t_vb_arbshader.c23
-rw-r--r--src/mesa/tnl/t_vtx_generic.c61
5 files changed, 171 insertions, 140 deletions
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index d9777bfe6d..ad972fa7b7 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 6.5
*
- * Copyright (C) 1999-2005 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"),
@@ -170,32 +170,43 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
/* Calculate tnl->render_inputs:
*/
if (ctx->Visual.rgbMode) {
- tnl->render_inputs = (_TNL_BIT_POS|
- _TNL_BIT_COLOR0|
- (ctx->Texture._EnabledCoordUnits << _TNL_ATTRIB_TEX0));
+ GLuint i;
+
+ RENDERINPUTS_ZERO( tnl->render_inputs_bitset );
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR0 );
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
+ if (ctx->Texture._EnabledCoordUnits & (1 << i)) {
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) );
+ }
+ }
if (NEED_SECONDARY_COLOR(ctx))
- tnl->render_inputs |= _TNL_BIT_COLOR1;
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 );
}
else {
- tnl->render_inputs |= (_TNL_BIT_POS|_TNL_BIT_INDEX);
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_INDEX );
}
-
+
if (ctx->Fog.Enabled ||
(ctx->FragmentProgram._Active &&
- ctx->FragmentProgram._Current->FogOption != GL_NONE))
- tnl->render_inputs |= _TNL_BIT_FOG;
+ ctx->FragmentProgram._Current->FogOption != GL_NONE))
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
if (ctx->Polygon.FrontMode != GL_FILL ||
ctx->Polygon.BackMode != GL_FILL)
- tnl->render_inputs |= _TNL_BIT_EDGEFLAG;
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_EDGEFLAG );
if (ctx->RenderMode == GL_FEEDBACK)
- tnl->render_inputs |= _TNL_BIT_TEX0;
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_TEX0 );
if (ctx->Point._Attenuated ||
(ctx->VertexProgram._Enabled && ctx->VertexProgram.PointSizeEnabled))
- tnl->render_inputs |= _TNL_BIT_POINTSIZE;
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POINTSIZE );
+
+ if (ctx->ShaderObjects._VertexShaderPresent || ctx->ShaderObjects._FragmentShaderPresent)
+ RENDERINPUTS_SET_RANGE( tnl->render_inputs_bitset, _TNL_FIRST_ATTRIBUTE, _TNL_LAST_ATTRIBUTE );
}
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 753f59257a..7a0ca6f411 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -2,7 +2,7 @@
* mesa 3-D graphics library
* Version: 6.5
*
- * Copyright (C) 1999-2005 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"),
@@ -92,6 +92,12 @@
* number of bits allocated for these numbers in places like vertex
* program instruction formats and register layouts.
*/
+/* The bit space exhaustion is a fact now, done by _TNL_ATTRIB_ATTRIBUTE* for
+ * GLSL vertex shader which cannot be aliased with conventional vertex attribs.
+ * Compacting _TNL_ATTRIB_MAT_* attribs would not work, they would not give
+ * as many free bits (11 plus already 1 free bit) as _TNL_ATTRIB_ATTRIBUTE*
+ * attribs want (16).
+ */
enum {
_TNL_ATTRIB_POS = 0,
_TNL_ATTRIB_WEIGHT = 1,
@@ -109,98 +115,56 @@ enum {
_TNL_ATTRIB_TEX5 = 13,
_TNL_ATTRIB_TEX6 = 14,
_TNL_ATTRIB_TEX7 = 15,
- _TNL_ATTRIB_MAT_FRONT_AMBIENT = 16,
- _TNL_ATTRIB_MAT_BACK_AMBIENT = 17,
- _TNL_ATTRIB_MAT_FRONT_DIFFUSE = 18,
- _TNL_ATTRIB_MAT_BACK_DIFFUSE = 19,
- _TNL_ATTRIB_MAT_FRONT_SPECULAR = 20,
- _TNL_ATTRIB_MAT_BACK_SPECULAR = 21,
- _TNL_ATTRIB_MAT_FRONT_EMISSION = 22,
- _TNL_ATTRIB_MAT_BACK_EMISSION = 23,
- _TNL_ATTRIB_MAT_FRONT_SHININESS = 24,
- _TNL_ATTRIB_MAT_BACK_SHININESS = 25,
- _TNL_ATTRIB_MAT_FRONT_INDEXES = 26,
- _TNL_ATTRIB_MAT_BACK_INDEXES = 27,
- _TNL_ATTRIB_INDEX = 28,
- _TNL_ATTRIB_EDGEFLAG = 29,
- _TNL_ATTRIB_POINTSIZE = 30,
- _TNL_ATTRIB_MAX = 31
+ _TNL_ATTRIB_ATTRIBUTE0 = 16,
+ _TNL_ATTRIB_ATTRIBUTE1 = 17,
+ _TNL_ATTRIB_ATTRIBUTE2 = 18,
+ _TNL_ATTRIB_ATTRIBUTE3 = 19,
+ _TNL_ATTRIB_ATTRIBUTE4 = 20,
+ _TNL_ATTRIB_ATTRIBUTE5 = 21,
+ _TNL_ATTRIB_ATTRIBUTE6 = 22,
+ _TNL_ATTRIB_ATTRIBUTE7 = 23,
+ _TNL_ATTRIB_ATTRIBUTE8 = 24,
+ _TNL_ATTRIB_ATTRIBUTE9 = 25,
+ _TNL_ATTRIB_ATTRIBUTE10 = 26,
+ _TNL_ATTRIB_ATTRIBUTE11 = 27,
+ _TNL_ATTRIB_ATTRIBUTE12 = 28,
+ _TNL_ATTRIB_ATTRIBUTE13 = 29,
+ _TNL_ATTRIB_ATTRIBUTE14 = 30,
+ _TNL_ATTRIB_ATTRIBUTE15 = 31,
+ _TNL_ATTRIB_MAT_FRONT_AMBIENT = 32,
+ _TNL_ATTRIB_MAT_BACK_AMBIENT = 33,
+ _TNL_ATTRIB_MAT_FRONT_DIFFUSE = 34,
+ _TNL_ATTRIB_MAT_BACK_DIFFUSE = 35,
+ _TNL_ATTRIB_MAT_FRONT_SPECULAR = 36,
+ _TNL_ATTRIB_MAT_BACK_SPECULAR = 37,
+ _TNL_ATTRIB_MAT_FRONT_EMISSION = 38,
+ _TNL_ATTRIB_MAT_BACK_EMISSION = 39,
+ _TNL_ATTRIB_MAT_FRONT_SHININESS = 40,
+ _TNL_ATTRIB_MAT_BACK_SHININESS = 41,
+ _TNL_ATTRIB_MAT_FRONT_INDEXES = 42,
+ _TNL_ATTRIB_MAT_BACK_INDEXES = 43,
+ _TNL_ATTRIB_INDEX = 44,
+ _TNL_ATTRIB_EDGEFLAG = 45,
+ _TNL_ATTRIB_POINTSIZE = 46,
+ _TNL_ATTRIB_MAX = 47
} ;
-/* Will probably have to revise this scheme fairly shortly, eg. by
- * compacting all the MAT flags down to one bit, or by using two
- * dwords to store the flags.
+#define _TNL_ATTRIB_TEX(u) (_TNL_ATTRIB_TEX0 + (u))
+#define _TNL_ATTRIB_ATTRIBUTE(n) (_TNL_ATTRIB_ATTRIBUTE0 + (n))
+
+/* Define bit ranges instead of bit masks.
*/
-#define _TNL_BIT_POS (1<<0)
-#define _TNL_BIT_WEIGHT (1<<1)
-#define _TNL_BIT_NORMAL (1<<2)
-#define _TNL_BIT_COLOR0 (1<<3)
-#define _TNL_BIT_COLOR1 (1<<4)
-#define _TNL_BIT_FOG (1<<5)
-#define _TNL_BIT_SIX (1<<6)
-#define _TNL_BIT_SEVEN (1<<7)
-#define _TNL_BIT_TEX0 (1<<8)
-#define _TNL_BIT_TEX1 (1<<9)
-#define _TNL_BIT_TEX2 (1<<10)
-#define _TNL_BIT_TEX3 (1<<11)
-#define _TNL_BIT_TEX4 (1<<12)
-#define _TNL_BIT_TEX5 (1<<13)
-#define _TNL_BIT_TEX6 (1<<14)
-#define _TNL_BIT_TEX7 (1<<15)
-#define _TNL_BIT_MAT_FRONT_AMBIENT (1<<16)
-#define _TNL_BIT_MAT_BACK_AMBIENT (1<<17)
-#define _TNL_BIT_MAT_FRONT_DIFFUSE (1<<18)
-#define _TNL_BIT_MAT_BACK_DIFFUSE (1<<19)
-#define _TNL_BIT_MAT_FRONT_SPECULAR (1<<20)
-#define _TNL_BIT_MAT_BACK_SPECULAR (1<<21)
-#define _TNL_BIT_MAT_FRONT_EMISSION (1<<22)
-#define _TNL_BIT_MAT_BACK_EMISSION (1<<23)
-#define _TNL_BIT_MAT_FRONT_SHININESS (1<<24)
-#define _TNL_BIT_MAT_BACK_SHININESS (1<<25)
-#define _TNL_BIT_MAT_FRONT_INDEXES (1<<26)
-#define _TNL_BIT_MAT_BACK_INDEXES (1<<27)
-#define _TNL_BIT_INDEX (1<<28)
-#define _TNL_BIT_EDGEFLAG (1<<29)
-#define _TNL_BIT_POINTSIZE (1<<30)
-
-#define _TNL_BIT_TEX(u) (1 << (_TNL_ATTRIB_TEX0 + (u)))
-
-
-
-#define _TNL_BITS_MAT_ANY (_TNL_BIT_MAT_FRONT_AMBIENT | \
- _TNL_BIT_MAT_BACK_AMBIENT | \
- _TNL_BIT_MAT_FRONT_DIFFUSE | \
- _TNL_BIT_MAT_BACK_DIFFUSE | \
- _TNL_BIT_MAT_FRONT_SPECULAR | \
- _TNL_BIT_MAT_BACK_SPECULAR | \
- _TNL_BIT_MAT_FRONT_EMISSION | \
- _TNL_BIT_MAT_BACK_EMISSION | \
- _TNL_BIT_MAT_FRONT_SHININESS | \
- _TNL_BIT_MAT_BACK_SHININESS | \
- _TNL_BIT_MAT_FRONT_INDEXES | \
- _TNL_BIT_MAT_BACK_INDEXES)
-
-
-#define _TNL_BITS_TEX_ANY (_TNL_BIT_TEX0 | \
- _TNL_BIT_TEX1 | \
- _TNL_BIT_TEX2 | \
- _TNL_BIT_TEX3 | \
- _TNL_BIT_TEX4 | \
- _TNL_BIT_TEX5 | \
- _TNL_BIT_TEX6 | \
- _TNL_BIT_TEX7)
-
-
-#define _TNL_BITS_PROG_ANY (_TNL_BIT_POS | \
- _TNL_BIT_WEIGHT | \
- _TNL_BIT_NORMAL | \
- _TNL_BIT_COLOR0 | \
- _TNL_BIT_COLOR1 | \
- _TNL_BIT_FOG | \
- _TNL_BIT_SIX | \
- _TNL_BIT_SEVEN | \
- _TNL_BITS_TEX_ANY)
+#define _TNL_FIRST_PROG _TNL_ATTRIB_WEIGHT
+#define _TNL_LAST_PROG _TNL_ATTRIB_TEX7
+
+#define _TNL_FIRST_TEX _TNL_ATTRIB_TEX0
+#define _TNL_LAST_TEX _TNL_ATTRIB_TEX7
+
+#define _TNL_FIRST_ATTRIBUTE _TNL_ATTRIB_ATTRIBUTE0
+#define _TNL_LAST_ATTRIBUTE _TNL_ATTRIB_ATTRIBUTE15
+#define _TNL_FIRST_MAT _TNL_ATTRIB_MAT_FRONT_AMBIENT
+#define _TNL_LAST_MAT _TNL_ATTRIB_MAT_BACK_INDEXES
#define PRIM_BEGIN 0x10
@@ -444,6 +408,7 @@ struct vertex_buffer
GLvector4f *SecondaryColorPtr[2]; /* _TNL_BIT_COLOR1 */
GLvector4f *PointSizePtr; /* _TNL_BIT_POS */
GLvector4f *FogCoordPtr; /* _TNL_BIT_FOG */
+ GLvector4f *VaryingPtr[MAX_VARYING_VECTORS];
struct tnl_prim *Primitive;
GLuint PrimitiveCount;
@@ -730,7 +695,20 @@ struct tnl_device_driver
*/
} Render;
};
-
+
+
+#define DECLARE_RENDERINPUTS(name) BITSET64_DECLARE(name, _TNL_ATTRIB_MAX)
+#define RENDERINPUTS_COPY BITSET64_COPY
+#define RENDERINPUTS_EQUAL BITSET64_EQUAL
+#define RENDERINPUTS_ZERO BITSET64_ZERO
+#define RENDERINPUTS_ONES BITSET64_ONES
+#define RENDERINPUTS_TEST BITSET64_TEST
+#define RENDERINPUTS_SET BITSET64_SET
+#define RENDERINPUTS_CLEAR BITSET64_CLEAR
+#define RENDERINPUTS_TEST_RANGE BITSET64_TEST_RANGE
+#define RENDERINPUTS_SET_RANGE BITSET64_SET_RANGE
+#define RENDERINPUTS_CLEAR_RANGE BITSET64_CLEAR_RANGE
+
/**
* Context state for T&L context.
@@ -783,7 +761,7 @@ typedef struct
*/
GLboolean DiscardPrimitive;
- GLuint render_inputs;
+ DECLARE_RENDERINPUTS(render_inputs_bitset);
GLvertexformat exec_vtxfmt;
GLvertexformat save_vtxfmt;
diff --git a/src/mesa/tnl/t_save_api.c b/src/mesa/tnl/t_save_api.c
index 9788468d50..5765652b7e 100644
--- a/src/mesa/tnl/t_save_api.c
+++ b/src/mesa/tnl/t_save_api.c
@@ -936,7 +936,7 @@ static void GLAPIENTRY _save_MultiTexCoord4fv( GLenum target, const GLfloat *v )
static void GLAPIENTRY _save_VertexAttrib1fNV( GLuint index, GLfloat x )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR1F( index, x );
else
enum_error();
@@ -944,7 +944,7 @@ static void GLAPIENTRY _save_VertexAttrib1fNV( GLuint index, GLfloat x )
static void GLAPIENTRY _save_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR1FV( index, v );
else
enum_error();
@@ -952,7 +952,7 @@ static void GLAPIENTRY _save_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
static void GLAPIENTRY _save_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR2F( index, x, y );
else
enum_error();
@@ -960,7 +960,7 @@ static void GLAPIENTRY _save_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat
static void GLAPIENTRY _save_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR2FV( index, v );
else
enum_error();
@@ -969,7 +969,7 @@ static void GLAPIENTRY _save_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
static void GLAPIENTRY _save_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y,
GLfloat z )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR3F( index, x, y, z );
else
enum_error();
@@ -977,7 +977,7 @@ static void GLAPIENTRY _save_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat
static void GLAPIENTRY _save_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR3FV( index, v );
else
enum_error();
@@ -986,7 +986,7 @@ static void GLAPIENTRY _save_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
static void GLAPIENTRY _save_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y,
GLfloat z, GLfloat w )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR4F( index, x, y, z, w );
else
enum_error();
@@ -994,7 +994,7 @@ static void GLAPIENTRY _save_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat
static void GLAPIENTRY _save_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR4FV( index, v );
else
enum_error();
@@ -1004,7 +1004,7 @@ static void GLAPIENTRY _save_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
static void GLAPIENTRY
_save_VertexAttrib1fARB( GLuint index, GLfloat x )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR1F( index, x );
else
enum_error();
@@ -1013,7 +1013,7 @@ _save_VertexAttrib1fARB( GLuint index, GLfloat x )
static void GLAPIENTRY
_save_VertexAttrib1fvARB( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR1FV( index, v );
else
enum_error();
@@ -1022,7 +1022,7 @@ _save_VertexAttrib1fvARB( GLuint index, const GLfloat *v )
static void GLAPIENTRY
_save_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR2F( index, x, y );
else
enum_error();
@@ -1031,7 +1031,7 @@ _save_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y )
static void GLAPIENTRY
_save_VertexAttrib2fvARB( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR2FV( index, v );
else
enum_error();
@@ -1040,7 +1040,7 @@ _save_VertexAttrib2fvARB( GLuint index, const GLfloat *v )
static void GLAPIENTRY
_save_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR3F( index, x, y, z );
else
enum_error();
@@ -1049,7 +1049,7 @@ _save_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z )
static void GLAPIENTRY
_save_VertexAttrib3fvARB( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR3FV( index, v );
else
enum_error();
@@ -1058,7 +1058,7 @@ _save_VertexAttrib3fvARB( GLuint index, const GLfloat *v )
static void GLAPIENTRY
_save_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR4F( index, x, y, z, w );
else
enum_error();
@@ -1067,7 +1067,7 @@ _save_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat
static void GLAPIENTRY
_save_VertexAttrib4fvARB( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR4FV( index, v );
else
enum_error();
diff --git a/src/mesa/tnl/t_vb_arbshader.c b/src/mesa/tnl/t_vb_arbshader.c
index 88d7f6ac8c..b1d024e0cc 100644
--- a/src/mesa/tnl/t_vb_arbshader.c
+++ b/src/mesa/tnl/t_vb_arbshader.c
@@ -37,6 +37,7 @@
typedef struct
{
GLvector4f outputs[VERT_RESULT_MAX];
+ GLvector4f varyings[MAX_VARYING_VECTORS];
GLvector4f ndc_coords;
GLubyte *clipmask;
GLubyte ormask;
@@ -63,6 +64,11 @@ static GLboolean construct_arb_vertex_shader (GLcontext *ctx, struct tnl_pipelin
_mesa_vector4f_alloc (&store->outputs[i], 0, size, 32);
store->outputs[i].size = 4;
}
+ for (i = 0; i < MAX_VARYING_VECTORS; i++)
+ {
+ _mesa_vector4f_alloc (&store->varyings[i], 0, size, 32);
+ store->varyings[i].size = 4;
+ }
_mesa_vector4f_alloc (&store->ndc_coords, 0, size, 32);
store->clipmask = (GLubyte *) ALIGN_MALLOC (size, 32);
@@ -79,6 +85,8 @@ static void destruct_arb_vertex_shader (struct tnl_pipeline_stage *stage)
for (i = 0; i < VERT_RESULT_MAX; i++)
_mesa_vector4f_free (&store->outputs[i]);
+ for (i = 0; i < MAX_VARYING_VECTORS; i++)
+ _mesa_vector4f_free (&store->varyings[i]);
_mesa_vector4f_free (&store->ndc_coords);
ALIGN_FREE (store->clipmask);
@@ -206,6 +214,17 @@ static GLboolean run_arb_vertex_shader (GLcontext *ctx, struct tnl_pipeline_stag
fetch_output_vec4 (pro, SLANG_VERTEX_FIXED_BACKCOLOR, VERT_RESULT_BFC0, i, 0, store);
fetch_output_vec4 (pro, SLANG_VERTEX_FIXED_BACKSECONDARYCOLOR, VERT_RESULT_BFC1, i, 0, store);
/* XXX: fetch output SLANG_VERTEX_FIXED_CLIPVERTEX */
+
+ for (j = 0; j < MAX_VARYING_VECTORS; j++)
+ {
+ GLuint k;
+
+ for (k = 0; k < VARYINGS_PER_VECTOR; k++)
+ {
+ (**pro).UpdateVarying (pro, j * VARYINGS_PER_VECTOR + k,
+ &store->varyings[j].data[i][k], GL_TRUE);
+ }
+ }
}
vb->ClipPtr = &store->outputs[VERT_RESULT_HPOS];
@@ -218,6 +237,8 @@ static GLboolean run_arb_vertex_shader (GLcontext *ctx, struct tnl_pipeline_stag
vb->SecondaryColorPtr[1] = &store->outputs[VERT_RESULT_BFC1];
vb->FogCoordPtr = &store->outputs[VERT_RESULT_FOGC];
vb->PointSizePtr = &store->outputs[VERT_RESULT_PSIZ];
+ for (i = 0; i < MAX_VARYING_VECTORS; i++)
+ vb->VaryingPtr[i] = &store->varyings[i];
vb->AttribPtr[VERT_ATTRIB_COLOR0] = vb->ColorPtr[0];
vb->AttribPtr[VERT_ATTRIB_COLOR1] = vb->SecondaryColorPtr[0];
@@ -225,6 +246,8 @@ static GLboolean run_arb_vertex_shader (GLcontext *ctx, struct tnl_pipeline_stag
for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
vb->AttribPtr[VERT_ATTRIB_TEX0 + i] = vb->TexCoordPtr[i];
vb->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->outputs[VERT_RESULT_PSIZ];
+ for (i = 0; i < MAX_VARYING_VECTORS; i++)
+ vb->AttribPtr[_TNL_ATTRIB_ATTRIBUTE0 + i] = vb->VaryingPtr[i];
store->ormask = 0;
store->andmask = CLIP_FRUSTUM_BITS;
diff --git a/src/mesa/tnl/t_vtx_generic.c b/src/mesa/tnl/t_vtx_generic.c
index 0422fcd45d..d59ce90c6d 100644
--- a/src/mesa/tnl/t_vtx_generic.c
+++ b/src/mesa/tnl/t_vtx_generic.c
@@ -364,42 +364,42 @@ static void GLAPIENTRY _tnl_MultiTexCoord4fv( GLenum target,
static void GLAPIENTRY _tnl_VertexAttrib1fNV( GLuint index, GLfloat x )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR1F( index, x );
}
static void GLAPIENTRY _tnl_VertexAttrib1fvNV( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR1FV( index, v );
}
static void GLAPIENTRY _tnl_VertexAttrib2fNV( GLuint index, GLfloat x,
GLfloat y )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR2F( index, x, y );
}
static void GLAPIENTRY _tnl_VertexAttrib2fvNV( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR2FV( index, v );
}
static void GLAPIENTRY _tnl_VertexAttrib3fNV( GLuint index, GLfloat x,
GLfloat y, GLfloat z )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR3F( index, x, y, z );
}
static void GLAPIENTRY _tnl_VertexAttrib3fvNV( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR3FV( index, v );
}
@@ -407,60 +407,73 @@ static void GLAPIENTRY _tnl_VertexAttrib4fNV( GLuint index, GLfloat x,
GLfloat y, GLfloat z,
GLfloat w )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR4F( index, x, y, z, w );
}
static void GLAPIENTRY _tnl_VertexAttrib4fvNV( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR4FV( index, v );
}
-
-/*
- * XXX adjust index
- */
-
static void GLAPIENTRY _tnl_VertexAttrib1fARB( GLuint index, GLfloat x )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR1F( index, x );
}
static void GLAPIENTRY _tnl_VertexAttrib1fvARB( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR1FV( index, v );
}
static void GLAPIENTRY _tnl_VertexAttrib2fARB( GLuint index, GLfloat x,
GLfloat y )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR2F( index, x, y );
}
static void GLAPIENTRY _tnl_VertexAttrib2fvARB( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR2FV( index, v );
}
static void GLAPIENTRY _tnl_VertexAttrib3fARB( GLuint index, GLfloat x,
GLfloat y, GLfloat z )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR3F( index, x, y, z );
}
static void GLAPIENTRY _tnl_VertexAttrib3fvARB( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR3FV( index, v );
}
@@ -468,14 +481,20 @@ static void GLAPIENTRY _tnl_VertexAttrib4fARB( GLuint index, GLfloat x,
GLfloat y, GLfloat z,
GLfloat w )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR4F( index, x, y, z, w );
}
static void GLAPIENTRY _tnl_VertexAttrib4fvARB( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR4FV( index, v );
}