[Mesa-dev] [RFC PATCH 20/40] mesa: Publish uniform update state flags
Abdiel Janulgue
abdiel.janulgue at linux.intel.com
Sun Jan 4 06:04:34 PST 2015
Trigger it when uniforms are updated
Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
src/mesa/main/dd.h | 2 ++
src/mesa/main/mtypes.h | 3 +++
src/mesa/main/state.c | 10 +++++-----
src/mesa/main/uniform_query.cpp | 6 ++++++
4 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 8c737e0..1be51fc 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -592,6 +592,8 @@ struct dd_function_table {
void (*TexParameter)(struct gl_context *ctx,
struct gl_texture_object *texObj,
GLenum pname, const GLfloat *params);
+ void (*UniformUpdate)(struct gl_context *ctx,
+ GLint location);
/** Set the viewport */
void (*Viewport)(struct gl_context *ctx);
/*@}*/
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 12ab3e8..e762199 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3933,6 +3933,9 @@ struct gl_matrix_stack
/* gap, re-use for core Mesa state only; use ctx->DriverFlags otherwise */
#define _NEW_VARYING_VP_INPUTS (1 << 31) /**< gl_context::varying_vp_inputs */
+#define _NEW_VERTEX_CONSTANTS (1ULL << 32)
+#define _NEW_GEOMETRY_CONSTANTS (1ULL << 33)
+#define _NEW_FRAGMENT_CONSTANTS (1ULL << 34)
#define _NEW_ALL ~0
/*@}*/
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index ccf60de..553ea8a 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -232,16 +232,16 @@ update_program(struct gl_context *ctx)
/**
* Examine shader constants and return either _NEW_PROGRAM_CONSTANTS or 0.
*/
-static GLbitfield
+static GLbitfield64
update_program_constants(struct gl_context *ctx)
{
- GLbitfield new_state = 0x0;
+ GLbitfield64 new_state = 0x0;
if (ctx->FragmentProgram._Current) {
const struct gl_program_parameter_list *params =
ctx->FragmentProgram._Current->Base.Parameters;
if (params && params->StateFlags & ctx->NewState) {
- new_state |= _NEW_PROGRAM_CONSTANTS;
+ new_state |= (_NEW_PROGRAM_CONSTANTS | _NEW_FRAGMENT_CONSTANTS);
}
}
@@ -251,7 +251,7 @@ update_program_constants(struct gl_context *ctx)
/*FIXME: StateFlags is always 0 because we have unnamed constant
* not state changes */
if (params /*&& params->StateFlags & ctx->NewState*/) {
- new_state |= _NEW_PROGRAM_CONSTANTS;
+ new_state |= (_NEW_PROGRAM_CONSTANTS | _NEW_GEOMETRY_CONSTANTS);
}
}
@@ -259,7 +259,7 @@ update_program_constants(struct gl_context *ctx)
const struct gl_program_parameter_list *params =
ctx->VertexProgram._Current->Base.Parameters;
if (params && params->StateFlags & ctx->NewState) {
- new_state |= _NEW_PROGRAM_CONSTANTS;
+ new_state |= (_NEW_PROGRAM_CONSTANTS | _NEW_VERTEX_CONSTANTS);
}
}
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 32870d0..14837ec 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -700,6 +700,9 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
count = MIN2(count, (int) (uni->array_elements - offset));
}
+ if (ctx->Driver.UniformUpdate)
+ ctx->Driver.UniformUpdate(ctx, location);
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
/* Store the data in the "actual type" backing storage for the uniform.
@@ -866,6 +869,9 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
count = MIN2(count, (int) (uni->array_elements - offset));
}
+ if (ctx->Driver.UniformUpdate)
+ ctx->Driver.UniformUpdate(ctx, location);
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
/* Store the data in the "actual type" backing storage for the uniform.
--
1.9.1
More information about the mesa-dev
mailing list