diff options
Diffstat (limited to 'mesalib/src/glsl')
32 files changed, 125 insertions, 2 deletions
diff --git a/mesalib/src/glsl/builtin_functions.cpp b/mesalib/src/glsl/builtin_functions.cpp index 96358a737..72054e0fe 100644 --- a/mesalib/src/glsl/builtin_functions.cpp +++ b/mesalib/src/glsl/builtin_functions.cpp @@ -304,6 +304,8 @@ tex3d_lod(const _mesa_glsl_parse_state *state) /******************************************************************************/ +namespace { + /** * builtin_builder: A singleton object representing the core of the built-in * function module. @@ -521,6 +523,8 @@ private: /** @} */ }; +} /* anonymous namespace */ + /** * Core builtin_builder functionality: * @{ diff --git a/mesalib/src/glsl/ir_function_detect_recursion.cpp b/mesalib/src/glsl/ir_function_detect_recursion.cpp index b02c32518..5813315b6 100644 --- a/mesalib/src/glsl/ir_function_detect_recursion.cpp +++ b/mesalib/src/glsl/ir_function_detect_recursion.cpp @@ -127,6 +127,8 @@ #include "program/hash_table.h" #include "program.h" +namespace { + struct call_node : public exec_node { class function *func; }; @@ -222,6 +224,8 @@ public: bool progress; }; +} /* anonymous namespace */ + static void destroy_links(exec_list *list, function *f) { diff --git a/mesalib/src/glsl/ir_import_prototypes.cpp b/mesalib/src/glsl/ir_import_prototypes.cpp index 3585bf6b2..b0429fbc3 100644 --- a/mesalib/src/glsl/ir_import_prototypes.cpp +++ b/mesalib/src/glsl/ir_import_prototypes.cpp @@ -30,6 +30,8 @@ #include "ir.h" #include "glsl_symbol_table.h" +namespace { + /** * Visitor used to import function prototypes * @@ -99,6 +101,7 @@ private: void *mem_ctx; }; +} /* anonymous namespace */ /** * Import function prototypes from one IR tree into another diff --git a/mesalib/src/glsl/ir_reader.cpp b/mesalib/src/glsl/ir_reader.cpp index ec35b682e..f0318ea21 100644 --- a/mesalib/src/glsl/ir_reader.cpp +++ b/mesalib/src/glsl/ir_reader.cpp @@ -28,6 +28,8 @@ const static bool debug = false; +namespace { + class ir_reader { public: ir_reader(_mesa_glsl_parse_state *); @@ -66,6 +68,8 @@ private: ir_dereference_variable *read_var_ref(s_expression *); }; +} /* anonymous namespace */ + ir_reader::ir_reader(_mesa_glsl_parse_state *state) : state(state) { this->mem_ctx = state; diff --git a/mesalib/src/glsl/ir_set_program_inouts.cpp b/mesalib/src/glsl/ir_set_program_inouts.cpp index 6196d6a64..1267d6d71 100644 --- a/mesalib/src/glsl/ir_set_program_inouts.cpp +++ b/mesalib/src/glsl/ir_set_program_inouts.cpp @@ -42,6 +42,8 @@ #include "ir_visitor.h" #include "glsl_types.h" +namespace { + class ir_set_program_inouts_visitor : public ir_hierarchical_visitor { public: ir_set_program_inouts_visitor(struct gl_program *prog, GLenum shader_type) @@ -67,6 +69,8 @@ private: GLenum shader_type; }; +} /* anonymous namespace */ + static inline bool is_shader_inout(ir_variable *var) { diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp index 2068de06a..2c64f4e58 100644 --- a/mesalib/src/glsl/ir_validate.cpp +++ b/mesalib/src/glsl/ir_validate.cpp @@ -38,6 +38,8 @@ #include "program/hash_table.h" #include "glsl_types.h" +namespace { + class ir_validate : public ir_hierarchical_visitor { public: ir_validate() @@ -81,6 +83,7 @@ public: struct hash_table *ht; }; +} /* anonymous namespace */ ir_visitor_status ir_validate::visit(ir_dereference_variable *ir) diff --git a/mesalib/src/glsl/link_functions.cpp b/mesalib/src/glsl/link_functions.cpp index 9e96365e6..b1a68fd55 100644 --- a/mesalib/src/glsl/link_functions.cpp +++ b/mesalib/src/glsl/link_functions.cpp @@ -34,6 +34,8 @@ find_matching_signature(const char *name, const exec_list *actual_parameters, gl_shader **shader_list, unsigned num_shaders, bool use_builtin); +namespace { + class call_link_visitor : public ir_hierarchical_visitor { public: call_link_visitor(gl_shader_program *prog, gl_shader *linked, @@ -273,6 +275,7 @@ private: hash_table *locals; }; +} /* anonymous namespace */ /** * Searches a list of shaders for a particular function definition diff --git a/mesalib/src/glsl/link_uniform_blocks.cpp b/mesalib/src/glsl/link_uniform_blocks.cpp index d96075849..72d6c5323 100644 --- a/mesalib/src/glsl/link_uniform_blocks.cpp +++ b/mesalib/src/glsl/link_uniform_blocks.cpp @@ -29,6 +29,8 @@ #include "main/hash_table.h" #include "program.h" +namespace { + class ubo_visitor : public program_resource_visitor { public: ubo_visitor(void *mem_ctx, gl_uniform_buffer_variable *variables, @@ -147,6 +149,8 @@ private: } }; +} /* anonymous namespace */ + struct block { const glsl_type *type; bool has_instance_name; diff --git a/mesalib/src/glsl/link_uniforms.cpp b/mesalib/src/glsl/link_uniforms.cpp index fa77157f7..03cbcd1ce 100644 --- a/mesalib/src/glsl/link_uniforms.cpp +++ b/mesalib/src/glsl/link_uniforms.cpp @@ -168,6 +168,8 @@ program_resource_visitor::visit_field(const glsl_struct_field *field) /* empty */ } +namespace { + /** * Class to help calculate the storage requirements for a set of uniforms * @@ -272,6 +274,8 @@ private: struct string_to_uint_map *map; }; +} /* anonymous namespace */ + /** * Class to help parcel out pieces of backing storage to uniforms * diff --git a/mesalib/src/glsl/link_varyings.cpp b/mesalib/src/glsl/link_varyings.cpp index 081a51da5..905621daf 100644 --- a/mesalib/src/glsl/link_varyings.cpp +++ b/mesalib/src/glsl/link_varyings.cpp @@ -597,6 +597,7 @@ store_tfeedback_info(struct gl_context *ctx, struct gl_shader_program *prog, return true; } +namespace { /** * Data structure recording the relationship between outputs of one shader @@ -689,6 +690,7 @@ private: const bool consumer_is_fs; }; +} /* anonymous namespace */ varying_matches::varying_matches(bool disable_varying_packing, bool consumer_is_fs) diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp index 8a143fddf..c54b7049b 100644 --- a/mesalib/src/glsl/linker.cpp +++ b/mesalib/src/glsl/linker.cpp @@ -82,6 +82,8 @@ extern "C" { void linker_error(gl_shader_program *, const char *, ...); +namespace { + /** * Visitor that determines whether or not a variable is ever written. */ @@ -275,6 +277,7 @@ private: bool found; }; +} /* anonymous namespace */ void linker_error(gl_shader_program *prog, const char *fmt, ...) diff --git a/mesalib/src/glsl/loop_analysis.cpp b/mesalib/src/glsl/loop_analysis.cpp index 40897bb6f..b08241af5 100644 --- a/mesalib/src/glsl/loop_analysis.cpp +++ b/mesalib/src/glsl/loop_analysis.cpp @@ -102,6 +102,7 @@ loop_variable_state::insert(ir_if *if_stmt) return t; } +namespace { class loop_analysis : public ir_hierarchical_visitor { public: @@ -128,6 +129,7 @@ public: exec_list state; }; +} /* anonymous namespace */ loop_analysis::loop_analysis(loop_state *loops) : loops(loops), if_statement_depth(0), current_assignment(NULL) diff --git a/mesalib/src/glsl/loop_controls.cpp b/mesalib/src/glsl/loop_controls.cpp index 79c820436..26481930d 100644 --- a/mesalib/src/glsl/loop_controls.cpp +++ b/mesalib/src/glsl/loop_controls.cpp @@ -151,6 +151,7 @@ calculate_iterations(ir_rvalue *from, ir_rvalue *to, ir_rvalue *increment, return (valid_loop) ? iter_value : -1; } +namespace { class loop_control_visitor : public ir_hierarchical_visitor { public: @@ -167,6 +168,7 @@ public: bool progress; }; +} /* anonymous namespace */ ir_visitor_status loop_control_visitor::visit_leave(ir_loop *ir) diff --git a/mesalib/src/glsl/loop_unroll.cpp b/mesalib/src/glsl/loop_unroll.cpp index 3434fde62..ff97766f1 100644 --- a/mesalib/src/glsl/loop_unroll.cpp +++ b/mesalib/src/glsl/loop_unroll.cpp @@ -25,6 +25,8 @@ #include "loop_analysis.h" #include "ir_hierarchical_visitor.h" +namespace { + class loop_unroll_visitor : public ir_hierarchical_visitor { public: loop_unroll_visitor(loop_state *state, unsigned max_iterations) @@ -42,6 +44,7 @@ public: unsigned max_iterations; }; +} /* anonymous namespace */ static bool is_break(ir_instruction *ir) diff --git a/mesalib/src/glsl/lower_clip_distance.cpp b/mesalib/src/glsl/lower_clip_distance.cpp index d6cf94438..9ddd64603 100644 --- a/mesalib/src/glsl/lower_clip_distance.cpp +++ b/mesalib/src/glsl/lower_clip_distance.cpp @@ -50,6 +50,8 @@ #include "ir.h" #include "program/prog_instruction.h" /* For WRITEMASK_* */ +namespace { + class lower_clip_distance_visitor : public ir_rvalue_visitor { public: lower_clip_distance_visitor() @@ -81,6 +83,7 @@ public: ir_variable *new_clip_distance_var; }; +} /* anonymous namespace */ /** * Replace any declaration of gl_ClipDistance as an array of floats with a diff --git a/mesalib/src/glsl/lower_discard.cpp b/mesalib/src/glsl/lower_discard.cpp index cafd2dd3b..f2757d120 100644 --- a/mesalib/src/glsl/lower_discard.cpp +++ b/mesalib/src/glsl/lower_discard.cpp @@ -108,6 +108,8 @@ #include "glsl_types.h" #include "ir.h" +namespace { + class lower_discard_visitor : public ir_hierarchical_visitor { public: lower_discard_visitor() @@ -120,6 +122,7 @@ public: bool progress; }; +} /* anonymous namespace */ bool lower_discard(exec_list *instructions) diff --git a/mesalib/src/glsl/lower_discard_flow.cpp b/mesalib/src/glsl/lower_discard_flow.cpp index d385c1435..1bc56d79e 100644 --- a/mesalib/src/glsl/lower_discard_flow.cpp +++ b/mesalib/src/glsl/lower_discard_flow.cpp @@ -48,6 +48,8 @@ #include "ir.h" #include "program/hash_table.h" +namespace { + class lower_discard_flow_visitor : public ir_hierarchical_visitor { public: lower_discard_flow_visitor(ir_variable *discarded) @@ -71,6 +73,8 @@ public: void *mem_ctx; }; +} /* anonymous namespace */ + ir_visitor_status lower_discard_flow_visitor::visit_enter(ir_loop_jump *ir) { diff --git a/mesalib/src/glsl/lower_if_to_cond_assign.cpp b/mesalib/src/glsl/lower_if_to_cond_assign.cpp index 2c5d5612d..1e7ce51c7 100644 --- a/mesalib/src/glsl/lower_if_to_cond_assign.cpp +++ b/mesalib/src/glsl/lower_if_to_cond_assign.cpp @@ -49,6 +49,8 @@ #include "ir.h" #include "program/hash_table.h" +namespace { + class ir_if_to_cond_assign_visitor : public ir_hierarchical_visitor { public: ir_if_to_cond_assign_visitor(unsigned max_depth) @@ -76,6 +78,8 @@ public: struct hash_table *condition_variables; }; +} /* anonymous namespace */ + bool lower_if_to_cond_assign(exec_list *instructions, unsigned max_depth) { diff --git a/mesalib/src/glsl/lower_instructions.cpp b/mesalib/src/glsl/lower_instructions.cpp index cb5304895..d01879cbd 100644 --- a/mesalib/src/glsl/lower_instructions.cpp +++ b/mesalib/src/glsl/lower_instructions.cpp @@ -109,6 +109,8 @@ using namespace ir_builder; +namespace { + class lower_instructions_visitor : public ir_hierarchical_visitor { public: lower_instructions_visitor(unsigned lower) @@ -133,6 +135,8 @@ private: void ldexp_to_arith(ir_expression *); }; +} /* anonymous namespace */ + /** * Determine if a particular type of lowering should occur */ diff --git a/mesalib/src/glsl/lower_jumps.cpp b/mesalib/src/glsl/lower_jumps.cpp index bfc8c013b..02f65f097 100644 --- a/mesalib/src/glsl/lower_jumps.cpp +++ b/mesalib/src/glsl/lower_jumps.cpp @@ -133,6 +133,8 @@ enum jump_strength strength_return }; +namespace { + struct block_record { /* minimum jump strength (of lowered IR, not pre-lowering IR) @@ -279,8 +281,13 @@ struct ir_lower_jumps_visitor : public ir_control_flow_visitor { bool lower_main_return; ir_lower_jumps_visitor() + : progress(false), + pull_out_jumps(false), + lower_continue(false), + lower_break(false), + lower_sub_return(false), + lower_main_return(false) { - this->progress = false; } void truncate_after_instruction(exec_node *ir) @@ -992,6 +999,8 @@ lower_continue: } }; +} /* anonymous namespace */ + bool do_lower_jumps(exec_list *instructions, bool pull_out_jumps, bool lower_sub_return, bool lower_main_return, bool lower_continue, bool lower_break) { diff --git a/mesalib/src/glsl/lower_mat_op_to_vec.cpp b/mesalib/src/glsl/lower_mat_op_to_vec.cpp index 08cae29fa..105ee0d3f 100644 --- a/mesalib/src/glsl/lower_mat_op_to_vec.cpp +++ b/mesalib/src/glsl/lower_mat_op_to_vec.cpp @@ -35,6 +35,8 @@ #include "ir_expression_flattening.h" #include "glsl_types.h" +namespace { + class ir_mat_op_to_vec_visitor : public ir_hierarchical_visitor { public: ir_mat_op_to_vec_visitor() @@ -63,6 +65,8 @@ public: bool made_progress; }; +} /* anonymous namespace */ + static bool mat_op_to_vec_predicate(ir_instruction *ir) { diff --git a/mesalib/src/glsl/lower_named_interface_blocks.cpp b/mesalib/src/glsl/lower_named_interface_blocks.cpp index 20196a356..7019185a2 100644 --- a/mesalib/src/glsl/lower_named_interface_blocks.cpp +++ b/mesalib/src/glsl/lower_named_interface_blocks.cpp @@ -65,6 +65,8 @@ #include "ir_rvalue_visitor.h" #include "program/hash_table.h" +namespace { + class flatten_named_interface_blocks_declarations : public ir_rvalue_visitor { public: @@ -83,6 +85,8 @@ public: virtual void handle_rvalue(ir_rvalue **rvalue); }; +} /* anonymous namespace */ + void flatten_named_interface_blocks_declarations::run(exec_list *instructions) { diff --git a/mesalib/src/glsl/lower_output_reads.cpp b/mesalib/src/glsl/lower_output_reads.cpp index 5ba9720d0..128b0b8cd 100644 --- a/mesalib/src/glsl/lower_output_reads.cpp +++ b/mesalib/src/glsl/lower_output_reads.cpp @@ -37,6 +37,8 @@ * main() function to copy the final values to the actual shader outputs. */ +namespace { + class output_read_remover : public ir_hierarchical_visitor { protected: /** @@ -55,6 +57,8 @@ public: virtual ir_visitor_status visit_leave(class ir_function_signature *); }; +} /* anonymous namespace */ + /** * Hash function for the output variables - computes the hash of the name. * NOTE: We're using the name string to ensure that the hash doesn't depend diff --git a/mesalib/src/glsl/lower_packed_varyings.cpp b/mesalib/src/glsl/lower_packed_varyings.cpp index 4f617225c..2bcadfd55 100644 --- a/mesalib/src/glsl/lower_packed_varyings.cpp +++ b/mesalib/src/glsl/lower_packed_varyings.cpp @@ -148,6 +148,8 @@ #include "ir.h" #include "ir_optimization.h" +namespace { + /** * Visitor that performs varying packing. For each varying declared in the * shader, this visitor determines whether it needs to be packed. If so, it @@ -230,6 +232,8 @@ private: exec_list *out_instructions; }; +} /* anonymous namespace */ + lower_packed_varyings_visitor::lower_packed_varyings_visitor( void *mem_ctx, unsigned location_base, unsigned locations_used, ir_variable_mode mode, unsigned gs_input_vertices, diff --git a/mesalib/src/glsl/lower_texture_projection.cpp b/mesalib/src/glsl/lower_texture_projection.cpp index 6e3aaecce..16d637680 100644 --- a/mesalib/src/glsl/lower_texture_projection.cpp +++ b/mesalib/src/glsl/lower_texture_projection.cpp @@ -37,6 +37,8 @@ #include "ir.h" +namespace { + class lower_texture_projection_visitor : public ir_hierarchical_visitor { public: lower_texture_projection_visitor() @@ -49,6 +51,8 @@ public: bool progress; }; +} /* anonymous namespace */ + ir_visitor_status lower_texture_projection_visitor::visit_leave(ir_texture *ir) { diff --git a/mesalib/src/glsl/lower_variable_index_to_cond_assign.cpp b/mesalib/src/glsl/lower_variable_index_to_cond_assign.cpp index 0f5072793..699fb3903 100644 --- a/mesalib/src/glsl/lower_variable_index_to_cond_assign.cpp +++ b/mesalib/src/glsl/lower_variable_index_to_cond_assign.cpp @@ -122,6 +122,7 @@ is_array_or_matrix(const ir_rvalue *ir) return (ir->type->is_array() || ir->type->is_matrix()); } +namespace { /** * Replace a dereference of a variable with a specified r-value * @@ -191,6 +192,12 @@ struct assignment_generator ir_variable* var; assignment_generator() + : base_ir(NULL), + rvalue(NULL), + old_index(NULL), + is_write(false), + write_mask(0), + var(NULL) { } @@ -512,6 +519,8 @@ public: } }; +} /* anonymous namespace */ + bool lower_variable_index_to_cond_assign(exec_list *instructions, bool lower_input, diff --git a/mesalib/src/glsl/lower_vec_index_to_cond_assign.cpp b/mesalib/src/glsl/lower_vec_index_to_cond_assign.cpp index 880859688..8080006c1 100644 --- a/mesalib/src/glsl/lower_vec_index_to_cond_assign.cpp +++ b/mesalib/src/glsl/lower_vec_index_to_cond_assign.cpp @@ -41,6 +41,8 @@ #include "ir_optimization.h" #include "glsl_types.h" +namespace { + /** * Visitor class for replacing expressions with ir_constant values. */ @@ -69,6 +71,8 @@ public: bool progress; }; +} /* anonymous namespace */ + ir_rvalue * ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(void *mem_ctx, ir_rvalue *orig_vector, diff --git a/mesalib/src/glsl/lower_vec_index_to_swizzle.cpp b/mesalib/src/glsl/lower_vec_index_to_swizzle.cpp index d5ad692c2..46985791e 100644 --- a/mesalib/src/glsl/lower_vec_index_to_swizzle.cpp +++ b/mesalib/src/glsl/lower_vec_index_to_swizzle.cpp @@ -39,6 +39,8 @@ * Visitor class for replacing expressions with ir_constant values. */ +namespace { + class ir_vec_index_to_swizzle_visitor : public ir_hierarchical_visitor { public: ir_vec_index_to_swizzle_visitor() @@ -58,6 +60,8 @@ public: bool progress; }; +} /* anonymous namespace */ + ir_rvalue * ir_vec_index_to_swizzle_visitor::convert_vector_extract_to_swizzle(ir_rvalue *ir) { diff --git a/mesalib/src/glsl/lower_vector.cpp b/mesalib/src/glsl/lower_vector.cpp index 0cd6909db..a658410ae 100644 --- a/mesalib/src/glsl/lower_vector.cpp +++ b/mesalib/src/glsl/lower_vector.cpp @@ -31,9 +31,11 @@ #include "ir.h" #include "ir_rvalue_visitor.h" +namespace { + class lower_vector_visitor : public ir_rvalue_visitor { public: - lower_vector_visitor() : progress(false) + lower_vector_visitor() : dont_lower_swz(false), progress(false) { /* empty */ } @@ -48,6 +50,8 @@ public: bool progress; }; +} /* anonymous namespace */ + /** * Determine if an IR expression tree looks like an extended swizzle * diff --git a/mesalib/src/glsl/lower_vector_insert.cpp b/mesalib/src/glsl/lower_vector_insert.cpp index 0e640cc32..6d7cfa942 100644 --- a/mesalib/src/glsl/lower_vector_insert.cpp +++ b/mesalib/src/glsl/lower_vector_insert.cpp @@ -27,6 +27,8 @@ using namespace ir_builder; +namespace { + class vector_insert_visitor : public ir_rvalue_visitor { public: vector_insert_visitor(bool lower_nonconstant_index) @@ -48,6 +50,7 @@ public: bool lower_nonconstant_index; }; +} /* anonymous namespace */ void vector_insert_visitor::handle_rvalue(ir_rvalue **rv) diff --git a/mesalib/src/glsl/opt_array_splitting.cpp b/mesalib/src/glsl/opt_array_splitting.cpp index f4a7ef99b..34ac836ae 100644 --- a/mesalib/src/glsl/opt_array_splitting.cpp +++ b/mesalib/src/glsl/opt_array_splitting.cpp @@ -40,6 +40,8 @@ static bool debug = false; +namespace { + namespace opt_array_splitting { class variable_entry : public exec_node @@ -77,6 +79,7 @@ public: }; } /* namespace */ + using namespace opt_array_splitting; /** @@ -112,6 +115,8 @@ public: void *mem_ctx; }; +} /* namespace */ + variable_entry * ir_array_reference_visitor::get_variable_entry(ir_variable *var) { diff --git a/mesalib/src/glsl/opt_dead_builtin_varyings.cpp b/mesalib/src/glsl/opt_dead_builtin_varyings.cpp index 3cdd13038..7e8cd4372 100644 --- a/mesalib/src/glsl/opt_dead_builtin_varyings.cpp +++ b/mesalib/src/glsl/opt_dead_builtin_varyings.cpp @@ -52,6 +52,7 @@ #include "glsl_types.h" #include "link_varyings.h" +namespace { /** * This obtains detailed information about built-in varyings from shader code. @@ -397,6 +398,7 @@ private: ir_variable *new_fog; }; +} /* anonymous namespace */ static void lower_texcoord_array(exec_list *ir, const varying_info_visitor *info) |