[Mesa-dev] [PATCH v2 3/3] mesa: do not fail when stage not linked is not in use

Tapani Pälli tapani.palli at intel.com
Tue Dec 8 01:16:46 PST 2015


Shader linking may fail but if glUseProgramStages does not take shader
in use, previously set stages to pipeline should continue to work.

This fixes a subtest in following CTS test:
	ES31-CTS.sepshaderobjs.StateInteraction

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
 src/mesa/main/context.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index d73c984..df2c41c 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1977,6 +1977,24 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
       bool from_glsl_shader[MESA_SHADER_COMPUTE] = { false };
 
       for (i = 0; i < MESA_SHADER_COMPUTE; i++) {
+
+         /* If stage has not marked as active in the pipeline, it does not
+          * matter if linking this shader failed. If stage has been set as used
+          * it should have ValidProgramUse set.
+          *
+          * OpenGL ES 3.1 spec (7.3 Program objects):
+          *
+          *     "If a program object that is active for any shader stage is
+          *     re-linked unsuccessfully, the link status will be set to FALSE,
+          *     but any existing executables and associated state will remain
+          *     part of the current rendering state until a subsequent call to
+          *     UseProgram, UseProgramStages, or BindProgramPipeline removes
+          *     them from use.
+          */
+         if (ctx->_Shader->CurrentProgram[i] &&
+             !ctx->_Shader->CurrentProgram[i]->ValidProgramUse)
+            continue;
+
          if (!shader_linked_or_absent(ctx, ctx->_Shader->CurrentProgram[i],
                                       &from_glsl_shader[i], where))
             return GL_FALSE;
-- 
2.5.0



More information about the mesa-dev mailing list