summaryrefslogtreecommitdiff
path: root/src/mesa/swrast_setup/ss_triangle.c
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_triangle.c
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_triangle.c')
-rw-r--r--src/mesa/swrast_setup/ss_triangle.c130
1 files changed, 72 insertions, 58 deletions
diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c
index 962f811875..a3f8cd6cec 100644
--- a/src/mesa/swrast_setup/ss_triangle.c
+++ b/src/mesa/swrast_setup/ss_triangle.c
@@ -34,16 +34,15 @@
#include "ss_triangle.h"
#include "ss_context.h"
-#define SS_FLAT_BIT 0x1
+#define SS_FLAT_BIT 0x1
#define SS_OFFSET_BIT 0x2
#define SS_TWOSIDE_BIT 0x4
#define SS_UNFILLED_BIT 0x10
-#define SS_COPY_EXTRAS 0x20 /* optimization */
-#define SS_MAX_TRIFUNC 0x40
+#define SS_RGBA_BIT 0x20
+#define SS_MAX_TRIFUNC 0x80
static triangle_func tri_tab[SS_MAX_TRIFUNC];
static line_func line_tab[SS_MAX_TRIFUNC];
-static points_func points_tab[SS_MAX_TRIFUNC];
static quad_func quad_tab[SS_MAX_TRIFUNC];
@@ -115,68 +114,68 @@ static quad_func quad_tab[SS_MAX_TRIFUNC];
#define TAG(x) x##_flat_offset_twoside_unfilled
#include "ss_tritmp.h"
-#define IND (0|SS_COPY_EXTRAS)
-#define TAG(x) x##_spec
+#define IND (0|SS_RGBA_BIT)
+#define TAG(x) x##_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_COPY_EXTRAS)
-#define TAG(x) x##_flat_spec
+#define IND (SS_FLAT_BIT|SS_RGBA_BIT)
+#define TAG(x) x##_flat_rgba
#include "ss_tritmp.h"
-#define IND (SS_OFFSET_BIT|SS_COPY_EXTRAS)
-#define TAG(x) x##_offset_spec
+#define IND (SS_OFFSET_BIT|SS_RGBA_BIT)
+#define TAG(x) x##_offset_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_COPY_EXTRAS)
-#define TAG(x) x##_flat_offset_spec
+#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_RGBA_BIT)
+#define TAG(x) x##_flat_offset_rgba
#include "ss_tritmp.h"
-#define IND (SS_TWOSIDE_BIT|SS_COPY_EXTRAS)
-#define TAG(x) x##_twoside_spec
+#define IND (SS_TWOSIDE_BIT|SS_RGBA_BIT)
+#define TAG(x) x##_twoside_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_TWOSIDE_BIT|SS_COPY_EXTRAS)
-#define TAG(x) x##_flat_twoside_spec
+#define IND (SS_FLAT_BIT|SS_TWOSIDE_BIT|SS_RGBA_BIT)
+#define TAG(x) x##_flat_twoside_rgba
#include "ss_tritmp.h"
-#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_COPY_EXTRAS)
-#define TAG(x) x##_offset_twoside_spec
+#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_RGBA_BIT)
+#define TAG(x) x##_offset_twoside_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_COPY_EXTRAS)
-#define TAG(x) x##_flat_offset_twoside_spec
+#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_RGBA_BIT)
+#define TAG(x) x##_flat_offset_twoside_rgba
#include "ss_tritmp.h"
-#define IND (SS_UNFILLED_BIT|SS_COPY_EXTRAS)
-#define TAG(x) x##_unfilled_spec
+#define IND (SS_UNFILLED_BIT|SS_RGBA_BIT)
+#define TAG(x) x##_unfilled_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS)
-#define TAG(x) x##_flat_unfilled_spec
+#define IND (SS_FLAT_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
+#define TAG(x) x##_flat_unfilled_rgba
#include "ss_tritmp.h"
-#define IND (SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS)
-#define TAG(x) x##_offset_unfilled_spec
+#define IND (SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
+#define TAG(x) x##_offset_unfilled_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS)
-#define TAG(x) x##_flat_offset_unfilled_spec
+#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
+#define TAG(x) x##_flat_offset_unfilled_rgba
#include "ss_tritmp.h"
-#define IND (SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS)
-#define TAG(x) x##_twoside_unfilled_spec
+#define IND (SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
+#define TAG(x) x##_twoside_unfilled_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS)
-#define TAG(x) x##_flat_twoside_unfilled_spec
+#define IND (SS_FLAT_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
+#define TAG(x) x##_flat_twoside_unfilled_rgba
#include "ss_tritmp.h"
-#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS)
-#define TAG(x) x##_offset_twoside_unfilled_spec
+#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
+#define TAG(x) x##_offset_twoside_unfilled_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS)
-#define TAG(x) x##_flat_offset_twoside_unfilled_spec
+#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
+#define TAG(x) x##_flat_offset_twoside_unfilled_rgba
#include "ss_tritmp.h"
@@ -201,25 +200,42 @@ void _swsetup_trifuncs_init( GLcontext *ctx )
init_offset_twoside_unfilled();
init_flat_offset_twoside_unfilled();
- init_spec();
- init_flat_spec();
- init_offset_spec();
- init_flat_offset_spec();
- init_twoside_spec();
- init_flat_twoside_spec();
- init_offset_twoside_spec();
- init_flat_offset_twoside_spec();
- init_unfilled_spec();
- init_flat_unfilled_spec();
- init_offset_unfilled_spec();
- init_flat_offset_unfilled_spec();
- init_twoside_unfilled_spec();
- init_flat_twoside_unfilled_spec();
- init_offset_twoside_unfilled_spec();
- init_flat_offset_twoside_unfilled_spec();
+ init_rgba();
+ init_flat_rgba();
+ init_offset_rgba();
+ init_flat_offset_rgba();
+ init_twoside_rgba();
+ init_flat_twoside_rgba();
+ init_offset_twoside_rgba();
+ init_flat_offset_twoside_rgba();
+ init_unfilled_rgba();
+ init_flat_unfilled_rgba();
+ init_offset_unfilled_rgba();
+ init_flat_offset_unfilled_rgba();
+ init_twoside_unfilled_rgba();
+ init_flat_twoside_unfilled_rgba();
+ init_offset_twoside_unfilled_rgba();
+ init_flat_offset_twoside_unfilled_rgba();
}
+static void swsetup_points( GLcontext *ctx, GLuint first, GLuint last )
+{
+ struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
+ SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts;
+ int i;
+
+ if (VB->Elts) {
+ for(i=first;i<=last;i++)
+ if(VB->ClipMask[VB->Elts[i]]==0)
+ _swrast_Point( ctx, &verts[VB->Elts[i]] );
+ } else {
+ for(i=first;i<=last;i++)
+ if(VB->ClipMask[i]==0)
+ _swrast_Point( ctx, &verts[i] );
+ }
+}
+
void _swsetup_choose_trifuncs( GLcontext *ctx )
{
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
@@ -234,17 +250,15 @@ void _swsetup_choose_trifuncs( GLcontext *ctx )
if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
ind |= SS_TWOSIDE_BIT;
- if (ctx->Polygon._Unfilled)
+ if (ctx->_TriangleCaps & DD_TRI_UNFILLED)
ind |= SS_UNFILLED_BIT;
- if ((ctx->_TriangleCaps & DD_SEPERATE_SPECULAR) ||
- ctx->RenderMode == GL_SELECT ||
- !ctx->Visual.RGBAflag)
- ind |= SS_COPY_EXTRAS;
+ if (ctx->Visual.RGBAflag)
+ ind |= SS_RGBA_BIT;
swsetup->Triangle = tri_tab[ind];
swsetup->Line = line_tab[ind];
- swsetup->Points = points_tab[ind];
swsetup->Quad = quad_tab[ind];
+ swsetup->Points = swsetup_points;
}