[Mesa-dev] [PATCH 01/70] mesa/compiler: add stage to shader_info

Timothy Arceri timothy.arceri at collabora.com
Tue Dec 20 10:37:11 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/glsl/linker.cpp | 2 ++
 src/compiler/shader_info.h   | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 5508d58..05f8ddb 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -2202,6 +2202,8 @@ link_intrastage_shaders(void *mem_ctx,
       ctx->Driver.NewProgram(ctx,
                              _mesa_shader_stage_to_program(shader_list[0]->Stage),
                              prog->Name);
+   gl_prog->info.stage = shader_list[0]->Stage;
+
    if (!gl_prog) {
       prog->data->LinkStatus = false;
       _mesa_delete_linked_shader(ctx, linked);
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index 768f053..6c05f38 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 */
-- 
2.9.3



More information about the mesa-dev mailing list