summaryrefslogtreecommitdiff
path: root/src/mesa/swrast_setup/ss_vbtmp.h
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2000-12-26 05:09:27 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2000-12-26 05:09:27 +0000
commitcab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290 (patch)
tree45385bd755d8e3876c54b2b0113636f5ceb7976a /src/mesa/swrast_setup/ss_vbtmp.h
parentd1ff1f6798b003a820f5de9fad835ff352f31afe (diff)
Major rework of tnl module
New array_cache module Support 8 texture units in core mesa (now support 8 everywhere) Rework core mesa statechange operations to avoid flushing on many noop statechanges.
Diffstat (limited to 'src/mesa/swrast_setup/ss_vbtmp.h')
-rw-r--r--src/mesa/swrast_setup/ss_vbtmp.h99
1 files changed, 56 insertions, 43 deletions
diff --git a/src/mesa/swrast_setup/ss_vbtmp.h b/src/mesa/swrast_setup/ss_vbtmp.h
index 7ed4d51441..f5a4c449e7 100644
--- a/src/mesa/swrast_setup/ss_vbtmp.h
+++ b/src/mesa/swrast_setup/ss_vbtmp.h
@@ -26,80 +26,92 @@
*/
-static void TAG(rs)(struct vertex_buffer *VB, GLuint start, GLuint end)
+static void TAG(rs)(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs )
{
- GLcontext *ctx = VB->ctx;
TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct vertex_buffer *VB = &tnl->vb;
SWvertex *v;
- GLfloat (*eye)[4];
- GLfloat (*win)[4];
+ GLfloat (*proj)[4]; /* projected clip coordinates */
GLfloat (*tc[MAX_TEXTURE_UNITS])[4];
GLubyte (*color)[4];
GLubyte (*spec)[4];
GLuint *index;
GLfloat *fog;
GLfloat *pointSize;
- GLuint sz[MAX_TEXTURE_UNITS];
- GLuint szeye;
+ GLuint tsz[MAX_TEXTURE_UNITS];
int i;
+ GLfloat *m = ctx->Viewport._WindowMap.m;
+ const GLfloat sx = m[0];
+ const GLfloat sy = m[5];
+ const GLfloat sz = m[10];
+ const GLfloat tx = m[12];
+ const GLfloat ty = m[13];
+ const GLfloat tz = m[14];
+ GLuint maxtex = 0;
- /* TODO: Do window map here.
- */
-/* GLfloat *m = VB->ctx->Viewport.WindowMap.m; */
-/* const GLfloat sx = m[0]; */
-/* const GLfloat sy = m[5]; */
-/* const GLfloat sz = m[10] * ctx->Visual->DepthMaxF; */
-/* const GLfloat tx = m[12]; */
-/* const GLfloat ty = m[13]; */
-/* const GLfloat tz = m[14] * ctx->Visual->DepthMaxF; */
-
+/* fprintf(stderr, "%s\n", __FUNCTION__); */
/* TODO: Get import_client_data to pad vectors out to 4 cleanly.
*/
- _tnl_import_client_data( VB, tnl->_RenderFlags,
- (VB->ClipOrMask
- ? /* VEC_CLEAN| */VEC_WRITABLE|VEC_GOOD_STRIDE
- : /* VEC_CLEAN| */VEC_GOOD_STRIDE));
-
+ if (VB->importable_data)
+ VB->import_data( ctx, VB->importable_data & newinputs,
+ (VB->ClipOrMask
+ ? VEC_NOT_WRITEABLE|VEC_BAD_STRIDE
+ : VEC_BAD_STRIDE));
+
if (IND & TEX0) {
tc[0] = VB->TexCoordPtr[0]->data;
- sz[0] = VB->TexCoordPtr[0]->size;
+ tsz[0] = VB->TexCoordPtr[0]->size;
}
if (IND & MULTITEX) {
- for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) {
- tc[i] = VB->TexCoordPtr[i]->data;
- sz[i] = VB->TexCoordPtr[i]->size;
+ for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
+ if (VB->TexCoordPtr[i]) {
+ maxtex = i+1;
+ tc[i] = VB->TexCoordPtr[i]->data;
+ tsz[i] = VB->TexCoordPtr[i]->size;
+ }
+ else tc[i] = 0;
}
}
- fog = VB->FogCoordPtr->data;
- eye = VB->EyePtr->data;
- szeye = VB->EyePtr->size;
- win = VB->Win.data;
- color = VB->Color[0]->data;
- spec = VB->SecondaryColor[0]->data;
- index = VB->Index[0]->data;
- pointSize = VB->PointSize.data;
+ /* Tie up some dangling pointers for flat/twoside code in ss_tritmp.h
+ */
+ if ((ctx->_TriangleCaps & DD_SEPERATE_SPECULAR) == 0) {
+ VB->SecondaryColorPtr[0] = VB->ColorPtr[0];
+ VB->SecondaryColorPtr[1] = VB->ColorPtr[1];
+ }
+
+
+ proj = VB->ProjectedClipPtr->data;
+ if (IND & FOG)
+ fog = VB->FogCoordPtr->data;
+ if (IND & COLOR)
+ color = VB->ColorPtr[0]->data;
+ if (IND & SPEC)
+ spec = VB->SecondaryColorPtr[0]->data;
+ if (IND & INDEX)
+ index = VB->IndexPtr[0]->data;
+ if (IND & POINT)
+ pointSize = VB->PointSizePtr->data;
- v = &(SWSETUP_VB(VB)->verts[start]);
+ v = &(SWSETUP_CONTEXT(ctx)->verts[start]);
for (i=start; i < end; i++, v++) {
if (VB->ClipMask[i] == 0) {
- COPY_4FV( v->win, win[i] );
+ v->win[0] = sx * proj[i][0] + tx;
+ v->win[1] = sy * proj[i][1] + ty;
+ v->win[2] = sz * proj[i][2] + tz;
+ v->win[3] = proj[i][3];
-#if 0
- if (IND & EYE)
- COPY_4FV( v->eye, eye[i] );
-#endif
if (IND & TEX0)
- COPY_CLEAN_4V( v->texcoord[0], sz[0], tc[0][i] );
+ COPY_CLEAN_4V( v->texcoord[0], tsz[0], tc[0][i] );
if (IND & MULTITEX) {
GLuint u;
- for (u = 0 ; u < MAX_TEXTURE_UNITS ; u++)
- if (ctx->Texture.Unit[u]._ReallyEnabled)
- COPY_CLEAN_4V( v->texcoord[u], sz[u], tc[u][i] );
+ for (u = 0 ; u < maxtex ; u++)
+ if (tc[u])
+ COPY_CLEAN_4V( v->texcoord[u], tsz[u], tc[u][i] );
}
if (IND & COLOR)
@@ -122,3 +134,4 @@ static void TAG(rs)(struct vertex_buffer *VB, GLuint start, GLuint end)
#undef TAG
#undef IND
+#undef SETUP_FLAGS