summaryrefslogtreecommitdiffstats
path: root/src/glsl/linker.cpp
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-02-02 20:10:40 -0700
committerBrian Paul <[email protected]>2012-02-02 20:10:51 -0700
commit84a1273e7fe1216a4724ab13cd061a12b48893c2 (patch)
tree4665ebc65df04a0a3499b21339ab5cf05f0c98e8 /src/glsl/linker.cpp
parent8cbe699c0dd9b8d4accf1eaa570689f813aa3c2f (diff)
glsl: move array_sizing_visitor class outside of link_intrastage_shaders()
To silence warnings with gcc 4.4.x on Linux and llvm-g++ 4.2 on Mac. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/linker.cpp')
-rw-r--r--src/glsl/linker.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 509575192e7..82bddb003c3 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -856,6 +856,27 @@ get_main_function_signature(gl_shader *sh)
/**
+ * This class is only used in link_intrastage_shaders() below but declaring
+ * it inside that function leads to compiler warnings with some versions of
+ * gcc.
+ */
+class array_sizing_visitor : public ir_hierarchical_visitor {
+public:
+ virtual ir_visitor_status visit(ir_variable *var)
+ {
+ if (var->type->is_array() && (var->type->length == 0)) {
+ const glsl_type *type =
+ glsl_type::get_array_instance(var->type->fields.array,
+ var->max_array_access + 1);
+ assert(type != NULL);
+ var->type = type;
+ }
+ return visit_continue;
+ }
+};
+
+
+/**
* Combine a group of shaders for a single stage to generate a linked shader
*
* \note
@@ -1005,22 +1026,7 @@ link_intrastage_shaders(void *mem_ctx,
* max_array_access field.
*/
if (linked != NULL) {
- class array_sizing_visitor : public ir_hierarchical_visitor {
- public:
- virtual ir_visitor_status visit(ir_variable *var)
- {
- if (var->type->is_array() && (var->type->length == 0)) {
- const glsl_type *type =
- glsl_type::get_array_instance(var->type->fields.array,
- var->max_array_access + 1);
-
- assert(type != NULL);
- var->type = type;
- }
-
- return visit_continue;
- }
- } v;
+ array_sizing_visitor v;
v.run(linked->ir);
}