diff options
author | Alejandro Piñeiro <apinheiro@igalia.com> | 2016-08-23 17:00:54 +0200 |
---|---|---|
committer | Alejandro Piñeiro <apinheiro@igalia.com> | 2016-08-24 14:57:13 +0200 |
commit | b4959e17f18aff68465f4b3445b6a53ee0227b16 (patch) | |
tree | fe369939d09ebcc341bd8790d4f78710b89b6246 /src/mesa/main | |
parent | 9411eb67ecebfc76c909ca81b09e6e7fe08ac8eb (diff) |
shaderapi: don't generate not linked error on GetProgramStage in general
Both ARB_shader_subroutine and the GL core spec doesn't list any
error when the program is not linked.
We left a error generation for the uniform location, in order to be
consistent with other methods from the spec that generate them.
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/shaderapi.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 8b19c01b759..d9699555497 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -2725,8 +2725,25 @@ _mesa_GetProgramStageiv(GLuint program, GLenum shadertype, stage = _mesa_shader_enum_to_shader_stage(shadertype); sh = shProg->_LinkedShaders[stage]; + + /* ARB_shader_subroutine doesn't ask the program to be linked, or list any + * INVALID_OPERATION in the case of not be linked. + * + * And for some pnames, like GL_ACTIVE_SUBROUTINE_UNIFORMS, you can ask the + * same info using other specs (ARB_program_interface_query), without the + * need of the program to be linked, being the value for that case 0. + * + * But at the same time, some other methods require the program to be + * linked for pname related to locations, so it would be inconsistent to + * not do the same here. So we are: + * * Return GL_INVALID_OPERATION if not linked only for locations. + * * Setting a default value of 0, to be returned if not linked. + */ if (!sh) { - _mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name); + values[0] = 0; + if (pname == GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name); + } return; } |