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/ss_context.c29
-rw-r--r--src/mesa/swrast_setup/ss_triangle.c4
-rw-r--r--src/mesa/swrast_setup/ss_tritmp.h3
3 files changed, 24 insertions, 12 deletions
diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c
index cd76375d0c..e1b60d0e85 100644
--- a/src/mesa/swrast_setup/ss_context.c
+++ b/src/mesa/swrast_setup/ss_context.c
@@ -42,6 +42,9 @@
#define _SWSETUP_NEW_RENDERINDEX (_NEW_POLYGON|_NEW_LIGHT|_NEW_PROGRAM)
+#define VARYING_EMIT_STYLE EMIT_4F
+
+
GLboolean
_swsetup_CreateContext( GLcontext *ctx )
{
@@ -142,17 +145,20 @@ _swsetup_RenderStart( GLcontext *ctx )
if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) {
- EMIT_ATTR( _TNL_ATTRIB_TEX(i), EMIT_4F, texcoord[i] );
+ EMIT_ATTR( _TNL_ATTRIB_TEX(i), EMIT_4F, attrib[FRAG_ATTRIB_TEX0 + i] );
}
}
}
- if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_GENERIC, _TNL_LAST_GENERIC )) {
- for (i = 0; i < MAX_VERTEX_ATTRIBS; i++) {
- if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_GENERIC(i) )) {
- EMIT_ATTR( _TNL_ATTRIB_GENERIC(i), VARYING_EMIT_STYLE, attribute[i] );
- }
- }
+ /* shader varying vars */
+ if (RENDERINPUTS_TEST_RANGE( index_bitset,
+ _TNL_FIRST_GENERIC, _TNL_LAST_GENERIC )) {
+ for (i = 0; i < ctx->Const.MaxVarying; i++) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_GENERIC(i) )) {
+ EMIT_ATTR( _TNL_ATTRIB_GENERIC(i), VARYING_EMIT_STYLE,
+ attrib[FRAG_ATTRIB_VAR0 + i] );
+ }
+ }
}
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POINTSIZE ))
@@ -236,8 +242,13 @@ _swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest )
for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
- _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_TEX0+i, dest->texcoord[i] );
-
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_TEX0+i,
+ dest->attrib[FRAG_ATTRIB_TEX0 + i] );
+
+ for (i = 0 ; i < ctx->Const.MaxVarying ; i++)
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_GENERIC0+i,
+ dest->attrib[FRAG_ATTRIB_VAR0 + i] );
+
_tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR0, tmp );
UNCLAMPED_FLOAT_TO_RGBA_CHAN( dest->color, tmp );
diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c
index 09244d9c4b..628e9288e8 100644
--- a/src/mesa/swrast_setup/ss_triangle.c
+++ b/src/mesa/swrast_setup/ss_triangle.c
@@ -290,8 +290,10 @@ 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->VertexProgram._Enabled && ctx->VertexProgram.TwoSideEnabled) ||
+ (ctx->FragmentProgram._Current && ctx->FragmentProgram._Current->Base.InputsRead & (1 << FRAG_ATTRIB_FOGC)))
ind |= SS_TWOSIDE_BIT;
/* We piggyback the two-sided stencil front/back determination on the
diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index 61c9b2817e..5b14b283f1 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -55,8 +55,7 @@ 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;
- if (ctx->Stencil.TestTwoSide)
- ctx->_Facing = facing; /* for 2-sided stencil test */
+ ctx->_Facing = facing;
if (IND & SS_UNFILLED_BIT)
mode = facing ? ctx->Polygon.BackMode : ctx->Polygon.FrontMode;