[Mesa-dev] [PATCH 3/7] glsl: pass symbols rather than shader to _mesa_get_main_function_signature()

Timothy Arceri timothy.arceri at collabora.com
Tue Jun 28 01:52:46 UTC 2016


This will allow us to split gl_shader into two different structs, one for
shader objects and one for linked shaders.
---
 src/compiler/glsl/builtin_functions.cpp | 4 ++--
 src/compiler/glsl/builtin_variables.cpp | 2 +-
 src/compiler/glsl/ir.h                  | 2 +-
 src/compiler/glsl/linker.cpp            | 4 ++--
 src/compiler/glsl/lower_vertex_id.cpp   | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index 018e4064..ae4e8f2 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -5658,9 +5658,9 @@ _mesa_glsl_get_builtin_function_shader()
  * Get the function signature for main from a shader
  */
 ir_function_signature *
-_mesa_get_main_function_signature(gl_shader *sh)
+_mesa_get_main_function_signature(glsl_symbol_table *symbols)
 {
-   ir_function *const f = sh->symbols->get_function("main");
+   ir_function *const f = symbols->get_function("main");
    if (f != NULL) {
       exec_list void_parameters;
 
diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
index e1a95e3..a311047 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -1456,7 +1456,7 @@ _mesa_glsl_initialize_derived_variables(struct gl_context *ctx,
    if (shader->Stage == MESA_SHADER_COMPUTE &&
        ctx->Const.LowerCsDerivedVariables) {
       ir_function_signature *const main_sig =
-         _mesa_get_main_function_signature(shader);
+         _mesa_get_main_function_signature(shader->symbols);
 
       if (main_sig != NULL)
          initialize_cs_derived_variables(shader, main_sig);
diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h
index cd17f69..cd56a2a 100644
--- a/src/compiler/glsl/ir.h
+++ b/src/compiler/glsl/ir.h
@@ -2593,7 +2593,7 @@ extern gl_shader *
 _mesa_glsl_get_builtin_function_shader(void);
 
 extern ir_function_signature *
-_mesa_get_main_function_signature(gl_shader *sh);
+_mesa_get_main_function_signature(glsl_symbol_table *symbols);
 
 extern void
 _mesa_glsl_release_functions(void);
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 90d7831..411d2fe 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -2216,7 +2216,7 @@ link_intrastage_shaders(void *mem_ctx,
     */
    gl_shader *main = NULL;
    for (unsigned i = 0; i < num_shaders; i++) {
-      if (_mesa_get_main_function_signature(shader_list[i]) != NULL) {
+      if (!_mesa_get_main_function_signature(shader_list[i]->symbols)) {
 	 main = shader_list[i];
 	 break;
       }
@@ -2246,7 +2246,7 @@ link_intrastage_shaders(void *mem_ctx,
     * copy of the original shader that contained the main function).
     */
    ir_function_signature *const main_sig =
-      _mesa_get_main_function_signature(linked);
+      _mesa_get_main_function_signature(linked->symbols);
 
    /* Move any instructions other than variable declarations or function
     * declarations into main.
diff --git a/src/compiler/glsl/lower_vertex_id.cpp b/src/compiler/glsl/lower_vertex_id.cpp
index 6f46945..ee69d94 100644
--- a/src/compiler/glsl/lower_vertex_id.cpp
+++ b/src/compiler/glsl/lower_vertex_id.cpp
@@ -130,7 +130,7 @@ lower_vertex_id(gl_shader *shader)
       return false;
 
    ir_function_signature *const main_sig =
-      _mesa_get_main_function_signature(shader);
+      _mesa_get_main_function_signature(shader->symbols);
    if (main_sig == NULL) {
       assert(main_sig != NULL);
       return false;
-- 
2.7.4



More information about the mesa-dev mailing list