Restore old _TriangleCaps code to fix Blender problem (bug 12164)
This commit is contained in:
@@ -364,6 +364,10 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
|
|||||||
case GL_LIGHTING:
|
case GL_LIGHTING:
|
||||||
if (ctx->Light.Enabled == state)
|
if (ctx->Light.Enabled == state)
|
||||||
return;
|
return;
|
||||||
|
if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
|
||||||
|
ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
|
||||||
|
else
|
||||||
|
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
|
||||||
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
||||||
ctx->Light.Enabled = state;
|
ctx->Light.Enabled = state;
|
||||||
break;
|
break;
|
||||||
@@ -372,12 +376,14 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
|
|||||||
return;
|
return;
|
||||||
FLUSH_VERTICES(ctx, _NEW_LINE);
|
FLUSH_VERTICES(ctx, _NEW_LINE);
|
||||||
ctx->Line.SmoothFlag = state;
|
ctx->Line.SmoothFlag = state;
|
||||||
|
ctx->_TriangleCaps ^= DD_LINE_SMOOTH;
|
||||||
break;
|
break;
|
||||||
case GL_LINE_STIPPLE:
|
case GL_LINE_STIPPLE:
|
||||||
if (ctx->Line.StippleFlag == state)
|
if (ctx->Line.StippleFlag == state)
|
||||||
return;
|
return;
|
||||||
FLUSH_VERTICES(ctx, _NEW_LINE);
|
FLUSH_VERTICES(ctx, _NEW_LINE);
|
||||||
ctx->Line.StippleFlag = state;
|
ctx->Line.StippleFlag = state;
|
||||||
|
ctx->_TriangleCaps ^= DD_LINE_STIPPLE;
|
||||||
break;
|
break;
|
||||||
case GL_INDEX_LOGIC_OP:
|
case GL_INDEX_LOGIC_OP:
|
||||||
if (ctx->Color.IndexLogicOpEnabled == state)
|
if (ctx->Color.IndexLogicOpEnabled == state)
|
||||||
@@ -516,18 +522,21 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
|
|||||||
return;
|
return;
|
||||||
FLUSH_VERTICES(ctx, _NEW_POINT);
|
FLUSH_VERTICES(ctx, _NEW_POINT);
|
||||||
ctx->Point.SmoothFlag = state;
|
ctx->Point.SmoothFlag = state;
|
||||||
|
ctx->_TriangleCaps ^= DD_POINT_SMOOTH;
|
||||||
break;
|
break;
|
||||||
case GL_POLYGON_SMOOTH:
|
case GL_POLYGON_SMOOTH:
|
||||||
if (ctx->Polygon.SmoothFlag == state)
|
if (ctx->Polygon.SmoothFlag == state)
|
||||||
return;
|
return;
|
||||||
FLUSH_VERTICES(ctx, _NEW_POLYGON);
|
FLUSH_VERTICES(ctx, _NEW_POLYGON);
|
||||||
ctx->Polygon.SmoothFlag = state;
|
ctx->Polygon.SmoothFlag = state;
|
||||||
|
ctx->_TriangleCaps ^= DD_TRI_SMOOTH;
|
||||||
break;
|
break;
|
||||||
case GL_POLYGON_STIPPLE:
|
case GL_POLYGON_STIPPLE:
|
||||||
if (ctx->Polygon.StippleFlag == state)
|
if (ctx->Polygon.StippleFlag == state)
|
||||||
return;
|
return;
|
||||||
FLUSH_VERTICES(ctx, _NEW_POLYGON);
|
FLUSH_VERTICES(ctx, _NEW_POLYGON);
|
||||||
ctx->Polygon.StippleFlag = state;
|
ctx->Polygon.StippleFlag = state;
|
||||||
|
ctx->_TriangleCaps ^= DD_TRI_STIPPLE;
|
||||||
break;
|
break;
|
||||||
case GL_POLYGON_OFFSET_POINT:
|
case GL_POLYGON_OFFSET_POINT:
|
||||||
if (ctx->Polygon.OffsetPoint == state)
|
if (ctx->Polygon.OffsetPoint == state)
|
||||||
@@ -877,6 +886,10 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
|
|||||||
return;
|
return;
|
||||||
FLUSH_VERTICES(ctx, _NEW_STENCIL);
|
FLUSH_VERTICES(ctx, _NEW_STENCIL);
|
||||||
ctx->Stencil.TestTwoSide = state;
|
ctx->Stencil.TestTwoSide = state;
|
||||||
|
if (state)
|
||||||
|
ctx->_TriangleCaps |= DD_TRI_TWOSTENCIL;
|
||||||
|
else
|
||||||
|
ctx->_TriangleCaps &= ~DD_TRI_TWOSTENCIL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if FEATURE_ARB_fragment_program
|
#if FEATURE_ARB_fragment_program
|
||||||
|
@@ -53,6 +53,11 @@ _mesa_ShadeModel( GLenum mode )
|
|||||||
|
|
||||||
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
||||||
ctx->Light.ShadeModel = mode;
|
ctx->Light.ShadeModel = mode;
|
||||||
|
if (mode == GL_FLAT)
|
||||||
|
ctx->_TriangleCaps |= DD_FLATSHADE;
|
||||||
|
else
|
||||||
|
ctx->_TriangleCaps &= ~DD_FLATSHADE;
|
||||||
|
|
||||||
if (ctx->Driver.ShadeModel)
|
if (ctx->Driver.ShadeModel)
|
||||||
ctx->Driver.ShadeModel( ctx, mode );
|
ctx->Driver.ShadeModel( ctx, mode );
|
||||||
}
|
}
|
||||||
@@ -441,6 +446,10 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
|
|||||||
return;
|
return;
|
||||||
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
||||||
ctx->Light.Model.TwoSide = newbool;
|
ctx->Light.Model.TwoSide = newbool;
|
||||||
|
if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
|
||||||
|
ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
|
||||||
|
else
|
||||||
|
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
|
||||||
break;
|
break;
|
||||||
case GL_LIGHT_MODEL_COLOR_CONTROL:
|
case GL_LIGHT_MODEL_COLOR_CONTROL:
|
||||||
if (params[0] == (GLfloat) GL_SINGLE_COLOR)
|
if (params[0] == (GLfloat) GL_SINGLE_COLOR)
|
||||||
|
@@ -56,6 +56,11 @@ _mesa_LineWidth( GLfloat width )
|
|||||||
FLUSH_VERTICES(ctx, _NEW_LINE);
|
FLUSH_VERTICES(ctx, _NEW_LINE);
|
||||||
ctx->Line.Width = width;
|
ctx->Line.Width = width;
|
||||||
|
|
||||||
|
if (width != 1.0F)
|
||||||
|
ctx->_TriangleCaps |= DD_LINE_WIDTH;
|
||||||
|
else
|
||||||
|
ctx->_TriangleCaps &= ~DD_LINE_WIDTH;
|
||||||
|
|
||||||
if (ctx->Driver.LineWidth)
|
if (ctx->Driver.LineWidth)
|
||||||
ctx->Driver.LineWidth(ctx, width);
|
ctx->Driver.LineWidth(ctx, width);
|
||||||
}
|
}
|
||||||
|
@@ -3040,7 +3040,10 @@ struct __GLcontextRec
|
|||||||
|
|
||||||
/** \name Derived state */
|
/** \name Derived state */
|
||||||
/*@{*/
|
/*@{*/
|
||||||
GLbitfield _TriangleCaps; /**< bitwise-or of DD_* flags */
|
/** Bitwise-or of DD_* flags. Note that this bitfield may be used before
|
||||||
|
* state validation so they need to always be current.
|
||||||
|
*/
|
||||||
|
GLbitfield _TriangleCaps;
|
||||||
GLbitfield _ImageTransferState;/**< bitwise-or of IMAGE_*_BIT flags */
|
GLbitfield _ImageTransferState;/**< bitwise-or of IMAGE_*_BIT flags */
|
||||||
GLfloat _EyeZDir[3];
|
GLfloat _EyeZDir[3];
|
||||||
GLfloat _ModelViewInvScale;
|
GLfloat _ModelViewInvScale;
|
||||||
|
@@ -123,6 +123,11 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
|
|||||||
ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
|
ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
|
||||||
ctx->Point.Params[1] != 0.0 ||
|
ctx->Point.Params[1] != 0.0 ||
|
||||||
ctx->Point.Params[2] != 0.0);
|
ctx->Point.Params[2] != 0.0);
|
||||||
|
|
||||||
|
if (ctx->Point._Attenuated)
|
||||||
|
ctx->_TriangleCaps |= DD_POINT_ATTEN;
|
||||||
|
else
|
||||||
|
ctx->_TriangleCaps &= ~DD_POINT_ATTEN;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||||
|
@@ -167,6 +167,11 @@ _mesa_PolygonMode( GLenum face, GLenum mode )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctx->Polygon.FrontMode == GL_FILL && ctx->Polygon.BackMode == GL_FILL)
|
||||||
|
ctx->_TriangleCaps &= ~DD_TRI_UNFILLED;
|
||||||
|
else
|
||||||
|
ctx->_TriangleCaps |= DD_TRI_UNFILLED;
|
||||||
|
|
||||||
if (ctx->Driver.PolygonMode)
|
if (ctx->Driver.PolygonMode)
|
||||||
ctx->Driver.PolygonMode(ctx, face, mode);
|
ctx->Driver.PolygonMode(ctx, face, mode);
|
||||||
}
|
}
|
||||||
|
@@ -826,6 +826,16 @@ _mesa_init_exec_table(struct _glapi_table *exec)
|
|||||||
/*@{*/
|
/*@{*/
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_separate_specular(GLcontext *ctx)
|
||||||
|
{
|
||||||
|
if (NEED_SECONDARY_COLOR(ctx))
|
||||||
|
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
|
||||||
|
else
|
||||||
|
ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update state dependent on vertex arrays.
|
* Update state dependent on vertex arrays.
|
||||||
*/
|
*/
|
||||||
@@ -1050,6 +1060,24 @@ update_color(GLcontext *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET
|
||||||
|
* in ctx->_TriangleCaps if needed.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
update_polygon(GLcontext *ctx)
|
||||||
|
{
|
||||||
|
ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET);
|
||||||
|
|
||||||
|
if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
|
||||||
|
ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
|
||||||
|
|
||||||
|
if ( ctx->Polygon.OffsetPoint
|
||||||
|
|| ctx->Polygon.OffsetLine
|
||||||
|
|| ctx->Polygon.OffsetFill)
|
||||||
|
ctx->_TriangleCaps |= DD_TRI_OFFSET;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the ctx->_TriangleCaps bitfield.
|
* Update the ctx->_TriangleCaps bitfield.
|
||||||
@@ -1057,6 +1085,7 @@ update_color(GLcontext *ctx)
|
|||||||
* This function must be called after other update_*() functions since
|
* This function must be called after other update_*() functions since
|
||||||
* there are dependencies on some other derived values.
|
* there are dependencies on some other derived values.
|
||||||
*/
|
*/
|
||||||
|
#if 0
|
||||||
static void
|
static void
|
||||||
update_tricaps(GLcontext *ctx, GLbitfield new_state)
|
update_tricaps(GLcontext *ctx, GLbitfield new_state)
|
||||||
{
|
{
|
||||||
@@ -1122,6 +1151,7 @@ update_tricaps(GLcontext *ctx, GLbitfield new_state)
|
|||||||
if (ctx->Stencil._TestTwoSide)
|
if (ctx->Stencil._TestTwoSide)
|
||||||
ctx->_TriangleCaps |= DD_TRI_TWOSTENCIL;
|
ctx->_TriangleCaps |= DD_TRI_TWOSTENCIL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1159,6 +1189,9 @@ _mesa_update_state_locked( GLcontext *ctx )
|
|||||||
if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT))
|
if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT))
|
||||||
_mesa_update_draw_buffer_bounds( ctx );
|
_mesa_update_draw_buffer_bounds( ctx );
|
||||||
|
|
||||||
|
if (new_state & _NEW_POLYGON)
|
||||||
|
update_polygon( ctx );
|
||||||
|
|
||||||
if (new_state & _NEW_LIGHT)
|
if (new_state & _NEW_LIGHT)
|
||||||
_mesa_update_lighting( ctx );
|
_mesa_update_lighting( ctx );
|
||||||
|
|
||||||
@@ -1168,6 +1201,9 @@ _mesa_update_state_locked( GLcontext *ctx )
|
|||||||
if (new_state & _IMAGE_NEW_TRANSFER_STATE)
|
if (new_state & _IMAGE_NEW_TRANSFER_STATE)
|
||||||
_mesa_update_pixel( ctx, new_state );
|
_mesa_update_pixel( ctx, new_state );
|
||||||
|
|
||||||
|
if (new_state & _DD_NEW_SEPARATE_SPECULAR)
|
||||||
|
update_separate_specular( ctx );
|
||||||
|
|
||||||
if (new_state & (_NEW_ARRAY | _NEW_PROGRAM))
|
if (new_state & (_NEW_ARRAY | _NEW_PROGRAM))
|
||||||
update_arrays( ctx );
|
update_arrays( ctx );
|
||||||
|
|
||||||
@@ -1177,9 +1213,11 @@ _mesa_update_state_locked( GLcontext *ctx )
|
|||||||
if (new_state & _NEW_COLOR)
|
if (new_state & _NEW_COLOR)
|
||||||
update_color( ctx );
|
update_color( ctx );
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (new_state & (_NEW_POINT | _NEW_LINE | _NEW_POLYGON | _NEW_LIGHT
|
if (new_state & (_NEW_POINT | _NEW_LINE | _NEW_POLYGON | _NEW_LIGHT
|
||||||
| _NEW_STENCIL | _DD_NEW_SEPARATE_SPECULAR))
|
| _NEW_STENCIL | _DD_NEW_SEPARATE_SPECULAR))
|
||||||
update_tricaps( ctx, new_state );
|
update_tricaps( ctx, new_state );
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ctx->FragmentProgram._MaintainTexEnvProgram) {
|
if (ctx->FragmentProgram._MaintainTexEnvProgram) {
|
||||||
if (new_state & (_NEW_TEXTURE | _DD_NEW_SEPARATE_SPECULAR | _NEW_FOG))
|
if (new_state & (_NEW_TEXTURE | _DD_NEW_SEPARATE_SPECULAR | _NEW_FOG))
|
||||||
|
Reference in New Issue
Block a user