summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/Makefile1
-rw-r--r--src/mesa/drivers/dri/i965/brw_attrib.h96
-rw-r--r--src/mesa/drivers/dri/i965/brw_attrib_tmp.h485
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h5
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.c13
-rw-r--r--src/mesa/drivers/dri/i965/brw_exec.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_exec.h14
-rw-r--r--src/mesa/drivers/dri/i965/brw_exec_api.c401
-rw-r--r--src/mesa/drivers/dri/i965/brw_exec_array.c67
-rw-r--r--src/mesa/drivers/dri/i965/brw_exec_eval.c32
-rw-r--r--src/mesa/drivers/dri/i965/brw_fallback.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_save.h3
-rw-r--r--src/mesa/drivers/dri/i965/brw_save_api.c674
-rw-r--r--src/mesa/drivers/dri/i965/brw_save_draw.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.c3
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_constval.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_tnl.c34
-rw-r--r--src/mesa/drivers/dri/i965/intel_context.h10
18 files changed, 759 insertions, 1091 deletions
diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile
index 451af2e29ff..1710d2b6d45 100644
--- a/src/mesa/drivers/dri/i965/Makefile
+++ b/src/mesa/drivers/dri/i965/Makefile
@@ -42,7 +42,6 @@ DRIVER_SOURCES = \
brw_exec_array.c \
brw_exec_draw.c \
brw_exec_eval.c \
- brw_exec_generic.c \
brw_fallback.c \
brw_gs.c \
brw_gs_emit.c \
diff --git a/src/mesa/drivers/dri/i965/brw_attrib.h b/src/mesa/drivers/dri/i965/brw_attrib.h
index f180e16e5f1..a8efc3a528b 100644
--- a/src/mesa/drivers/dri/i965/brw_attrib.h
+++ b/src/mesa/drivers/dri/i965/brw_attrib.h
@@ -50,8 +50,8 @@ enum {
BRW_ATTRIB_COLOR0 = 3,
BRW_ATTRIB_COLOR1 = 4,
BRW_ATTRIB_FOG = 5,
- BRW_ATTRIB_SIX = 6,
- BRW_ATTRIB_SEVEN = 7,
+ BRW_ATTRIB_INDEX = 6,
+ BRW_ATTRIB_EDGEFLAG = 7,
BRW_ATTRIB_TEX0 = 8,
BRW_ATTRIB_TEX1 = 9,
BRW_ATTRIB_TEX2 = 10,
@@ -60,62 +60,54 @@ enum {
BRW_ATTRIB_TEX5 = 13,
BRW_ATTRIB_TEX6 = 14,
BRW_ATTRIB_TEX7 = 15,
- BRW_ATTRIB_MAT_FRONT_AMBIENT = 16,
- BRW_ATTRIB_MAT_BACK_AMBIENT = 17,
- BRW_ATTRIB_MAT_FRONT_DIFFUSE = 18,
- BRW_ATTRIB_MAT_BACK_DIFFUSE = 19,
- BRW_ATTRIB_MAT_FRONT_SPECULAR = 20,
- BRW_ATTRIB_MAT_BACK_SPECULAR = 21,
- BRW_ATTRIB_MAT_FRONT_EMISSION = 22,
- BRW_ATTRIB_MAT_BACK_EMISSION = 23,
- BRW_ATTRIB_MAT_FRONT_SHININESS = 24,
- BRW_ATTRIB_MAT_BACK_SHININESS = 25,
- BRW_ATTRIB_MAT_FRONT_INDEXES = 26,
- BRW_ATTRIB_MAT_BACK_INDEXES = 27,
- BRW_ATTRIB_INDEX = 28,
- BRW_ATTRIB_EDGEFLAG = 29,
- BRW_ATTRIB_MAX = 30
+ BRW_ATTRIB_GENERIC0 = 16, /* Not used? */
+ BRW_ATTRIB_GENERIC1 = 17,
+ BRW_ATTRIB_GENERIC2 = 18,
+ BRW_ATTRIB_GENERIC3 = 19,
+ BRW_ATTRIB_GENERIC4 = 20,
+ BRW_ATTRIB_GENERIC5 = 21,
+ BRW_ATTRIB_GENERIC6 = 22,
+ BRW_ATTRIB_GENERIC7 = 23,
+ BRW_ATTRIB_GENERIC8 = 24,
+ BRW_ATTRIB_GENERIC9 = 25,
+ BRW_ATTRIB_GENERIC10 = 26,
+ BRW_ATTRIB_GENERIC11 = 27,
+ BRW_ATTRIB_GENERIC12 = 28,
+ BRW_ATTRIB_GENERIC13 = 29,
+ BRW_ATTRIB_GENERIC14 = 30,
+ BRW_ATTRIB_GENERIC15 = 31,
+
+ BRW_ATTRIB_MAT_FRONT_AMBIENT = 32,
+ BRW_ATTRIB_MAT_BACK_AMBIENT = 33,
+ BRW_ATTRIB_MAT_FRONT_DIFFUSE = 34,
+ BRW_ATTRIB_MAT_BACK_DIFFUSE = 35,
+ BRW_ATTRIB_MAT_FRONT_SPECULAR = 36,
+ BRW_ATTRIB_MAT_BACK_SPECULAR = 37,
+ BRW_ATTRIB_MAT_FRONT_EMISSION = 38,
+ BRW_ATTRIB_MAT_BACK_EMISSION = 39,
+ BRW_ATTRIB_MAT_FRONT_SHININESS = 40,
+ BRW_ATTRIB_MAT_BACK_SHININESS = 41,
+ BRW_ATTRIB_MAT_FRONT_INDEXES = 42,
+ BRW_ATTRIB_MAT_BACK_INDEXES = 43,
+
+ BRW_ATTRIB_MAX = 44
} ;
#define BRW_ATTRIB_FIRST_MATERIAL BRW_ATTRIB_MAT_FRONT_AMBIENT
-/* 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 BRW_BIT_POS (1<<0)
-#define BRW_BIT_WEIGHT (1<<1)
-#define BRW_BIT_NORMAL (1<<2)
-#define BRW_BIT_COLOR0 (1<<3)
-#define BRW_BIT_COLOR1 (1<<4)
-#define BRW_BIT_FOG (1<<5)
-#define BRW_BIT_SIX (1<<6)
-#define BRW_BIT_SEVEN (1<<7)
-#define BRW_BIT_TEX0 (1<<8)
-#define BRW_BIT_TEX1 (1<<9)
-#define BRW_BIT_TEX2 (1<<10)
-#define BRW_BIT_TEX3 (1<<11)
-#define BRW_BIT_TEX4 (1<<12)
-#define BRW_BIT_TEX5 (1<<13)
-#define BRW_BIT_TEX6 (1<<14)
-#define BRW_BIT_TEX7 (1<<15)
-#define BRW_BIT_MAT_FRONT_AMBIENT (1<<16)
-#define BRW_BIT_MAT_BACK_AMBIENT (1<<17)
-#define BRW_BIT_MAT_FRONT_DIFFUSE (1<<18)
-#define BRW_BIT_MAT_BACK_DIFFUSE (1<<19)
-#define BRW_BIT_MAT_FRONT_SPECULAR (1<<20)
-#define BRW_BIT_MAT_BACK_SPECULAR (1<<21)
-#define BRW_BIT_MAT_FRONT_EMISSION (1<<22)
-#define BRW_BIT_MAT_BACK_EMISSION (1<<23)
-#define BRW_BIT_MAT_FRONT_SHININESS (1<<24)
-#define BRW_BIT_MAT_BACK_SHININESS (1<<25)
-#define BRW_BIT_MAT_FRONT_INDEXES (1<<26)
-#define BRW_BIT_MAT_BACK_INDEXES (1<<27)
-#define BRW_BIT_INDEX (1<<28)
-#define BRW_BIT_EDGEFLAG (1<<29)
+#define BRW_MAX_COPIED_VERTS 3
-#define BRW_MAX_COPIED_VERTS 3
+static inline GLuint64EXT brw_translate_inputs( GLboolean vp_enabled,
+ GLuint mesa_inputs )
+{
+ GLuint64EXT inputs = mesa_inputs;
+ if (vp_enabled)
+ return inputs;
+ else
+ return (inputs & 0xffff) | ((inputs & 0xffff0000) << 16);
+}
+
#endif
diff --git a/src/mesa/drivers/dri/i965/brw_attrib_tmp.h b/src/mesa/drivers/dri/i965/brw_attrib_tmp.h
new file mode 100644
index 00000000000..3089bd6cac2
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/brw_attrib_tmp.h
@@ -0,0 +1,485 @@
+/**************************************************************************
+
+Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
+
+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"),
+to deal in the Software without restriction, including without limitation
+on the rights to use, copy, modify, merge, publish, distribute, sub
+license, and/or sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#define ATTR1FV( A, V ) ATTR( A, 1, (V)[0], 0, 0, 1 )
+#define ATTR2FV( A, V ) ATTR( A, 2, (V)[0], (V)[1], 0, 1 )
+#define ATTR3FV( A, V ) ATTR( A, 3, (V)[0], (V)[1], (V)[2], 1 )
+#define ATTR4FV( A, V ) ATTR( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
+
+#define ATTR1F( A, X ) ATTR( A, 1, X, 0, 0, 1 )
+#define ATTR2F( A, X, Y ) ATTR( A, 2, X, Y, 0, 1 )
+#define ATTR3F( A, X, Y, Z ) ATTR( A, 3, X, Y, Z, 1 )
+#define ATTR4F( A, X, Y, Z, W ) ATTR( A, 4, X, Y, Z, W )
+
+#define MAT_ATTR( A, N, V ) ATTR( A, N, (V)[0], (V)[1], (V)[2], (V)[3] )
+
+static void GLAPIENTRY TAG(Vertex2f)( GLfloat x, GLfloat y )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR2F( BRW_ATTRIB_POS, x, y );
+}
+
+static void GLAPIENTRY TAG(Vertex2fv)( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR2FV( BRW_ATTRIB_POS, v );
+}
+
+static void GLAPIENTRY TAG(Vertex3f)( GLfloat x, GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR3F( BRW_ATTRIB_POS, x, y, z );
+}
+
+static void GLAPIENTRY TAG(Vertex3fv)( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR3FV( BRW_ATTRIB_POS, v );
+}
+
+static void GLAPIENTRY TAG(Vertex4f)( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR4F( BRW_ATTRIB_POS, x, y, z, w );
+}
+
+static void GLAPIENTRY TAG(Vertex4fv)( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR4FV( BRW_ATTRIB_POS, v );
+}
+
+static void GLAPIENTRY TAG(TexCoord1f)( GLfloat x )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR1F( BRW_ATTRIB_TEX0, x );
+}
+
+static void GLAPIENTRY TAG(TexCoord1fv)( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR1FV( BRW_ATTRIB_TEX0, v );
+}
+
+static void GLAPIENTRY TAG(TexCoord2f)( GLfloat x, GLfloat y )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR2F( BRW_ATTRIB_TEX0, x, y );
+}
+
+static void GLAPIENTRY TAG(TexCoord2fv)( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR2FV( BRW_ATTRIB_TEX0, v );
+}
+
+static void GLAPIENTRY TAG(TexCoord3f)( GLfloat x, GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR3F( BRW_ATTRIB_TEX0, x, y, z );
+}
+
+static void GLAPIENTRY TAG(TexCoord3fv)( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR3FV( BRW_ATTRIB_TEX0, v );
+}
+
+static void GLAPIENTRY TAG(TexCoord4f)( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR4F( BRW_ATTRIB_TEX0, x, y, z, w );
+}
+
+static void GLAPIENTRY TAG(TexCoord4fv)( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR4FV( BRW_ATTRIB_TEX0, v );
+}
+
+static void GLAPIENTRY TAG(Normal3f)( GLfloat x, GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR3F( BRW_ATTRIB_NORMAL, x, y, z );
+}
+
+static void GLAPIENTRY TAG(Normal3fv)( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR3FV( BRW_ATTRIB_NORMAL, v );
+}
+
+static void GLAPIENTRY TAG(FogCoordfEXT)( GLfloat x )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR1F( BRW_ATTRIB_FOG, x );
+}
+
+static void GLAPIENTRY TAG(FogCoordfvEXT)( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR1FV( BRW_ATTRIB_FOG, v );
+}
+
+static void GLAPIENTRY TAG(Color3f)( GLfloat x, GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR3F( BRW_ATTRIB_COLOR0, x, y, z );
+}
+
+static void GLAPIENTRY TAG(Color3fv)( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR3FV( BRW_ATTRIB_COLOR0, v );
+}
+
+static void GLAPIENTRY TAG(Color4f)( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR4F( BRW_ATTRIB_COLOR0, x, y, z, w );
+}
+
+static void GLAPIENTRY TAG(Color4fv)( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR4FV( BRW_ATTRIB_COLOR0, v );
+}
+
+static void GLAPIENTRY TAG(SecondaryColor3fEXT)( GLfloat x, GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR3F( BRW_ATTRIB_COLOR1, x, y, z );
+}
+
+static void GLAPIENTRY TAG(SecondaryColor3fvEXT)( const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR3FV( BRW_ATTRIB_COLOR1, v );
+}
+
+
+static void GLAPIENTRY TAG(EdgeFlag)( GLboolean b )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR1F( BRW_ATTRIB_EDGEFLAG, (GLfloat)b );
+}
+
+static void GLAPIENTRY TAG(Indexf)( GLfloat f )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR1F( BRW_ATTRIB_INDEX, f );
+}
+
+static void GLAPIENTRY TAG(Indexfv)( const GLfloat *f )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ ATTR1FV( BRW_ATTRIB_INDEX, f );
+}
+
+
+static void GLAPIENTRY TAG(MultiTexCoord1f)( GLenum target, GLfloat x )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
+ ATTR1F( attr, x );
+}
+
+static void GLAPIENTRY TAG(MultiTexCoord1fv)( GLenum target, const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
+ ATTR1FV( attr, v );
+}
+
+static void GLAPIENTRY TAG(MultiTexCoord2f)( GLenum target, GLfloat x, GLfloat y )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
+ ATTR2F( attr, x, y );
+}
+
+static void GLAPIENTRY TAG(MultiTexCoord2fv)( GLenum target, const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
+ ATTR2FV( attr, v );
+}
+
+static void GLAPIENTRY TAG(MultiTexCoord3f)( GLenum target, GLfloat x, GLfloat y,
+ GLfloat z)
+{
+ GET_CURRENT_CONTEXT( ctx );
+ GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
+ ATTR3F( attr, x, y, z );
+}
+
+static void GLAPIENTRY TAG(MultiTexCoord3fv)( GLenum target, const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
+ ATTR3FV( attr, v );
+}
+
+static void GLAPIENTRY TAG(MultiTexCoord4f)( GLenum target, GLfloat x, GLfloat y,
+ GLfloat z, GLfloat w )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
+ ATTR4F( attr, x, y, z, w );
+}
+
+static void GLAPIENTRY TAG(MultiTexCoord4fv)( GLenum target, const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
+ ATTR4FV( attr, v );
+}
+
+
+static void GLAPIENTRY TAG(VertexAttrib1fARB)( GLuint index, GLfloat x )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index == 0)
+ ATTR1F(0, x);
+ else if (index < MAX_VERTEX_ATTRIBS)
+ ATTR1F(BRW_ATTRIB_GENERIC0 + index, x);
+ else
+ ERROR();
+}
+
+static void GLAPIENTRY TAG(VertexAttrib1fvARB)( GLuint index,
+ const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index == 0)
+ ATTR1FV(0, v);
+ else if (index < MAX_VERTEX_ATTRIBS)
+ ATTR1FV(BRW_ATTRIB_GENERIC0 + index, v);
+ else
+ ERROR();
+}
+
+static void GLAPIENTRY TAG(VertexAttrib2fARB)( GLuint index, GLfloat x,
+ GLfloat y )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index == 0)
+ ATTR2F(0, x, y);
+ else if (index < MAX_VERTEX_ATTRIBS)
+ ATTR2F(BRW_ATTRIB_GENERIC0 + index, x, y);
+ else
+ ERROR();
+}
+
+static void GLAPIENTRY TAG(VertexAttrib2fvARB)( GLuint index,
+ const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index == 0)
+ ATTR2FV(0, v);
+ else if (index < MAX_VERTEX_ATTRIBS)
+ ATTR2FV(BRW_ATTRIB_GENERIC0 + index, v);
+ else
+ ERROR();
+}
+
+static void GLAPIENTRY TAG(VertexAttrib3fARB)( GLuint index, GLfloat x,
+ GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index == 0)
+ ATTR3F(0, x, y, z);
+ else if (index < MAX_VERTEX_ATTRIBS)
+ ATTR3F(BRW_ATTRIB_GENERIC0 + index, x, y, z);
+ else
+ ERROR();
+}
+
+static void GLAPIENTRY TAG(VertexAttrib3fvARB)( GLuint index,
+ const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index == 0)
+ ATTR3FV(0, v);
+ else if (index < MAX_VERTEX_ATTRIBS)
+ ATTR3FV(BRW_ATTRIB_GENERIC0 + index, v);
+ else
+ ERROR();
+}
+
+static void GLAPIENTRY TAG(VertexAttrib4fARB)( GLuint index, GLfloat x,
+ GLfloat y, GLfloat z,
+ GLfloat w )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index == 0)
+ ATTR4F(0, x, y, z, w);
+ else if (index < MAX_VERTEX_ATTRIBS)
+ ATTR4F(BRW_ATTRIB_GENERIC0 + index, x, y, z, w);
+ else
+ ERROR();
+}
+
+static void GLAPIENTRY TAG(VertexAttrib4fvARB)( GLuint index,
+ const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index == 0)
+ ATTR4FV(0, v);
+ else if (index < MAX_VERTEX_ATTRIBS)
+ ATTR4FV(BRW_ATTRIB_GENERIC0 + index, v);
+ else
+ ERROR();
+}
+
+
+/* Although we don't export NV_vertex_program, these entrypoints are
+ * used by the display list and other code specifically because of
+ * their property of aliasing with other attributes.
+ */
+static void GLAPIENTRY TAG(VertexAttrib1fNV)( GLuint index, GLfloat x )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index < BRW_ATTRIB_MAX)
+ ATTR1F(index, x);
+}
+
+static void GLAPIENTRY TAG(VertexAttrib1fvNV)( GLuint index,
+ const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index < BRW_ATTRIB_MAX)
+ ATTR1FV(index, v);
+}
+
+static void GLAPIENTRY TAG(VertexAttrib2fNV)( GLuint index, GLfloat x,
+ GLfloat y )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index < BRW_ATTRIB_MAX)
+ ATTR2F(index, x, y);
+}
+
+static void GLAPIENTRY TAG(VertexAttrib2fvNV)( GLuint index,
+ const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index < BRW_ATTRIB_MAX)
+ ATTR2FV(index, v);
+}
+
+static void GLAPIENTRY TAG(VertexAttrib3fNV)( GLuint index, GLfloat x,
+ GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index < BRW_ATTRIB_MAX)
+ ATTR3F(index, x, y, z);
+}
+
+static void GLAPIENTRY TAG(VertexAttrib3fvNV)( GLuint index,
+ const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index < BRW_ATTRIB_MAX)
+ ATTR3FV(index, v);
+}
+
+static void GLAPIENTRY TAG(VertexAttrib4fNV)( GLuint index, GLfloat x,
+ GLfloat y, GLfloat z,
+ GLfloat w )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index < BRW_ATTRIB_MAX)
+ ATTR4F(index, x, y, z, w);
+}
+
+static void GLAPIENTRY TAG(VertexAttrib4fvNV)( GLuint index,
+ const GLfloat *v )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ if (index < BRW_ATTRIB_MAX)
+ ATTR4FV(index, v);
+}
+
+
+#define MAT( ATTR, N, face, params ) \
+do { \
+ if (face != GL_BACK) \
+ MAT_ATTR( ATTR, N, params ); /* front */ \
+ if (face != GL_FRONT) \
+ MAT_ATTR( ATTR + 1, N, params ); /* back */ \
+} while (0)
+
+
+/* Colormaterial conflicts are dealt with later.
+ */
+static void GLAPIENTRY TAG(Materialfv)( GLenum face, GLenum pname,
+ const GLfloat *params )
+{
+ GET_CURRENT_CONTEXT( ctx );
+ switch (pname) {
+ case GL_EMISSION:
+ MAT( BRW_ATTRIB_MAT_FRONT_EMISSION, 4, face, params );
+ break;
+ case GL_AMBIENT:
+ MAT( BRW_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params );
+ break;
+ case GL_DIFFUSE:
+ MAT( BRW_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params );
+ break;
+ case GL_SPECULAR:
+ MAT( BRW_ATTRIB_MAT_FRONT_SPECULAR, 4, face, params );
+ break;
+ case GL_SHININESS:
+ MAT( BRW_ATTRIB_MAT_FRONT_SHININESS, 1, face, params );
+ break;
+ case GL_COLOR_INDEXES:
+ MAT( BRW_ATTRIB_MAT_FRONT_INDEXES, 3, face, params );
+ break;
+ case GL_AMBIENT_AND_DIFFUSE:
+ MAT( BRW_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params );
+ MAT( BRW_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params );
+ break;
+ default:
+ ERROR();
+ return;
+ }
+}
+
+
+#undef ATTR1FV
+#undef ATTR2FV
+#undef ATTR3FV
+#undef ATTR4FV
+
+#undef ATTR1F
+#undef ATTR2F
+#undef ATTR3F
+#undef ATTR4F
+
+#undef MAT
+#undef MAT_ATTR
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index aa1cd58f69b..48d2cce4484 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -213,7 +213,8 @@ struct brw_vs_prog_data {
GLuint urb_read_length;
GLuint total_grf;
GLuint outputs_written;
- GLuint inputs_read;
+
+ GLuint64EXT inputs_read;
/* Used for calculating urb partitions:
*/
@@ -399,7 +400,7 @@ struct brw_vertex_element {
struct brw_vertex_info {
- GLuint varying[ATTRIB_BIT_DWORDS]; /* varying:1[BRW_ATTRIB_MAX] */
+ GLuint64EXT varying; /* varying:1[BRW_ATTRIB_MAX] */
GLuint sizes[ATTRIB_BIT_DWORDS * 2]; /* sizes:2[BRW_ATTRIB_MAX] */
};
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index a98e08e363a..104404b3019 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -160,7 +160,7 @@ static void update_current_size( struct gl_client_array *array)
const GLfloat *ptr = (const GLfloat *)array->Ptr;
assert(array->StrideB == 0);
- assert(array->Type == GL_FLOAT);
+ assert(array->Type == GL_FLOAT || array->Type == GL_UNSIGNED_BYTE);
if (ptr[3] != 1.0)
array->Size = 4;
@@ -192,17 +192,12 @@ static void brw_merge_inputs( struct brw_context *brw,
if (arrays[i] && arrays[i]->Enabled)
{
brw->vb.inputs[i].glarray = arrays[i];
- brw->vb.info.varying[i/32] |= 1 << (i%32);
+ brw->vb.info.varying |= 1 << i;
}
else
{
brw->vb.inputs[i].glarray = &current_values[i];
-
- /* XXX: This will change on the Mesa trunk as Brian has moved
- * edgeflag, index into this range:
- */
- if (i < VERT_ATTRIB_GENERIC0)
- update_current_size(&current_values[i]);
+ update_current_size(&current_values[i]);
}
brw->vb.info.sizes[i/16] |= (inputs[i].glarray->Size - 1) << ((i%16) * 2);
@@ -213,7 +208,7 @@ static void brw_merge_inputs( struct brw_context *brw,
if (memcmp(brw->vb.info.sizes, old.sizes, sizeof(old.sizes)) != 0)
brw->state.dirty.brw |= BRW_NEW_INPUT_DIMENSIONS;
- if (memcmp(brw->vb.info.varying, old.varying, sizeof(old.varying)) != 0)
+ if (brw->vb.info.varying != old.varying)
brw->state.dirty.brw |= BRW_NEW_INPUT_VARYING;
}
diff --git a/src/mesa/drivers/dri/i965/brw_exec.c b/src/mesa/drivers/dri/i965/brw_exec.c
index 1be858f11b6..fc06c3c3617 100644
--- a/src/mesa/drivers/dri/i965/brw_exec.c
+++ b/src/mesa/drivers/dri/i965/brw_exec.c
@@ -63,7 +63,6 @@ void brw_exec_init( GLcontext *ctx )
ctx->Driver.FlushVertices = brw_exec_FlushVertices;
exec->eval.recalculate_maps = 1;
- exec->array.recalculate_inputs = 1;
}
@@ -102,9 +101,6 @@ void brw_exec_invalidate_state( GLcontext *ctx, GLuint new_state )
if (new_state & (_NEW_PROGRAM|_NEW_EVAL))
exec->eval.recalculate_maps = 1;
- if (new_state & (_NEW_PROGRAM|_NEW_ARRAY))
- exec->array.recalculate_inputs = 1;
-
_ae_invalidate_state(ctx, new_state);
}
diff --git a/src/mesa/drivers/dri/i965/brw_exec.h b/src/mesa/drivers/dri/i965/brw_exec.h
index 2fa111dc8b3..f07b4485874 100644
--- a/src/mesa/drivers/dri/i965/brw_exec.h
+++ b/src/mesa/drivers/dri/i965/brw_exec.h
@@ -95,9 +95,9 @@ struct brw_exec_context
GLuint max_vert;
struct brw_exec_copied_vtx copied;
- brw_attrfv_func tabfv[BRW_MAX_ATTR_CODEGEN+1][4]; /* plus 1 for ERROR_ATTRIB */
-
GLubyte attrsz[BRW_ATTRIB_MAX];
+ GLubyte active_sz[BRW_ATTRIB_MAX];
+
GLfloat *attrptr[BRW_ATTRIB_MAX];
struct gl_client_array arrays[BRW_ATTRIB_MAX];
const struct gl_client_array *inputs[BRW_ATTRIB_MAX];
@@ -111,10 +111,7 @@ struct brw_exec_context
} eval;
struct {
- GLboolean recalculate_inputs;
const struct gl_client_array *inputs[BRW_ATTRIB_MAX];
- const struct gl_client_array *attrib_arrays[BRW_ATTRIB_MAX];
- const struct gl_client_array *legacy_arrays[BRW_ATTRIB_MAX];
struct gl_buffer_object *index_obj;
} array;
@@ -150,11 +147,4 @@ void brw_exec_do_EvalCoord2f( struct brw_exec_context *exec,
void brw_exec_do_EvalCoord1f( struct brw_exec_context *exec,
GLfloat u);
-
-
-void brw_exec_vtx_generic_init( struct brw_exec_context *exec );
-
-void brw_exec_generic_attr_table_init( brw_attrfv_func (*tab)[4] );
-
-
#endif
diff --git a/src/mesa/drivers/dri/i965/brw_exec_api.c b/src/mesa/drivers/dri/i965/brw_exec_api.c
index d42720286c3..ca012dbcd8a 100644
--- a/src/mesa/drivers/dri/i965/brw_exec_api.c
+++ b/src/mesa/drivers/dri/i965/brw_exec_api.c
@@ -45,9 +45,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
static void reset_attrfv( struct brw_exec_context *exec );
-static brw_attrfv_func choose[BRW_MAX_ATTR_CODEGEN+1][4]; /* +1 for ERROR_ATTRIB */
-static brw_attrfv_func generic_attr_func[BRW_MAX_ATTR_CODEGEN][4];
-
/* Close off the last primitive, execute the buffer, restart the
* primitive.
@@ -135,7 +132,7 @@ static void brw_exec_copy_to_current( struct brw_exec_context *exec )
GLcontext *ctx = exec->ctx;
GLuint i;
- for (i = BRW_ATTRIB_POS+1 ; i < BRW_ATTRIB_INDEX ; i++) {
+ for (i = BRW_ATTRIB_POS+1 ; i < BRW_ATTRIB_MAX ; i++) {
if (exec->vtx.attrsz[i]) {
/* Note: the exec->vtx.current[i] pointers point into the
* ctx->Current.Attrib and ctx->Light.Material.Attrib arrays.
@@ -166,15 +163,13 @@ static void brw_exec_copy_to_current( struct brw_exec_context *exec )
ctx->Current.EdgeFlag = (exec->vtx.CurrentFloatEdgeFlag == 1.0);
}
-#if 1
/* Colormaterial -- this kindof sucks.
*/
if (ctx->Light.ColorMaterialEnabled &&
- exec->vtx.attrsz[VERT_ATTRIB_COLOR0]) {
+ exec->vtx.attrsz[BRW_ATTRIB_COLOR0]) {
_mesa_update_color_material(ctx,
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
+ ctx->Current.Attrib[BRW_ATTRIB_COLOR0]);
}
-#endif
ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
}
@@ -304,35 +299,24 @@ static void brw_exec_wrap_upgrade_vertex( struct brw_exec_context *exec,
exec->vtx.vert_count += exec->vtx.copied.nr;
exec->vtx.copied.nr = 0;
}
-
- /* For codegen - attrptr's may have changed, so need to redo
- * codegen. Might be a reasonable place to try & detect attributes
- * in the vertex which aren't being submitted any more.
- */
- for (i = 0 ; i < BRW_ATTRIB_MAX ; i++)
- if (exec->vtx.attrsz[i]) {
- GLuint j = exec->vtx.attrsz[i] - 1;
-
- if (i < BRW_MAX_ATTR_CODEGEN)
- exec->vtx.tabfv[i][j] = choose[i][j];
- }
-
}
-static void brw_exec_fixup_vertex( struct brw_exec_context *exec,
+static void brw_exec_fixup_vertex( GLcontext *ctx,
GLuint attr, GLuint sz )
{
- static const GLfloat id[4] = { 0, 0, 0, 1 };
+ struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec;
int i;
- if (exec->vtx.attrsz[attr] < sz) {
+ if (sz > exec->vtx.attrsz[attr]) {
/* New size is larger. Need to flush existing vertices and get
* an enlarged vertex format.
*/
brw_exec_wrap_upgrade_vertex( exec, attr, sz );
}
- else if (exec->vtx.attrsz[attr] > sz) {
+ else if (sz < exec->vtx.active_sz[attr]) {
+ static const GLfloat id[4] = { 0, 0, 0, 1 };
+
/* New size is smaller - just need to fill in some
* zeros. Don't need to flush or wrap.
*/
@@ -340,6 +324,8 @@ static void brw_exec_fixup_vertex( struct brw_exec_context *exec,
exec->vtx.attrptr[attr][i-1] = id[i-1];
}
+ exec->vtx.active_sz[attr] = sz;
+
/* Does setting NeedFlush belong here? Necessitates resetting
* vtxfmt on each flush (otherwise flags won't get reset
* afterwards).
@@ -351,230 +337,48 @@ static void brw_exec_fixup_vertex( struct brw_exec_context *exec,
}
-/* Helper function for 'CHOOSE' macro. Do what's necessary when an
- * entrypoint is called for the first time.
- */
-
-static brw_attrfv_func do_choose( GLuint attr, GLuint sz )
-{
- GET_CURRENT_CONTEXT( ctx );
- struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec;
- GLuint oldsz = exec->vtx.attrsz[attr];
-
- assert(attr < BRW_MAX_ATTR_CODEGEN);
-
- if (oldsz != sz) {
- /* Reset any active pointers for this attribute
- */
- if (oldsz)
- exec->vtx.tabfv[attr][oldsz-1] = choose[attr][oldsz-1];
-
- brw_exec_fixup_vertex( exec, attr, sz );
-
- }
-
- /* Codegen?
- */
-
- /* Else use generic version:
- */
- exec->vtx.tabfv[attr][sz-1] = generic_attr_func[attr][sz-1];
-
- return exec->vtx.tabfv[attr][sz-1];
-}
-
-#define CHOOSE( ATTR, N ) \
-static void choose_##ATTR##_##N( const GLfloat *v ) \
-{ \
- brw_attrfv_func f = do_choose(ATTR, N); \
- f( v ); \
-}
-
-#define CHOOSERS( ATTRIB ) \
- CHOOSE( ATTRIB, 1 ) \
- CHOOSE( ATTRIB, 2 ) \
- CHOOSE( ATTRIB, 3 ) \
- CHOOSE( ATTRIB, 4 ) \
-
-
-#define INIT_CHOOSERS(ATTR) \
- choose[ATTR][0] = choose_##ATTR##_1; \
- choose[ATTR][1] = choose_##ATTR##_2; \
- choose[ATTR][2] = choose_##ATTR##_3; \
- choose[ATTR][3] = choose_##ATTR##_4;
-
-CHOOSERS( 0 )
-CHOOSERS( 1 )
-CHOOSERS( 2 )
-CHOOSERS( 3 )
-CHOOSERS( 4 )
-CHOOSERS( 5 )
-CHOOSERS( 6 )
-CHOOSERS( 7 )
-CHOOSERS( 8 )
-CHOOSERS( 9 )
-CHOOSERS( 10 )
-CHOOSERS( 11 )
-CHOOSERS( 12 )
-CHOOSERS( 13 )
-CHOOSERS( 14 )
-CHOOSERS( 15 )
-
-static void error_attrib( const GLfloat *unused )
-{
- GET_CURRENT_CONTEXT( ctx );
- (void) unused;
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib" );
-}
-
-
-
-static void reset_attrfv( struct brw_exec_context *exec )
-{
- GLuint i;
-
- for (i = 0 ; i < BRW_ATTRIB_MAX ; i++)
- if (exec->vtx.attrsz[i]) {
- GLint j = exec->vtx.attrsz[i] - 1;
- exec->vtx.attrsz[i] = 0;
-
- if (i < BRW_MAX_ATTR_CODEGEN) {
- while (j >= 0) {
- exec->vtx.tabfv[i][j] = choose[i][j];
- j--;
- }
- }
- }
-
- exec->vtx.vertex_size = 0;
-}
-
-
-
-/* Materials:
- *
- * These are treated as per-vertex attributes, at indices above where
- * the NV_vertex_program leaves off. There are a lot of good things
- * about treating materials this way.
- *
- * However: I don't want to double the number of generated functions
- * just to cope with this, so I unroll the 'C' varients of CHOOSE and
- * ATTRF into this function, and dispense with codegen and
- * second-level dispatch.
- *
- * There is no aliasing of material attributes with other entrypoints.
+/*
*/
-#define OTHER_ATTR( exec, A, N, params ) \
-do { \
- if (exec->vtx.attrsz[A] != N) { \
- brw_exec_fixup_vertex( exec, A, N ); \
- } \
- \
- { \
- GLfloat *dest = exec->vtx.attrptr[A]; \
- if (N>0) dest[0] = (params)[0]; \
- if (N>1) dest[1] = (params)[1]; \
- if (N>2) dest[2] = (params)[2]; \
- if (N>3) dest[3] = (params)[3]; \
- } \
-} while (0)
-
-
-#define MAT( exec, ATTR, N, face, params ) \
+#define ATTR( A, N, V0, V1, V2, V3 ) \
do { \
- if (face != GL_BACK) \
- OTHER_ATTR( exec, ATTR, N, params ); /* front */ \
- if (face != GL_FRONT) \
- OTHER_ATTR( exec, ATTR + 1, N, params ); /* back */ \
+ struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec; \
+ \
+ if (exec->vtx.active_sz[A] != N) \
+ brw_exec_fixup_vertex(ctx, A, N); \
+ \
+ { \
+ GLfloat *dest = exec->vtx.attrptr[A]; \
+ if (N>0) dest[0] = V0; \
+ if (N>1) dest[1] = V1; \
+ if (N>2) dest[2] = V2; \
+ if (N>3) dest[3] = V3; \
+ } \
+ \
+ if ((A) == 0) { \
+ GLuint i; \
+ \
+ for (i = 0; i < exec->vtx.vertex_size; i++) \
+ exec->vtx.vbptr[i] = exec->vtx.vertex[i]; \
+ \
+ exec->vtx.vbptr += exec->vtx.vertex_size; \
+ exec->ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; \
+ \
+ if (++exec->vtx.vert_count >= exec->vtx.max_vert) \
+ brw_exec_vtx_wrap( exec ); \
+ } \
} while (0)
-/* Colormaterial is dealt with later on.
- */
-static void GLAPIENTRY brw_exec_Materialfv( GLenum face, GLenum pname,
- const GLfloat *params )
-{
- GET_CURRENT_CONTEXT( ctx );
- struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec;
+#define ERROR() _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ )
+#define TAG(x) brw_##x
- switch (face) {
- case GL_FRONT:
- case GL_BACK:
- case GL_FRONT_AND_BACK:
- break;
-
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glMaterialfv" );
- return;
- }
+#include "brw_attrib_tmp.h"
- switch (pname) {
- case GL_EMISSION:
- MAT( exec, BRW_ATTRIB_MAT_FRONT_EMISSION, 4, face, params );
- break;
- case GL_AMBIENT:
- MAT( exec, BRW_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params );
- break;
- case GL_DIFFUSE:
- MAT( exec, BRW_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params );
- break;
- case GL_SPECULAR:
- MAT( exec, BRW_ATTRIB_MAT_FRONT_SPECULAR, 4, face, params );
- break;
- case GL_SHININESS:
- MAT( exec, BRW_ATTRIB_MAT_FRONT_SHININESS, 1, face, params );
- break;
- case GL_COLOR_INDEXES:
- MAT( exec, BRW_ATTRIB_MAT_FRONT_INDEXES, 3, face, params );
- break;
- case GL_AMBIENT_AND_DIFFUSE:
- MAT( exec, BRW_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params );
- MAT( exec, BRW_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params );
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glMaterialfv" );
- return;
- }
-}
-
-
-static void GLAPIENTRY brw_exec_EdgeFlag( GLboolean b )
-{
- GET_CURRENT_CONTEXT( ctx );
- struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec;
- GLfloat f = (GLfloat)b;
-
- OTHER_ATTR( exec, BRW_ATTRIB_EDGEFLAG, 1, &f );
-}
-
-#if 0
-static void GLAPIENTRY brw_exec_EdgeFlagv( const GLboolean *v )
-{
- GET_CURRENT_CONTEXT( ctx );
- struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec;
- GLfloat f = (GLfloat)v[0];
-
- OTHER_ATTR( exec, BRW_ATTRIB_EDGEFLAG, 1, &f );
-}
-#endif
-
-static void GLAPIENTRY brw_exec_Indexf( GLfloat f )
-{
- GET_CURRENT_CONTEXT( ctx );
- struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec;
- OTHER_ATTR( exec, BRW_ATTRIB_INDEX, 1, &f );
-}
-static void GLAPIENTRY brw_exec_Indexfv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT( ctx );
- struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec;
- OTHER_ATTR( exec, BRW_ATTRIB_INDEX, 1, v );
-}
/* Eval
*/
@@ -583,7 +387,6 @@ static void GLAPIENTRY brw_exec_EvalCoord1f( GLfloat u )
GET_CURRENT_CONTEXT( ctx );
struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec;
- /* TODO: use a CHOOSE() function for this: */
{
GLint i;
if (exec->eval.recalculate_maps)
@@ -592,7 +395,7 @@ static void GLAPIENTRY brw_exec_EvalCoord1f( GLfloat u )
for (i = 0 ; i <= BRW_ATTRIB_INDEX ; i++) {
if (exec->eval.map1[i].map)
if (exec->vtx.attrsz[i] != exec->eval.map1[i].sz)
- brw_exec_fixup_vertex( exec, i, exec->eval.map1[i].sz );
+ brw_exec_fixup_vertex( ctx, i, exec->eval.map1[i].sz );
}
}
@@ -611,7 +414,6 @@ static void GLAPIENTRY brw_exec_EvalCoord2f( GLfloat u, GLfloat v )
GET_CURRENT_CONTEXT( ctx );
struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec;
- /* TODO: use a CHOOSE() function for this: */
{
GLint i;
if (exec->eval.recalculate_maps)
@@ -619,13 +421,13 @@ static void GLAPIENTRY brw_exec_EvalCoord2f( GLfloat u, GLfloat v )
for (i = 0 ; i <= BRW_ATTRIB_INDEX ; i++) {
if (exec->eval.map2[i].map)
- if (exec->vtx.attrsz[i] != exec->eval.map2[i].sz)
- brw_exec_fixup_vertex( exec, i, exec->eval.map2[i].sz );
+ if (exec->vtx.active_sz[i] != exec->eval.map2[i].sz)
+ brw_exec_fixup_vertex( ctx, i, exec->eval.map2[i].sz );
}
if (ctx->Eval.AutoNormal)
- if (exec->vtx.attrsz[BRW_ATTRIB_NORMAL] != 3)
- brw_exec_fixup_vertex( exec, BRW_ATTRIB_NORMAL, 3 );
+ if (exec->vtx.active_sz[BRW_ATTRIB_NORMAL] != 3)
+ brw_exec_fixup_vertex( ctx, BRW_ATTRIB_NORMAL, 3 );
}
_mesa_memcpy( exec->vtx.copied.buffer, exec->vtx.vertex,
@@ -750,8 +552,6 @@ static void brw_exec_vtxfmt_init( struct brw_exec_context *exec )
vfmt->Begin = brw_exec_Begin;
vfmt->CallList = _mesa_CallList;
vfmt->CallLists = _mesa_CallLists;
- vfmt->EdgeFlag = brw_exec_EdgeFlag;
-/* vfmt->EdgeFlagv = brw_exec_EdgeFlagv; */
vfmt->End = brw_exec_End;
vfmt->EvalCoord1f = brw_exec_EvalCoord1f;
vfmt->EvalCoord1fv = brw_exec_EvalCoord1fv;
@@ -759,13 +559,71 @@ static void brw_exec_vtxfmt_init( struct brw_exec_context *exec )
vfmt->EvalCoord2fv = brw_exec_EvalCoord2fv;
vfmt->EvalPoint1 = brw_exec_EvalPoint1;
vfmt->EvalPoint2 = brw_exec_EvalPoint2;
- vfmt->Indexf = brw_exec_Indexf;
- vfmt->Indexfv = brw_exec_Indexfv;
- vfmt->Materialfv = brw_exec_Materialfv;
vfmt->Rectf = _mesa_noop_Rectf;
vfmt->EvalMesh1 = _mesa_noop_EvalMesh1;
vfmt->EvalMesh2 = _mesa_noop_EvalMesh2;
+
+
+ /* from attrib_tmp.h:
+ */
+ vfmt->Color3f = brw_Color3f;
+ vfmt->Color3fv = brw_Color3fv;
+ vfmt->Color4f = brw_Color4f;
+ vfmt->Color4fv = brw_Color4fv;
+ vfmt->FogCoordfEXT = brw_FogCoordfEXT;
+ vfmt->FogCoordfvEXT = brw_FogCoordfvEXT;
+ vfmt->MultiTexCoord1fARB = brw_MultiTexCoord1f;
+ vfmt->MultiTexCoord1fvARB = brw_MultiTexCoord1fv;
+ vfmt->MultiTexCoord2fARB = brw_MultiTexCoord2f;
+ vfmt->MultiTexCoord2fvARB = brw_MultiTexCoord2fv;
+ vfmt->MultiTexCoord3fARB = brw_MultiTexCoord3f;
+ vfmt->MultiTexCoord3fvARB = brw_MultiTexCoord3fv;
+ vfmt->MultiTexCoord4fARB = brw_MultiTexCoord4f;
+ vfmt->MultiTexCoord4fvARB = brw_MultiTexCoord4fv;
+ vfmt->Normal3f = brw_Normal3f;
+ vfmt->Normal3fv = brw_Normal3fv;
+ vfmt->SecondaryColor3fEXT = brw_SecondaryColor3fEXT;
+ vfmt->SecondaryColor3fvEXT = brw_SecondaryColor3fvEXT;
+ vfmt->TexCoord1f = brw_TexCoord1f;
+ vfmt->TexCoord1fv = brw_TexCoord1fv;
+ vfmt->TexCoord2f = brw_TexCoord2f;
+ vfmt->TexCoord2fv = brw_TexCoord2fv;
+ vfmt->TexCoord3f = brw_TexCoord3f;
+ vfmt->TexCoord3fv = brw_TexCoord3fv;
+ vfmt->TexCoord4f = brw_TexCoord4f;
+ vfmt->TexCoord4fv = brw_TexCoord4fv;
+ vfmt->Vertex2f = brw_Vertex2f;
+ vfmt->Vertex2fv = brw_Vertex2fv;
+ vfmt->Vertex3f = brw_Vertex3f;
+ vfmt->Vertex3fv = brw_Vertex3fv;
+ vfmt->Vertex4f = brw_Vertex4f;
+ vfmt->Vertex4fv = brw_Vertex4fv;
+
+ vfmt->VertexAttrib1fARB = brw_VertexAttrib1fARB;
+ vfmt->VertexAttrib1fvARB = brw_VertexAttrib1fvARB;
+ vfmt->VertexAttrib2fARB = brw_VertexAttrib2fARB;
+ vfmt->VertexAttrib2fvARB = brw_VertexAttrib2fvARB;
+ vfmt->VertexAttrib3fARB = brw_VertexAttrib3fARB;
+ vfmt->VertexAttrib3fvARB = brw_VertexAttrib3fvARB;
+ vfmt->VertexAttrib4fARB = brw_VertexAttrib4fARB;
+ vfmt->VertexAttrib4fvARB = brw_VertexAttrib4fvARB;
+
+ vfmt->VertexAttrib1fNV = brw_VertexAttrib1fNV;
+ vfmt->VertexAttrib1fvNV = brw_VertexAttrib1fvNV;
+ vfmt->VertexAttrib2fNV = brw_VertexAttrib2fNV;
+ vfmt->VertexAttrib2fvNV = brw_VertexAttrib2fvNV;
+ vfmt->VertexAttrib3fNV = brw_VertexAttrib3fNV;
+ vfmt->VertexAttrib3fvNV = brw_VertexAttrib3fvNV;
+ vfmt->VertexAttrib4fNV = brw_VertexAttrib4fNV;
+ vfmt->VertexAttrib4fvNV = brw_VertexAttrib4fvNV;
+
+ vfmt->Materialfv = brw_Materialfv;
+
+ vfmt->EdgeFlag = brw_EdgeFlag;
+ vfmt->Indexf = brw_Indexf;
+ vfmt->Indexfv = brw_Indexfv;
+
}
@@ -791,35 +649,6 @@ void brw_exec_vtx_init( struct brw_exec_context *exec )
{
GLcontext *ctx = exec->ctx;
GLuint i;
- static int firsttime = 1;
-
- if (firsttime) {
- firsttime = 0;
-
- INIT_CHOOSERS( 0 );
- INIT_CHOOSERS( 1 );
- INIT_CHOOSERS( 2 );
- INIT_CHOOSERS( 3 );
- INIT_CHOOSERS( 4 );
- INIT_CHOOSERS( 5 );
- INIT_CHOOSERS( 6 );
- INIT_CHOOSERS( 7 );
- INIT_CHOOSERS( 8 );
- INIT_CHOOSERS( 9 );
- INIT_CHOOSERS( 10 );
- INIT_CHOOSERS( 11 );
- INIT_CHOOSERS( 12 );
- INIT_CHOOSERS( 13 );
- INIT_CHOOSERS( 14 );
- INIT_CHOOSERS( 15 );
-
- choose[ERROR_ATTRIB][0] = error_attrib;
- choose[ERROR_ATTRIB][1] = error_attrib;
- choose[ERROR_ATTRIB][2] = error_attrib;
- choose[ERROR_ATTRIB][3] = error_attrib;
-
- brw_exec_generic_attr_table_init( generic_attr_func );
- }
/* Allocate a buffer object. Will just reuse this object
* continuously.
@@ -829,16 +658,14 @@ void brw_exec_vtx_init( struct brw_exec_context *exec )
brw_exec_current_init( exec );
brw_exec_vtxfmt_init( exec );
- brw_exec_vtx_generic_init( exec );
/* Hook our functions into the dispatch table.
*/
_mesa_install_exec_vtxfmt( exec->ctx, &exec->vtxfmt );
- memcpy( exec->vtx.tabfv, choose, sizeof(choose) );
-
for (i = 0 ; i < BRW_ATTRIB_MAX ; i++) {
exec->vtx.attrsz[i] = 0;
+ exec->vtx.active_sz[i] = 0;
exec->vtx.inputs[i] = &exec->vtx.arrays[i];
}
@@ -875,3 +702,15 @@ void brw_exec_FlushVertices( GLcontext *ctx, GLuint flags )
}
+static void reset_attrfv( struct brw_exec_context *exec )
+{
+ GLuint i;
+
+ for (i = 0 ; i < BRW_ATTRIB_MAX ; i++) {
+ exec->vtx.attrsz[i] = 0;
+ exec->vtx.active_sz[i] = 0;
+ }
+
+ exec->vtx.vertex_size = 0;
+}
+
diff --git a/src/mesa/drivers/dri/i965/brw_exec_array.c b/src/mesa/drivers/dri/i965/brw_exec_array.c
index 95ed7704f63..ca19a198374 100644
--- a/src/mesa/drivers/dri/i965/brw_exec_array.c
+++ b/src/mesa/drivers/dri/i965/brw_exec_array.c
@@ -37,44 +37,6 @@
#include "brw_exec.h"
#include "brw_fallback.h"
-static GLboolean enabled( const struct gl_client_array *array )
-{
- return array && array->Enabled;
-}
-
-static void merge_enabled_arrays( const struct gl_client_array *inputs[],
- const struct gl_client_array *arrays[],
- GLuint nr )
-{
- GLuint i;
- for (i = 0; i < nr; i++)
- if (!enabled(inputs[i]) && enabled(arrays[i]))
- inputs[i] = arrays[i];
-}
-
-
-/* _NEW_PROGRAM, _NEW_CLIENT */
-static void recalculate_inputs( struct brw_exec_context *exec )
-{
- if (exec->ctx->VertexProgram._Enabled) {
- memcpy( exec->array.inputs,
- exec->array.attrib_arrays,
- sizeof(exec->array.inputs) );
-
- merge_enabled_arrays( exec->array.inputs,
- exec->array.legacy_arrays,
- BRW_ATTRIB_MAX );
- }
- else {
- memcpy( exec->array.inputs,
- exec->array.legacy_arrays,
- sizeof(exec->array.inputs) );
- }
-
- exec->array.recalculate_inputs = 0;
-}
-
-
static GLuint get_max_index( GLuint count, GLuint type,
const GLvoid *indices )
{
@@ -140,11 +102,6 @@ brw_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
if (ctx->NewState)
_mesa_update_state( ctx );
- /* Bind all inputs, derive varying and size information:
- */
- if (exec->array.recalculate_inputs)
- recalculate_inputs( exec );
-
prim[0].begin = 1;
prim[0].end = 1;
prim[0].weak = 0;
@@ -202,9 +159,6 @@ brw_exec_DrawRangeElements(GLenum mode,
if (ctx->NewState)
_mesa_update_state( ctx );
- if (exec->array.recalculate_inputs)
- recalculate_inputs( exec );
-
ib.count = count;
ib.type = type;
ib.obj = ctx->Array.ElementArrayBufferObj;
@@ -274,8 +228,8 @@ brw_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *ind
*/
-static void init_legacy_arrays( GLcontext *ctx,
- const struct gl_client_array *arrays[] )
+static void init_arrays( GLcontext *ctx,
+ const struct gl_client_array *arrays[] )
{
struct gl_array_object *obj = ctx->Array.ArrayObj;
GLuint i;
@@ -293,17 +247,9 @@ static void init_legacy_arrays( GLcontext *ctx,
arrays[BRW_ATTRIB_INDEX] = &obj->Index;
arrays[BRW_ATTRIB_EDGEFLAG] = &obj->EdgeFlag;
-}
-
-static void init_attrib_arrays( GLcontext *ctx,
- const struct gl_client_array *arrays[] )
-{
- struct gl_array_object *obj = ctx->Array.ArrayObj;
- GLuint i;
-
- for (i = 0; i < BRW_ATTRIB_FIRST_MATERIAL; i++)
- arrays[i] = &obj->VertexAttrib[i];
+ for (i = BRW_ATTRIB_GENERIC0; i <= BRW_ATTRIB_GENERIC15; i++)
+ arrays[i] = &obj->VertexAttrib[i - BRW_ATTRIB_GENERIC0];
}
@@ -313,8 +259,7 @@ void brw_exec_array_init( struct brw_exec_context *exec )
{
GLcontext *ctx = exec->ctx;
- init_legacy_arrays(ctx, exec->array.legacy_arrays);
- init_attrib_arrays(ctx, exec->array.attrib_arrays);
+ init_arrays(ctx, exec->array.inputs);
#if 1
exec->vtxfmt.DrawArrays = brw_exec_DrawArrays;
@@ -326,8 +271,6 @@ void brw_exec_array_init( struct brw_exec_context *exec )
exec->vtxfmt.DrawRangeElements = _mesa_noop_DrawRangeElements;
#endif
- exec->array.recalculate_inputs = 1;
-
exec->array.index_obj = ctx->Driver.NewBufferObject(ctx, 1, GL_ARRAY_BUFFER_ARB);
}
diff --git a/src/mesa/drivers/dri/i965/brw_exec_eval.c b/src/mesa/drivers/dri/i965/brw_exec_eval.c
index 5b6d154b70d..9dbeb1b58e4 100644
--- a/src/mesa/drivers/dri/i965/brw_exec_eval.c
+++ b/src/mesa/drivers/dri/i965/brw_exec_eval.c
@@ -87,44 +87,44 @@ void brw_exec_eval_update( struct brw_exec_context *exec )
}
if (ctx->Eval.Map1Color4)
- set_active_eval1( exec, VERT_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map1Color4 );
+ set_active_eval1( exec, BRW_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map1Color4 );
if (ctx->Eval.Map2Color4)
- set_active_eval2( exec, VERT_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map2Color4 );
+ set_active_eval2( exec, BRW_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map2Color4 );
if (ctx->Eval.Map1TextureCoord4)
- set_active_eval1( exec, VERT_ATTRIB_TEX0, 4, &ctx->EvalMap.Map1Texture4 );
+ set_active_eval1( exec, BRW_ATTRIB_TEX0, 4, &ctx->EvalMap.Map1Texture4 );
else if (ctx->Eval.Map1TextureCoord3)
- set_active_eval1( exec, VERT_ATTRIB_TEX0, 3, &ctx->EvalMap.Map1Texture3 );
+ set_active_eval1( exec, BRW_ATTRIB_TEX0, 3, &ctx->EvalMap.Map1Texture3 );
else if (ctx->Eval.Map1TextureCoord2)
- set_active_eval1( exec, VERT_ATTRIB_TEX0, 2, &ctx->EvalMap.Map1Texture2 );
+ set_active_eval1( exec, BRW_ATTRIB_TEX0, 2, &ctx->EvalMap.Map1Texture2 );
else if (ctx->Eval.Map1TextureCoord1)
- set_active_eval1( exec, VERT_ATTRIB_TEX0, 1, &ctx->EvalMap.Map1Texture1 );
+ set_active_eval1( exec, BRW_ATTRIB_TEX0, 1, &ctx->EvalMap.Map1Texture1 );
if (ctx->Eval.Map2TextureCoord4)
- set_active_eval2( exec, VERT_ATTRIB_TEX0, 4, &ctx->EvalMap.Map2Texture4 );
+ set_active_eval2( exec, BRW_ATTRIB_TEX0, 4, &ctx->EvalMap.Map2Texture4 );
else if (ctx->Eval.Map2TextureCoord3)
- set_active_eval2( exec, VERT_ATTRIB_TEX0, 3, &ctx->EvalMap.Map2Texture3 );
+ set_active_eval2( exec, BRW_ATTRIB_TEX0, 3, &ctx->EvalMap.Map2Texture3 );
else if (ctx->Eval.Map2TextureCoord2)
- set_active_eval2( exec, VERT_ATTRIB_TEX0, 2, &ctx->EvalMap.Map2Texture2 );
+ set_active_eval2( exec, BRW_ATTRIB_TEX0, 2, &ctx->EvalMap.Map2Texture2 );
else if (ctx->Eval.Map2TextureCoord1)
- set_active_eval2( exec, VERT_ATTRIB_TEX0, 1, &ctx->EvalMap.Map2Texture1 );
+ set_active_eval2( exec, BRW_ATTRIB_TEX0, 1, &ctx->EvalMap.Map2Texture1 );
if (ctx->Eval.Map1Normal)
- set_active_eval1( exec, VERT_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map1Normal );
+ set_active_eval1( exec, BRW_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map1Normal );
if (ctx->Eval.Map2Normal)
- set_active_eval2( exec, VERT_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map2Normal );
+ set_active_eval2( exec, BRW_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map2Normal );
if (ctx->Eval.Map1Vertex4)
- set_active_eval1( exec, VERT_ATTRIB_POS, 4, &ctx->EvalMap.Map1Vertex4 );
+ set_active_eval1( exec, BRW_ATTRIB_POS, 4, &ctx->EvalMap.Map1Vertex4 );
else if (ctx->Eval.Map1Vertex3)
- set_active_eval1( exec, VERT_ATTRIB_POS, 3, &ctx->EvalMap.Map1Vertex3 );
+ set_active_eval1( exec, BRW_ATTRIB_POS, 3, &ctx->EvalMap.Map1Vertex3 );
if (ctx->Eval.Map2Vertex4)
- set_active_eval2( exec, VERT_ATTRIB_POS, 4, &ctx->EvalMap.Map2Vertex4 );
+ set_active_eval2( exec, BRW_ATTRIB_POS, 4, &ctx->EvalMap.Map2Vertex4 );
else if (ctx->Eval.Map2Vertex3)
- set_active_eval2( exec, VERT_ATTRIB_POS, 3, &ctx->EvalMap.Map2Vertex3 );
+ set_active_eval2( exec, BRW_ATTRIB_POS, 3, &ctx->EvalMap.Map2Vertex3 );
exec->eval.recalculate_maps = 0;
}
diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c
index 6bb3dd2217d..4d84ba88137 100644
--- a/src/mesa/drivers/dri/i965/brw_fallback.c
+++ b/src/mesa/drivers/dri/i965/brw_fallback.c
@@ -237,7 +237,7 @@ static void loopback_prim( GLcontext *ctx,
/* Fire the vertex
*/
- la[0].func( ctx, VERT_ATTRIB_POS, data );
+ la[0].func( ctx, BRW_ATTRIB_POS, data );
data = tmp;
}
diff --git a/src/mesa/drivers/dri/i965/brw_save.h b/src/mesa/drivers/dri/i965/brw_save.h
index 9b219393d57..41cabe65084 100644
--- a/src/mesa/drivers/dri/i965/brw_save.h
+++ b/src/mesa/drivers/dri/i965/brw_save.h
@@ -116,6 +116,7 @@ struct brw_save_context {
const struct gl_client_array *inputs[BRW_ATTRIB_MAX];
GLubyte attrsz[BRW_ATTRIB_MAX];
+ GLubyte active_sz[BRW_ATTRIB_MAX];
GLuint vertex_size;
GLfloat *buffer;
@@ -145,8 +146,6 @@ struct brw_save_context {
GLfloat *current[BRW_ATTRIB_MAX]; /* points into ctx->ListState */
GLubyte *currentsz[BRW_ATTRIB_MAX];
-
- void (*tabfv[BRW_ATTRIB_MAX][4])( const GLfloat * );
};
diff --git a/src/mesa/drivers/dri/i965/brw_save_api.c b/src/mesa/drivers/dri/i965/brw_save_api.c
index 90ccd0a2262..9c0e4af48a5 100644
--- a/src/mesa/drivers/dri/i965/brw_save_api.c
+++ b/src/mesa/drivers/dri/i965/brw_save_api.c
@@ -563,32 +563,20 @@ static void _save_upgrade_vertex( GLcontext *ctx,
}
}
-
-
-
-/* Helper function for 'CHOOSE' macro. Do what's necessary when an
- * entrypoint is called for the first time.
- */
-static void do_choose( GLuint attr, GLuint sz,
- void (*attr_func)( const GLfloat *),
- void (*choose1)( const GLfloat *),
- void (*choose2)( const GLfloat *),
- void (*choose3)( const GLfloat *),
- void (*choose4)( const GLfloat *),
- const GLfloat *v )
-{
- GET_CURRENT_CONTEXT( ctx );
+static void save_fixup_vertex( GLcontext *ctx, GLuint attr, GLuint sz )
+{
struct brw_save_context *save = IMM_CONTEXT(ctx)->save;
- static GLfloat id[4] = { 0, 0, 0, 1 };
- int i;
- if (save->attrsz[attr] < sz) {
+ if (sz > save->attrsz[attr]) {
/* New size is larger. Need to flush existing vertices and get
* an enlarged vertex format.
*/
_save_upgrade_vertex( ctx, attr, sz );
}
- else {
+ else if (sz < save->active_sz[attr]) {
+ static GLfloat id[4] = { 0, 0, 0, 1 };
+ GLuint i;
+
/* New size is equal or smaller - just need to fill in some
* zeros.
*/
@@ -596,624 +584,64 @@ static void do_choose( GLuint attr, GLuint sz,
save->attrptr[attr][i-1] = id[i-1];
}
- /* Reset any active pointers for this attribute
- */
- save->tabfv[attr][0] = choose1;
- save->tabfv[attr][1] = choose2;
- save->tabfv[attr][2] = choose3;
- save->tabfv[attr][3] = choose4;
+ save->active_sz[attr] = sz;
+}
- /* Update the secondary dispatch table with the new function
- */
- save->tabfv[attr][sz-1] = attr_func;
+static void _save_reset_vertex( GLcontext *ctx )
+{
+ struct brw_save_context *save = IMM_CONTEXT(ctx)->save;
+ GLuint i;
- (*attr_func)(v);
+ for (i = 0 ; i < BRW_ATTRIB_MAX ; i++) {
+ save->attrsz[i] = 0;
+ save->active_sz[i] = 0;
+ }
+
+ save->vertex_size = 0;
}
+#define ERROR() _mesa_compile_error( ctx, GL_INVALID_ENUM, __FUNCTION__ );
+
+
/* Only one size for each attribute may be active at once. Eg. if
* Color3f is installed/active, then Color4f may not be, even if the
* vertex actually contains 4 color coordinates. This is because the
* 3f version won't otherwise set color[3] to 1.0 -- this is the job
* of the chooser function when switching between Color4f and Color3f.
*/
-#define ATTRFV( ATTR, N ) \
-static void save_choose_##ATTR##_##N( const GLfloat *v ); \
+#define ATTR( A, N, V0, V1, V2, V3 ) \
+do { \
+ struct brw_save_context *save = IMM_CONTEXT(ctx)->save; \
\
-static void save_attrib_##ATTR##_##N( const GLfloat *v ) \
-{ \
- GET_CURRENT_CONTEXT( ctx ); \
- struct brw_save_context *save = IMM_CONTEXT(ctx)->save; \
+ if (save->active_sz[A] != N) \
+ save_fixup_vertex(ctx, A, N); \
\
- if ((ATTR) == 0) { \
- GLuint i; \
+ { \
+ GLfloat *dest = save->attrptr[A]; \
+ if (N>0) dest[0] = V0; \
+ if (N>1) dest[1] = V1; \
+ if (N>2) dest[2] = V2; \
+ if (N>3) dest[3] = V3; \
+ } \
\
- if (N>0) save->vbptr[0] = v[0]; \
- if (N>1) save->vbptr[1] = v[1]; \
- if (N>2) save->vbptr[2] = v[2]; \
- if (N>3) save->vbptr[3] = v[3]; \
+ if ((A) == 0) { \
+ GLuint i; \
\
- for (i = N; i < save->vertex_size; i++) \
- save->vbptr[i] = save->vertex[i]; \
+ for (i = 0; i < save->vertex_size; i++) \
+ save->vbptr[i] = save->vertex[i]; \
\
- save->vbptr += save->vertex_size; \
+ save->vbptr += save->vertex_size; \
\
- if (++save->vert_count >= save->max_vert) \
+ if (++save->vert_count >= save->max_vert) \
_save_wrap_filled_vertex( ctx ); \
} \
- else { \
- GLfloat *dest = save->attrptr[ATTR]; \
- if (N>0) dest[0] = v[0]; \
- if (N>1) dest[1] = v[1]; \
- if (N>2) dest[2] = v[2]; \
- if (N>3) dest[3] = v[3]; \
- } \
-}
-
-#define CHOOSE( ATTR, N ) \
-static void save_choose_##ATTR##_##N( const GLfloat *v ) \
-{ \
- do_choose(ATTR, N, \
- save_attrib_##ATTR##_##N, \
- save_choose_##ATTR##_1, \
- save_choose_##ATTR##_2, \
- save_choose_##ATTR##_3, \
- save_choose_##ATTR##_4, \
- v ); \
-}
-
-#define INIT(ATTR) \
-static void save_init_##ATTR( struct brw_save_context *save ) \
-{ \
- save->tabfv[ATTR][0] = save_choose_##ATTR##_1; \
- save->tabfv[ATTR][1] = save_choose_##ATTR##_2; \
- save->tabfv[ATTR][2] = save_choose_##ATTR##_3; \
- save->tabfv[ATTR][3] = save_choose_##ATTR##_4; \
-}
-
-#define ATTRS( ATTRIB ) \
- ATTRFV( ATTRIB, 1 ) \
- ATTRFV( ATTRIB, 2 ) \
- ATTRFV( ATTRIB, 3 ) \
- ATTRFV( ATTRIB, 4 ) \
- CHOOSE( ATTRIB, 1 ) \
- CHOOSE( ATTRIB, 2 ) \
- CHOOSE( ATTRIB, 3 ) \
- CHOOSE( ATTRIB, 4 ) \
- INIT( ATTRIB ) \
-
-
-/* Generate a lot of functions. These are the actual worker
- * functions, which are equivalent to those generated via codegen
- * elsewhere.
- */
-ATTRS( 0 )
-ATTRS( 1 )
-ATTRS( 2 )
-ATTRS( 3 )
-ATTRS( 4 )
-ATTRS( 5 )
-ATTRS( 6 )
-ATTRS( 7 )
-ATTRS( 8 )
-ATTRS( 9 )
-ATTRS( 10 )
-ATTRS( 11 )
-ATTRS( 12 )
-ATTRS( 13 )
-ATTRS( 14 )
-ATTRS( 15 )
-
-
-static void _save_reset_vertex( GLcontext *ctx )
-{
- struct brw_save_context *save = IMM_CONTEXT(ctx)->save;
- GLuint i;
-
- save_init_0( save );
- save_init_1( save );
- save_init_2( save );
- save_init_3( save );
- save_init_4( save );
- save_init_5( save );
- save_init_6( save );
- save_init_7( save );
- save_init_8( save );
- save_init_9( save );
- save_init_10( save );
- save_init_11( save );
- save_init_12( save );
- save_init_13( save );
- save_init_14( save );
- save_init_15( save );
-
- for (i = 0 ; i < BRW_ATTRIB_MAX ; i++)
- save->attrsz[i] = 0;
-
- save->vertex_size = 0;
-}
-
-
-
-/* Cope with aliasing of classic Vertex, Normal, etc. and the fan-out
- * of glMultTexCoord and glProgramParamterNV by routing all these
- * through a second level dispatch table.
- */
-#define DISPATCH_ATTRFV( ATTR, COUNT, P ) \
-do { \
- GET_CURRENT_CONTEXT( ctx ); \
- struct brw_save_context *save = IMM_CONTEXT(ctx)->save; \
- save->tabfv[ATTR][COUNT-1]( P ); \
-} while (0)
-
-#define DISPATCH_ATTR1FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 1, V )
-#define DISPATCH_ATTR2FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 2, V )
-#define DISPATCH_ATTR3FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 3, V )
-#define DISPATCH_ATTR4FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 4, V )
-
-#define DISPATCH_ATTR1F( ATTR, S ) DISPATCH_ATTRFV( ATTR, 1, &(S) )
-
-#if defined(USE_X86_ASM) && 0 /* will break register calling convention */
-/* Naughty cheat:
- */
-#define DISPATCH_ATTR2F( ATTR, S,T ) DISPATCH_ATTRFV( ATTR, 2, &(S) )
-#define DISPATCH_ATTR3F( ATTR, S,T,R ) DISPATCH_ATTRFV( ATTR, 3, &(S) )
-#define DISPATCH_ATTR4F( ATTR, S,T,R,Q ) DISPATCH_ATTRFV( ATTR, 4, &(S) )
-#else
-/* Safe:
- */
-#define DISPATCH_ATTR2F( ATTR, S,T ) \
-do { \
- GLfloat v[2]; \
- v[0] = S; v[1] = T; \
- DISPATCH_ATTR2FV( ATTR, v ); \
} while (0)
-#define DISPATCH_ATTR3F( ATTR, S,T,R ) \
-do { \
- GLfloat v[3]; \
- v[0] = S; v[1] = T; v[2] = R; \
- DISPATCH_ATTR3FV( ATTR, v ); \
-} while (0)
-#define DISPATCH_ATTR4F( ATTR, S,T,R,Q ) \
-do { \
- GLfloat v[4]; \
- v[0] = S; v[1] = T; v[2] = R; v[3] = Q; \
- DISPATCH_ATTR4FV( ATTR, v ); \
-} while (0)
-#endif
-
-
-static void enum_error( void )
-{
- GET_CURRENT_CONTEXT( ctx );
- _mesa_compile_error( ctx, GL_INVALID_ENUM, "glVertexAttrib" );
-}
-
-static void GLAPIENTRY _save_Vertex2f( GLfloat x, GLfloat y )
-{
- DISPATCH_ATTR2F( BRW_ATTRIB_POS, x, y );
-}
-
-static void GLAPIENTRY _save_Vertex2fv( const GLfloat *v )
-{
- DISPATCH_ATTR2FV( BRW_ATTRIB_POS, v );
-}
-
-static void GLAPIENTRY _save_Vertex3f( GLfloat x, GLfloat y, GLfloat z )
-{
- DISPATCH_ATTR3F( BRW_ATTRIB_POS, x, y, z );
-}
-
-static void GLAPIENTRY _save_Vertex3fv( const GLfloat *v )
-{
- DISPATCH_ATTR3FV( BRW_ATTRIB_POS, v );
-}
-
-static void GLAPIENTRY _save_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
-{
- DISPATCH_ATTR4F( BRW_ATTRIB_POS, x, y, z, w );
-}
-
-static void GLAPIENTRY _save_Vertex4fv( const GLfloat *v )
-{
- DISPATCH_ATTR4FV( BRW_ATTRIB_POS, v );
-}
-
-static void GLAPIENTRY _save_TexCoord1f( GLfloat x )
-{
- DISPATCH_ATTR1F( BRW_ATTRIB_TEX0, x );
-}
-
-static void GLAPIENTRY _save_TexCoord1fv( const GLfloat *v )
-{
- DISPATCH_ATTR1FV( BRW_ATTRIB_TEX0, v );
-}
-
-static void GLAPIENTRY _save_TexCoord2f( GLfloat x, GLfloat y )
-{
- DISPATCH_ATTR2F( BRW_ATTRIB_TEX0, x, y );
-}
-
-static void GLAPIENTRY _save_TexCoord2fv( const GLfloat *v )
-{
- DISPATCH_ATTR2FV( BRW_ATTRIB_TEX0, v );
-}
-
-static void GLAPIENTRY _save_TexCoord3f( GLfloat x, GLfloat y, GLfloat z )
-{
- DISPATCH_ATTR3F( BRW_ATTRIB_TEX0, x, y, z );
-}
-
-static void GLAPIENTRY _save_TexCoord3fv( const GLfloat *v )
-{
- DISPATCH_ATTR3FV( BRW_ATTRIB_TEX0, v );
-}
-
-static void GLAPIENTRY _save_TexCoord4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
-{
- DISPATCH_ATTR4F( BRW_ATTRIB_TEX0, x, y, z, w );
-}
-
-static void GLAPIENTRY _save_TexCoord4fv( const GLfloat *v )
-{
- DISPATCH_ATTR4FV( BRW_ATTRIB_TEX0, v );
-}
-
-static void GLAPIENTRY _save_Normal3f( GLfloat x, GLfloat y, GLfloat z )
-{
- DISPATCH_ATTR3F( BRW_ATTRIB_NORMAL, x, y, z );
-}
-static void GLAPIENTRY _save_Normal3fv( const GLfloat *v )
-{
- DISPATCH_ATTR3FV( BRW_ATTRIB_NORMAL, v );
-}
-
-static void GLAPIENTRY _save_FogCoordfEXT( GLfloat x )
-{
- DISPATCH_ATTR1F( BRW_ATTRIB_FOG, x );
-}
+#define TAG(x) _save_##x
-static void GLAPIENTRY _save_FogCoordfvEXT( const GLfloat *v )
-{
- DISPATCH_ATTR1FV( BRW_ATTRIB_FOG, v );
-}
-
-static void GLAPIENTRY _save_Color3f( GLfloat x, GLfloat y, GLfloat z )
-{
- DISPATCH_ATTR3F( BRW_ATTRIB_COLOR0, x, y, z );
-}
-
-static void GLAPIENTRY _save_Color3fv( const GLfloat *v )
-{
- DISPATCH_ATTR3FV( BRW_ATTRIB_COLOR0, v );
-}
-
-static void GLAPIENTRY _save_Color4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
-{
- DISPATCH_ATTR4F( BRW_ATTRIB_COLOR0, x, y, z, w );
-}
-
-static void GLAPIENTRY _save_Color4fv( const GLfloat *v )
-{
- DISPATCH_ATTR4FV( BRW_ATTRIB_COLOR0, v );
-}
-
-static void GLAPIENTRY _save_SecondaryColor3fEXT( GLfloat x, GLfloat y, GLfloat z )
-{
- DISPATCH_ATTR3F( BRW_ATTRIB_COLOR1, x, y, z );
-}
-
-static void GLAPIENTRY _save_SecondaryColor3fvEXT( const GLfloat *v )
-{
- DISPATCH_ATTR3FV( BRW_ATTRIB_COLOR1, v );
-}
-
-static void GLAPIENTRY _save_MultiTexCoord1f( GLenum target, GLfloat x )
-{
- GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
- DISPATCH_ATTR1F( attr, x );
-}
-
-static void GLAPIENTRY _save_MultiTexCoord1fv( GLenum target, const GLfloat *v )
-{
- GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
- DISPATCH_ATTR1FV( attr, v );
-}
-
-static void GLAPIENTRY _save_MultiTexCoord2f( GLenum target, GLfloat x, GLfloat y )
-{
- GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
- DISPATCH_ATTR2F( attr, x, y );
-}
-
-static void GLAPIENTRY _save_MultiTexCoord2fv( GLenum target, const GLfloat *v )
-{
- GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
- DISPATCH_ATTR2FV( attr, v );
-}
-
-static void GLAPIENTRY _save_MultiTexCoord3f( GLenum target, GLfloat x, GLfloat y,
- GLfloat z)
-{
- GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
- DISPATCH_ATTR3F( attr, x, y, z );
-}
-
-static void GLAPIENTRY _save_MultiTexCoord3fv( GLenum target, const GLfloat *v )
-{
- GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
- DISPATCH_ATTR3FV( attr, v );
-}
-
-static void GLAPIENTRY _save_MultiTexCoord4f( GLenum target, GLfloat x, GLfloat y,
- GLfloat z, GLfloat w )
-{
- GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
- DISPATCH_ATTR4F( attr, x, y, z, w );
-}
-
-static void GLAPIENTRY _save_MultiTexCoord4fv( GLenum target, const GLfloat *v )
-{
- GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0;
- DISPATCH_ATTR4FV( attr, v );
-}
-
-static void GLAPIENTRY _save_VertexAttrib1fNV( GLuint index, GLfloat x )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR1F( index, x );
- else
- enum_error();
-}
-
-static void GLAPIENTRY _save_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR1FV( index, v );
- else
- enum_error();
-}
-
-static void GLAPIENTRY _save_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR2F( index, x, y );
- else
- enum_error();
-}
-
-static void GLAPIENTRY _save_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR2FV( index, v );
- else
- enum_error();
-}
-
-static void GLAPIENTRY _save_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y,
- GLfloat z )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR3F( index, x, y, z );
- else
- enum_error();
-}
-
-static void GLAPIENTRY _save_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR3FV( index, v );
- else
- enum_error();
-}
-
-static void GLAPIENTRY _save_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y,
- GLfloat z, GLfloat w )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR4F( index, x, y, z, w );
- else
- enum_error();
-}
-
-static void GLAPIENTRY _save_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR4FV( index, v );
- else
- enum_error();
-}
-
-
-static void GLAPIENTRY
-_save_VertexAttrib1fARB( GLuint index, GLfloat x )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR1F( index, x );
- else
- enum_error();
-}
-
-static void GLAPIENTRY
-_save_VertexAttrib1fvARB( GLuint index, const GLfloat *v )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR1FV( index, v );
- else
- enum_error();
-}
-
-static void GLAPIENTRY
-_save_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR2F( index, x, y );
- else
- enum_error();
-}
-
-static void GLAPIENTRY
-_save_VertexAttrib2fvARB( GLuint index, const GLfloat *v )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR2FV( index, v );
- else
- enum_error();
-}
-
-static void GLAPIENTRY
-_save_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR3F( index, x, y, z );
- else
- enum_error();
-}
-
-static void GLAPIENTRY
-_save_VertexAttrib3fvARB( GLuint index, const GLfloat *v )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR3FV( index, v );
- else
- enum_error();
-}
-
-static void GLAPIENTRY
-_save_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR4F( index, x, y, z, w );
- else
- enum_error();
-}
-
-static void GLAPIENTRY
-_save_VertexAttrib4fvARB( GLuint index, const GLfloat *v )
-{
- if (index < BRW_ATTRIB_FIRST_MATERIAL)
- DISPATCH_ATTR4FV( index, v );
- else
- enum_error();
-}
-
-
-/* Materials:
- *
- * These are treated as per-vertex attributes, at indices above where
- * the NV_vertex_program leaves off. There are a lot of good things
- * about treating materials this way.
- *
- * However: I don't want to double the number of generated functions
- * just to cope with this, so I unroll the 'C' varients of CHOOSE and
- * ATTRF into this function, and dispense with codegen and
- * second-level dispatch.
- *
- * There is no aliasing of material attributes with other entrypoints.
- */
-#define MAT_ATTR( A, N, params ) \
-do { \
- if (save->attrsz[A] < N) { \
- _save_upgrade_vertex( ctx, A, N ); \
- } \
- \
- { \
- GLfloat *dest = save->attrptr[A]; \
- if (N>0) dest[0] = params[0]; \
- if (N>1) dest[1] = params[1]; \
- if (N>2) dest[2] = params[2]; \
- if (N>3) dest[3] = params[3]; \
- } \
-} while (0)
-
-
-#define MAT( ATTR, N, face, params ) \
-do { \
- if (face != GL_BACK) \
- MAT_ATTR( ATTR, N, params ); /* front */ \
- if (face != GL_FRONT) \
- MAT_ATTR( ATTR + 1, N, params ); /* back */ \
-} while (0)
-
-
-/* NOTE: Have to remove/deal-with colormaterial crossovers, probably
- * later on - in the meantime just store everything.
- */
-static void GLAPIENTRY _save_Materialfv( GLenum face, GLenum pname,
- const GLfloat *params )
-{
- GET_CURRENT_CONTEXT( ctx );
- struct brw_save_context *save = IMM_CONTEXT(ctx)->save;
-
- switch (pname) {
- case GL_EMISSION:
- MAT( BRW_ATTRIB_MAT_FRONT_EMISSION, 4, face, params );
- break;
- case GL_AMBIENT:
- MAT( BRW_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params );
- break;
- case GL_DIFFUSE:
- MAT( BRW_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params );
- break;
- case GL_SPECULAR:
- MAT( BRW_ATTRIB_MAT_FRONT_SPECULAR, 4, face, params );
- break;
- case GL_SHININESS:
- MAT( BRW_ATTRIB_MAT_FRONT_SHININESS, 1, face, params );
- break;
- case GL_COLOR_INDEXES:
- MAT( BRW_ATTRIB_MAT_FRONT_INDEXES, 3, face, params );
- break;
- case GL_AMBIENT_AND_DIFFUSE:
- MAT( BRW_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params );
- MAT( BRW_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params );
- break;
- default:
- _mesa_compile_error( ctx, GL_INVALID_ENUM, "glMaterialfv" );
- return;
- }
-}
-
-
-#define IDX_ATTR( A, IDX ) \
-do { \
- GET_CURRENT_CONTEXT( ctx ); \
- struct brw_save_context *save = IMM_CONTEXT(ctx)->save; \
- \
- if (save->attrsz[A] < 1) { \
- _save_upgrade_vertex( ctx, A, 1 ); \
- } \
- \
- { \
- GLfloat *dest = save->attrptr[A]; \
- dest[0] = IDX; \
- } \
-} while (0)
-
-
-static void GLAPIENTRY _save_EdgeFlag( GLboolean b )
-{
- IDX_ATTR( BRW_ATTRIB_EDGEFLAG, (GLfloat)b );
-}
-
-#if 0
-static void GLAPIENTRY _save_EdgeFlagv( const GLboolean *v )
-{
- IDX_ATTR( BRW_ATTRIB_EDGEFLAG, (GLfloat)(v[0]) );
-}
-#endif
-
-static void GLAPIENTRY _save_Indexf( GLfloat f )
-{
- IDX_ATTR( BRW_ATTRIB_INDEX, f );
-}
-
-static void GLAPIENTRY _save_Indexfv( const GLfloat *f )
-{
- IDX_ATTR( BRW_ATTRIB_INDEX, f[0] );
-}
+#include "brw_attrib_tmp.h"
@@ -1496,7 +924,6 @@ static void _save_vtxfmt_init( GLcontext *ctx )
vfmt->Color4f = _save_Color4f;
vfmt->Color4fv = _save_Color4fv;
vfmt->EdgeFlag = _save_EdgeFlag;
-/* vfmt->EdgeFlagv = _save_EdgeFlagv; */
vfmt->End = _save_End;
vfmt->FogCoordfEXT = _save_FogCoordfEXT;
vfmt->FogCoordfvEXT = _save_FogCoordfvEXT;
@@ -1529,14 +956,6 @@ static void _save_vtxfmt_init( GLcontext *ctx )
vfmt->Vertex3fv = _save_Vertex3fv;
vfmt->Vertex4f = _save_Vertex4f;
vfmt->Vertex4fv = _save_Vertex4fv;
- vfmt->VertexAttrib1fNV = _save_VertexAttrib1fNV;
- vfmt->VertexAttrib1fvNV = _save_VertexAttrib1fvNV;
- vfmt->VertexAttrib2fNV = _save_VertexAttrib2fNV;
- vfmt->VertexAttrib2fvNV = _save_VertexAttrib2fvNV;
- vfmt->VertexAttrib3fNV = _save_VertexAttrib3fNV;
- vfmt->VertexAttrib3fvNV = _save_VertexAttrib3fvNV;
- vfmt->VertexAttrib4fNV = _save_VertexAttrib4fNV;
- vfmt->VertexAttrib4fvNV = _save_VertexAttrib4fvNV;
vfmt->VertexAttrib1fARB = _save_VertexAttrib1fARB;
vfmt->VertexAttrib1fvARB = _save_VertexAttrib1fvARB;
vfmt->VertexAttrib2fARB = _save_VertexAttrib2fARB;
@@ -1545,6 +964,15 @@ static void _save_vtxfmt_init( GLcontext *ctx )
vfmt->VertexAttrib3fvARB = _save_VertexAttrib3fvARB;
vfmt->VertexAttrib4fARB = _save_VertexAttrib4fARB;
vfmt->VertexAttrib4fvARB = _save_VertexAttrib4fvARB;
+
+ vfmt->VertexAttrib1fNV = _save_VertexAttrib1fNV;
+ vfmt->VertexAttrib1fvNV = _save_VertexAttrib1fvNV;
+ vfmt->VertexAttrib2fNV = _save_VertexAttrib2fNV;
+ vfmt->VertexAttrib2fvNV = _save_VertexAttrib2fvNV;
+ vfmt->VertexAttrib3fNV = _save_VertexAttrib3fNV;
+ vfmt->VertexAttrib3fvNV = _save_VertexAttrib3fvNV;
+ vfmt->VertexAttrib4fNV = _save_VertexAttrib4fNV;
+ vfmt->VertexAttrib4fvNV = _save_VertexAttrib4fvNV;
/* This will all require us to fallback to saving the list as opcodes:
*/
diff --git a/src/mesa/drivers/dri/i965/brw_save_draw.c b/src/mesa/drivers/dri/i965/brw_save_draw.c
index 244c2feb1e0..84f74d3f6cf 100644
--- a/src/mesa/drivers/dri/i965/brw_save_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_save_draw.c
@@ -76,7 +76,7 @@ static void _playback_copy_to_current( GLcontext *ctx,
/* Colormaterial -- this kindof sucks.
*/
if (ctx->Light.ColorMaterialEnabled) {
- _mesa_update_color_material(ctx, ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
+ _mesa_update_color_material(ctx, ctx->Current.Attrib[BRW_ATTRIB_COLOR0]);
}
#endif
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index 96b58cb0d9f..2a94ac64965 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -54,7 +54,8 @@ static void do_vs_prog( struct brw_context *brw,
c.vp = vp;
c.prog_data.outputs_written = vp->program.Base.OutputsWritten;
- c.prog_data.inputs_read = vp->program.Base.InputsRead;
+ c.prog_data.inputs_read = brw_translate_inputs(brw->intel.ctx.VertexProgram._Enabled,
+ vp->program.Base.InputsRead);
if (c.key.copy_edgeflag) {
c.prog_data.outputs_written |= 1<<VERT_RESULT_EDGE;
diff --git a/src/mesa/drivers/dri/i965/brw_vs_constval.c b/src/mesa/drivers/dri/i965/brw_vs_constval.c
index 9407f9a1a80..502d8283970 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_constval.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_constval.c
@@ -176,6 +176,8 @@ static void calc_wm_input_sizes( struct brw_context *brw )
struct tracker t;
GLuint insn;
GLuint i;
+ GLuint64EXT inputs = brw_translate_inputs(brw->intel.ctx.VertexProgram._Enabled,
+ vp->program.Base.InputsRead);
memset(&t, 0, sizeof(t));
@@ -184,7 +186,7 @@ static void calc_wm_input_sizes( struct brw_context *brw )
t.twoside = 1;
for (i = 0; i < BRW_ATTRIB_MAX; i++)
- if (vp->program.Base.InputsRead & (1<<i))
+ if (inputs & (1<<i))
set_active_component(&t, PROGRAM_INPUT, i,
szflag[get_input_size(brw, i)]);
diff --git a/src/mesa/drivers/dri/i965/brw_vs_tnl.c b/src/mesa/drivers/dri/i965/brw_vs_tnl.c
index cf3b904793d..107473eda52 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_tnl.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_tnl.c
@@ -147,7 +147,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
/* BRW_NEW_INPUT_VARYING */
for (i = BRW_ATTRIB_MAT_FRONT_AMBIENT ; i < BRW_ATTRIB_INDEX ; i++)
- if (brw->vb.info.varying[0] & (1<<i))
+ if (brw->vb.info.varying & (1<<i))
key->light_material_mask |= 1<<(i-BRW_ATTRIB_MAT_FRONT_AMBIENT);
for (i = 0; i < MAX_LIGHTS; i++) {
@@ -374,6 +374,14 @@ static void release_temps( struct tnl_program *p )
static struct ureg register_input( struct tnl_program *p, GLuint input )
{
+ /* Cram the material flags into the generic range. We'll translate
+ * them back later.
+ */
+ if (input >= BRW_ATTRIB_MAT_FRONT_AMBIENT)
+ input -= BRW_ATTRIB_MAT_FRONT_AMBIENT;
+
+ assert(input < 32);
+
p->program->Base.InputsRead |= (1<<input);
return make_ureg(PROGRAM_INPUT, input);
}
@@ -637,7 +645,7 @@ static void emit_passthrough( struct tnl_program *p,
static struct ureg get_eye_position( struct tnl_program *p )
{
if (is_undef(p->eye_position)) {
- struct ureg pos = register_input( p, VERT_ATTRIB_POS );
+ struct ureg pos = register_input( p, BRW_ATTRIB_POS );
struct ureg modelview[4];
p->eye_position = reserve_temp(p);
@@ -667,7 +675,7 @@ static struct ureg get_eye_z( struct tnl_program *p )
return swizzle1(p->eye_position, Z);
}
else if (!is_undef(p->eye_z)) {
- struct ureg pos = register_input( p, VERT_ATTRIB_POS );
+ struct ureg pos = register_input( p, BRW_ATTRIB_POS );
struct ureg modelview2;
p->eye_z = reserve_temp(p);
@@ -700,7 +708,7 @@ static struct ureg get_eye_position_normalized( struct tnl_program *p )
static struct ureg get_eye_normal( struct tnl_program *p )
{
if (is_undef(p->eye_normal)) {
- struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL );
+ struct ureg normal = register_input(p, BRW_ATTRIB_NORMAL );
struct ureg mvinv[3];
register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 2,
@@ -733,7 +741,7 @@ static struct ureg get_eye_normal( struct tnl_program *p )
static void build_hpos( struct tnl_program *p )
{
- struct ureg pos = register_input( p, VERT_ATTRIB_POS );
+ struct ureg pos = register_input( p, BRW_ATTRIB_POS );
struct ureg hpos = register_output( p, VERT_RESULT_HPOS );
struct ureg mvp[4];
@@ -777,7 +785,7 @@ static struct ureg get_material( struct tnl_program *p, GLuint side,
GLuint attrib = material_attrib(side, property);
if (p->color_materials & (1<<attrib))
- return register_input(p, VERT_ATTRIB_COLOR0);
+ return register_input(p, BRW_ATTRIB_COLOR0);
else if (p->materials & (1<<attrib))
return register_input( p, attrib + BRW_ATTRIB_MAT_FRONT_AMBIENT );
else
@@ -1147,7 +1155,7 @@ static void build_fog( struct tnl_program *p )
input = swizzle1(get_eye_position(p), Z);
}
else {
- input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X);
+ input = swizzle1(register_input(p, BRW_ATTRIB_FOG), X);
}
if (p->state->fog_option &&
@@ -1289,7 +1297,7 @@ static void build_texture_transform( struct tnl_program *p )
for (j = 0; j < 4; j++) {
switch (modes[j]) {
case TXG_OBJ_LINEAR: {
- struct ureg obj = register_input(p, VERT_ATTRIB_POS);
+ struct ureg obj = register_input(p, BRW_ATTRIB_POS);
struct ureg plane =
register_param3(p, STATE_TEXGEN, i,
STATE_TEXGEN_OBJECT_S + j);
@@ -1338,7 +1346,7 @@ static void build_texture_transform( struct tnl_program *p )
}
if (copy_mask) {
- struct ureg in = register_input(p, VERT_ATTRIB_TEX0+i);
+ struct ureg in = register_input(p, BRW_ATTRIB_TEX0+i);
emit_op1(p, OPCODE_MOV, out_texgen, copy_mask, in );
}
}
@@ -1347,7 +1355,7 @@ static void build_texture_transform( struct tnl_program *p )
struct ureg texmat[4];
struct ureg in = (!is_undef(out_texgen) ?
out_texgen :
- register_input(p, VERT_ATTRIB_TEX0+i));
+ register_input(p, BRW_ATTRIB_TEX0+i));
if (PREFER_DP4) {
register_matrix_param6( p, STATE_MATRIX, STATE_TEXTURE, i,
0, 3, STATE_MATRIX, texmat );
@@ -1363,7 +1371,7 @@ static void build_texture_transform( struct tnl_program *p )
release_temps(p);
}
else {
- emit_passthrough(p, VERT_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i);
+ emit_passthrough(p, BRW_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i);
}
}
}
@@ -1415,10 +1423,10 @@ static void build_tnl_program( struct tnl_program *p )
build_lighting(p);
else {
if (p->state->fragprog_inputs_read & FRAG_BIT_COL0)
- emit_passthrough(p, VERT_ATTRIB_COLOR0, VERT_RESULT_COL0);
+ emit_passthrough(p, BRW_ATTRIB_COLOR0, VERT_RESULT_COL0);
if (p->state->fragprog_inputs_read & FRAG_BIT_COL1)
- emit_passthrough(p, VERT_ATTRIB_COLOR1, VERT_RESULT_COL1);
+ emit_passthrough(p, BRW_ATTRIB_COLOR1, VERT_RESULT_COL1);
}
}
diff --git a/src/mesa/drivers/dri/i965/intel_context.h b/src/mesa/drivers/dri/i965/intel_context.h
index 83db8192bc4..8fa9619a522 100644
--- a/src/mesa/drivers/dri/i965/intel_context.h
+++ b/src/mesa/drivers/dri/i965/intel_context.h
@@ -192,16 +192,6 @@ struct intel_context
GLuint ClearColor;
GLuint ClearDepth;
- /* Offsets of fields within the current vertex:
- */
- GLuint coloroffset;
- GLuint specoffset;
- GLuint wpos_offset;
- GLuint wpos_size;
-
- struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
- GLuint vertex_attr_count;
-
GLfloat depth_scale;
GLfloat polygon_offset_scale; /* dependent on depth_scale, bpp */
GLuint depth_clear_mask;