summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/arbprogram.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/arbprogram.c')
-rw-r--r--src/mesa/main/arbprogram.c30
1 files changed, 24 insertions, 6 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, &param)) {
@@ -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, &param)) {
@@ -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, &param)) {
@@ -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)");