Patch moves shader_linked_or_absent functionality as part of _mesa_valid_to_render function. Function contained code marked as "not normally enabled" which would not work any more and removing that made it small enough to justify the move.
Signed-off-by: Tapani Pälli <tapani.pa...@intel.com> --- src/mesa/main/context.c | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 5a8f718..fb62275 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1858,32 +1858,6 @@ _mesa_check_blend_func_error(struct gl_context *ctx) return GL_TRUE; } -static bool -shader_linked_or_absent(struct gl_context *ctx, - const struct gl_shader_program *shProg, - bool *shader_present, const char *where) -{ - if (shProg) { - *shader_present = true; - - if (!shProg->LinkStatus) { - _mesa_error(ctx, GL_INVALID_OPERATION, "%s(shader not linked)", where); - return false; - } -#if 0 /* not normally enabled */ - { - char errMsg[100]; - if (!_mesa_validate_shader_program(ctx, shProg, errMsg)) { - _mesa_warning(ctx, "Shader program %u is invalid: %s", - shProg->Name, errMsg); - } - } -#endif - } - - return true; -} - /** * Prior to drawing anything with glBegin, glDrawArrays, etc. this function * is called to see if it's valid to render. This involves checking that @@ -1902,10 +1876,16 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where) if (ctx->NewState) _mesa_update_state(ctx); + /* Check if the programs are linked and mark which ones are present */ for (i = 0; i < MESA_SHADER_COMPUTE; i++) { - if (!shader_linked_or_absent(ctx, ctx->_Shader->CurrentProgram[i], - &from_glsl_shader[i], where)) - return GL_FALSE; + if (ctx->_Shader->CurrentProgram[i]) { + from_glsl_shader[i] = true; + if (!ctx->_Shader->CurrentProgram[i]->LinkStatus) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s(shader not linked)", where); + return GL_FALSE; + } + } } /* Any shader stages that are not supplied by the GLSL shader and have -- 1.9.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev