summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-05-23 01:37:12 -0400
committerMarek Olšák <[email protected]>2018-05-29 20:13:24 -0400
commite453fc76e7d38df44aa27fed7df011df76b1d03a (patch)
tree2d823fb90a924a8237530afebd9e8d4e9dbd5f52 /src
parent27a9f273109d0f7826013afcc3b9a3dcd6a79a91 (diff)
mesa: update fixed-func state constants for TCS, TES, GS
Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/state.c64
1 files changed, 36 insertions, 28 deletions
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index be8f3f302c6..097cd9e20d2 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -222,41 +222,49 @@ update_program(struct gl_context *ctx)
}
-/**
- * Examine shader constants and return either _NEW_PROGRAM_CONSTANTS or 0.
- */
static GLbitfield
-update_program_constants(struct gl_context *ctx)
+update_single_program_constants(struct gl_context *ctx,
+ struct gl_program *prog,
+ gl_shader_stage stage)
{
- GLbitfield new_state = 0x0;
-
- if (ctx->FragmentProgram._Current) {
- const struct gl_program_parameter_list *params =
- ctx->FragmentProgram._Current->Parameters;
+ if (prog) {
+ const struct gl_program_parameter_list *params = prog->Parameters;
if (params && params->StateFlags & ctx->NewState) {
- if (ctx->DriverFlags.NewShaderConstants[MESA_SHADER_FRAGMENT]) {
- ctx->NewDriverState |=
- ctx->DriverFlags.NewShaderConstants[MESA_SHADER_FRAGMENT];
- } else {
- new_state |= _NEW_PROGRAM_CONSTANTS;
- }
+ if (ctx->DriverFlags.NewShaderConstants[stage])
+ ctx->NewDriverState |= ctx->DriverFlags.NewShaderConstants[stage];
+ else
+ return _NEW_PROGRAM_CONSTANTS;
}
}
+ return 0;
+}
- /* Don't handle tessellation and geometry shaders here. They don't use
- * any state constants.
- */
- if (ctx->VertexProgram._Current) {
- const struct gl_program_parameter_list *params =
- ctx->VertexProgram._Current->Parameters;
- if (params && params->StateFlags & ctx->NewState) {
- if (ctx->DriverFlags.NewShaderConstants[MESA_SHADER_VERTEX]) {
- ctx->NewDriverState |=
- ctx->DriverFlags.NewShaderConstants[MESA_SHADER_VERTEX];
- } else {
- new_state |= _NEW_PROGRAM_CONSTANTS;
- }
+/**
+ * This updates fixed-func state constants such as gl_ModelViewMatrix.
+ * Examine shader constants and return either _NEW_PROGRAM_CONSTANTS or 0.
+ */
+static GLbitfield
+update_program_constants(struct gl_context *ctx)
+{
+ GLbitfield new_state =
+ update_single_program_constants(ctx, ctx->VertexProgram._Current,
+ MESA_SHADER_VERTEX) |
+ update_single_program_constants(ctx, ctx->FragmentProgram._Current,
+ MESA_SHADER_FRAGMENT);
+
+ if (ctx->API == API_OPENGL_COMPAT &&
+ ctx->Const.GLSLVersionCompat >= 150) {
+ new_state |=
+ update_single_program_constants(ctx, ctx->GeometryProgram._Current,
+ MESA_SHADER_GEOMETRY);
+
+ if (_mesa_has_ARB_tessellation_shader(ctx)) {
+ new_state |=
+ update_single_program_constants(ctx, ctx->TessCtrlProgram._Current,
+ MESA_SHADER_TESS_CTRL) |
+ update_single_program_constants(ctx, ctx->TessEvalProgram._Current,
+ MESA_SHADER_TESS_EVAL);
}
}