mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-12-01 14:13:52 +08:00
Don't set extra bits in FLUSH_VERTICES, fix several state bugs.
This commit is contained in:
parent
5c161cf615
commit
3abf746a7e
@ -38,8 +38,8 @@
|
||||
#include "arbparse.h"
|
||||
#include "arbfragparse.h"
|
||||
|
||||
static void
|
||||
debug_fp_inst(GLint num, struct fp_instruction *fp)
|
||||
void
|
||||
_mesa_debug_fp_inst(GLint num, struct fp_instruction *fp)
|
||||
{
|
||||
GLint a;
|
||||
|
||||
@ -228,9 +228,7 @@ _mesa_parse_arb_fragment_program(GLcontext * ctx, GLenum target,
|
||||
}
|
||||
|
||||
#if DEBUG_FP
|
||||
debug_fp_inst(ap.Base.NumInstructions, ap.FPInstructions);
|
||||
#else
|
||||
(void) debug_fp_inst;
|
||||
_mesa_debug_fp_inst(ap.Base.NumInstructions, ap.FPInstructions);
|
||||
#endif
|
||||
|
||||
program->Instructions = ap.FPInstructions;
|
||||
|
@ -32,4 +32,8 @@ _mesa_parse_arb_fragment_program(GLcontext * ctx, GLenum target,
|
||||
const GLubyte * str, GLsizei len,
|
||||
struct fragment_program *program);
|
||||
|
||||
extern void
|
||||
_mesa_debug_fp_inst(GLint num, struct fp_instruction *fp);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -353,13 +353,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
|
||||
else
|
||||
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
|
||||
|
||||
if ((ctx->Light.Enabled &&
|
||||
ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
|
||||
|| ctx->Fog.ColorSumEnabled)
|
||||
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
|
||||
else
|
||||
ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
|
||||
|
||||
break;
|
||||
case GL_LINE_SMOOTH:
|
||||
if (ctx->Line.SmoothFlag == state)
|
||||
@ -791,14 +784,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_FOG);
|
||||
ctx->Fog.ColorSumEnabled = state;
|
||||
|
||||
if ((ctx->Light.Enabled &&
|
||||
ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
|
||||
|| ctx->Fog.ColorSumEnabled)
|
||||
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
|
||||
else
|
||||
ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
|
||||
|
||||
break;
|
||||
|
||||
/* GL_ARB_multisample */
|
||||
@ -861,21 +846,21 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
|
||||
CHECK_EXTENSION(NV_vertex_program, cap);
|
||||
if (ctx->VertexProgram.Enabled == state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_TRANSFORM | _NEW_PROGRAM); /* XXX OK? */
|
||||
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
|
||||
ctx->VertexProgram.Enabled = state;
|
||||
break;
|
||||
case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
|
||||
CHECK_EXTENSION(NV_vertex_program, cap);
|
||||
if (ctx->VertexProgram.PointSizeEnabled == state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_POINT | _NEW_PROGRAM);
|
||||
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
|
||||
ctx->VertexProgram.PointSizeEnabled = state;
|
||||
break;
|
||||
case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
|
||||
CHECK_EXTENSION(NV_vertex_program, cap);
|
||||
if (ctx->VertexProgram.TwoSideEnabled == state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_PROGRAM); /* XXX OK? */
|
||||
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
|
||||
ctx->VertexProgram.TwoSideEnabled = state;
|
||||
break;
|
||||
case GL_MAP1_VERTEX_ATTRIB0_4_NV:
|
||||
@ -931,7 +916,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
|
||||
CHECK_EXTENSION(NV_fragment_program, cap);
|
||||
if (ctx->FragmentProgram.Enabled == state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_TEXTURE);
|
||||
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
|
||||
ctx->FragmentProgram.Enabled = state;
|
||||
break;
|
||||
#endif /* FEATURE_NV_fragment_program */
|
||||
@ -967,7 +952,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
|
||||
CHECK_EXTENSION(ARB_fragment_program, cap);
|
||||
if (ctx->FragmentProgram.Enabled == state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_TEXTURE);
|
||||
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
|
||||
ctx->FragmentProgram.Enabled = state;
|
||||
break;
|
||||
#endif /* FEATURE_ARB_fragment_program */
|
||||
|
@ -409,14 +409,6 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
||||
ctx->Light.Model.ColorControl = newenum;
|
||||
|
||||
if ((ctx->Light.Enabled &&
|
||||
ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
|
||||
|| ctx->Fog.ColorSumEnabled)
|
||||
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
|
||||
else
|
||||
ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
|
||||
|
||||
break;
|
||||
default:
|
||||
_mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(pname=0x%x)", pname );
|
||||
|
@ -1980,7 +1980,7 @@ struct matrix_stack
|
||||
*/
|
||||
/*@{*/
|
||||
#define _DD_NEW_FLATSHADE _NEW_LIGHT
|
||||
#define _DD_NEW_SEPARATE_SPECULAR (_NEW_LIGHT | _NEW_FOG)
|
||||
#define _DD_NEW_SEPARATE_SPECULAR (_NEW_LIGHT | _NEW_FOG | _NEW_PROGRAM)
|
||||
#define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON
|
||||
#define _DD_NEW_TRI_LIGHT_TWOSIDE _NEW_LIGHT
|
||||
#define _DD_NEW_TRI_UNFILLED _NEW_POLYGON
|
||||
|
@ -798,8 +798,7 @@ _mesa_BindProgram(GLenum target, GLuint id)
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
/* texture state is dependent on current fragment and vertex programs */
|
||||
FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_TEXTURE);
|
||||
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
|
||||
|
||||
if ((target == GL_VERTEX_PROGRAM_NV
|
||||
&& ctx->Extensions.NV_vertex_program) ||
|
||||
|
@ -740,16 +740,13 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
|
||||
/*@{*/
|
||||
|
||||
|
||||
/*
|
||||
* Update items which depend on vertex/fragment programs.
|
||||
*/
|
||||
static void
|
||||
update_program( GLcontext *ctx )
|
||||
update_separate_specular( GLcontext *ctx )
|
||||
{
|
||||
if (ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current) {
|
||||
if (ctx->FragmentProgram.Current->InputsRead & (1 << FRAG_ATTRIB_COL1))
|
||||
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
|
||||
}
|
||||
if (NEED_SECONDARY_COLOR(ctx))
|
||||
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
|
||||
else
|
||||
ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
|
||||
}
|
||||
|
||||
|
||||
@ -872,7 +869,7 @@ update_arrays( GLcontext *ctx )
|
||||
*/
|
||||
void _mesa_update_state( GLcontext *ctx )
|
||||
{
|
||||
const GLuint new_state = ctx->NewState;
|
||||
GLuint new_state = ctx->NewState;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_STATE)
|
||||
_mesa_print_state("_mesa_update_state", new_state);
|
||||
@ -880,7 +877,7 @@ void _mesa_update_state( GLcontext *ctx )
|
||||
if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
|
||||
_mesa_update_modelview_project( ctx, new_state );
|
||||
|
||||
if (new_state & (_NEW_TEXTURE|_NEW_TEXTURE_MATRIX))
|
||||
if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX))
|
||||
_mesa_update_texture( ctx, new_state );
|
||||
|
||||
if (new_state & (_NEW_SCISSOR|_NEW_BUFFERS))
|
||||
@ -895,10 +892,10 @@ void _mesa_update_state( GLcontext *ctx )
|
||||
if (new_state & _IMAGE_NEW_TRANSFER_STATE)
|
||||
_mesa_update_pixel( ctx, new_state );
|
||||
|
||||
if (new_state & _NEW_PROGRAM)
|
||||
update_program( ctx );
|
||||
if (new_state & _DD_NEW_SEPARATE_SPECULAR)
|
||||
update_separate_specular( ctx );
|
||||
|
||||
if (new_state & _NEW_ARRAY)
|
||||
if (new_state & (_NEW_ARRAY | _NEW_PROGRAM))
|
||||
update_arrays( ctx );
|
||||
|
||||
/* ctx->_NeedEyeCoords is now up to date.
|
||||
@ -922,6 +919,7 @@ void _mesa_update_state( GLcontext *ctx )
|
||||
* Set ctx->NewState to zero to avoid recursion if
|
||||
* Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?)
|
||||
*/
|
||||
new_state = ctx->NewState;
|
||||
ctx->NewState = 0;
|
||||
ctx->Driver.UpdateState(ctx, new_state);
|
||||
ctx->Array.NewState = 0;
|
||||
|
@ -2703,6 +2703,10 @@ update_texture_state( GLcontext *ctx )
|
||||
{
|
||||
GLuint unit;
|
||||
|
||||
ctx->NewState |= _NEW_TEXTURE; /* TODO: only set this if there are
|
||||
* actual changes.
|
||||
*/
|
||||
|
||||
ctx->Texture._EnabledUnits = 0;
|
||||
ctx->Texture._GenFlags = 0;
|
||||
ctx->Texture._TexMatEnabled = 0;
|
||||
@ -2834,7 +2838,7 @@ void _mesa_update_texture( GLcontext *ctx, GLuint new_state )
|
||||
if (new_state & _NEW_TEXTURE_MATRIX)
|
||||
update_texture_matrices( ctx );
|
||||
|
||||
if (new_state & _NEW_TEXTURE)
|
||||
if (new_state & (_NEW_TEXTURE | _NEW_PROGRAM))
|
||||
update_texture_state( ctx );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user