[Mesa-dev] [PATCH 16/70] mesa/glsl: add bitmask to track stages a program was linked against

Timothy Arceri timothy.arceri at collabora.com
Fri Nov 11 00:45:58 UTC 2016


This will be used to enable us to store the current gl_program
rather than gl_shader_program in the gl_pipline_object allowing
us to simplify handing of validation.

Also we should not be depending on _LinkedShader for this information
as it may contain shaders from a failed linking attempt rather than
the current program still in use.

We could also use this mask to iterate over the stages during linking
with _mesa_bit_scan() rather then the current method of NULL checking
each stage.
---
 src/compiler/glsl/linker.cpp | 1 +
 src/mesa/main/mtypes.h       | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index a0341c2..be4e18c 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4873,6 +4873,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
          }
 
          prog->_LinkedShaders[stage] = sh;
+         prog->data->linked_stages |= 1 << stage;
       }
    }
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index bf604c3..6047c8f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2647,6 +2647,9 @@ struct gl_shader_program_data
    GLboolean LinkStatus;   /**< GL_LINK_STATUS */
    GLboolean Validated;
    GLchar *InfoLog;
+
+   /* Mask of stages this program was linked against */
+   unsigned linked_stages;
 };
 
 /**
-- 
2.7.4



More information about the mesa-dev mailing list