summaryrefslogtreecommitdiff
path: root/src/mesa/tnl_dd/t_dd_tritmp.h
diff options
context:
space:
mode:
authorMichal Krol <michal@vmware.com>2010-03-10 15:49:30 +0100
committerMichal Krol <michal@vmware.com>2010-03-10 15:49:30 +0100
commit3ce4375912c8ea488460e593e07c5bb15b92dca9 (patch)
tree1011fa439bd829fd46a44fd99478135848800e73 /src/mesa/tnl_dd/t_dd_tritmp.h
parentf59f28093ea827bd234d8e1a36bdd56a9fce5f09 (diff)
parent9b348d0ed125a22be3f318ac60cef6f201edfdab (diff)
Merge branch 'master' into gallium-sampler-view
Conflicts: src/gallium/auxiliary/Makefile src/gallium/auxiliary/SConscript src/gallium/auxiliary/tgsi/tgsi_exec.c src/gallium/auxiliary/util/u_blitter.c src/gallium/drivers/i915/i915_context.h src/gallium/drivers/i965/brw_context.h src/gallium/drivers/llvmpipe/lp_context.h src/gallium/drivers/nv50/nv50_context.h src/gallium/drivers/nv50/nv50_state_validate.c src/gallium/drivers/nv50/nv50_tex.c src/gallium/drivers/r300/r300_blit.c src/gallium/drivers/r300/r300_context.h src/gallium/drivers/r300/r300_emit.c src/gallium/drivers/r300/r300_state.c src/gallium/drivers/softpipe/sp_context.h src/gallium/drivers/svga/svga_context.h src/gallium/drivers/svga/svga_pipe_sampler.c
Diffstat (limited to 'src/mesa/tnl_dd/t_dd_tritmp.h')
-rw-r--r--src/mesa/tnl_dd/t_dd_tritmp.h404
1 files changed, 140 insertions, 264 deletions
diff --git a/src/mesa/tnl_dd/t_dd_tritmp.h b/src/mesa/tnl_dd/t_dd_tritmp.h
index 6acd837317..2c36d845ab 100644
--- a/src/mesa/tnl_dd/t_dd_tritmp.h
+++ b/src/mesa/tnl_dd/t_dd_tritmp.h
@@ -42,7 +42,6 @@
* DO_UNFILLED: Decompose triangles to lines and points where appropriate.
* DO_TWOSTENCIL:Gross hack for two-sided stencil.
*
- * HAVE_RGBA: Vertices have rgba values (otherwise index values).
* HAVE_SPEC: Vertices have secondary rgba values.
*
* VERT_X(v): Alias for vertex x value.
@@ -59,29 +58,15 @@
* VERT_COPY_RGBA: Copy vertex rgba another vertex.
* VERT_SAVE_RGBA: Save vertex rgba to a local variable.
* VERT_RESTORE_RGBA: Restore vertex rgba from a local variable.
- * --> Similar for IND and SPEC.
+ * --> Similar for SPEC.
*
* LOCAL_VARS(n): (At least) define local vars for save/restore rgba.
*
*/
-#if HAVE_RGBA
-#define VERT_SET_IND( v, c ) (void) c
-#define VERT_COPY_IND( v0, v1 )
-#define VERT_SAVE_IND( idx )
-#define VERT_RESTORE_IND( idx )
#if HAVE_BACK_COLORS
#define VERT_SET_RGBA( v, c )
#endif
-#else
-#define VERT_SET_RGBA( v, c ) (void) c
-#define VERT_COPY_RGBA( v0, v1 )
-#define VERT_SAVE_RGBA( idx )
-#define VERT_RESTORE_RGBA( idx )
-#if HAVE_BACK_COLORS
-#define VERT_SET_IND( v, c )
-#endif
-#endif
#if !HAVE_SPEC
#define VERT_SET_SPEC( v, c ) (void) c
@@ -99,7 +84,6 @@
#if !HAVE_BACK_COLORS
#define VERT_COPY_SPEC1( v )
-#define VERT_COPY_IND1( v )
#define VERT_COPY_RGBA1( v )
#endif
@@ -171,82 +155,68 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
}
}
- if (DO_TWOSIDE && facing == 1)
- {
- if (HAVE_RGBA) {
- if (HAVE_BACK_COLORS) {
+ if (DO_TWOSIDE && facing == 1) {
+ if (HAVE_BACK_COLORS) {
+ if (!DO_FLAT) {
+ VERT_SAVE_RGBA( 0 );
+ VERT_SAVE_RGBA( 1 );
+ VERT_COPY_RGBA1( v[0] );
+ VERT_COPY_RGBA1( v[1] );
+ }
+ VERT_SAVE_RGBA( 2 );
+ VERT_COPY_RGBA1( v[2] );
+ if (HAVE_SPEC) {
if (!DO_FLAT) {
- VERT_SAVE_RGBA( 0 );
- VERT_SAVE_RGBA( 1 );
- VERT_COPY_RGBA1( v[0] );
- VERT_COPY_RGBA1( v[1] );
- }
- VERT_SAVE_RGBA( 2 );
- VERT_COPY_RGBA1( v[2] );
- if (HAVE_SPEC) {
- if (!DO_FLAT) {
- VERT_SAVE_SPEC( 0 );
- VERT_SAVE_SPEC( 1 );
- VERT_COPY_SPEC1( v[0] );
- VERT_COPY_SPEC1( v[1] );
- }
- VERT_SAVE_SPEC( 2 );
- VERT_COPY_SPEC1( v[2] );
+ VERT_SAVE_SPEC( 0 );
+ VERT_SAVE_SPEC( 1 );
+ VERT_COPY_SPEC1( v[0] );
+ VERT_COPY_SPEC1( v[1] );
}
+ VERT_SAVE_SPEC( 2 );
+ VERT_COPY_SPEC1( v[2] );
}
- else {
- GLfloat (*vbcolor)[4] = VB->BackfaceColorPtr->data;
- (void) vbcolor;
+ }
+ else {
+ GLfloat (*vbcolor)[4] = VB->BackfaceColorPtr->data;
+ (void) vbcolor;
- if (!DO_FLAT) {
- VERT_SAVE_RGBA( 0 );
- VERT_SAVE_RGBA( 1 );
- }
- VERT_SAVE_RGBA( 2 );
+ if (!DO_FLAT) {
+ VERT_SAVE_RGBA( 0 );
+ VERT_SAVE_RGBA( 1 );
+ }
+ VERT_SAVE_RGBA( 2 );
- if (VB->BackfaceColorPtr->stride) {
- ASSERT(VB->BackfaceColorPtr->stride == 4*sizeof(GLfloat));
+ if (VB->BackfaceColorPtr->stride) {
+ ASSERT(VB->BackfaceColorPtr->stride == 4*sizeof(GLfloat));
- if (!DO_FLAT) {
- VERT_SET_RGBA( v[0], vbcolor[e0] );
- VERT_SET_RGBA( v[1], vbcolor[e1] );
- }
- VERT_SET_RGBA( v[2], vbcolor[e2] );
+ if (!DO_FLAT) {
+ VERT_SET_RGBA( v[0], vbcolor[e0] );
+ VERT_SET_RGBA( v[1], vbcolor[e1] );
}
- else {
- if (!DO_FLAT) {
- VERT_SET_RGBA( v[0], vbcolor[0] );
- VERT_SET_RGBA( v[1], vbcolor[0] );
- }
- VERT_SET_RGBA( v[2], vbcolor[0] );
+ VERT_SET_RGBA( v[2], vbcolor[e2] );
+ }
+ else {
+ if (!DO_FLAT) {
+ VERT_SET_RGBA( v[0], vbcolor[0] );
+ VERT_SET_RGBA( v[1], vbcolor[0] );
}
+ VERT_SET_RGBA( v[2], vbcolor[0] );
+ }
- if (HAVE_SPEC && VB->BackfaceSecondaryColorPtr) {
- GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data;
- ASSERT(VB->BackfaceSecondaryColorPtr->stride == 4*sizeof(GLfloat));
+ if (HAVE_SPEC && VB->BackfaceSecondaryColorPtr) {
+ GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data;
+ ASSERT(VB->BackfaceSecondaryColorPtr->stride == 4*sizeof(GLfloat));
- if (!DO_FLAT) {
- VERT_SAVE_SPEC( 0 );
- VERT_SAVE_SPEC( 1 );
- VERT_SET_SPEC( v[0], vbspec[e0] );
- VERT_SET_SPEC( v[1], vbspec[e1] );
- }
- VERT_SAVE_SPEC( 2 );
- VERT_SET_SPEC( v[2], vbspec[e2] );
+ if (!DO_FLAT) {
+ VERT_SAVE_SPEC( 0 );
+ VERT_SAVE_SPEC( 1 );
+ VERT_SET_SPEC( v[0], vbspec[e0] );
+ VERT_SET_SPEC( v[1], vbspec[e1] );
}
+ VERT_SAVE_SPEC( 2 );
+ VERT_SET_SPEC( v[2], vbspec[e2] );
}
}
- else {
- GLfloat (*vbindex) = (GLfloat *)VB->BackfaceIndexPtr->data;
- if (!DO_FLAT) {
- VERT_SAVE_IND( 0 );
- VERT_SAVE_IND( 1 );
- VERT_SET_IND( v[0], vbindex[e0] );
- VERT_SET_IND( v[1], vbindex[e1] );
- }
- VERT_SAVE_IND( 2 );
- VERT_SET_IND( v[2], vbindex[e2] );
- }
}
}
@@ -274,23 +244,15 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
}
if (DO_FLAT) {
- if (HAVE_RGBA) {
- VERT_SAVE_RGBA( 0 );
- VERT_SAVE_RGBA( 1 );
- VERT_COPY_RGBA( v[0], v[2] );
- VERT_COPY_RGBA( v[1], v[2] );
- if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) {
- VERT_SAVE_SPEC( 0 );
- VERT_SAVE_SPEC( 1 );
- VERT_COPY_SPEC( v[0], v[2] );
- VERT_COPY_SPEC( v[1], v[2] );
- }
- }
- else {
- VERT_SAVE_IND( 0 );
- VERT_SAVE_IND( 1 );
- VERT_COPY_IND( v[0], v[2] );
- VERT_COPY_IND( v[1], v[2] );
+ VERT_SAVE_RGBA( 0 );
+ VERT_SAVE_RGBA( 1 );
+ VERT_COPY_RGBA( v[0], v[2] );
+ VERT_COPY_RGBA( v[1], v[2] );
+ if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) {
+ VERT_SAVE_SPEC( 0 );
+ VERT_SAVE_SPEC( 1 );
+ VERT_COPY_SPEC( v[0], v[2] );
+ VERT_COPY_SPEC( v[1], v[2] );
}
}
@@ -344,45 +306,29 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
VERT_SET_Z(v[2], z[2]);
}
- if (DO_TWOSIDE && facing == 1)
- {
- if (HAVE_RGBA) {
- if (!DO_FLAT) {
- VERT_RESTORE_RGBA( 0 );
- VERT_RESTORE_RGBA( 1 );
- }
- VERT_RESTORE_RGBA( 2 );
- if (HAVE_SPEC) {
- if (!DO_FLAT) {
- VERT_RESTORE_SPEC( 0 );
- VERT_RESTORE_SPEC( 1 );
- }
- VERT_RESTORE_SPEC( 2 );
- }
+ if (DO_TWOSIDE && facing == 1) {
+ if (!DO_FLAT) {
+ VERT_RESTORE_RGBA( 0 );
+ VERT_RESTORE_RGBA( 1 );
}
- else {
+ VERT_RESTORE_RGBA( 2 );
+ if (HAVE_SPEC) {
if (!DO_FLAT) {
- VERT_RESTORE_IND( 0 );
- VERT_RESTORE_IND( 1 );
+ VERT_RESTORE_SPEC( 0 );
+ VERT_RESTORE_SPEC( 1 );
}
- VERT_RESTORE_IND( 2 );
+ VERT_RESTORE_SPEC( 2 );
}
}
if (DO_FLAT) {
- if (HAVE_RGBA) {
VERT_RESTORE_RGBA( 0 );
VERT_RESTORE_RGBA( 1 );
if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) {
VERT_RESTORE_SPEC( 0 );
VERT_RESTORE_SPEC( 1 );
}
- }
- else {
- VERT_RESTORE_IND( 0 );
- VERT_RESTORE_IND( 1 );
- }
}
}
#endif
@@ -433,90 +379,74 @@ static void TAG(quadr)( GLcontext *ctx,
}
}
- if (DO_TWOSIDE && facing == 1)
- {
- if (HAVE_RGBA) {
- GLfloat (*vbcolor)[4] = VB->BackfaceColorPtr->data;
- (void)vbcolor;
-
- if (HAVE_BACK_COLORS) {
- if (!DO_FLAT) {
- VERT_SAVE_RGBA( 0 );
- VERT_SAVE_RGBA( 1 );
- VERT_SAVE_RGBA( 2 );
- VERT_COPY_RGBA1( v[0] );
- VERT_COPY_RGBA1( v[1] );
- VERT_COPY_RGBA1( v[2] );
- }
- VERT_SAVE_RGBA( 3 );
- VERT_COPY_RGBA1( v[3] );
- if (HAVE_SPEC) {
- if (!DO_FLAT) {
- VERT_SAVE_SPEC( 0 );
- VERT_SAVE_SPEC( 1 );
- VERT_SAVE_SPEC( 2 );
- VERT_COPY_SPEC1( v[0] );
- VERT_COPY_SPEC1( v[1] );
- VERT_COPY_SPEC1( v[2] );
- }
- VERT_SAVE_SPEC( 3 );
- VERT_COPY_SPEC1( v[3] );
- }
+ if (DO_TWOSIDE && facing == 1) {
+ GLfloat (*vbcolor)[4] = VB->BackfaceColorPtr->data;
+ (void)vbcolor;
+
+ if (HAVE_BACK_COLORS) {
+ if (!DO_FLAT) {
+ VERT_SAVE_RGBA( 0 );
+ VERT_SAVE_RGBA( 1 );
+ VERT_SAVE_RGBA( 2 );
+ VERT_COPY_RGBA1( v[0] );
+ VERT_COPY_RGBA1( v[1] );
+ VERT_COPY_RGBA1( v[2] );
}
- else {
- if (!DO_FLAT) {
- VERT_SAVE_RGBA( 0 );
- VERT_SAVE_RGBA( 1 );
- VERT_SAVE_RGBA( 2 );
- }
- VERT_SAVE_RGBA( 3 );
-
- if (VB->BackfaceColorPtr->stride) {
- if (!DO_FLAT) {
- VERT_SET_RGBA( v[0], vbcolor[e0] );
- VERT_SET_RGBA( v[1], vbcolor[e1] );
- VERT_SET_RGBA( v[2], vbcolor[e2] );
- }
- VERT_SET_RGBA( v[3], vbcolor[e3] );
- }
- else {
- if (!DO_FLAT) {
- VERT_SET_RGBA( v[0], vbcolor[0] );
- VERT_SET_RGBA( v[1], vbcolor[0] );
- VERT_SET_RGBA( v[2], vbcolor[0] );
- }
- VERT_SET_RGBA( v[3], vbcolor[0] );
+ VERT_SAVE_RGBA( 3 );
+ VERT_COPY_RGBA1( v[3] );
+ if (HAVE_SPEC) {
+ if (!DO_FLAT) {
+ VERT_SAVE_SPEC( 0 );
+ VERT_SAVE_SPEC( 1 );
+ VERT_SAVE_SPEC( 2 );
+ VERT_COPY_SPEC1( v[0] );
+ VERT_COPY_SPEC1( v[1] );
+ VERT_COPY_SPEC1( v[2] );
}
-
- if (HAVE_SPEC && VB->BackfaceSecondaryColorPtr) {
- GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data;
- ASSERT(VB->BackfaceSecondaryColorPtr->stride==4*sizeof(GLfloat));
-
- if (!DO_FLAT) {
- VERT_SAVE_SPEC( 0 );
- VERT_SAVE_SPEC( 1 );
- VERT_SAVE_SPEC( 2 );
- VERT_SET_SPEC( v[0], vbspec[e0] );
- VERT_SET_SPEC( v[1], vbspec[e1] );
- VERT_SET_SPEC( v[2], vbspec[e2] );
- }
- VERT_SAVE_SPEC( 3 );
- VERT_SET_SPEC( v[3], vbspec[e3] );
- }
+ VERT_SAVE_SPEC( 3 );
+ VERT_COPY_SPEC1( v[3] );
}
}
else {
- GLfloat *vbindex = (GLfloat *)VB->BackfaceIndexPtr->data;
if (!DO_FLAT) {
- VERT_SAVE_IND( 0 );
- VERT_SAVE_IND( 1 );
- VERT_SAVE_IND( 2 );
- VERT_SET_IND( v[0], vbindex[e0] );
- VERT_SET_IND( v[1], vbindex[e1] );
- VERT_SET_IND( v[2], vbindex[e2] );
+ VERT_SAVE_RGBA( 0 );
+ VERT_SAVE_RGBA( 1 );
+ VERT_SAVE_RGBA( 2 );
+ }
+ VERT_SAVE_RGBA( 3 );
+
+ if (VB->BackfaceColorPtr->stride) {
+ if (!DO_FLAT) {
+ VERT_SET_RGBA( v[0], vbcolor[e0] );
+ VERT_SET_RGBA( v[1], vbcolor[e1] );
+ VERT_SET_RGBA( v[2], vbcolor[e2] );
+ }
+ VERT_SET_RGBA( v[3], vbcolor[e3] );
+ }
+ else {
+ if (!DO_FLAT) {
+ VERT_SET_RGBA( v[0], vbcolor[0] );
+ VERT_SET_RGBA( v[1], vbcolor[0] );
+ VERT_SET_RGBA( v[2], vbcolor[0] );
+ }
+ VERT_SET_RGBA( v[3], vbcolor[0] );
+ }
+
+ if (HAVE_SPEC && VB->BackfaceSecondaryColorPtr) {
+ GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data;
+ ASSERT(VB->BackfaceSecondaryColorPtr->stride==4*sizeof(GLfloat));
+
+ if (!DO_FLAT) {
+ VERT_SAVE_SPEC( 0 );
+ VERT_SAVE_SPEC( 1 );
+ VERT_SAVE_SPEC( 2 );
+ VERT_SET_SPEC( v[0], vbspec[e0] );
+ VERT_SET_SPEC( v[1], vbspec[e1] );
+ VERT_SET_SPEC( v[2], vbspec[e2] );
+ }
+ VERT_SAVE_SPEC( 3 );
+ VERT_SET_SPEC( v[3], vbspec[e3] );
}
- VERT_SAVE_IND( 3 );
- VERT_SET_IND( v[3], vbindex[e3] );
}
}
}
@@ -546,7 +476,6 @@ static void TAG(quadr)( GLcontext *ctx,
}
if (DO_FLAT) {
- if (HAVE_RGBA) {
VERT_SAVE_RGBA( 0 );
VERT_SAVE_RGBA( 1 );
VERT_SAVE_RGBA( 2 );
@@ -561,15 +490,6 @@ static void TAG(quadr)( GLcontext *ctx,
VERT_COPY_SPEC( v[1], v[3] );
VERT_COPY_SPEC( v[2], v[3] );
}
- }
- else {
- VERT_SAVE_IND( 0 );
- VERT_SAVE_IND( 1 );
- VERT_SAVE_IND( 2 );
- VERT_COPY_IND( v[0], v[3] );
- VERT_COPY_IND( v[1], v[3] );
- VERT_COPY_IND( v[2], v[3] );
- }
}
if (mode == GL_POINT) {
@@ -625,37 +545,25 @@ static void TAG(quadr)( GLcontext *ctx,
VERT_SET_Z(v[3], z[3]);
}
- if (DO_TWOSIDE && facing == 1)
- {
- if (HAVE_RGBA) {
- if (!DO_FLAT) {
- VERT_RESTORE_RGBA( 0 );
- VERT_RESTORE_RGBA( 1 );
- VERT_RESTORE_RGBA( 2 );
- }
- VERT_RESTORE_RGBA( 3 );
- if (HAVE_SPEC) {
- if (!DO_FLAT) {
- VERT_RESTORE_SPEC( 0 );
- VERT_RESTORE_SPEC( 1 );
- VERT_RESTORE_SPEC( 2 );
- }
- VERT_RESTORE_SPEC( 3 );
- }
+ if (DO_TWOSIDE && facing == 1) {
+ if (!DO_FLAT) {
+ VERT_RESTORE_RGBA( 0 );
+ VERT_RESTORE_RGBA( 1 );
+ VERT_RESTORE_RGBA( 2 );
}
- else {
+ VERT_RESTORE_RGBA( 3 );
+ if (HAVE_SPEC) {
if (!DO_FLAT) {
- VERT_RESTORE_IND( 0 );
- VERT_RESTORE_IND( 1 );
- VERT_RESTORE_IND( 2 );
+ VERT_RESTORE_SPEC( 0 );
+ VERT_RESTORE_SPEC( 1 );
+ VERT_RESTORE_SPEC( 2 );
}
- VERT_RESTORE_IND( 3 );
+ VERT_RESTORE_SPEC( 3 );
}
}
if (DO_FLAT) {
- if (HAVE_RGBA) {
VERT_RESTORE_RGBA( 0 );
VERT_RESTORE_RGBA( 1 );
VERT_RESTORE_RGBA( 2 );
@@ -664,12 +572,6 @@ static void TAG(quadr)( GLcontext *ctx,
VERT_RESTORE_SPEC( 1 );
VERT_RESTORE_SPEC( 2 );
}
- }
- else {
- VERT_RESTORE_IND( 0 );
- VERT_RESTORE_IND( 1 );
- VERT_RESTORE_IND( 2 );
- }
}
}
#else
@@ -705,33 +607,22 @@ static void TAG(line)( GLcontext *ctx, GLuint e0, GLuint e1 )
v[1] = (VERTEX *)GET_VERTEX(e1);
if (DO_FLAT) {
- if (HAVE_RGBA) {
VERT_SAVE_RGBA( 0 );
VERT_COPY_RGBA( v[0], v[1] );
if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) {
VERT_SAVE_SPEC( 0 );
VERT_COPY_SPEC( v[0], v[1] );
}
- }
- else {
- VERT_SAVE_IND( 0 );
- VERT_COPY_IND( v[0], v[1] );
- }
}
LINE( v[0], v[1] );
if (DO_FLAT) {
- if (HAVE_RGBA) {
VERT_RESTORE_RGBA( 0 );
if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) {
VERT_RESTORE_SPEC( 0 );
}
- }
- else {
- VERT_RESTORE_IND( 0 );
- }
}
}
#endif
@@ -781,23 +672,9 @@ static void TAG(init)( void )
#undef IND
#undef TAG
-#if HAVE_RGBA
-#undef VERT_SET_IND
-#undef VERT_COPY_IND
-#undef VERT_SAVE_IND
-#undef VERT_RESTORE_IND
#if HAVE_BACK_COLORS
#undef VERT_SET_RGBA
#endif
-#else
-#undef VERT_SET_RGBA
-#undef VERT_COPY_RGBA
-#undef VERT_SAVE_RGBA
-#undef VERT_RESTORE_RGBA
-#if HAVE_BACK_COLORS
-#undef VERT_SET_IND
-#endif
-#endif
#if !HAVE_SPEC
#undef VERT_SET_SPEC
@@ -815,7 +692,6 @@ static void TAG(init)( void )
#if !HAVE_BACK_COLORS
#undef VERT_COPY_SPEC1
-#undef VERT_COPY_IND1
#undef VERT_COPY_RGBA1
#endif