summaryrefslogtreecommitdiff
path: root/src/mesa/swrast_setup
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/swrast_setup')
-rw-r--r--src/mesa/swrast_setup/descrip.mms42
-rw-r--r--src/mesa/swrast_setup/sources10
-rw-r--r--src/mesa/swrast_setup/ss_context.c23
-rw-r--r--src/mesa/swrast_setup/ss_triangle.c14
-rw-r--r--src/mesa/swrast_setup/ss_triangle.h1
-rw-r--r--src/mesa/swrast_setup/ss_tritmp.h20
6 files changed, 74 insertions, 36 deletions
diff --git a/src/mesa/swrast_setup/descrip.mms b/src/mesa/swrast_setup/descrip.mms
new file mode 100644
index 0000000000..32ffd80732
--- /dev/null
+++ b/src/mesa/swrast_setup/descrip.mms
@@ -0,0 +1,42 @@
+# Makefile for core library for VMS
+# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
+# Last revision : 3 October 2007
+
+.first
+ define gl [---.include.gl]
+ define math [-.math]
+ define tnl [-.tnl]
+ define vbo [-.vbo]
+ define swrast [-.swrast]
+ define array_cache [-.array_cache]
+ define glapi [-.glapi]
+ define main [-.main]
+
+.include [---]mms-config.
+
+##### MACROS #####
+
+VPATH = RCS
+
+INCDIR = [---.include],[-.main],[-.glapi]
+LIBDIR = [---.lib]
+CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm
+
+SOURCES = ss_context.c ss_triangle.c
+
+OBJECTS = ss_context.obj,ss_triangle.obj
+##### RULES #####
+
+VERSION=Mesa V3.4
+
+##### TARGETS #####
+# Make the library
+$(LIBDIR)$(GL_LIB) : $(OBJECTS)
+ @ library $(LIBDIR)$(GL_LIB) $(OBJECTS)
+
+clean :
+ purge
+ delete *.obj;*
+
+ss_context.obj : ss_context.c
+ss_triangle.obj : ss_triangle.c
diff --git a/src/mesa/swrast_setup/sources b/src/mesa/swrast_setup/sources
deleted file mode 100644
index dee14b6774..0000000000
--- a/src/mesa/swrast_setup/sources
+++ /dev/null
@@ -1,10 +0,0 @@
-MESA_SWRAST_SETUP_SOURCES = \
-ss_context.c \
-ss_triangle.c
-
-MESA_SWRAST_SETUP_HEADERS = \
-ss_context.h \
-ss_triangle.h \
-ss_tritmp.h \
-ss_vb.h \
-swrast_setup.h
diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c
index fd6935e7be..61172f9979 100644
--- a/src/mesa/swrast_setup/ss_context.c
+++ b/src/mesa/swrast_setup/ss_context.c
@@ -28,13 +28,14 @@
#include "main/glheader.h"
#include "main/imports.h"
#include "main/colormac.h"
-#include "ss_context.h"
-#include "ss_triangle.h"
-#include "swrast_setup.h"
#include "tnl/tnl.h"
#include "tnl/t_context.h"
#include "tnl/t_pipeline.h"
#include "tnl/t_vertex.h"
+#include "swrast_setup.h"
+#include "ss_context.h"
+#include "ss_triangle.h"
+
/* Need to check lighting state and vertex program state to know
* if two-sided lighting is in effect.
@@ -111,22 +112,25 @@ setup_vertex_format(GLcontext *ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
+ GLboolean intColors = !ctx->FragmentProgram._Current
+ && !ctx->ATIFragmentShader._Enabled
+ && ctx->RenderMode == GL_RENDER
+ && CHAN_TYPE == GL_UNSIGNED_BYTE;
- if (!RENDERINPUTS_EQUAL(tnl->render_inputs_bitset,
+ if (intColors != swsetup->intColors ||
+ !RENDERINPUTS_EQUAL(tnl->render_inputs_bitset,
swsetup->last_index_bitset)) {
DECLARE_RENDERINPUTS(index_bitset);
struct tnl_attr_map map[_TNL_ATTRIB_MAX];
int i, e = 0;
+ swsetup->intColors = intColors;
+
RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, attrib[FRAG_ATTRIB_WPOS] );
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR0 )) {
- swsetup->intColors = !ctx->FragmentProgram._Current
- && !ctx->ATIFragmentShader._Enabled
- && ctx->RenderMode == GL_RENDER
- && CHAN_TYPE == GL_UNSIGNED_BYTE;
if (swsetup->intColors)
EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4CHAN_4F_RGBA, color );
else
@@ -201,6 +205,9 @@ _swsetup_RenderStart( GLcontext *ctx )
swsetup->NewState = 0;
+ /* This will change if drawing unfilled tris */
+ _swrast_SetFacing(ctx, 0);
+
_swrast_render_start(ctx);
/* Important */
diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c
index 9fef7a52ec..54e24c4c44 100644
--- a/src/mesa/swrast_setup/ss_triangle.c
+++ b/src/mesa/swrast_setup/ss_triangle.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 7.1
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -68,6 +68,8 @@ static void _swsetup_render_line_tri( GLcontext *ctx,
return;
}
+ _swrast_SetFacing(ctx, facing);
+
if (ctx->Light.ShadeModel == GL_FLAT) {
COPY_CHAN4(c[0], v0->color);
COPY_CHAN4(c[1], v1->color);
@@ -127,6 +129,8 @@ static void _swsetup_render_point_tri( GLcontext *ctx,
return;
}
+ _swrast_SetFacing(ctx, facing);
+
if (ctx->Light.ShadeModel == GL_FLAT) {
/* save colors/indexes for v0, v1 vertices */
COPY_CHAN4(c[0], v0->color);
@@ -290,10 +294,8 @@ void _swsetup_choose_trifuncs( GLcontext *ctx )
ctx->Polygon.OffsetFill)
ind |= SS_OFFSET_BIT;
- /* Note: gl_FrontFacing lives in fragment input FOGC.Y at this time */
if ((ctx->Light.Enabled && ctx->Light.Model.TwoSide) ||
- (ctx->VertexProgram._Enabled && ctx->VertexProgram.TwoSideEnabled) ||
- (ctx->FragmentProgram._Current && ctx->FragmentProgram._Current->Base.InputsRead & (1 << FRAG_ATTRIB_FOGC)))
+ (ctx->VertexProgram._Current && ctx->VertexProgram.TwoSideEnabled))
ind |= SS_TWOSIDE_BIT;
/* We piggyback the two-sided stencil front/back determination on the
@@ -311,6 +313,4 @@ void _swsetup_choose_trifuncs( GLcontext *ctx )
tnl->Driver.Render.Quad = quad_tab[ind];
tnl->Driver.Render.Line = swsetup_line;
tnl->Driver.Render.Points = swsetup_points;
-
- ctx->_Facing = 0;
}
diff --git a/src/mesa/swrast_setup/ss_triangle.h b/src/mesa/swrast_setup/ss_triangle.h
index 863e744607..007fa2e914 100644
--- a/src/mesa/swrast_setup/ss_triangle.h
+++ b/src/mesa/swrast_setup/ss_triangle.h
@@ -29,7 +29,6 @@
#ifndef SS_TRIANGLE_H
#define SS_TRIANGLE_H
-#include "main/mtypes.h"
#include "ss_context.h"
diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index f6b738d60d..97d2f4a16b 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -49,7 +49,6 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
v[1] = &verts[e1];
v[2] = &verts[e2];
-
if (IND & (SS_TWOSIDE_BIT | SS_OFFSET_BIT | SS_UNFILLED_BIT))
{
GLfloat ex = v[0]->attrib[FRAG_ATTRIB_WPOS][0] - v[2]->attrib[FRAG_ATTRIB_WPOS][0];
@@ -61,7 +60,6 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT))
{
facing = (cc < 0.0) ^ ctx->Polygon._FrontBit;
- ctx->_Facing = facing;
if (IND & SS_UNFILLED_BIT)
mode = facing ? ctx->Polygon.BackMode : ctx->Polygon.FrontMode;
@@ -238,14 +236,16 @@ static void TAG(quadfunc)( GLcontext *ctx, GLuint v0,
{
if (IND & SS_UNFILLED_BIT) {
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLubyte ef1 = VB->EdgeFlag[v1];
- GLubyte ef3 = VB->EdgeFlag[v3];
- VB->EdgeFlag[v1] = 0;
- TAG(triangle)( ctx, v0, v1, v3 );
- VB->EdgeFlag[v1] = ef1;
- VB->EdgeFlag[v3] = 0;
- TAG(triangle)( ctx, v1, v2, v3 );
- VB->EdgeFlag[v3] = ef3;
+ if (VB->EdgeFlag) { /* XXX this test shouldn't be needed (bug 12614) */
+ GLubyte ef1 = VB->EdgeFlag[v1];
+ GLubyte ef3 = VB->EdgeFlag[v3];
+ VB->EdgeFlag[v1] = 0;
+ TAG(triangle)( ctx, v0, v1, v3 );
+ VB->EdgeFlag[v1] = ef1;
+ VB->EdgeFlag[v3] = 0;
+ TAG(triangle)( ctx, v1, v2, v3 );
+ VB->EdgeFlag[v3] = ef3;
+ }
} else {
TAG(triangle)( ctx, v0, v1, v3 );
TAG(triangle)( ctx, v1, v2, v3 );