From 47f83817303e0f24f2d410450f897945a5746ef2 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 27 Jun 2016 16:25:00 +1000 Subject: [PATCH] glsl: pass symbols rather than shader to _mesa_get_main_function_signature() This will allow us to split gl_shader into two different structs, one for shader objects and one for linked shaders. Reviewed-by: Iago Toral Quiroga --- 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 018e4064f10..ae4e8f2c455 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 e1a95e3bf8c..a311047dced 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 cd17f69c179..cd56a2a9f52 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 90d7831cde0..411d2feec74 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 6f46945026c..ee69d940388 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.30.2