summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Borca <[email protected]>2004-10-29 13:35:56 +0000
committerDaniel Borca <[email protected]>2004-10-29 13:35:56 +0000
commitb0996b19f0af063da5a563778acd3119cde7ce09 (patch)
tree897b6df76d1bd34d5c232242460d8ce08b4b81b7 /src
parent03501e7a29138e030b43746dcc71781b9652a113 (diff)
make sure we don't generate random alpha
Diffstat (limited to 'src')
-rw-r--r--src/mesa/tnl_dd/t_dd_vbtmp.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mesa/tnl_dd/t_dd_vbtmp.h b/src/mesa/tnl_dd/t_dd_vbtmp.h
index f4b710dfcc3..d8452f6f439 100644
--- a/src/mesa/tnl_dd/t_dd_vbtmp.h
+++ b/src/mesa/tnl_dd/t_dd_vbtmp.h
@@ -129,7 +129,7 @@ static void TAG(emit)( GLcontext *ctx,
GLfloat (*col)[4], (*spec)[4];
GLuint tc0_stride, tc1_stride, col_stride, spec_stride, fog_stride;
GLuint tc2_stride, tc3_stride;
- GLuint tc0_size, tc1_size;
+ GLuint tc0_size, tc1_size, col_size;
GLuint tc2_size, tc3_size;
GLfloat (*coord)[4];
GLuint coord_stride;
@@ -186,6 +186,7 @@ static void TAG(emit)( GLcontext *ctx,
if (DO_RGBA) {
col_stride = VB->ColorPtr[0]->stride;
col = VB->ColorPtr[0]->data;
+ col_size = VB->ColorPtr[0]->size;
}
if (DO_SPEC) {
@@ -244,7 +245,11 @@ static void TAG(emit)( GLcontext *ctx,
UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.red, col[0][0]);
UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.green, col[0][1]);
UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.blue, col[0][2]);
- UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.alpha, col[0][3]);
+ if (col_size == 4) {
+ UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.alpha, col[0][3]);
+ } else {
+ v->v.color.alpha = CHAN_MAX;
+ }
STRIDE_4F(col, col_stride);
}
if (DO_SPEC) {
@@ -379,7 +384,11 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
UNCLAMPED_FLOAT_TO_UBYTE(c->red, col[0][0]);
UNCLAMPED_FLOAT_TO_UBYTE(c->green, col[0][1]);
UNCLAMPED_FLOAT_TO_UBYTE(c->blue, col[0][2]);
- UNCLAMPED_FLOAT_TO_UBYTE(c->alpha, col[0][3]);
+ if (col_size == 4) {
+ UNCLAMPED_FLOAT_TO_UBYTE(c->alpha, col[0][3]);
+ } else {
+ c->alpha = CHAN_MAX;
+ }
STRIDE_4F( col, col_stride );
}
/* fprintf(stderr, "vert %d: %.2f %.2f %.2f %x\n", */