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

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
Marek Olšák 2018-05-23 01:37:12 -04:00
parent 27a9f27310
commit e453fc76e7

View file

@ -222,41 +222,49 @@ update_program(struct gl_context *ctx)
} }
static GLbitfield
update_single_program_constants(struct gl_context *ctx,
struct gl_program *prog,
gl_shader_stage stage)
{
if (prog) {
const struct gl_program_parameter_list *params = prog->Parameters;
if (params && params->StateFlags & ctx->NewState) {
if (ctx->DriverFlags.NewShaderConstants[stage])
ctx->NewDriverState |= ctx->DriverFlags.NewShaderConstants[stage];
else
return _NEW_PROGRAM_CONSTANTS;
}
}
return 0;
}
/** /**
* This updates fixed-func state constants such as gl_ModelViewMatrix.
* Examine shader constants and return either _NEW_PROGRAM_CONSTANTS or 0. * Examine shader constants and return either _NEW_PROGRAM_CONSTANTS or 0.
*/ */
static GLbitfield static GLbitfield
update_program_constants(struct gl_context *ctx) update_program_constants(struct gl_context *ctx)
{ {
GLbitfield new_state = 0x0; 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->FragmentProgram._Current) { if (ctx->API == API_OPENGL_COMPAT &&
const struct gl_program_parameter_list *params = ctx->Const.GLSLVersionCompat >= 150) {
ctx->FragmentProgram._Current->Parameters; new_state |=
if (params && params->StateFlags & ctx->NewState) { update_single_program_constants(ctx, ctx->GeometryProgram._Current,
if (ctx->DriverFlags.NewShaderConstants[MESA_SHADER_FRAGMENT]) { MESA_SHADER_GEOMETRY);
ctx->NewDriverState |=
ctx->DriverFlags.NewShaderConstants[MESA_SHADER_FRAGMENT];
} else {
new_state |= _NEW_PROGRAM_CONSTANTS;
}
}
}
/* Don't handle tessellation and geometry shaders here. They don't use if (_mesa_has_ARB_tessellation_shader(ctx)) {
* any state constants. new_state |=
*/ update_single_program_constants(ctx, ctx->TessCtrlProgram._Current,
MESA_SHADER_TESS_CTRL) |
if (ctx->VertexProgram._Current) { update_single_program_constants(ctx, ctx->TessEvalProgram._Current,
const struct gl_program_parameter_list *params = MESA_SHADER_TESS_EVAL);
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;
}
} }
} }