[Mesa-dev] [PATCH 04/58] mesa/compiler: add stage to shader_info

Timothy Arceri timothy.arceri at collabora.com
Sun Nov 20 13:28:43 UTC 2016


This will allow us to simplify the current program logic for SSO.

Also since we aim to detach shader_info from nir_shader this will come
in handy avoiding passing nir_shader around just to keep track of
the stage we are dealing with.
---
 src/compiler/shader_info.h | 3 +++
 src/mesa/main/shaderapi.c  | 1 +
 2 files changed, 4 insertions(+)

diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index 7ea5d9c..2c1be93 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -32,6 +32,9 @@ extern "C" {
 #endif
 
 typedef struct shader_info {
+   /** The shader stage, such as MESA_SHADER_VERTEX. */
+   gl_shader_stage stage;
+
    const char *name;
 
    /* Descriptive name provided by the client; may be NULL */
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index ab15300..4d70602 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -2153,6 +2153,7 @@ _mesa_copy_linked_program_data(const struct gl_shader_program *src,
    struct gl_program *dst = dst_sh->Program;
 
    dst->info.num_images = dst_sh->NumImages;
+   dst->info.stage = dst_sh->Stage;
 
    switch (dst_sh->Stage) {
    case MESA_SHADER_VERTEX:
-- 
2.7.4



More information about the mesa-dev mailing list