summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/arbprogram.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-06-10 17:22:09 +0200
committerMarek Olšák <[email protected]>2017-06-22 01:51:02 +0200
commit670c4dd3957efe0022a3ac36074fd89a5873d953 (patch)
tree13668237b0a6a149a43204f608ce817c8614f9dd /src/mesa/main/arbprogram.c
parent0b70d6ec568a2c5d7b2ff814e6e26b6d1379c829 (diff)
mesa: don't flag _NEW_PROGRAM_CONSTANTS for non-GLSL programs for st/mesa
This has the benefit that we get to set up constants for exactly the shader stage that needs it. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
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)");