Mesa (master): mesa/compiler: add stage to shader_info

Timothy Arceri tarceri at kemper.freedesktop.org
Thu Dec 29 23:57:41 UTC 2016


Module: Mesa
Branch: master
Commit: 0de6f6223ab917ec532e3fe3afd14f8f5cd3b87b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0de6f6223ab917ec532e3fe3afd14f8f5cd3b87b

Author: Timothy Arceri <timothy.arceri at collabora.com>
Date:   Mon Oct 31 19:57:57 2016 +1100

mesa/compiler: add stage to shader_info

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.

V2: set stage for arb asm programs also.

Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/compiler/shader_info.h | 3 +++
 src/mesa/program/program.c | 1 +
 2 files changed, 4 insertions(+)

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 */
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index e5eb06c..27ae1c6 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -190,6 +190,7 @@ _mesa_init_gl_program(struct gl_program *prog, GLenum target, GLuint id)
    prog->Target = target;
    prog->RefCount = 1;
    prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB;
+   prog->info.stage = _mesa_program_enum_to_shader_stage(target);
 
    /* default mapping from samplers to texture units */
    for (i = 0; i < MAX_SAMPLERS; i++)




More information about the mesa-commit mailing list