diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/arbprogram.c | 30 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 3 | ||||
-rw-r--r-- | src/mesa/main/state.c | 14 |
3 files changed, 39 insertions, 8 deletions
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c index f3a0a54c016..625dc667f80 100644 --- a/src/mesa/main/arbprogram.c +++ b/src/mesa/main/arbprogram.c @@ -41,6 +41,23 @@ #include "program/program.h" #include "program/prog_print.h" +static void +flush_vertices_for_program_constants(struct gl_context *ctx, GLenum target) +{ + uint64_t new_driver_state; + + if (target == GL_FRAGMENT_PROGRAM_ARB) { + new_driver_state = + ctx->DriverFlags.NewShaderConstants[MESA_SHADER_FRAGMENT]; + } else { + new_driver_state = + ctx->DriverFlags.NewShaderConstants[MESA_SHADER_VERTEX]; + } + + FLUSH_VERTICES(ctx, new_driver_state ? 0 : _NEW_PROGRAM_CONSTANTS); + ctx->NewDriverState |= new_driver_state; +} + /** * Bind a program (make it current) * \note Called from the GL API dispatcher by both glBindProgramNV @@ -105,7 +122,8 @@ _mesa_BindProgramARB(GLenum target, GLuint id) } /* signal new program (and its new constants) */ - FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + flush_vertices_for_program_constants(ctx, target); /* bind newProg */ if (target == GL_VERTEX_PROGRAM_ARB) { @@ -434,7 +452,7 @@ _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index, GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); + flush_vertices_for_program_constants(ctx, target); if (get_env_param_pointer(ctx, "glProgramEnvParameter", target, index, ¶m)) { @@ -456,7 +474,7 @@ _mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index, GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); + flush_vertices_for_program_constants(ctx, target); if (get_env_param_pointer(ctx, "glProgramEnvParameter4fv", target, index, ¶m)) { @@ -472,7 +490,7 @@ _mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, GET_CURRENT_CONTEXT(ctx); GLfloat * dest; - FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); + flush_vertices_for_program_constants(ctx, target); if (count <= 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameters4fv(count)"); @@ -539,7 +557,7 @@ _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index, GET_CURRENT_CONTEXT(ctx); GLfloat *param; - FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); + flush_vertices_for_program_constants(ctx, target); if (get_local_param_pointer(ctx, "glProgramLocalParameterARB", target, index, ¶m)) { @@ -565,7 +583,7 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, GET_CURRENT_CONTEXT(ctx); GLfloat *dest; - FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); + flush_vertices_for_program_constants(ctx, target); if (count <= 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameters4fv(count)"); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index bc99da97f3e..0cb002469b2 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -4531,6 +4531,9 @@ struct gl_driver_flags /** gl_context::ViewportArray */ uint64_t NewViewport; + + /** Shader constants (uniforms, program parameters, state constants) */ + uint64_t NewShaderConstants[MESA_SHADER_STAGES]; }; struct gl_uniform_buffer_binding diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 2b4d8d46ea0..7aec98e5784 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -230,7 +230,12 @@ update_program_constants(struct gl_context *ctx) const struct gl_program_parameter_list *params = ctx->FragmentProgram._Current->Parameters; if (params && params->StateFlags & ctx->NewState) { - new_state |= _NEW_PROGRAM_CONSTANTS; + if (ctx->DriverFlags.NewShaderConstants[MESA_SHADER_FRAGMENT]) { + ctx->NewDriverState |= + ctx->DriverFlags.NewShaderConstants[MESA_SHADER_FRAGMENT]; + } else { + new_state |= _NEW_PROGRAM_CONSTANTS; + } } } @@ -242,7 +247,12 @@ update_program_constants(struct gl_context *ctx) const struct gl_program_parameter_list *params = ctx->VertexProgram._Current->Parameters; if (params && params->StateFlags & ctx->NewState) { - new_state |= _NEW_PROGRAM_CONSTANTS; + if (ctx->DriverFlags.NewShaderConstants[MESA_SHADER_VERTEX]) { + ctx->NewDriverState |= + ctx->DriverFlags.NewShaderConstants[MESA_SHADER_VERTEX]; + } else { + new_state |= _NEW_PROGRAM_CONSTANTS; + } } } |