summaryrefslogtreecommitdiff
path: root/src/mesa/swrast_setup
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2004-01-05 09:43:42 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2004-01-05 09:43:42 +0000
commit790734045b69c47b1525fbf9106a7ca5a8eb7416 (patch)
tree6d071a1bfea29d14bc132414cc62a18e0b5fb51f /src/mesa/swrast_setup
parenteffc73931f86c7961b4eb296d2d4c5d91624a9e3 (diff)
Re-commit t_vertex.[ch] changes to fd.o server.
Diffstat (limited to 'src/mesa/swrast_setup')
-rw-r--r--src/mesa/swrast_setup/ss_context.c40
-rw-r--r--src/mesa/swrast_setup/swrast_setup.h8
2 files changed, 48 insertions, 0 deletions
diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c
index eb133f969c..55fe141c25 100644
--- a/src/mesa/swrast_setup/ss_context.c
+++ b/src/mesa/swrast_setup/ss_context.c
@@ -28,6 +28,7 @@
#include "glheader.h"
#include "imports.h"
+#include "colormac.h"
#include "ss_context.h"
#include "ss_triangle.h"
#include "ss_vb.h"
@@ -35,6 +36,7 @@
#include "tnl/tnl.h"
#include "tnl/t_context.h"
#include "tnl/t_pipeline.h"
+#include "tnl/t_vertex.h"
#define _SWSETUP_NEW_VERTS (_NEW_RENDERMODE| \
@@ -164,3 +166,41 @@ _swsetup_Wakeup( GLcontext *ctx )
_tnl_need_projected_coords( ctx, GL_TRUE );
_swsetup_InvalidateState( ctx, ~0 );
}
+
+
+
+
+
+/* Populate a swrast SWvertex from an attrib-style vertex.
+ */
+void
+_swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest )
+{
+ GLfloat tmp[4];
+ GLint i;
+
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POS, dest->win );
+
+ for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_TEX0+i, dest->texcoord[i] );
+
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR0, tmp );
+ UNCLAMPED_FLOAT_TO_RGBA_CHAN( dest->color, tmp );
+
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR1, tmp );
+ UNCLAMPED_FLOAT_TO_RGB_CHAN( dest->specular, tmp );
+
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_FOG, tmp );
+ dest->fog = tmp[0];
+
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_INDEX, tmp );
+ dest->index = (GLuint) tmp[0];
+
+/*
+ Need to check how pointsize is related to vertex program attributes:
+
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POINTSIZE, tmp );
+ dest->pointSize = tmp[0];
+*/
+}
+
diff --git a/src/mesa/swrast_setup/swrast_setup.h b/src/mesa/swrast_setup/swrast_setup.h
index 4825c772f1..5dcbe2675b 100644
--- a/src/mesa/swrast_setup/swrast_setup.h
+++ b/src/mesa/swrast_setup/swrast_setup.h
@@ -38,6 +38,8 @@
#ifndef SWRAST_SETUP_H
#define SWRAST_SETUP_H
+#include "swrast/swrast.h"
+
extern GLboolean
_swsetup_CreateContext( GLcontext *ctx );
@@ -50,4 +52,10 @@ _swsetup_InvalidateState( GLcontext *ctx, GLuint new_state );
extern void
_swsetup_Wakeup( GLcontext *ctx );
+/* Helper function to translate a hardware vertex (as understood by
+ * the tnl/t_vertex.c code) to a swrast vertex.
+ */
+extern void
+_swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest );
+
#endif