mesa: don't update shaders on fixed-func state changes if user shaders are bound
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4314>
This commit is contained in:
parent
256d5ca80a
commit
2e3a9d7828
|
@ -2290,6 +2290,8 @@ struct gl_vertex_program_state
|
|||
GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
|
||||
/** Should fixed-function T&L be implemented with a vertex prog? */
|
||||
GLboolean _MaintainTnlProgram;
|
||||
/** Whether the fixed-func program is being used right now. */
|
||||
GLboolean _UsesTnlProgram;
|
||||
|
||||
struct gl_program *Current; /**< User-bound vertex program */
|
||||
|
||||
|
@ -2363,6 +2365,8 @@ struct gl_fragment_program_state
|
|||
GLboolean Enabled; /**< User-set fragment program enable flag */
|
||||
/** Should fixed-function texturing be implemented with a fragment prog? */
|
||||
GLboolean _MaintainTexEnvProgram;
|
||||
/** Whether the fixed-func program is being used right now. */
|
||||
GLboolean _UsesTexEnvProgram;
|
||||
|
||||
struct gl_program *Current; /**< User-bound fragment program */
|
||||
|
||||
|
|
|
@ -363,6 +363,23 @@ update_program_constants(struct gl_context *ctx)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
update_fixed_func_program_usage(struct gl_context *ctx)
|
||||
{
|
||||
ctx->FragmentProgram._UsesTexEnvProgram =
|
||||
ctx->FragmentProgram._MaintainTexEnvProgram &&
|
||||
!ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT] && /* GLSL*/
|
||||
!_mesa_arb_fragment_program_enabled(ctx) &&
|
||||
!(_mesa_ati_fragment_shader_enabled(ctx) &&
|
||||
ctx->ATIFragmentShader.Current->Program);
|
||||
|
||||
ctx->VertexProgram._UsesTnlProgram =
|
||||
ctx->VertexProgram._MaintainTnlProgram &&
|
||||
!ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX] && /* GLSL */
|
||||
!_mesa_arb_vertex_program_enabled(ctx);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compute derived GL state.
|
||||
* If __struct gl_contextRec::NewState is non-zero then this function \b must
|
||||
|
@ -399,13 +416,17 @@ _mesa_update_state_locked( struct gl_context *ctx )
|
|||
ctx->API == API_OPENGLES) {
|
||||
GLbitfield prog_flags = _NEW_PROGRAM;
|
||||
|
||||
/* Determine which state flags effect vertex/fragment program state */
|
||||
if (ctx->FragmentProgram._MaintainTexEnvProgram) {
|
||||
if (new_state & _NEW_PROGRAM)
|
||||
update_fixed_func_program_usage(ctx);
|
||||
|
||||
/* Determine which states affect fixed-func vertex/fragment program. */
|
||||
if (ctx->FragmentProgram._UsesTexEnvProgram) {
|
||||
prog_flags |= (_NEW_BUFFERS | _NEW_TEXTURE_OBJECT | _NEW_FOG |
|
||||
_NEW_VARYING_VP_INPUTS | _NEW_LIGHT | _NEW_POINT |
|
||||
_NEW_RENDERMODE | _NEW_COLOR | _NEW_TEXTURE_STATE);
|
||||
}
|
||||
if (ctx->VertexProgram._MaintainTnlProgram) {
|
||||
|
||||
if (ctx->VertexProgram._UsesTnlProgram) {
|
||||
prog_flags |= (_NEW_VARYING_VP_INPUTS | _NEW_TEXTURE_OBJECT |
|
||||
_NEW_TEXTURE_MATRIX | _NEW_TRANSFORM | _NEW_POINT |
|
||||
_NEW_FOG | _NEW_LIGHT | _NEW_TEXTURE_STATE |
|
||||
|
|
Loading…
Reference in New Issue