diff options
Diffstat (limited to 'src')
33 files changed, 126 insertions, 2 deletions
diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp index 96358a7373d..72054e0fe93 100644 --- a/src/glsl/builtin_functions.cpp +++ b/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/src/glsl/ir_function_detect_recursion.cpp b/src/glsl/ir_function_detect_recursion.cpp index b02c32518cc..5813315b613 100644 --- a/src/glsl/ir_function_detect_recursion.cpp +++ b/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/src/glsl/ir_import_prototypes.cpp b/src/glsl/ir_import_prototypes.cpp index 3585bf6b24b..b0429fbc3af 100644 --- a/src/glsl/ir_import_prototypes.cpp +++ b/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/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index ec35b682eaf..f0318ea210a 100644 --- a/src/glsl/ir_reader.cpp +++ b/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/src/glsl/ir_set_program_inouts.cpp b/src/glsl/ir_set_program_inouts.cpp index 6196d6a6425..1267d6d7177 100644 --- a/src/glsl/ir_set_program_inouts.cpp +++ b/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/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 2068de06a3b..2c64f4e582a 100644 --- a/src/glsl/ir_validate.cpp +++ b/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/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp index 9e96365e6de..b1a68fd55b0 100644 --- a/src/glsl/link_functions.cpp +++ b/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/src/glsl/link_uniform_blocks.cpp b/src/glsl/link_uniform_blocks.cpp index d9607584970..72d6c5323a6 100644 --- a/src/glsl/link_uniform_blocks.cpp +++ b/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/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp index fa77157f78d..03cbcd1ce20 100644 --- a/src/glsl/link_uniforms.cpp +++ b/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/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index 081a51da54f..905621daf8e 100644 --- a/src/glsl/link_varyings.cpp +++ b/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/src/glsl/linker.cpp b/src/glsl/linker.cpp index 8a143fddfca..c54b7049bbe 100644 --- a/src/glsl/linker.cpp +++ b/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/src/glsl/loop_analysis.cpp b/src/glsl/loop_analysis.cpp index 40897bb6fa8..b08241af527 100644 --- a/src/glsl/loop_analysis.cpp +++ b/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/src/glsl/loop_controls.cpp b/src/glsl/loop_controls.cpp index 79c820436fd..26481930db7 100644 --- a/src/glsl/loop_controls.cpp +++ b/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/src/glsl/loop_unroll.cpp b/src/glsl/loop_unroll.cpp index 3434fde6292..ff97766f17b 100644 --- a/src/glsl/loop_unroll.cpp +++ b/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/src/glsl/lower_clip_distance.cpp b/src/glsl/lower_clip_distance.cpp index d6cf944388b..9ddd64603e6 100644 --- a/src/glsl/lower_clip_distance.cpp +++ b/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/src/glsl/lower_discard.cpp b/src/glsl/lower_discard.cpp index cafd2dd3b44..f2757d12048 100644 --- a/src/glsl/lower_discard.cpp +++ b/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/src/glsl/lower_discard_flow.cpp b/src/glsl/lower_discard_flow.cpp index d385c143547..1bc56d79e98 100644 --- a/src/glsl/lower_discard_flow.cpp +++ b/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/src/glsl/lower_if_to_cond_assign.cpp b/src/glsl/lower_if_to_cond_assign.cpp index 2c5d5612d0d..1e7ce51c707 100644 --- a/src/glsl/lower_if_to_cond_assign.cpp +++ b/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/src/glsl/lower_instructions.cpp b/src/glsl/lower_instructions.cpp index cb530489593..d01879cbd4f 100644 --- a/src/glsl/lower_instructions.cpp +++ b/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/src/glsl/lower_jumps.cpp b/src/glsl/lower_jumps.cpp index bfc8c013bda..97b1abb9b02 100644 --- a/src/glsl/lower_jumps.cpp +++ b/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) @@ -992,6 +994,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/src/glsl/lower_mat_op_to_vec.cpp b/src/glsl/lower_mat_op_to_vec.cpp index 08cae29fa5d..105ee0d3f51 100644 --- a/src/glsl/lower_mat_op_to_vec.cpp +++ b/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/src/glsl/lower_named_interface_blocks.cpp b/src/glsl/lower_named_interface_blocks.cpp index 20196a35648..7019185a2f3 100644 --- a/src/glsl/lower_named_interface_blocks.cpp +++ b/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/src/glsl/lower_output_reads.cpp b/src/glsl/lower_output_reads.cpp index 5ba9720d0dc..128b0b8cdb2 100644 --- a/src/glsl/lower_output_reads.cpp +++ b/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/src/glsl/lower_packed_varyings.cpp b/src/glsl/lower_packed_varyings.cpp index 4f617225c0f..2bcadfd55bc 100644 --- a/src/glsl/lower_packed_varyings.cpp +++ b/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/src/glsl/lower_texture_projection.cpp b/src/glsl/lower_texture_projection.cpp index 6e3aaecceee..16d63768055 100644 --- a/src/glsl/lower_texture_projection.cpp +++ b/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/src/glsl/lower_variable_index_to_cond_assign.cpp b/src/glsl/lower_variable_index_to_cond_assign.cpp index 0f507279382..21674b5f8fb 100644 --- a/src/glsl/lower_variable_index_to_cond_assign.cpp +++ b/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 * @@ -512,6 +513,8 @@ public: } }; +} /* anonymous namespace */ + bool lower_variable_index_to_cond_assign(exec_list *instructions, bool lower_input, diff --git a/src/glsl/lower_vec_index_to_cond_assign.cpp b/src/glsl/lower_vec_index_to_cond_assign.cpp index 88085968801..8080006c1d0 100644 --- a/src/glsl/lower_vec_index_to_cond_assign.cpp +++ b/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/src/glsl/lower_vec_index_to_swizzle.cpp b/src/glsl/lower_vec_index_to_swizzle.cpp index d5ad692c2f2..46985791ef6 100644 --- a/src/glsl/lower_vec_index_to_swizzle.cpp +++ b/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/src/glsl/lower_vector.cpp b/src/glsl/lower_vector.cpp index 0cd6909db55..9172b6af7b5 100644 --- a/src/glsl/lower_vector.cpp +++ b/src/glsl/lower_vector.cpp @@ -31,6 +31,8 @@ #include "ir.h" #include "ir_rvalue_visitor.h" +namespace { + class lower_vector_visitor : public ir_rvalue_visitor { public: lower_vector_visitor() : progress(false) @@ -48,6 +50,8 @@ public: bool progress; }; +} /* anonymous namespace */ + /** * Determine if an IR expression tree looks like an extended swizzle * diff --git a/src/glsl/lower_vector_insert.cpp b/src/glsl/lower_vector_insert.cpp index 0e640cc3240..6d7cfa94262 100644 --- a/src/glsl/lower_vector_insert.cpp +++ b/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/src/glsl/opt_array_splitting.cpp b/src/glsl/opt_array_splitting.cpp index f4a7ef99bcd..34ac836ae5c 100644 --- a/src/glsl/opt_array_splitting.cpp +++ b/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/src/glsl/opt_dead_builtin_varyings.cpp b/src/glsl/opt_dead_builtin_varyings.cpp index 3cdd13038ae..7e8cd43728d 100644 --- a/src/glsl/opt_dead_builtin_varyings.cpp +++ b/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) diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index c46a3d00541..d5a6a872ab5 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -57,11 +57,13 @@ extern "C" { #include "program/sampler.h" } +static int swizzle_for_size(int size); + +namespace { + class src_reg; class dst_reg; -static int swizzle_for_size(int size); - /** * This struct is a corresponding struct to Mesa prog_src_register, with * wider fields. @@ -129,6 +131,8 @@ public: src_reg *reladdr; }; +} /* anonymous namespace */ + src_reg::src_reg(dst_reg reg) { this->file = reg.file; @@ -147,6 +151,8 @@ dst_reg::dst_reg(src_reg reg) this->reladdr = reg.reladdr; } +namespace { + class ir_to_mesa_instruction : public exec_node { public: DECLARE_RZALLOC_CXX_OPERATORS(ir_to_mesa_instruction) @@ -316,6 +322,8 @@ public: void *mem_ctx; }; +} /* anonymous namespace */ + static src_reg undef_src = src_reg(PROGRAM_UNDEFINED, 0, NULL); static dst_reg undef_dst = dst_reg(PROGRAM_UNDEFINED, SWIZZLE_NOOP); @@ -2407,6 +2415,8 @@ print_program(struct prog_instruction *mesa_instructions, } } +namespace { + class add_uniform_to_shader : public program_resource_visitor { public: add_uniform_to_shader(struct gl_shader_program *shader_program, @@ -2436,6 +2446,8 @@ private: gl_shader_type shader_type; }; +} /* anonymous namespace */ + void add_uniform_to_shader::visit_field(const glsl_type *type, const char *name, bool row_major) |