[Mesa-dev] [PATCH 1/3] glsl: build up a mask of active shader stages in a program

Tapani Pälli tapani.palli at intel.com
Mon Dec 7 01:29:49 PST 2015


This will be used for validating SSO pipeline where all active stages
in linked programs should be in use when rendering.

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
 src/glsl/linker.cpp    | 4 ++++
 src/mesa/main/mtypes.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index ae628cd..4150d40 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -4611,11 +4611,15 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
    }
 
 done:
+   prog->ActiveStages = 0;
+
    for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       free(shader_list[i]);
       if (prog->_LinkedShaders[i] == NULL)
 	 continue;
 
+      prog->ActiveStages |= (1 << i);
+
       /* Do a final validation step to make sure that the IR wasn't
        * invalidated by any modifications performed after intrastage linking.
        */
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 1eb1e21..fa7ead0 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2556,6 +2556,7 @@ struct gl_shader_program
    GLboolean SeparateShader;
 
    GLuint NumShaders;          /**< number of attached shaders */
+   uint8_t ActiveStages;       /**< mask of active shader stages */
    struct gl_shader **Shaders; /**< List of attached the shaders */
 
    /**
-- 
2.5.0



More information about the mesa-dev mailing list