summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast_setup
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2003-11-24 15:23:18 +0000
committerKeith Whitwell <[email protected]>2003-11-24 15:23:18 +0000
commitae0eaf93e092ac8e8b1c98f3e986de96940663fa (patch)
tree56aae7c4b985f657384df5e088227c4dd08130fb /src/mesa/swrast_setup
parent57c9814b9e87924696df4c741861c29d4236d1eb (diff)
Merge vtx-0-2-branch
Diffstat (limited to 'src/mesa/swrast_setup')
-rw-r--r--src/mesa/swrast_setup/ss_triangle.c4
-rw-r--r--src/mesa/swrast_setup/ss_tritmp.h12
-rw-r--r--src/mesa/swrast_setup/ss_vb.c23
-rw-r--r--src/mesa/swrast_setup/ss_vbtmp.h32
4 files changed, 33 insertions, 38 deletions
diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c
index d106d4c3173..3a0af5de5eb 100644
--- a/src/mesa/swrast_setup/ss_triangle.c
+++ b/src/mesa/swrast_setup/ss_triangle.c
@@ -162,8 +162,8 @@ static void _swsetup_render_point_tri( GLcontext *ctx,
_swrast_flush(ctx);
}
-#define SS_COLOR(a,b) COPY_CHAN4(a,b)
-#define SS_SPEC(a,b) COPY_3V(a,b)
+#define SS_COLOR(a,b) UNCLAMPED_FLOAT_TO_RGBA_CHAN(a,b)
+#define SS_SPEC(a,b) UNCLAMPED_FLOAT_TO_RGB_CHAN(a,b)
#define SS_IND(a,b) (a = b)
#define IND (0)
diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index 77219fc6076..85234ce73e1 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -62,18 +62,18 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
if (facing == 1) {
if (IND & SS_TWOSIDE_BIT) {
if (IND & SS_RGBA_BIT) {
- GLchan (*vbcolor)[4] = (GLchan (*)[4])VB->ColorPtr[1]->Ptr;
+ GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->data;
SS_COLOR(v[0]->color, vbcolor[e0]);
SS_COLOR(v[1]->color, vbcolor[e1]);
SS_COLOR(v[2]->color, vbcolor[e2]);
if (VB->SecondaryColorPtr[1]) {
- GLchan (*vbspec)[4] = (GLchan (*)[4])VB->SecondaryColorPtr[1]->Ptr;
+ GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->data;
SS_SPEC(v[0]->specular, vbspec[e0]);
SS_SPEC(v[1]->specular, vbspec[e1]);
SS_SPEC(v[2]->specular, vbspec[e2]);
}
} else {
- GLuint *vbindex = VB->IndexPtr[1]->data;
+ GLfloat *vbindex = (GLfloat *)VB->IndexPtr[1]->data;
SS_IND(v[0]->index, vbindex[e0]);
SS_IND(v[1]->index, vbindex[e1]);
SS_IND(v[2]->index, vbindex[e2]);
@@ -137,18 +137,18 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
if (IND & SS_TWOSIDE_BIT) {
if (facing == 1) {
if (IND & SS_RGBA_BIT) {
- GLchan (*vbcolor)[4] = (GLchan (*)[4])VB->ColorPtr[0]->Ptr;
+ GLfloat (*vbcolor)[4] = VB->ColorPtr[0]->data;
SS_COLOR(v[0]->color, vbcolor[e0]);
SS_COLOR(v[1]->color, vbcolor[e1]);
SS_COLOR(v[2]->color, vbcolor[e2]);
if (VB->SecondaryColorPtr[0]) {
- GLchan (*vbspec)[4] = (GLchan (*)[4])VB->SecondaryColorPtr[0]->Ptr;
+ GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[0]->data;
SS_SPEC(v[0]->specular, vbspec[e0]);
SS_SPEC(v[1]->specular, vbspec[e1]);
SS_SPEC(v[2]->specular, vbspec[e2]);
}
} else {
- GLuint *vbindex = VB->IndexPtr[0]->data;
+ GLfloat *vbindex = (GLfloat *)VB->IndexPtr[0]->data;
SS_IND(v[0]->index, vbindex[e0]);
SS_IND(v[1]->index, vbindex[e1]);
SS_IND(v[2]->index, vbindex[e2]);
diff --git a/src/mesa/swrast_setup/ss_vb.c b/src/mesa/swrast_setup/ss_vb.c
index 869d519832d..bb9819b5b87 100644
--- a/src/mesa/swrast_setup/ss_vb.c
+++ b/src/mesa/swrast_setup/ss_vb.c
@@ -39,6 +39,8 @@
#include "ss_context.h"
#include "ss_vb.h"
+
+#if 0
static void do_import( struct vertex_buffer *VB,
struct gl_client_array *to,
struct gl_client_array *from )
@@ -83,7 +85,7 @@ static void import_float_spec_colors( GLcontext *ctx )
do_import( VB, to, VB->SecondaryColorPtr[0] );
VB->SecondaryColorPtr[0] = to;
}
-
+#endif
/* Provides a RasterSetup function which prebuilds vertices for the
* software rasterizer. This is required for the triangle functions
@@ -226,7 +228,7 @@ static copy_pv_func copy_pv_tab[MAX_SETUPFUNC];
* Additional setup and interp for back color and edgeflag.
***********************************************************************/
-#define GET_COLOR(ptr, idx) (((GLchan (*)[4])((ptr)->Ptr))[idx])
+#define GET_COLOR(ptr, idx) (((GLfloat (*)[4])((ptr)->data))[idx])
static void interp_extras( GLcontext *ctx,
GLfloat t,
@@ -236,23 +238,22 @@ static void interp_extras( GLcontext *ctx,
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
if (VB->ColorPtr[1]) {
- INTERP_4CHAN( t,
+ INTERP_4F( t,
GET_COLOR(VB->ColorPtr[1], dst),
GET_COLOR(VB->ColorPtr[1], out),
GET_COLOR(VB->ColorPtr[1], in) );
if (VB->SecondaryColorPtr[1]) {
- INTERP_3CHAN( t,
+ INTERP_3F( t,
GET_COLOR(VB->SecondaryColorPtr[1], dst),
GET_COLOR(VB->SecondaryColorPtr[1], out),
GET_COLOR(VB->SecondaryColorPtr[1], in) );
}
}
else if (VB->IndexPtr[1]) {
- VB->IndexPtr[1]->data[dst] = (GLuint) (GLint)
- LINTERP( t,
- (GLfloat) VB->IndexPtr[1]->data[out],
- (GLfloat) VB->IndexPtr[1]->data[in] );
+ VB->IndexPtr[1]->data[dst][0] = LINTERP( t,
+ VB->IndexPtr[1]->data[out][0],
+ VB->IndexPtr[1]->data[in][0] );
}
if (VB->EdgeFlag) {
@@ -268,8 +269,8 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src )
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
if (VB->ColorPtr[1]) {
- COPY_CHAN4( GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], src) );
+ COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst),
+ GET_COLOR(VB->ColorPtr[1], src) );
if (VB->SecondaryColorPtr[1]) {
COPY_3V( GET_COLOR(VB->SecondaryColorPtr[1], dst),
@@ -277,7 +278,7 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src )
}
}
else if (VB->IndexPtr[1]) {
- VB->IndexPtr[1]->data[dst] = VB->IndexPtr[1]->data[src];
+ VB->IndexPtr[1]->data[dst][0] = VB->IndexPtr[1]->data[src][0];
}
copy_pv_tab[SWSETUP_CONTEXT(ctx)->SetupIndex](ctx, dst, src);
diff --git a/src/mesa/swrast_setup/ss_vbtmp.h b/src/mesa/swrast_setup/ss_vbtmp.h
index 00290c30c36..61956f25cee 100644
--- a/src/mesa/swrast_setup/ss_vbtmp.h
+++ b/src/mesa/swrast_setup/ss_vbtmp.h
@@ -35,9 +35,9 @@ static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end,
SWvertex *v;
const GLfloat *ndc; /* NDC (i.e. projected clip coordinates) */
const GLfloat *tc[MAX_TEXTURE_COORD_UNITS];
- const GLchan *color;
- const GLchan *spec;
- const GLuint *index;
+ const GLfloat *color;
+ const GLfloat *spec;
+ const GLfloat *index;
const GLfloat *fog;
const GLfloat *pointSize;
GLuint tsz[MAX_TEXTURE_COORD_UNITS];
@@ -80,21 +80,15 @@ static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end,
fog_stride = VB->FogCoordPtr->stride;
}
if (IND & COLOR) {
- if (VB->ColorPtr[0]->Type != CHAN_TYPE)
- import_float_colors( ctx );
-
- color = (GLchan *) VB->ColorPtr[0]->Ptr;
- color_stride = VB->ColorPtr[0]->StrideB;
+ color = (GLfloat *) VB->ColorPtr[0]->data;
+ color_stride = VB->ColorPtr[0]->stride;
}
if (IND & SPEC) {
- if (VB->SecondaryColorPtr[0]->Type != CHAN_TYPE)
- import_float_spec_colors( ctx );
-
- spec = (GLchan *) VB->SecondaryColorPtr[0]->Ptr;
- spec_stride = VB->SecondaryColorPtr[0]->StrideB;
+ spec = (GLfloat *) VB->SecondaryColorPtr[0]->data;
+ spec_stride = VB->SecondaryColorPtr[0]->stride;
}
if (IND & INDEX) {
- index = VB->IndexPtr[0]->data;
+ index = (GLfloat *) VB->IndexPtr[0]->data;
index_stride = VB->IndexPtr[0]->stride;
}
if (IND & POINT) {
@@ -128,13 +122,13 @@ static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end,
}
if (IND & COLOR) {
- COPY_CHAN4(v->color, color);
- STRIDE_CHAN(color, color_stride);
+ UNCLAMPED_FLOAT_TO_RGBA_CHAN(v->color, color);
+ STRIDE_F(color, color_stride);
}
if (IND & SPEC) {
- COPY_CHAN4(v->specular, spec);
- STRIDE_CHAN(spec, spec_stride);
+ UNCLAMPED_FLOAT_TO_RGBA_CHAN(v->specular, spec);
+ STRIDE_F(spec, spec_stride);
}
if (IND & FOG) {
@@ -144,7 +138,7 @@ static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end,
if (IND & INDEX) {
v->index = index[0];
- STRIDE_UI(index, index_stride);
+ STRIDE_F(index, index_stride);
}
if (IND & POINT) {