summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2001-03-01 17:40:14 +0000
committerKeith Whitwell <[email protected]>2001-03-01 17:40:14 +0000
commit0fe593a71e4f78c5683455cf71d5873a3664f146 (patch)
treebf6a68123a6cd104f3bd38a8b2463118b08352d0
parentd89c87ac40631cb7c8c7da71c61770fc93903a33 (diff)
Bugfixes for vertex format, templates
-rw-r--r--src/mesa/drivers/common/t_dd_dmatmp.h25
-rw-r--r--src/mesa/drivers/common/t_dd_vbtmp.h54
-rw-r--r--src/mesa/drivers/common/t_dd_vertex.h2
3 files changed, 36 insertions, 45 deletions
diff --git a/src/mesa/drivers/common/t_dd_dmatmp.h b/src/mesa/drivers/common/t_dd_dmatmp.h
index 15568ee659d..b537127c9b6 100644
--- a/src/mesa/drivers/common/t_dd_dmatmp.h
+++ b/src/mesa/drivers/common/t_dd_dmatmp.h
@@ -43,18 +43,17 @@
#error "must have at least triangles to use render template"
#endif
-#if !HAVE_ELTS
-#define ALLOC_ELTS( nr )
-#define EMIT_ELT( offset, elt )
-#define INCR_ELTS( nr )
-#define ELT_INIT(prim)
-#define GET_CURRENT_VB_MAX_ELTS() 0
-#define GET_SUBSEQUENT_VB_MAX_ELTS() 0
-#define ALLOC_ELTS_NEW_PRIMITIVE(nr)
-#define RELEASE_ELT_VERTS()
-#define EMIT_INDEXED_VERTS( ctx, start, count )
-
-#endif
+/* #if !HAVE_ELTS */
+/* #define ALLOC_ELTS( nr ) */
+/* #define EMIT_ELT( offset, elt ) */
+/* #define INCR_ELTS( nr ) */
+/* #define ELT_INIT(prim) */
+/* #define GET_CURRENT_VB_MAX_ELTS() 0 */
+/* #define GET_SUBSEQUENT_VB_MAX_ELTS() 0 */
+/* #define ALLOC_ELTS_NEW_PRIMITIVE(nr) */
+/* #define RELEASE_ELT_VERTS() */
+/* #define EMIT_INDEXED_VERTS( ctx, start, count ) */
+/* #endif */
#ifndef EMIT_TWO_ELTS
#define EMIT_TWO_ELTS( offset, elt0, elt1 ) \
@@ -99,7 +98,7 @@ static void TAG(emit_elts)( GLcontext *ctx, GLuint *elts, GLuint nr )
ALLOC_ELTS( nr );
- for ( i = 0 ; i < nr ; i++, elts += 2 ) {
+ for ( i = 0 ; i < nr ; i+=2, elts += 2 ) {
EMIT_TWO_ELTS( 0, elts[0], elts[1] );
INCR_ELTS( 2 );
}
diff --git a/src/mesa/drivers/common/t_dd_vbtmp.h b/src/mesa/drivers/common/t_dd_vbtmp.h
index 4e769c48ac1..8be88a2261a 100644
--- a/src/mesa/drivers/common/t_dd_vbtmp.h
+++ b/src/mesa/drivers/common/t_dd_vbtmp.h
@@ -125,8 +125,6 @@ static void TAG(emit)( GLcontext *ctx,
const GLubyte *mask = VB->ClipMask;
int i;
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
if (HAVE_HW_VIEWPORT && HAVE_HW_DIVIDE) {
(void) s;
coord = VB->ClipPtr->data;
@@ -139,16 +137,6 @@ static void TAG(emit)( GLcontext *ctx,
if (DO_TEX3) {
const GLuint t3 = GET_TEXSOURCE(3);
-
- if (VB->TexCoordPtr[2] == 0) {
- if (VB->TexCoordPtr[1] == 0) {
- if (VB->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[t3];
- VB->TexCoordPtr[1] = VB->TexCoordPtr[t3];
- }
- VB->TexCoordPtr[2] = VB->TexCoordPtr[t3];
- }
-
tc3 = VB->TexCoordPtr[t3]->data;
tc3_stride = VB->TexCoordPtr[t3]->stride;
if (DO_PTEX)
@@ -157,28 +145,18 @@ static void TAG(emit)( GLcontext *ctx,
if (DO_TEX2) {
const GLuint t2 = GET_TEXSOURCE(2);
-
- if (VB->TexCoordPtr[1] == 0) {
- if (VB->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[t2];
- VB->TexCoordPtr[1] = VB->TexCoordPtr[t2];
- }
-
tc2 = VB->TexCoordPtr[t2]->data;
tc2_stride = VB->TexCoordPtr[t2]->stride;
if (DO_PTEX)
tc2_size = VB->TexCoordPtr[t2]->size;
}
-
if (DO_TEX1) {
const GLuint t1 = GET_TEXSOURCE(1);
- if (VB->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[t1];
- tc1 = VB->TexCoordPtr[1]->data;
- tc1_stride = VB->TexCoordPtr[1]->stride;
+ tc1 = VB->TexCoordPtr[t1]->data;
+ tc1_stride = VB->TexCoordPtr[t1]->stride;
if (DO_PTEX)
- tc1_size = VB->TexCoordPtr[1]->size;
+ tc1_size = VB->TexCoordPtr[t1]->size;
}
if (DO_TEX0) {
@@ -422,8 +400,6 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
(void) s;
-/* fprintf(stderr, "%s (template 2)\n", __FUNCTION__); */
-
ASSERT(stride == 4);
/* Pack what's left into a 4-dword vertex. Color is in a different
@@ -523,6 +499,15 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
+ if (DO_TEX3 && VB->TexCoordPtr[2] == 0)
+ VB->TexCoordPtr[2] = VB->TexCoordPtr[3];
+
+ if (DO_TEX2 && VB->TexCoordPtr[1] == 0)
+ VB->TexCoordPtr[1] = VB->TexCoordPtr[2];
+
+ if (DO_TEX1 && VB->TexCoordPtr[0] == 0)
+ VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
+
if (DO_PTEX)
return GL_TRUE;
@@ -539,6 +524,15 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
+ if (DO_TEX3 && VB->TexCoordPtr[2] == 0)
+ VB->TexCoordPtr[2] = VB->TexCoordPtr[3];
+
+ if (DO_TEX2 && VB->TexCoordPtr[1] == 0)
+ VB->TexCoordPtr[1] = VB->TexCoordPtr[2];
+
+ if (DO_TEX1 && VB->TexCoordPtr[0] == 0)
+ VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
+
if (DO_PTEX)
return GL_TRUE;
@@ -582,7 +576,6 @@ static void TAG(interp)( GLcontext *ctx,
(void)s;
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
if (!HAVE_HW_DIVIDE) {
w = 1.0 / dstclip[3];
@@ -599,9 +592,8 @@ static void TAG(interp)( GLcontext *ctx,
if (HAVE_HW_DIVIDE || DO_FOG || DO_SPEC || DO_TEX0 || DO_TEX1 ||
DO_TEX2 || DO_TEX3) {
-
- if (!HAVE_HW_VIEWPORT || !HAVE_HW_DIVIDE)
- dst->v.w = w;
+
+ dst->v.w = w;
INTERP_UB( t, dst->ub4[4][0], out->ub4[4][0], in->ub4[4][0] );
INTERP_UB( t, dst->ub4[4][1], out->ub4[4][1], in->ub4[4][1] );
diff --git a/src/mesa/drivers/common/t_dd_vertex.h b/src/mesa/drivers/common/t_dd_vertex.h
index fcb734072bf..3f62aeeb1a7 100644
--- a/src/mesa/drivers/common/t_dd_vertex.h
+++ b/src/mesa/drivers/common/t_dd_vertex.h
@@ -66,5 +66,5 @@ typedef union {
} tv;
float f[16];
unsigned int ui[16];
- unsigned char ub4[4][16];
+ unsigned char ub4[16][4];
} TAG(Vertex), *TAG(VertexPtr);