Commit e453fc76 authored by Marek Olšák's avatar Marek Olšák
Browse files

mesa: update fixed-func state constants for TCS, TES, GS


Reviewed-by: default avatarNicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: default avatarTimothy Arceri <tarceri@itsqueeze.com>
parent 27a9f273
...@@ -222,41 +222,49 @@ update_program(struct gl_context *ctx) ...@@ -222,41 +222,49 @@ update_program(struct gl_context *ctx)
} }
/**
* Examine shader constants and return either _NEW_PROGRAM_CONSTANTS or 0.
*/
static GLbitfield 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 (prog) {
const struct gl_program_parameter_list *params = prog->Parameters;
if (ctx->FragmentProgram._Current) {
const struct gl_program_parameter_list *params =
ctx->FragmentProgram._Current->Parameters;
if (params && params->StateFlags & ctx->NewState) { if (params && params->StateFlags & ctx->NewState) {
if (ctx->DriverFlags.NewShaderConstants[MESA_SHADER_FRAGMENT]) { if (ctx->DriverFlags.NewShaderConstants[stage])
ctx->NewDriverState |= ctx->NewDriverState |= ctx->DriverFlags.NewShaderConstants[stage];
ctx->DriverFlags.NewShaderConstants[MESA_SHADER_FRAGMENT]; else
} else { return _NEW_PROGRAM_CONSTANTS;
new_state |= _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 = * This updates fixed-func state constants such as gl_ModelViewMatrix.
ctx->VertexProgram._Current->Parameters; * Examine shader constants and return either _NEW_PROGRAM_CONSTANTS or 0.
if (params && params->StateFlags & ctx->NewState) { */
if (ctx->DriverFlags.NewShaderConstants[MESA_SHADER_VERTEX]) { static GLbitfield
ctx->NewDriverState |= update_program_constants(struct gl_context *ctx)
ctx->DriverFlags.NewShaderConstants[MESA_SHADER_VERTEX]; {
} else { GLbitfield new_state =
new_state |= _NEW_PROGRAM_CONSTANTS; 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);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment