RetroArch
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
spirv_cross::CompilerGLSL Class Reference

#include <spirv_glsl.hpp>

Inheritance diagram for spirv_cross::CompilerGLSL:
[legend]
Collaboration diagram for spirv_cross::CompilerGLSL:
[legend]

Classes

struct  BackendVariations
 
struct  Options
 

Public Member Functions

void remap_pixel_local_storage (std::vector< PlsRemap > inputs, std::vector< PlsRemap > outputs)
 
 CompilerGLSL (std::vector< uint32_t > spirv_)
 
 CompilerGLSL (const uint32_t *ir, size_t word_count)
 
 SPIRV_CROSS_DEPRECATED ("get_options() is obsolete, use get_common_options() instead.") const Options &get_options() const
 
const Optionsget_common_options () const
 
 SPIRV_CROSS_DEPRECATED ("set_options() is obsolete, use set_common_options() instead.") void set_options(Options &opts)
 
void set_common_options (const Options &opts)
 
std::string compile () override
 
std::string get_partial_source ()
 
void add_header_line (const std::string &str)
 
void require_extension (const std::string &ext)
 
void flatten_buffer_block (uint32_t id)
 
- Public Member Functions inherited from spirv_cross::Compiler
 Compiler (std::vector< uint32_t > ir)
 
 Compiler (const uint32_t *ir, size_t word_count)
 
virtual ~Compiler ()=default
 
const std::stringget_name (uint32_t id) const
 
void set_decoration (uint32_t id, spv::Decoration decoration, uint32_t argument=0)
 
void set_decoration_string (uint32_t id, spv::Decoration decoration, const std::string &argument)
 
void set_name (uint32_t id, const std::string &name)
 
uint64_t get_decoration_mask (uint32_t id) const
 
const Bitsetget_decoration_bitset (uint32_t id) const
 
bool has_decoration (uint32_t id, spv::Decoration decoration) const
 
uint32_t get_decoration (uint32_t id, spv::Decoration decoration) const
 
const std::stringget_decoration_string (uint32_t id, spv::Decoration decoration) const
 
void unset_decoration (uint32_t id, spv::Decoration decoration)
 
const SPIRTypeget_type (uint32_t id) const
 
const SPIRTypeget_type_from_variable (uint32_t id) const
 
uint32_t get_non_pointer_type_id (uint32_t type_id) const
 
const SPIRTypeget_non_pointer_type (const SPIRType &type) const
 
const SPIRTypeget_non_pointer_type (uint32_t type_id) const
 
spv::StorageClass get_storage_class (uint32_t id) const
 
virtual const std::string get_fallback_name (uint32_t id) const
 
virtual const std::string get_block_fallback_name (uint32_t id) const
 
const std::stringget_member_name (uint32_t id, uint32_t index) const
 
uint32_t get_member_decoration (uint32_t id, uint32_t index, spv::Decoration decoration) const
 
const std::stringget_member_decoration_string (uint32_t id, uint32_t index, spv::Decoration decoration) const
 
void set_member_name (uint32_t id, uint32_t index, const std::string &name)
 
const std::stringget_member_qualified_name (uint32_t type_id, uint32_t index) const
 
void set_member_qualified_name (uint32_t type_id, uint32_t index, const std::string &name)
 
uint64_t get_member_decoration_mask (uint32_t id, uint32_t index) const
 
const Bitsetget_member_decoration_bitset (uint32_t id, uint32_t index) const
 
bool has_member_decoration (uint32_t id, uint32_t index, spv::Decoration decoration) const
 
void set_member_decoration (uint32_t id, uint32_t index, spv::Decoration decoration, uint32_t argument=0)
 
void set_member_decoration_string (uint32_t id, uint32_t index, spv::Decoration decoration, const std::string &argument)
 
void unset_member_decoration (uint32_t id, uint32_t index, spv::Decoration decoration)
 
virtual const std::string get_fallback_member_name (uint32_t index) const
 
std::vector< BufferRangeget_active_buffer_ranges (uint32_t id) const
 
size_t get_declared_struct_size (const SPIRType &struct_type) const
 
virtual size_t get_declared_struct_member_size (const SPIRType &struct_type, uint32_t index) const
 
 SPIRV_CROSS_DEPRECATED ("Please use flatten_buffer_block instead.") void flatten_interface_block(uint32_t id)
 
std::unordered_set< uint32_tget_active_interface_variables () const
 
void set_enabled_interface_variables (std::unordered_set< uint32_t > active_variables)
 
ShaderResources get_shader_resources () const
 
ShaderResources get_shader_resources (const std::unordered_set< uint32_t > &active_variables) const
 
void set_remapped_variable_state (uint32_t id, bool remap_enable)
 
bool get_remapped_variable_state (uint32_t id) const
 
void set_subpass_input_remapped_components (uint32_t id, uint32_t components)
 
uint32_t get_subpass_input_remapped_components (uint32_t id) const
 
std::vector< std::stringget_entry_points () const
 
void set_entry_point (const std::string &name)
 
SPIREntryPointget_entry_point (const std::string &name)
 
void set_entry_point (const std::string &entry, spv::ExecutionModel execution_model)
 
void rename_entry_point (const std::string &old_name, const std::string &new_name, spv::ExecutionModel execution_model)
 
const SPIREntryPointget_entry_point (const std::string &name, spv::ExecutionModel execution_model) const
 
SPIREntryPointget_entry_point (const std::string &name, spv::ExecutionModel execution_model)
 
const std::stringget_cleansed_entry_point_name (const std::string &name, spv::ExecutionModel execution_model) const
 
uint64_t get_execution_mode_mask () const
 
const Bitsetget_execution_mode_bitset () const
 
void unset_execution_mode (spv::ExecutionMode mode)
 
void set_execution_mode (spv::ExecutionMode mode, uint32_t arg0=0, uint32_t arg1=0, uint32_t arg2=0)
 
uint32_t get_execution_mode_argument (spv::ExecutionMode mode, uint32_t index=0) const
 
spv::ExecutionModel get_execution_model () const
 
uint32_t get_work_group_size_specialization_constants (SpecializationConstant &x, SpecializationConstant &y, SpecializationConstant &z) const
 
uint32_t build_dummy_sampler_for_combined_images ()
 
void build_combined_image_samplers ()
 
const std::vector< CombinedImageSampler > & get_combined_image_samplers () const
 
void set_variable_type_remap_callback (VariableTypeRemapCallback cb)
 
std::vector< SpecializationConstantget_specialization_constants () const
 
SPIRConstantget_constant (uint32_t id)
 
const SPIRConstantget_constant (uint32_t id) const
 
uint32_t get_current_id_bound () const
 
uint32_t type_struct_member_offset (const SPIRType &type, uint32_t index) const
 
uint32_t type_struct_member_array_stride (const SPIRType &type, uint32_t index) const
 
uint32_t type_struct_member_matrix_stride (const SPIRType &type, uint32_t index) const
 
bool get_binary_offset_for_decoration (uint32_t id, spv::Decoration decoration, uint32_t &word_offset) const
 
bool buffer_is_hlsl_counter_buffer (uint32_t id) const
 
bool buffer_get_hlsl_counter_buffer (uint32_t id, uint32_t &counter_id) const
 
const std::vector< spv::Capability > & get_declared_capabilities () const
 
const std::vector< std::string > & get_declared_extensions () const
 
std::string get_remapped_declared_block_name (uint32_t id) const
 
Bitset get_buffer_block_flags (uint32_t id) const
 

Protected Member Functions

void reset ()
 
void emit_function (SPIRFunction &func, const Bitset &return_flags)
 
bool has_extension (const std::string &ext) const
 
void require_extension_internal (const std::string &ext)
 
virtual void emit_function_prototype (SPIRFunction &func, const Bitset &return_flags)
 
virtual void emit_instruction (const Instruction &instr)
 
void emit_block_instructions (SPIRBlock &block)
 
virtual void emit_glsl_op (uint32_t result_type, uint32_t result_id, uint32_t op, const uint32_t *args, uint32_t count)
 
virtual void emit_spv_amd_shader_ballot_op (uint32_t result_type, uint32_t result_id, uint32_t op, const uint32_t *args, uint32_t count)
 
virtual void emit_spv_amd_shader_explicit_vertex_parameter_op (uint32_t result_type, uint32_t result_id, uint32_t op, const uint32_t *args, uint32_t count)
 
virtual void emit_spv_amd_shader_trinary_minmax_op (uint32_t result_type, uint32_t result_id, uint32_t op, const uint32_t *args, uint32_t count)
 
virtual void emit_spv_amd_gcn_shader_op (uint32_t result_type, uint32_t result_id, uint32_t op, const uint32_t *args, uint32_t count)
 
virtual void emit_header ()
 
virtual void emit_sampled_image_op (uint32_t result_type, uint32_t result_id, uint32_t image_id, uint32_t samp_id)
 
virtual void emit_texture_op (const Instruction &i)
 
virtual void emit_subgroup_op (const Instruction &i)
 
virtual std::string type_to_glsl (const SPIRType &type, uint32_t id=0)
 
virtual std::string builtin_to_glsl (spv::BuiltIn builtin, spv::StorageClass storage)
 
virtual void emit_struct_member (const SPIRType &type, uint32_t member_type_id, uint32_t index, const std::string &qualifier="", uint32_t base_offset=0)
 
virtual std::string image_type_glsl (const SPIRType &type, uint32_t id=0)
 
virtual std::string constant_expression (const SPIRConstant &c)
 
std::string constant_op_expression (const SPIRConstantOp &cop)
 
virtual std::string constant_expression_vector (const SPIRConstant &c, uint32_t vector)
 
virtual void emit_fixup ()
 
virtual std::string variable_decl (const SPIRType &type, const std::string &name, uint32_t id=0)
 
virtual std::string to_func_call_arg (uint32_t id)
 
virtual std::string to_function_name (uint32_t img, const SPIRType &imgtype, bool is_fetch, bool is_gather, bool is_proj, bool has_array_offsets, bool has_offset, bool has_grad, bool has_dref, uint32_t lod)
 
virtual std::string to_function_args (uint32_t img, const SPIRType &imgtype, bool is_fetch, bool is_gather, bool is_proj, uint32_t coord, uint32_t coord_components, uint32_t dref, uint32_t grad_x, uint32_t grad_y, uint32_t lod, uint32_t coffset, uint32_t offset, uint32_t bias, uint32_t comp, uint32_t sample, bool *p_forward)
 
virtual void emit_buffer_block (const SPIRVariable &type)
 
virtual void emit_push_constant_block (const SPIRVariable &var)
 
virtual void emit_uniform (const SPIRVariable &var)
 
virtual std::string unpack_expression_type (std::string expr_str, const SPIRType &type)
 
template<typename T >
void statement_inner (T &&t)
 
template<typename T , typename... Ts>
void statement_inner (T &&t, Ts &&... ts)
 
template<typename... Ts>
void statement (Ts &&... ts)
 
template<typename... Ts>
void statement_no_indent (Ts &&... ts)
 
void begin_scope ()
 
void end_scope ()
 
void end_scope_decl ()
 
void end_scope_decl (const std::string &decl)
 
std::string type_to_array_glsl (const SPIRType &type)
 
std::string to_array_size (const SPIRType &type, uint32_t index)
 
uint32_t to_array_size_literal (const SPIRType &type, uint32_t index) const
 
std::string variable_decl (const SPIRVariable &variable)
 
std::string variable_decl_function_local (SPIRVariable &variable)
 
void add_local_variable_name (uint32_t id)
 
void add_resource_name (uint32_t id)
 
void add_member_name (SPIRType &type, uint32_t name)
 
void add_function_overload (const SPIRFunction &func)
 
virtual bool is_non_native_row_major_matrix (uint32_t id)
 
virtual bool member_is_non_native_row_major_matrix (const SPIRType &type, uint32_t index)
 
bool member_is_packed_type (const SPIRType &type, uint32_t index) const
 
virtual std::string convert_row_major_matrix (std::string exp_str, const SPIRType &exp_type, bool is_packed)
 
void emit_struct (SPIRType &type)
 
void emit_resources ()
 
void emit_buffer_block_native (const SPIRVariable &var)
 
void emit_buffer_block_legacy (const SPIRVariable &var)
 
void emit_buffer_block_flattened (const SPIRVariable &type)
 
void emit_declared_builtin_block (spv::StorageClass storage, spv::ExecutionModel model)
 
void emit_push_constant_block_vulkan (const SPIRVariable &var)
 
void emit_push_constant_block_glsl (const SPIRVariable &var)
 
void emit_interface_block (const SPIRVariable &type)
 
void emit_flattened_io_block (const SPIRVariable &var, const char *qual)
 
void emit_block_chain (SPIRBlock &block)
 
void emit_hoisted_temporaries (std::vector< std::pair< uint32_t, uint32_t >> &temporaries)
 
void emit_constant (const SPIRConstant &constant)
 
void emit_specialization_constant_op (const SPIRConstantOp &constant)
 
std::string emit_continue_block (uint32_t continue_block)
 
bool attempt_emit_loop_header (SPIRBlock &block, SPIRBlock::Method method)
 
void propagate_loop_dominators (const SPIRBlock &block)
 
void branch (uint32_t from, uint32_t to)
 
void branch_to_continue (uint32_t from, uint32_t to)
 
void branch (uint32_t from, uint32_t cond, uint32_t true_block, uint32_t false_block)
 
void flush_phi (uint32_t from, uint32_t to)
 
bool flush_phi_required (uint32_t from, uint32_t to)
 
void flush_variable_declaration (uint32_t id)
 
void flush_undeclared_variables (SPIRBlock &block)
 
bool should_forward (uint32_t id)
 
void emit_mix_op (uint32_t result_type, uint32_t id, uint32_t left, uint32_t right, uint32_t lerp)
 
bool to_trivial_mix_op (const SPIRType &type, std::string &op, uint32_t left, uint32_t right, uint32_t lerp)
 
void emit_quaternary_func_op (uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, uint32_t op2, uint32_t op3, const char *op)
 
void emit_trinary_func_op (uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, uint32_t op2, const char *op)
 
void emit_binary_func_op (uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, const char *op)
 
void emit_binary_func_op_cast (uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, const char *op, SPIRType::BaseType input_type, bool skip_cast_if_equal_type)
 
void emit_unary_func_op (uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op)
 
void emit_unrolled_unary_op (uint32_t result_type, uint32_t result_id, uint32_t operand, const char *op)
 
void emit_binary_op (uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, const char *op)
 
void emit_unrolled_binary_op (uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, const char *op)
 
void emit_binary_op_cast (uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, const char *op, SPIRType::BaseType input_type, bool skip_cast_if_equal_type)
 
SPIRType binary_op_bitcast_helper (std::string &cast_op0, std::string &cast_op1, SPIRType::BaseType &input_type, uint32_t op0, uint32_t op1, bool skip_cast_if_equal_type)
 
std::string to_ternary_expression (const SPIRType &result_type, uint32_t select, uint32_t true_value, uint32_t false_value)
 
void emit_unary_op (uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op)
 
bool expression_is_forwarded (uint32_t id)
 
SPIRExpressionemit_op (uint32_t result_type, uint32_t result_id, const std::string &rhs, bool forward_rhs, bool suppress_usage_tracking=false)
 
std::string access_chain_internal (uint32_t base, const uint32_t *indices, uint32_t count, bool index_is_literal, bool chain_only=false, bool *need_transpose=nullptr, bool *result_is_packed=nullptr)
 
std::string access_chain (uint32_t base, const uint32_t *indices, uint32_t count, const SPIRType &target_type, bool *need_transpose=nullptr, bool *result_is_packed=nullptr)
 
std::string flattened_access_chain (uint32_t base, const uint32_t *indices, uint32_t count, const SPIRType &target_type, uint32_t offset, uint32_t matrix_stride, bool need_transpose)
 
std::string flattened_access_chain_struct (uint32_t base, const uint32_t *indices, uint32_t count, const SPIRType &target_type, uint32_t offset)
 
std::string flattened_access_chain_matrix (uint32_t base, const uint32_t *indices, uint32_t count, const SPIRType &target_type, uint32_t offset, uint32_t matrix_stride, bool need_transpose)
 
std::string flattened_access_chain_vector (uint32_t base, const uint32_t *indices, uint32_t count, const SPIRType &target_type, uint32_t offset, uint32_t matrix_stride, bool need_transpose)
 
std::pair< std::string, uint32_tflattened_access_chain_offset (const SPIRType &basetype, const uint32_t *indices, uint32_t count, uint32_t offset, uint32_t word_stride, bool *need_transpose=nullptr, uint32_t *matrix_stride=nullptr)
 
const char * index_to_swizzle (uint32_t index)
 
std::string remap_swizzle (const SPIRType &result_type, uint32_t input_components, const std::string &expr)
 
std::string declare_temporary (uint32_t type, uint32_t id)
 
void append_global_func_args (const SPIRFunction &func, uint32_t index, std::vector< std::string > &arglist)
 
std::string to_expression (uint32_t id)
 
std::string to_enclosed_expression (uint32_t id)
 
std::string to_unpacked_expression (uint32_t id)
 
std::string to_enclosed_unpacked_expression (uint32_t id)
 
std::string to_extract_component_expression (uint32_t id, uint32_t index)
 
std::string enclose_expression (const std::string &expr)
 
void strip_enclosed_expression (std::string &expr)
 
std::string to_member_name (const SPIRType &type, uint32_t index)
 
std::string type_to_glsl_constructor (const SPIRType &type)
 
std::string argument_decl (const SPIRFunction::Parameter &arg)
 
virtual std::string to_qualifiers_glsl (uint32_t id)
 
const char * to_precision_qualifiers_glsl (uint32_t id)
 
virtual const char * to_storage_qualifiers_glsl (const SPIRVariable &var)
 
const char * flags_to_precision_qualifiers_glsl (const SPIRType &type, const Bitset &flags)
 
const char * format_to_glsl (spv::ImageFormat format)
 
virtual std::string layout_for_member (const SPIRType &type, uint32_t index)
 
virtual std::string to_interpolation_qualifiers (const Bitset &flags)
 
std::string layout_for_variable (const SPIRVariable &variable)
 
std::string to_combined_image_sampler (uint32_t image_id, uint32_t samp_id)
 
virtual bool skip_argument (uint32_t id) const
 
virtual void emit_array_copy (const std::string &lhs, uint32_t rhs_id)
 
virtual void emit_block_hints (const SPIRBlock &block)
 
virtual std::string to_initializer_expression (const SPIRVariable &var)
 
bool buffer_is_packing_standard (const SPIRType &type, BufferPackingStandard packing, uint32_t start_offset=0, uint32_t end_offset=UINT32_MAX)
 
uint32_t type_to_packed_base_size (const SPIRType &type, BufferPackingStandard packing)
 
uint32_t type_to_packed_alignment (const SPIRType &type, const Bitset &flags, BufferPackingStandard packing)
 
uint32_t type_to_packed_array_stride (const SPIRType &type, const Bitset &flags, BufferPackingStandard packing)
 
uint32_t type_to_packed_size (const SPIRType &type, const Bitset &flags, BufferPackingStandard packing)
 
std::string bitcast_glsl (const SPIRType &result_type, uint32_t arg)
 
virtual std::string bitcast_glsl_op (const SPIRType &result_type, const SPIRType &argument_type)
 
std::string bitcast_expression (SPIRType::BaseType target_type, uint32_t arg)
 
std::string bitcast_expression (const SPIRType &target_type, SPIRType::BaseType expr_type, const std::string &expr)
 
std::string build_composite_combiner (uint32_t result_type, const uint32_t *elems, uint32_t length)
 
bool remove_duplicate_swizzle (std::string &op)
 
bool remove_unity_swizzle (uint32_t base, std::string &op)
 
bool check_atomic_image (uint32_t id)
 
virtual void replace_illegal_names ()
 
virtual void emit_entry_point_declarations ()
 
void replace_fragment_output (SPIRVariable &var)
 
void replace_fragment_outputs ()
 
bool check_explicit_lod_allowed (uint32_t lod)
 
std::string legacy_tex_op (const std::string &op, const SPIRType &imgtype, uint32_t lod, uint32_t id)
 
std::string load_flattened_struct (SPIRVariable &var)
 
std::string to_flattened_struct_member (const SPIRVariable &var, uint32_t index)
 
void store_flattened_struct (SPIRVariable &var, uint32_t value)
 
void track_expression_read (uint32_t id)
 
bool is_legacy () const
 
bool is_legacy_es () const
 
bool is_legacy_desktop () const
 
bool args_will_forward (uint32_t id, const uint32_t *args, uint32_t num_args, bool pure)
 
void register_call_out_argument (uint32_t id)
 
void register_impure_function_call ()
 
void register_control_dependent_expression (uint32_t expr)
 
std::string pls_decl (const PlsRemap &variable)
 
const char * to_pls_qualifiers_glsl (const SPIRVariable &variable)
 
void emit_pls ()
 
void remap_pls_variables ()
 
void add_variable (std::unordered_set< std::string > &variables, uint32_t id)
 
void add_variable (std::unordered_set< std::string > &variables, std::string &name)
 
void check_function_call_constraints (const uint32_t *args, uint32_t length)
 
void handle_invalid_expression (uint32_t id)
 
void find_static_extensions ()
 
std::string emit_for_loop_initializers (const SPIRBlock &block)
 
bool for_loop_initializers_are_same_type (const SPIRBlock &block)
 
bool optimize_read_modify_write (const SPIRType &type, const std::string &lhs, const std::string &rhs)
 
void fixup_image_load_store_access ()
 
bool type_is_empty (const SPIRType &type)
 
virtual void declare_undefined_values ()
 
bool can_use_io_location (spv::StorageClass storage, bool block)
 
const Instructionget_next_instruction_in_block (const Instruction &instr)
 
std::string convert_half_to_string (const SPIRConstant &value, uint32_t col, uint32_t row)
 
std::string convert_float_to_string (const SPIRConstant &value, uint32_t col, uint32_t row)
 
std::string convert_double_to_string (const SPIRConstant &value, uint32_t col, uint32_t row)
 
std::string convert_separate_image_to_combined (uint32_t id)
 
virtual void bitcast_to_builtin_store (uint32_t target_id, std::string &expr, const SPIRType &expr_type)
 
virtual void bitcast_from_builtin_load (uint32_t source_id, std::string &expr, const SPIRType &expr_type)
 
- Protected Member Functions inherited from spirv_cross::Compiler
const uint32_tstream (const Instruction &instr) const
 
template<typename T , typename... P>
Tset (uint32_t id, P &&... args)
 
template<typename T >
Tget (uint32_t id)
 
template<typename T >
Tmaybe_get (uint32_t id)
 
template<typename T >
const Tget (uint32_t id) const
 
template<typename T >
const Tmaybe_get (uint32_t id) const
 
const SPIREntryPointget_entry_point () const
 
SPIREntryPointget_entry_point ()
 
virtual std::string to_name (uint32_t id, bool allow_alias=true) const
 
bool is_builtin_variable (const SPIRVariable &var) const
 
bool is_hidden_variable (const SPIRVariable &var, bool include_builtins=false) const
 
bool is_immutable (uint32_t id) const
 
bool is_member_builtin (const SPIRType &type, uint32_t index, spv::BuiltIn *builtin) const
 
bool is_scalar (const SPIRType &type) const
 
bool is_vector (const SPIRType &type) const
 
bool is_matrix (const SPIRType &type) const
 
bool is_array (const SPIRType &type) const
 
uint32_t expression_type_id (uint32_t id) const
 
const SPIRTypeexpression_type (uint32_t id) const
 
bool expression_is_lvalue (uint32_t id) const
 
bool variable_storage_is_aliased (const SPIRVariable &var)
 
SPIRVariablemaybe_get_backing_variable (uint32_t chain)
 
void mark_used_as_array_length (uint32_t id)
 
void register_read (uint32_t expr, uint32_t chain, bool forwarded)
 
void register_write (uint32_t chain)
 
bool is_continue (uint32_t next) const
 
bool is_single_block_loop (uint32_t next) const
 
bool is_break (uint32_t next) const
 
bool is_loop_break (uint32_t next) const
 
bool is_conditional (uint32_t next) const
 
void flush_dependees (SPIRVariable &var)
 
void flush_all_active_variables ()
 
void flush_control_dependent_expressions (uint32_t block)
 
void flush_all_atomic_capable_variables ()
 
void flush_all_aliased_variables ()
 
void register_global_read_dependencies (const SPIRBlock &func, uint32_t id)
 
void register_global_read_dependencies (const SPIRFunction &func, uint32_t id)
 
void update_name_cache (std::unordered_set< std::string > &cache, std::string &name)
 
bool function_is_pure (const SPIRFunction &func)
 
bool block_is_pure (const SPIRBlock &block)
 
bool block_is_outside_flow_control_from_block (const SPIRBlock &from, const SPIRBlock &to)
 
bool execution_is_branchless (const SPIRBlock &from, const SPIRBlock &to) const
 
bool execution_is_noop (const SPIRBlock &from, const SPIRBlock &to) const
 
SPIRBlock::ContinueBlockType continue_block_type (const SPIRBlock &continue_block) const
 
bool block_is_loop_candidate (const SPIRBlock &block, SPIRBlock::Method method) const
 
uint32_t increase_bound_by (uint32_t incr_amount)
 
bool types_are_logically_equivalent (const SPIRType &a, const SPIRType &b) const
 
void inherit_expression_dependencies (uint32_t dst, uint32_t source)
 
bool interface_variable_exists_in_entry_point (uint32_t id) const
 
void remap_variable_type_name (const SPIRType &type, const std::string &var_name, std::string &type_name) const
 
void parse ()
 
void parse (const Instruction &i)
 
bool traverse_all_reachable_opcodes (const SPIRBlock &block, OpcodeHandler &handler) const
 
bool traverse_all_reachable_opcodes (const SPIRFunction &block, OpcodeHandler &handler) const
 
ShaderResources get_shader_resources (const std::unordered_set< uint32_t > *active_variables) const
 
Bitset get_buffer_block_flags (const SPIRVariable &var) const
 
bool get_common_basic_type (const SPIRType &type, SPIRType::BaseType &base_type)
 
void update_active_builtins ()
 
bool has_active_builtin (spv::BuiltIn builtin, spv::StorageClass storage)
 
void analyze_parameter_preservation (SPIRFunction &entry, const CFG &cfg, const std::unordered_map< uint32_t, std::unordered_set< uint32_t >> &variable_to_blocks, const std::unordered_map< uint32_t, std::unordered_set< uint32_t >> &complete_write_blocks)
 
void analyze_image_and_sampler_usage ()
 
void build_function_control_flow_graphs_and_analyze ()
 
void analyze_variable_scope (SPIRFunction &function, AnalyzeVariableScopeAccessHandler &handler)
 
void find_function_local_luts (SPIRFunction &function, const AnalyzeVariableScopeAccessHandler &handler)
 
void make_constant_null (uint32_t id, uint32_t type)
 
bool instruction_to_result_type (uint32_t &result_type, uint32_t &result_id, spv::Op op, const uint32_t *args, uint32_t length)
 
Bitset combined_decoration_for_member (const SPIRType &type, uint32_t index) const
 
bool image_is_comparison (const SPIRType &type, uint32_t id) const
 

Static Protected Member Functions

static std::string sanitize_underscores (const std::string &str)
 
static uint32_t mask_relevant_memory_semantics (uint32_t semantics)
 
- Static Protected Member Functions inherited from spirv_cross::Compiler
static bool is_desktop_only_format (spv::ImageFormat format)
 

Protected Attributes

SPIRBlockcurrent_emitting_block = nullptr
 
std::unique_ptr< std::ostringstream > buffer
 
std::vector< std::string > * redirect_statement = nullptr
 
const SPIRBlockcurrent_continue_block = nullptr
 
Options options
 
std::unordered_set< std::stringlocal_variable_names
 
std::unordered_set< std::stringresource_names
 
std::unordered_map< std::string, std::unordered_set< uint64_t > > function_overloads
 
bool processing_entry_point = false
 
struct spirv_cross::CompilerGLSL::BackendVariations backend
 
uint32_t indent = 0
 
std::unordered_set< uint32_temitted_functions
 
std::unordered_set< uint32_tflattened_buffer_blocks
 
std::unordered_set< uint32_tflattened_structs
 
std::unordered_map< uint32_t, uint32_texpression_usage_counts
 
std::vector< std::stringforced_extensions
 
std::vector< std::stringheader_lines
 
uint32_t statement_count
 
std::vector< PlsRemappls_inputs
 
std::vector< PlsRemappls_outputs
 
- Protected Attributes inherited from spirv_cross::Compiler
std::vector< uint32_tspirv
 
std::vector< Instructioninst
 
std::vector< Variantids
 
std::vector< Metameta
 
SPIRFunctioncurrent_function = nullptr
 
SPIRBlockcurrent_block = nullptr
 
std::vector< uint32_tglobal_variables
 
std::vector< uint32_taliased_variables
 
std::unordered_set< uint32_tactive_interface_variables
 
bool check_active_interface_variables = false
 
uint32_t entry_point = 0
 
std::unordered_map< uint32_t, SPIREntryPointentry_points
 
struct spirv_cross::Compiler::Source source
 
std::unordered_set< uint32_tloop_blocks
 
std::unordered_set< uint32_tcontinue_blocks
 
std::unordered_set< uint32_tloop_merge_targets
 
std::unordered_set< uint32_tselection_merge_targets
 
std::unordered_set< uint32_tmultiselect_merge_targets
 
std::unordered_map< uint32_t, uint32_tcontinue_block_to_loop_header
 
std::unordered_set< uint32_tinvalid_expressions
 
bool force_recompile = false
 
std::vector< CombinedImageSamplercombined_image_samplers
 
std::vector< uint32_tglobal_struct_cache
 
VariableTypeRemapCallback variable_remap_callback
 
std::unordered_set< uint32_tforced_temporaries
 
std::unordered_set< uint32_tforwarded_temporaries
 
std::unordered_set< uint32_thoisted_temporaries
 
Bitset active_input_builtins
 
Bitset active_output_builtins
 
uint32_t clip_distance_count = 0
 
uint32_t cull_distance_count = 0
 
bool position_invariant = false
 
std::unordered_set< uint32_tcomparison_ids
 
bool need_subpass_input = false
 
uint32_t dummy_sampler_id = 0
 
std::unordered_map< uint32_t, std::unique_ptr< CFG > > function_cfgs
 
std::vector< spv::Capabilitydeclared_capabilities
 
std::vector< std::stringdeclared_extensions
 
std::unordered_map< uint32_t, std::stringdeclared_block_names
 

Private Member Functions

void init ()
 

Additional Inherited Members

- Public Attributes inherited from spirv_cross::Compiler
SPIRV_CROSS_DEPRECATED("Please use rename_entry_point(const std::string&, const std::string&, spv::ExecutionModel) instead.") void rename_entry_point(const std const SPIREntryPointget_entry_point (const std::string &name) const
 
SPIRV_CROSS_DEPRECATED("Please use get_cleansed_entry_point_name(const std::string &, spv::ExecutionModel) instead.") const std std::vector< EntryPointget_entry_points_and_stages () const
 

Constructor & Destructor Documentation

◆ CompilerGLSL() [1/2]

spirv_cross::CompilerGLSL::CompilerGLSL ( std::vector< uint32_t spirv_)
inline
Here is the call graph for this function:

◆ CompilerGLSL() [2/2]

spirv_cross::CompilerGLSL::CompilerGLSL ( const uint32_t ir,
size_t  word_count 
)
inline
Here is the call graph for this function:

Member Function Documentation

◆ access_chain()

string CompilerGLSL::access_chain ( uint32_t  base,
const uint32_t indices,
uint32_t  count,
const SPIRType target_type,
bool need_transpose = nullptr,
bool result_is_packed = nullptr 
)
protected
Here is the call graph for this function:

◆ access_chain_internal()

string CompilerGLSL::access_chain_internal ( uint32_t  base,
const uint32_t indices,
uint32_t  count,
bool  index_is_literal,
bool  chain_only = false,
bool need_transpose = nullptr,
bool result_is_packed = nullptr 
)
protected
Here is the call graph for this function:

◆ add_function_overload()

void CompilerGLSL::add_function_overload ( const SPIRFunction func)
protected
Here is the call graph for this function:

◆ add_header_line()

void CompilerGLSL::add_header_line ( const std::string str)
Here is the caller graph for this function:

◆ add_local_variable_name()

void CompilerGLSL::add_local_variable_name ( uint32_t  id)
protected

◆ add_member_name()

void CompilerGLSL::add_member_name ( SPIRType type,
uint32_t  name 
)
protected

◆ add_resource_name()

void CompilerGLSL::add_resource_name ( uint32_t  id)
protected
Here is the caller graph for this function:

◆ add_variable() [1/2]

void spirv_cross::CompilerGLSL::add_variable ( std::unordered_set< std::string > &  variables,
uint32_t  id 
)
protected

◆ add_variable() [2/2]

void spirv_cross::CompilerGLSL::add_variable ( std::unordered_set< std::string > &  variables,
std::string name 
)
protected

◆ append_global_func_args()

void CompilerGLSL::append_global_func_args ( const SPIRFunction func,
uint32_t  index,
std::vector< std::string > &  arglist 
)
protected

◆ args_will_forward()

bool CompilerGLSL::args_will_forward ( uint32_t  id,
const uint32_t args,
uint32_t  num_args,
bool  pure 
)
protected

◆ argument_decl()

string CompilerGLSL::argument_decl ( const SPIRFunction::Parameter arg)
protected
Here is the call graph for this function:

◆ attempt_emit_loop_header()

bool CompilerGLSL::attempt_emit_loop_header ( SPIRBlock block,
SPIRBlock::Method  method 
)
protected
Here is the call graph for this function:

◆ begin_scope()

void CompilerGLSL::begin_scope ( )
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ binary_op_bitcast_helper()

SPIRType CompilerGLSL::binary_op_bitcast_helper ( std::string cast_op0,
std::string cast_op1,
SPIRType::BaseType input_type,
uint32_t  op0,
uint32_t  op1,
bool  skip_cast_if_equal_type 
)
protected

◆ bitcast_expression() [1/2]

std::string CompilerGLSL::bitcast_expression ( SPIRType::BaseType  target_type,
uint32_t  arg 
)
protected
Here is the call graph for this function:

◆ bitcast_expression() [2/2]

std::string CompilerGLSL::bitcast_expression ( const SPIRType target_type,
SPIRType::BaseType  expr_type,
const std::string expr 
)
protected
Here is the call graph for this function:

◆ bitcast_from_builtin_load()

void CompilerGLSL::bitcast_from_builtin_load ( uint32_t  source_id,
std::string expr,
const SPIRType expr_type 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

Here is the call graph for this function:

◆ bitcast_glsl()

string CompilerGLSL::bitcast_glsl ( const SPIRType result_type,
uint32_t  arg 
)
protected
Here is the call graph for this function:

◆ bitcast_glsl_op()

string CompilerGLSL::bitcast_glsl_op ( const SPIRType result_type,
const SPIRType argument_type 
)
protectedvirtual

◆ bitcast_to_builtin_store()

void CompilerGLSL::bitcast_to_builtin_store ( uint32_t  target_id,
std::string expr,
const SPIRType expr_type 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

Here is the call graph for this function:

◆ branch() [1/2]

void CompilerGLSL::branch ( uint32_t  from,
uint32_t  to 
)
protected
Here is the call graph for this function:

◆ branch() [2/2]

void CompilerGLSL::branch ( uint32_t  from,
uint32_t  cond,
uint32_t  true_block,
uint32_t  false_block 
)
protected
Here is the call graph for this function:

◆ branch_to_continue()

void CompilerGLSL::branch_to_continue ( uint32_t  from,
uint32_t  to 
)
protected
Here is the call graph for this function:

◆ buffer_is_packing_standard()

bool CompilerGLSL::buffer_is_packing_standard ( const SPIRType type,
BufferPackingStandard  packing,
uint32_t  start_offset = 0,
uint32_t  end_offset = UINT32_MAX 
)
protected
Here is the call graph for this function:

◆ build_composite_combiner()

string CompilerGLSL::build_composite_combiner ( uint32_t  result_type,
const uint32_t elems,
uint32_t  length 
)
protected

◆ builtin_to_glsl()

string CompilerGLSL::builtin_to_glsl ( spv::BuiltIn  builtin,
spv::StorageClass  storage 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL, and spirv_cross::CompilerHLSL.

Here is the call graph for this function:

◆ can_use_io_location()

bool CompilerGLSL::can_use_io_location ( spv::StorageClass  storage,
bool  block 
)
protected

◆ check_atomic_image()

bool CompilerGLSL::check_atomic_image ( uint32_t  id)
protected

◆ check_explicit_lod_allowed()

bool CompilerGLSL::check_explicit_lod_allowed ( uint32_t  lod)
protected

◆ check_function_call_constraints()

void CompilerGLSL::check_function_call_constraints ( const uint32_t args,
uint32_t  length 
)
protected

◆ compile()

string CompilerGLSL::compile ( )
overridevirtual

Reimplemented from spirv_cross::Compiler.

Reimplemented in spirv_cross::CompilerMSL, spirv_cross::CompilerHLSL, and spirv_cross::CompilerReflection.

Here is the caller graph for this function:

◆ constant_expression()

string CompilerGLSL::constant_expression ( const SPIRConstant c)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

◆ constant_expression_vector()

string CompilerGLSL::constant_expression_vector ( const SPIRConstant c,
uint32_t  vector 
)
protectedvirtual
Here is the call graph for this function:

◆ constant_op_expression()

string CompilerGLSL::constant_op_expression ( const SPIRConstantOp cop)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_double_to_string()

std::string CompilerGLSL::convert_double_to_string ( const SPIRConstant value,
uint32_t  col,
uint32_t  row 
)
protected
Here is the call graph for this function:

◆ convert_float_to_string()

string CompilerGLSL::convert_float_to_string ( const SPIRConstant value,
uint32_t  col,
uint32_t  row 
)
protected
Here is the call graph for this function:

◆ convert_half_to_string()

string CompilerGLSL::convert_half_to_string ( const SPIRConstant value,
uint32_t  col,
uint32_t  row 
)
protected
Here is the call graph for this function:

◆ convert_row_major_matrix()

string CompilerGLSL::convert_row_major_matrix ( std::string  exp_str,
const SPIRType exp_type,
bool  is_packed 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

Here is the call graph for this function:

◆ convert_separate_image_to_combined()

std::string CompilerGLSL::convert_separate_image_to_combined ( uint32_t  id)
protected
Here is the call graph for this function:

◆ declare_temporary()

string CompilerGLSL::declare_temporary ( uint32_t  type,
uint32_t  id 
)
protected
Here is the call graph for this function:

◆ declare_undefined_values()

void CompilerGLSL::declare_undefined_values ( )
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

Here is the call graph for this function:

◆ emit_array_copy()

void CompilerGLSL::emit_array_copy ( const std::string lhs,
uint32_t  rhs_id 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

Here is the call graph for this function:

◆ emit_binary_func_op()

void CompilerGLSL::emit_binary_func_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  op0,
uint32_t  op1,
const char *  op 
)
protected
Here is the call graph for this function:

◆ emit_binary_func_op_cast()

void CompilerGLSL::emit_binary_func_op_cast ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  op0,
uint32_t  op1,
const char *  op,
SPIRType::BaseType  input_type,
bool  skip_cast_if_equal_type 
)
protected
Here is the call graph for this function:

◆ emit_binary_op()

void CompilerGLSL::emit_binary_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  op0,
uint32_t  op1,
const char *  op 
)
protected
Here is the call graph for this function:

◆ emit_binary_op_cast()

void CompilerGLSL::emit_binary_op_cast ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  op0,
uint32_t  op1,
const char *  op,
SPIRType::BaseType  input_type,
bool  skip_cast_if_equal_type 
)
protected
Here is the call graph for this function:

◆ emit_block_chain()

void CompilerGLSL::emit_block_chain ( SPIRBlock block)
protected
Here is the call graph for this function:

◆ emit_block_hints()

void CompilerGLSL::emit_block_hints ( const SPIRBlock block)
protectedvirtual

Reimplemented in spirv_cross::CompilerHLSL.

◆ emit_block_instructions()

void CompilerGLSL::emit_block_instructions ( SPIRBlock block)
protected

◆ emit_buffer_block()

void CompilerGLSL::emit_buffer_block ( const SPIRVariable type)
protectedvirtual

◆ emit_buffer_block_flattened()

void CompilerGLSL::emit_buffer_block_flattened ( const SPIRVariable type)
protected
Here is the call graph for this function:

◆ emit_buffer_block_legacy()

void CompilerGLSL::emit_buffer_block_legacy ( const SPIRVariable var)
protected
Here is the call graph for this function:

◆ emit_buffer_block_native()

void CompilerGLSL::emit_buffer_block_native ( const SPIRVariable var)
protected
Here is the call graph for this function:

◆ emit_constant()

void CompilerGLSL::emit_constant ( const SPIRConstant constant)
protected
Here is the call graph for this function:

◆ emit_continue_block()

string CompilerGLSL::emit_continue_block ( uint32_t  continue_block)
protected
Here is the call graph for this function:

◆ emit_declared_builtin_block()

void CompilerGLSL::emit_declared_builtin_block ( spv::StorageClass  storage,
spv::ExecutionModel  model 
)
protected
Here is the call graph for this function:

◆ emit_entry_point_declarations()

void CompilerGLSL::emit_entry_point_declarations ( )
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

◆ emit_fixup()

void CompilerGLSL::emit_fixup ( )
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL, and spirv_cross::CompilerHLSL.

Here is the call graph for this function:

◆ emit_flattened_io_block()

void CompilerGLSL::emit_flattened_io_block ( const SPIRVariable var,
const char *  qual 
)
protected
Here is the call graph for this function:

◆ emit_for_loop_initializers()

string CompilerGLSL::emit_for_loop_initializers ( const SPIRBlock block)
protected
Here is the call graph for this function:

◆ emit_function()

void CompilerGLSL::emit_function ( SPIRFunction func,
const Bitset return_flags 
)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ emit_function_prototype()

void CompilerGLSL::emit_function_prototype ( SPIRFunction func,
const Bitset return_flags 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL, spirv_cross::CompilerHLSL, and spirv_cross::CompilerCPP.

Here is the call graph for this function:

◆ emit_glsl_op()

void CompilerGLSL::emit_glsl_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  op,
const uint32_t args,
uint32_t  count 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL, and spirv_cross::CompilerHLSL.

Here is the call graph for this function:

◆ emit_header()

void CompilerGLSL::emit_header ( )
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL, spirv_cross::CompilerHLSL, and spirv_cross::CompilerCPP.

Here is the call graph for this function:

◆ emit_hoisted_temporaries()

void spirv_cross::CompilerGLSL::emit_hoisted_temporaries ( std::vector< std::pair< uint32_t, uint32_t >> &  temporaries)
protected

◆ emit_instruction()

void CompilerGLSL::emit_instruction ( const Instruction instr)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL, and spirv_cross::CompilerHLSL.

Here is the call graph for this function:

◆ emit_interface_block()

void CompilerGLSL::emit_interface_block ( const SPIRVariable type)
protected
Here is the call graph for this function:

◆ emit_mix_op()

void CompilerGLSL::emit_mix_op ( uint32_t  result_type,
uint32_t  id,
uint32_t  left,
uint32_t  right,
uint32_t  lerp 
)
protected
Here is the call graph for this function:

◆ emit_op()

SPIRExpression & CompilerGLSL::emit_op ( uint32_t  result_type,
uint32_t  result_id,
const std::string rhs,
bool  forward_rhs,
bool  suppress_usage_tracking = false 
)
protected
Here is the call graph for this function:

◆ emit_pls()

void CompilerGLSL::emit_pls ( )
protected
Here is the call graph for this function:

◆ emit_push_constant_block()

void CompilerGLSL::emit_push_constant_block ( const SPIRVariable var)
protectedvirtual

◆ emit_push_constant_block_glsl()

void CompilerGLSL::emit_push_constant_block_glsl ( const SPIRVariable var)
protected
Here is the call graph for this function:

◆ emit_push_constant_block_vulkan()

void CompilerGLSL::emit_push_constant_block_vulkan ( const SPIRVariable var)
protected

◆ emit_quaternary_func_op()

void CompilerGLSL::emit_quaternary_func_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  op0,
uint32_t  op1,
uint32_t  op2,
uint32_t  op3,
const char *  op 
)
protected
Here is the call graph for this function:

◆ emit_resources()

void CompilerGLSL::emit_resources ( )
protected
Here is the call graph for this function:

◆ emit_sampled_image_op()

void CompilerGLSL::emit_sampled_image_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  image_id,
uint32_t  samp_id 
)
protectedvirtual

◆ emit_specialization_constant_op()

void CompilerGLSL::emit_specialization_constant_op ( const SPIRConstantOp constant)
protected
Here is the call graph for this function:

◆ emit_spv_amd_gcn_shader_op()

void CompilerGLSL::emit_spv_amd_gcn_shader_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  op,
const uint32_t args,
uint32_t  count 
)
protectedvirtual
Here is the call graph for this function:

◆ emit_spv_amd_shader_ballot_op()

void CompilerGLSL::emit_spv_amd_shader_ballot_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  op,
const uint32_t args,
uint32_t  count 
)
protectedvirtual
Here is the call graph for this function:

◆ emit_spv_amd_shader_explicit_vertex_parameter_op()

void CompilerGLSL::emit_spv_amd_shader_explicit_vertex_parameter_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  op,
const uint32_t args,
uint32_t  count 
)
protectedvirtual
Here is the call graph for this function:

◆ emit_spv_amd_shader_trinary_minmax_op()

void CompilerGLSL::emit_spv_amd_shader_trinary_minmax_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  op,
const uint32_t args,
uint32_t  count 
)
protectedvirtual
Here is the call graph for this function:

◆ emit_struct()

void CompilerGLSL::emit_struct ( SPIRType type)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ emit_struct_member()

void CompilerGLSL::emit_struct_member ( const SPIRType type,
uint32_t  member_type_id,
uint32_t  index,
const std::string qualifier = "",
uint32_t  base_offset = 0 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL, and spirv_cross::CompilerHLSL.

Here is the call graph for this function:

◆ emit_subgroup_op()

void CompilerGLSL::emit_subgroup_op ( const Instruction i)
protectedvirtual

Reimplemented in spirv_cross::CompilerHLSL.

Here is the call graph for this function:

◆ emit_texture_op()

void CompilerGLSL::emit_texture_op ( const Instruction i)
protectedvirtual

Reimplemented in spirv_cross::CompilerHLSL.

Here is the call graph for this function:

◆ emit_trinary_func_op()

void CompilerGLSL::emit_trinary_func_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  op0,
uint32_t  op1,
uint32_t  op2,
const char *  op 
)
protected
Here is the call graph for this function:

◆ emit_unary_func_op()

void CompilerGLSL::emit_unary_func_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  op0,
const char *  op 
)
protected
Here is the call graph for this function:

◆ emit_unary_op()

void CompilerGLSL::emit_unary_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  op0,
const char *  op 
)
protected
Here is the call graph for this function:

◆ emit_uniform()

void CompilerGLSL::emit_uniform ( const SPIRVariable var)
protectedvirtual

Reimplemented in spirv_cross::CompilerHLSL, and spirv_cross::CompilerCPP.

Here is the call graph for this function:

◆ emit_unrolled_binary_op()

void CompilerGLSL::emit_unrolled_binary_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  op0,
uint32_t  op1,
const char *  op 
)
protected
Here is the call graph for this function:

◆ emit_unrolled_unary_op()

void CompilerGLSL::emit_unrolled_unary_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  operand,
const char *  op 
)
protected
Here is the call graph for this function:

◆ enclose_expression()

string CompilerGLSL::enclose_expression ( const std::string expr)
protected
Here is the call graph for this function:

◆ end_scope()

void CompilerGLSL::end_scope ( )
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ end_scope_decl() [1/2]

void CompilerGLSL::end_scope_decl ( )
protected
Here is the call graph for this function:

◆ end_scope_decl() [2/2]

void CompilerGLSL::end_scope_decl ( const std::string decl)
protected
Here is the call graph for this function:

◆ expression_is_forwarded()

bool CompilerGLSL::expression_is_forwarded ( uint32_t  id)
protected

◆ find_static_extensions()

void CompilerGLSL::find_static_extensions ( )
protected

◆ fixup_image_load_store_access()

void CompilerGLSL::fixup_image_load_store_access ( )
protected
Here is the caller graph for this function:

◆ flags_to_precision_qualifiers_glsl()

const char * CompilerGLSL::flags_to_precision_qualifiers_glsl ( const SPIRType type,
const Bitset flags 
)
protected

◆ flatten_buffer_block()

void CompilerGLSL::flatten_buffer_block ( uint32_t  id)

◆ flattened_access_chain()

std::string CompilerGLSL::flattened_access_chain ( uint32_t  base,
const uint32_t indices,
uint32_t  count,
const SPIRType target_type,
uint32_t  offset,
uint32_t  matrix_stride,
bool  need_transpose 
)
protected

◆ flattened_access_chain_matrix()

std::string CompilerGLSL::flattened_access_chain_matrix ( uint32_t  base,
const uint32_t indices,
uint32_t  count,
const SPIRType target_type,
uint32_t  offset,
uint32_t  matrix_stride,
bool  need_transpose 
)
protected
Here is the call graph for this function:

◆ flattened_access_chain_offset()

std::pair< std::string, uint32_t > CompilerGLSL::flattened_access_chain_offset ( const SPIRType basetype,
const uint32_t indices,
uint32_t  count,
uint32_t  offset,
uint32_t  word_stride,
bool need_transpose = nullptr,
uint32_t matrix_stride = nullptr 
)
protected
Here is the call graph for this function:

◆ flattened_access_chain_struct()

std::string CompilerGLSL::flattened_access_chain_struct ( uint32_t  base,
const uint32_t indices,
uint32_t  count,
const SPIRType target_type,
uint32_t  offset 
)
protected
Here is the call graph for this function:

◆ flattened_access_chain_vector()

std::string CompilerGLSL::flattened_access_chain_vector ( uint32_t  base,
const uint32_t indices,
uint32_t  count,
const SPIRType target_type,
uint32_t  offset,
uint32_t  matrix_stride,
bool  need_transpose 
)
protected
Here is the call graph for this function:

◆ flush_phi()

void CompilerGLSL::flush_phi ( uint32_t  from,
uint32_t  to 
)
protected
Here is the call graph for this function:

◆ flush_phi_required()

bool CompilerGLSL::flush_phi_required ( uint32_t  from,
uint32_t  to 
)
protected

◆ flush_undeclared_variables()

void CompilerGLSL::flush_undeclared_variables ( SPIRBlock block)
protected
Here is the call graph for this function:

◆ flush_variable_declaration()

void CompilerGLSL::flush_variable_declaration ( uint32_t  id)
protected
Here is the call graph for this function:

◆ for_loop_initializers_are_same_type()

bool CompilerGLSL::for_loop_initializers_are_same_type ( const SPIRBlock block)
protected
Here is the call graph for this function:

◆ format_to_glsl()

const char * CompilerGLSL::format_to_glsl ( spv::ImageFormat  format)
protected

◆ get_common_options()

const Options& spirv_cross::CompilerGLSL::get_common_options ( ) const
inline

◆ get_next_instruction_in_block()

const Instruction * CompilerGLSL::get_next_instruction_in_block ( const Instruction instr)
protected

◆ get_partial_source()

std::string CompilerGLSL::get_partial_source ( )

◆ handle_invalid_expression()

void CompilerGLSL::handle_invalid_expression ( uint32_t  id)
protected

◆ has_extension()

bool CompilerGLSL::has_extension ( const std::string ext) const
protected

◆ image_type_glsl()

string CompilerGLSL::image_type_glsl ( const SPIRType type,
uint32_t  id = 0 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

◆ index_to_swizzle()

const char * CompilerGLSL::index_to_swizzle ( uint32_t  index)
protected

◆ init()

void spirv_cross::CompilerGLSL::init ( )
inlineprivate
Here is the caller graph for this function:

◆ is_legacy()

bool spirv_cross::CompilerGLSL::is_legacy ( ) const
inlineprotected

◆ is_legacy_desktop()

bool spirv_cross::CompilerGLSL::is_legacy_desktop ( ) const
inlineprotected

◆ is_legacy_es()

bool spirv_cross::CompilerGLSL::is_legacy_es ( ) const
inlineprotected

◆ is_non_native_row_major_matrix()

bool CompilerGLSL::is_non_native_row_major_matrix ( uint32_t  id)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

◆ layout_for_member()

string CompilerGLSL::layout_for_member ( const SPIRType type,
uint32_t  index 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerHLSL.

Here is the call graph for this function:

◆ layout_for_variable()

string CompilerGLSL::layout_for_variable ( const SPIRVariable variable)
protected
Here is the call graph for this function:

◆ legacy_tex_op()

string CompilerGLSL::legacy_tex_op ( const std::string op,
const SPIRType imgtype,
uint32_t  lod,
uint32_t  id 
)
protected
Here is the call graph for this function:

◆ load_flattened_struct()

string CompilerGLSL::load_flattened_struct ( SPIRVariable var)
protected
Here is the call graph for this function:

◆ mask_relevant_memory_semantics()

uint32_t CompilerGLSL::mask_relevant_memory_semantics ( uint32_t  semantics)
staticprotected

◆ member_is_non_native_row_major_matrix()

bool CompilerGLSL::member_is_non_native_row_major_matrix ( const SPIRType type,
uint32_t  index 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

◆ member_is_packed_type()

bool CompilerGLSL::member_is_packed_type ( const SPIRType type,
uint32_t  index 
) const
protected

◆ optimize_read_modify_write()

bool CompilerGLSL::optimize_read_modify_write ( const SPIRType type,
const std::string lhs,
const std::string rhs 
)
protected
Here is the call graph for this function:

◆ pls_decl()

string CompilerGLSL::pls_decl ( const PlsRemap variable)
protected
Here is the call graph for this function:

◆ propagate_loop_dominators()

void CompilerGLSL::propagate_loop_dominators ( const SPIRBlock block)
protected

◆ register_call_out_argument()

void CompilerGLSL::register_call_out_argument ( uint32_t  id)
protected

◆ register_control_dependent_expression()

void CompilerGLSL::register_control_dependent_expression ( uint32_t  expr)
protected
Here is the call graph for this function:

◆ register_impure_function_call()

void CompilerGLSL::register_impure_function_call ( )
protected

◆ remap_pixel_local_storage()

void spirv_cross::CompilerGLSL::remap_pixel_local_storage ( std::vector< PlsRemap inputs,
std::vector< PlsRemap outputs 
)
inline
Here is the call graph for this function:

◆ remap_pls_variables()

void CompilerGLSL::remap_pls_variables ( )
protected
Here is the caller graph for this function:

◆ remap_swizzle()

string CompilerGLSL::remap_swizzle ( const SPIRType result_type,
uint32_t  input_components,
const std::string expr 
)
protected
Here is the call graph for this function:

◆ remove_duplicate_swizzle()

bool CompilerGLSL::remove_duplicate_swizzle ( std::string op)
protected

◆ remove_unity_swizzle()

bool CompilerGLSL::remove_unity_swizzle ( uint32_t  base,
std::string op 
)
protected

◆ replace_fragment_output()

void CompilerGLSL::replace_fragment_output ( SPIRVariable var)
protected
Here is the call graph for this function:

◆ replace_fragment_outputs()

void CompilerGLSL::replace_fragment_outputs ( )
protected

◆ replace_illegal_names()

void CompilerGLSL::replace_illegal_names ( )
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL, and spirv_cross::CompilerHLSL.

Here is the call graph for this function:

◆ require_extension()

void CompilerGLSL::require_extension ( const std::string ext)

◆ require_extension_internal()

void CompilerGLSL::require_extension_internal ( const std::string ext)
protected

◆ reset()

void CompilerGLSL::reset ( )
protected
Here is the caller graph for this function:

◆ sanitize_underscores()

string CompilerGLSL::sanitize_underscores ( const std::string str)
staticprotected

◆ set_common_options()

void spirv_cross::CompilerGLSL::set_common_options ( const Options opts)
inline
Here is the caller graph for this function:

◆ should_forward()

bool CompilerGLSL::should_forward ( uint32_t  id)
protected

◆ skip_argument()

bool CompilerGLSL::skip_argument ( uint32_t  id) const
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

◆ SPIRV_CROSS_DEPRECATED() [1/2]

spirv_cross::CompilerGLSL::SPIRV_CROSS_DEPRECATED ( "get_options() is  obsolete,
use get_common_options() instead."   
) const &
inline

◆ SPIRV_CROSS_DEPRECATED() [2/2]

spirv_cross::CompilerGLSL::SPIRV_CROSS_DEPRECATED ( "set_options() is  obsolete,
use set_common_options() instead."   
) &
inline

◆ statement()

template<typename... Ts>
void spirv_cross::CompilerGLSL::statement ( Ts &&...  ts)
inlineprotected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ statement_inner() [1/2]

template<typename T >
void spirv_cross::CompilerGLSL::statement_inner ( T &&  t)
inlineprotected
Here is the caller graph for this function:

◆ statement_inner() [2/2]

template<typename T , typename... Ts>
void spirv_cross::CompilerGLSL::statement_inner ( T &&  t,
Ts &&...  ts 
)
inlineprotected
Here is the call graph for this function:

◆ statement_no_indent()

template<typename... Ts>
void spirv_cross::CompilerGLSL::statement_no_indent ( Ts &&...  ts)
inlineprotected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ store_flattened_struct()

void CompilerGLSL::store_flattened_struct ( SPIRVariable var,
uint32_t  value 
)
protected
Here is the call graph for this function:

◆ strip_enclosed_expression()

void CompilerGLSL::strip_enclosed_expression ( std::string expr)
protected
Here is the call graph for this function:

◆ to_array_size()

string CompilerGLSL::to_array_size ( const SPIRType type,
uint32_t  index 
)
protected
Here is the call graph for this function:

◆ to_array_size_literal()

uint32_t CompilerGLSL::to_array_size_literal ( const SPIRType type,
uint32_t  index 
) const
protected
Here is the caller graph for this function:

◆ to_combined_image_sampler()

string CompilerGLSL::to_combined_image_sampler ( uint32_t  image_id,
uint32_t  samp_id 
)
protected

◆ to_enclosed_expression()

string CompilerGLSL::to_enclosed_expression ( uint32_t  id)
protected

◆ to_enclosed_unpacked_expression()

string CompilerGLSL::to_enclosed_unpacked_expression ( uint32_t  id)
protected

◆ to_expression()

string CompilerGLSL::to_expression ( uint32_t  id)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_extract_component_expression()

string CompilerGLSL::to_extract_component_expression ( uint32_t  id,
uint32_t  index 
)
protected
Here is the call graph for this function:

◆ to_flattened_struct_member()

string CompilerGLSL::to_flattened_struct_member ( const SPIRVariable var,
uint32_t  index 
)
protected
Here is the call graph for this function:

◆ to_func_call_arg()

string CompilerGLSL::to_func_call_arg ( uint32_t  id)
protectedvirtual

◆ to_function_args()

string CompilerGLSL::to_function_args ( uint32_t  img,
const SPIRType imgtype,
bool  is_fetch,
bool  is_gather,
bool  is_proj,
uint32_t  coord,
uint32_t  coord_components,
uint32_t  dref,
uint32_t  grad_x,
uint32_t  grad_y,
uint32_t  lod,
uint32_t  coffset,
uint32_t  offset,
uint32_t  bias,
uint32_t  comp,
uint32_t  sample,
bool p_forward 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

◆ to_function_name()

string CompilerGLSL::to_function_name ( uint32_t  img,
const SPIRType imgtype,
bool  is_fetch,
bool  is_gather,
bool  is_proj,
bool  has_array_offsets,
bool  has_offset,
bool  has_grad,
bool  has_dref,
uint32_t  lod 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

◆ to_initializer_expression()

string CompilerGLSL::to_initializer_expression ( const SPIRVariable var)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

◆ to_interpolation_qualifiers()

string CompilerGLSL::to_interpolation_qualifiers ( const Bitset flags)
protectedvirtual

Reimplemented in spirv_cross::CompilerHLSL.

◆ to_member_name()

string CompilerGLSL::to_member_name ( const SPIRType type,
uint32_t  index 
)
protected
Here is the call graph for this function:

◆ to_pls_qualifiers_glsl()

const char * CompilerGLSL::to_pls_qualifiers_glsl ( const SPIRVariable variable)
protected

◆ to_precision_qualifiers_glsl()

const char * CompilerGLSL::to_precision_qualifiers_glsl ( uint32_t  id)
protected

◆ to_qualifiers_glsl()

string CompilerGLSL::to_qualifiers_glsl ( uint32_t  id)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

◆ to_storage_qualifiers_glsl()

const char * CompilerGLSL::to_storage_qualifiers_glsl ( const SPIRVariable var)
protectedvirtual

Reimplemented in spirv_cross::CompilerHLSL.

◆ to_ternary_expression()

string CompilerGLSL::to_ternary_expression ( const SPIRType result_type,
uint32_t  select,
uint32_t  true_value,
uint32_t  false_value 
)
protected
Here is the call graph for this function:

◆ to_trivial_mix_op()

bool CompilerGLSL::to_trivial_mix_op ( const SPIRType type,
std::string op,
uint32_t  left,
uint32_t  right,
uint32_t  lerp 
)
protected

◆ to_unpacked_expression()

string CompilerGLSL::to_unpacked_expression ( uint32_t  id)
protected

◆ track_expression_read()

void CompilerGLSL::track_expression_read ( uint32_t  id)
protected

◆ type_is_empty()

bool CompilerGLSL::type_is_empty ( const SPIRType type)
protected

◆ type_to_array_glsl()

string CompilerGLSL::type_to_array_glsl ( const SPIRType type)
protected

◆ type_to_glsl()

string CompilerGLSL::type_to_glsl ( const SPIRType type,
uint32_t  id = 0 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL, and spirv_cross::CompilerHLSL.

Here is the call graph for this function:

◆ type_to_glsl_constructor()

string CompilerGLSL::type_to_glsl_constructor ( const SPIRType type)
protected

◆ type_to_packed_alignment()

uint32_t CompilerGLSL::type_to_packed_alignment ( const SPIRType type,
const Bitset flags,
BufferPackingStandard  packing 
)
protected
Here is the call graph for this function:

◆ type_to_packed_array_stride()

uint32_t CompilerGLSL::type_to_packed_array_stride ( const SPIRType type,
const Bitset flags,
BufferPackingStandard  packing 
)
protected

◆ type_to_packed_base_size()

uint32_t CompilerGLSL::type_to_packed_base_size ( const SPIRType type,
BufferPackingStandard  packing 
)
protected

◆ type_to_packed_size()

uint32_t CompilerGLSL::type_to_packed_size ( const SPIRType type,
const Bitset flags,
BufferPackingStandard  packing 
)
protected
Here is the call graph for this function:

◆ unpack_expression_type()

string CompilerGLSL::unpack_expression_type ( std::string  expr_str,
const SPIRType type 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerMSL.

◆ variable_decl() [1/2]

string CompilerGLSL::variable_decl ( const SPIRType type,
const std::string name,
uint32_t  id = 0 
)
protectedvirtual

Reimplemented in spirv_cross::CompilerCPP.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ variable_decl() [2/2]

string CompilerGLSL::variable_decl ( const SPIRVariable variable)
protected
Here is the call graph for this function:

◆ variable_decl_function_local()

string CompilerGLSL::variable_decl_function_local ( SPIRVariable variable)
protected
Here is the call graph for this function:

Member Data Documentation

◆ backend

struct spirv_cross::CompilerGLSL::BackendVariations spirv_cross::CompilerGLSL::backend
protected

◆ buffer

std::unique_ptr<std::ostringstream> spirv_cross::CompilerGLSL::buffer
protected

◆ current_continue_block

const SPIRBlock* spirv_cross::CompilerGLSL::current_continue_block = nullptr
protected

◆ current_emitting_block

SPIRBlock* spirv_cross::CompilerGLSL::current_emitting_block = nullptr
protected

◆ emitted_functions

std::unordered_set<uint32_t> spirv_cross::CompilerGLSL::emitted_functions
protected

◆ expression_usage_counts

std::unordered_map<uint32_t, uint32_t> spirv_cross::CompilerGLSL::expression_usage_counts
protected

◆ flattened_buffer_blocks

std::unordered_set<uint32_t> spirv_cross::CompilerGLSL::flattened_buffer_blocks
protected

◆ flattened_structs

std::unordered_set<uint32_t> spirv_cross::CompilerGLSL::flattened_structs
protected

◆ forced_extensions

std::vector<std::string> spirv_cross::CompilerGLSL::forced_extensions
protected

◆ function_overloads

std::unordered_map<std::string, std::unordered_set<uint64_t> > spirv_cross::CompilerGLSL::function_overloads
protected

◆ header_lines

std::vector<std::string> spirv_cross::CompilerGLSL::header_lines
protected

◆ indent

uint32_t spirv_cross::CompilerGLSL::indent = 0
protected

◆ local_variable_names

std::unordered_set<std::string> spirv_cross::CompilerGLSL::local_variable_names
protected

◆ options

Options spirv_cross::CompilerGLSL::options
protected

◆ pls_inputs

std::vector<PlsRemap> spirv_cross::CompilerGLSL::pls_inputs
protected

◆ pls_outputs

std::vector<PlsRemap> spirv_cross::CompilerGLSL::pls_outputs
protected

◆ processing_entry_point

bool spirv_cross::CompilerGLSL::processing_entry_point = false
protected

◆ redirect_statement

std::vector<std::string>* spirv_cross::CompilerGLSL::redirect_statement = nullptr
protected

◆ resource_names

std::unordered_set<std::string> spirv_cross::CompilerGLSL::resource_names
protected

◆ statement_count

uint32_t spirv_cross::CompilerGLSL::statement_count
protected

The documentation for this class was generated from the following files: