/******************************************************************************/
+namespace {
+
/**
* builtin_builder: A singleton object representing the core of the built-in
* function module.
/** @} */
};
+} /* anonymous namespace */
+
/**
* Core builtin_builder functionality:
* @{
#include "program/hash_table.h"
#include "program.h"
+namespace {
+
struct call_node : public exec_node {
class function *func;
};
bool progress;
};
+} /* anonymous namespace */
+
static void
destroy_links(exec_list *list, function *f)
{
#include "ir.h"
#include "glsl_symbol_table.h"
+namespace {
+
/**
* Visitor used to import function prototypes
*
void *mem_ctx;
};
+} /* anonymous namespace */
/**
* Import function prototypes from one IR tree into another
const static bool debug = false;
+namespace {
+
class ir_reader {
public:
ir_reader(_mesa_glsl_parse_state *);
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;
#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)
GLenum shader_type;
};
+} /* anonymous namespace */
+
static inline bool
is_shader_inout(ir_variable *var)
{
#include "program/hash_table.h"
#include "glsl_types.h"
+namespace {
+
class ir_validate : public ir_hierarchical_visitor {
public:
ir_validate()
struct hash_table *ht;
};
+} /* anonymous namespace */
ir_visitor_status
ir_validate::visit(ir_dereference_variable *ir)
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,
hash_table *locals;
};
+} /* anonymous namespace */
/**
* Searches a list of shaders for a particular function definition
#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,
}
};
+} /* anonymous namespace */
+
struct block {
const glsl_type *type;
bool has_instance_name;
/* empty */
}
+namespace {
+
/**
* Class to help calculate the storage requirements for a set of uniforms
*
struct string_to_uint_map *map;
};
+} /* anonymous namespace */
+
/**
* Class to help parcel out pieces of backing storage to uniforms
*
return true;
}
+namespace {
/**
* Data structure recording the relationship between outputs of one shader
const bool consumer_is_fs;
};
+} /* anonymous namespace */
varying_matches::varying_matches(bool disable_varying_packing,
bool consumer_is_fs)
void linker_error(gl_shader_program *, const char *, ...);
+namespace {
+
/**
* Visitor that determines whether or not a variable is ever written.
*/
bool found;
};
+} /* anonymous namespace */
void
linker_error(gl_shader_program *prog, const char *fmt, ...)
return t;
}
+namespace {
class loop_analysis : public ir_hierarchical_visitor {
public:
exec_list state;
};
+} /* anonymous namespace */
loop_analysis::loop_analysis(loop_state *loops)
: loops(loops), if_statement_depth(0), current_assignment(NULL)
return (valid_loop) ? iter_value : -1;
}
+namespace {
class loop_control_visitor : public ir_hierarchical_visitor {
public:
bool progress;
};
+} /* anonymous namespace */
ir_visitor_status
loop_control_visitor::visit_leave(ir_loop *ir)
#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)
unsigned max_iterations;
};
+} /* anonymous namespace */
static bool
is_break(ir_instruction *ir)
#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()
ir_variable *new_clip_distance_var;
};
+} /* anonymous namespace */
/**
* Replace any declaration of gl_ClipDistance as an array of floats with a
#include "glsl_types.h"
#include "ir.h"
+namespace {
+
class lower_discard_visitor : public ir_hierarchical_visitor {
public:
lower_discard_visitor()
bool progress;
};
+} /* anonymous namespace */
bool
lower_discard(exec_list *instructions)
#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)
void *mem_ctx;
};
+} /* anonymous namespace */
+
ir_visitor_status
lower_discard_flow_visitor::visit_enter(ir_loop_jump *ir)
{
#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)
struct hash_table *condition_variables;
};
+} /* anonymous namespace */
+
bool
lower_if_to_cond_assign(exec_list *instructions, unsigned max_depth)
{
using namespace ir_builder;
+namespace {
+
class lower_instructions_visitor : public ir_hierarchical_visitor {
public:
lower_instructions_visitor(unsigned lower)
void ldexp_to_arith(ir_expression *);
};
+} /* anonymous namespace */
+
/**
* Determine if a particular type of lowering should occur
*/
strength_return
};
+namespace {
+
struct block_record
{
/* minimum jump strength (of lowered IR, not pre-lowering IR)
}
};
+} /* 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)
{
#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()
bool made_progress;
};
+} /* anonymous namespace */
+
static bool
mat_op_to_vec_predicate(ir_instruction *ir)
{
#include "ir_rvalue_visitor.h"
#include "program/hash_table.h"
+namespace {
+
class flatten_named_interface_blocks_declarations : public ir_rvalue_visitor
{
public:
virtual void handle_rvalue(ir_rvalue **rvalue);
};
+} /* anonymous namespace */
+
void
flatten_named_interface_blocks_declarations::run(exec_list *instructions)
{
* main() function to copy the final values to the actual shader outputs.
*/
+namespace {
+
class output_read_remover : public ir_hierarchical_visitor {
protected:
/**
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
#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
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,
#include "ir.h"
+namespace {
+
class lower_texture_projection_visitor : public ir_hierarchical_visitor {
public:
lower_texture_projection_visitor()
bool progress;
};
+} /* anonymous namespace */
+
ir_visitor_status
lower_texture_projection_visitor::visit_leave(ir_texture *ir)
{
return (ir->type->is_array() || ir->type->is_matrix());
}
+namespace {
/**
* Replace a dereference of a variable with a specified r-value
*
}
};
+} /* anonymous namespace */
+
bool
lower_variable_index_to_cond_assign(exec_list *instructions,
bool lower_input,
#include "ir_optimization.h"
#include "glsl_types.h"
+namespace {
+
/**
* Visitor class for replacing expressions with ir_constant values.
*/
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,
* 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()
bool progress;
};
+} /* anonymous namespace */
+
ir_rvalue *
ir_vec_index_to_swizzle_visitor::convert_vector_extract_to_swizzle(ir_rvalue *ir)
{
#include "ir.h"
#include "ir_rvalue_visitor.h"
+namespace {
+
class lower_vector_visitor : public ir_rvalue_visitor {
public:
lower_vector_visitor() : progress(false)
bool progress;
};
+} /* anonymous namespace */
+
/**
* Determine if an IR expression tree looks like an extended swizzle
*
using namespace ir_builder;
+namespace {
+
class vector_insert_visitor : public ir_rvalue_visitor {
public:
vector_insert_visitor(bool lower_nonconstant_index)
bool lower_nonconstant_index;
};
+} /* anonymous namespace */
void
vector_insert_visitor::handle_rvalue(ir_rvalue **rv)
static bool debug = false;
+namespace {
+
namespace opt_array_splitting {
class variable_entry : public exec_node
};
} /* namespace */
+
using namespace opt_array_splitting;
/**
void *mem_ctx;
};
+} /* namespace */
+
variable_entry *
ir_array_reference_visitor::get_variable_entry(ir_variable *var)
{
#include "glsl_types.h"
#include "link_varyings.h"
+namespace {
/**
* This obtains detailed information about built-in varyings from shader code.
ir_variable *new_fog;
};
+} /* anonymous namespace */
static void
lower_texcoord_array(exec_list *ir, const varying_info_visitor *info)
#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.
src_reg *reladdr;
};
+} /* anonymous namespace */
+
src_reg::src_reg(dst_reg reg)
{
this->file = reg.file;
this->reladdr = reg.reladdr;
}
+namespace {
+
class ir_to_mesa_instruction : public exec_node {
public:
DECLARE_RZALLOC_CXX_OPERATORS(ir_to_mesa_instruction)
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);
}
}
+namespace {
+
class add_uniform_to_shader : public program_resource_visitor {
public:
add_uniform_to_shader(struct gl_shader_program *shader_program,
gl_shader_type shader_type;
};
+} /* anonymous namespace */
+
void
add_uniform_to_shader::visit_field(const glsl_type *type, const char *name,
bool row_major)