Class Compiler
Defined in File spirv_cross.hpp
Nested Relationships
Nested Types
Inheritance Relationships
Derived Type
public SPIRV_CROSS_NAMESPACE::CompilerGLSL
(Class CompilerGLSL)
Class Documentation
-
class Compiler
Subclassed by SPIRV_CROSS_NAMESPACE::CompilerGLSL
Public Functions
-
explicit Compiler(std::vector<uint32_t> ir)
-
Compiler(const uint32_t *ir, size_t word_count)
-
virtual ~Compiler() = default
-
virtual std::string compile()
-
void set_decoration(ID id, spv::Decoration decoration, uint32_t argument = 0)
-
void set_decoration_string(ID id, spv::Decoration decoration, const std::string &argument)
-
bool has_decoration(ID id, spv::Decoration decoration) const
-
uint32_t get_decoration(ID id, spv::Decoration decoration) const
-
const std::string &get_decoration_string(ID id, spv::Decoration decoration) const
-
void unset_decoration(ID id, spv::Decoration decoration)
-
const SPIRType &get_type_from_variable(VariableID id) const
-
spv::StorageClass get_storage_class(VariableID id) const
-
virtual const std::string get_block_fallback_name(VariableID id) const
-
uint32_t get_member_decoration(TypeID id, uint32_t index, spv::Decoration decoration) const
-
const std::string &get_member_decoration_string(TypeID id, uint32_t index, spv::Decoration decoration) const
-
bool has_member_decoration(TypeID id, uint32_t index, spv::Decoration decoration) const
-
void set_member_decoration(TypeID id, uint32_t index, spv::Decoration decoration, uint32_t argument = 0)
-
void set_member_decoration_string(TypeID id, uint32_t index, spv::Decoration decoration, const std::string &argument)
-
void unset_member_decoration(TypeID id, uint32_t index, spv::Decoration decoration)
-
inline virtual const std::string get_fallback_member_name(uint32_t index) const
-
SmallVector<BufferRange> get_active_buffer_ranges(VariableID id) const
-
size_t get_declared_struct_size_runtime_array(const SPIRType &struct_type, size_t array_size) const
-
std::unordered_set<VariableID> get_active_interface_variables() const
-
void set_enabled_interface_variables(std::unordered_set<VariableID> active_variables)
-
ShaderResources get_shader_resources() const
-
ShaderResources get_shader_resources(const std::unordered_set<VariableID> &active_variables) const
-
void set_remapped_variable_state(VariableID id, bool remap_enable)
-
bool get_remapped_variable_state(VariableID id) const
-
void set_subpass_input_remapped_components(VariableID id, uint32_t components)
-
uint32_t get_subpass_input_remapped_components(VariableID id) const
-
SmallVector<EntryPoint> get_entry_points_and_stages() const
-
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 SPIREntryPoint &get_entry_point(const std::string &name, spv::ExecutionModel execution_model) const
-
SPIREntryPoint &get_entry_point(const std::string &name, spv::ExecutionModel execution_model)
-
const std::string &get_cleansed_entry_point_name(const std::string &name, spv::ExecutionModel execution_model) const
-
void update_active_builtins()
-
bool has_active_builtin(spv::BuiltIn builtin, spv::StorageClass storage) 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
-
bool is_tessellation_shader() const
-
bool is_tessellating_triangles() const
-
uint32_t get_work_group_size_specialization_constants(SpecializationConstant &x, SpecializationConstant &y, SpecializationConstant &z) const
-
VariableID build_dummy_sampler_for_combined_images()
-
void build_combined_image_samplers()
-
inline const SmallVector<CombinedImageSampler> &get_combined_image_samplers() const
-
inline void set_variable_type_remap_callback(VariableTypeRemapCallback cb)
-
SmallVector<SpecializationConstant> get_specialization_constants() const
-
SPIRConstant &get_constant(ConstantID id)
-
const SPIRConstant &get_constant(ConstantID id) const
-
inline uint32_t get_current_id_bound() const
-
bool get_binary_offset_for_decoration(VariableID id, spv::Decoration decoration, uint32_t &word_offset) const
-
bool buffer_is_hlsl_counter_buffer(VariableID id) const
-
bool buffer_get_hlsl_counter_buffer(VariableID id, uint32_t &counter_id) const
-
const SmallVector<spv::Capability> &get_declared_capabilities() const
-
const SmallVector<std::string> &get_declared_extensions() const
-
std::string get_remapped_declared_block_name(VariableID id) const
-
Bitset get_buffer_block_flags(VariableID id) const
-
inline bool is_position_invariant() const
Protected Functions
-
inline const uint32_t *stream(const Instruction &instr) const
-
inline uint32_t *stream_mutable(const Instruction &instr) const
-
void add_loop_level()
-
inline void set_initializers(SPIRExpression &e)
-
uint32_t get_pointee_type_id(uint32_t type_id) const
-
uint32_t get_variable_data_type_id(const SPIRVariable &var) const
-
SPIRType &get_variable_data_type(const SPIRVariable &var)
-
const SPIRType &get_variable_data_type(const SPIRVariable &var) const
-
SPIRType &get_variable_element_type(const SPIRVariable &var)
-
const SPIRType &get_variable_element_type(const SPIRVariable &var) const
-
void set_member_qualified_name(uint32_t type_id, uint32_t index, const std::string &name)
-
void set_qualified_name(uint32_t id, const std::string &name)
-
const SPIREntryPoint &get_entry_point() const
-
SPIREntryPoint &get_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_immutable(uint32_t id) const
-
uint32_t expression_type_id(uint32_t id) const
-
bool expression_is_lvalue(uint32_t id) const
-
bool variable_storage_is_aliased(const SPIRVariable &var)
-
SPIRVariable *maybe_get_backing_variable(uint32_t chain)
-
void register_read(uint32_t expr, uint32_t chain, bool forwarded)
-
void register_write(uint32_t chain)
-
inline bool is_continue(uint32_t next) const
-
inline bool is_single_block_loop(uint32_t next) const
-
inline bool is_break(uint32_t next) const
-
inline bool is_loop_break(uint32_t next) const
-
inline 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 SPIRFunction &func, uint32_t id)
-
void update_name_cache(std::unordered_set<std::string> &cache, std::string &name)
-
void update_name_cache(std::unordered_set<std::string> &cache_primary, const std::unordered_set<std::string> &cache_secondary, std::string &name)
-
bool function_is_pure(const SPIRFunction &func)
-
bool function_is_control_dependent(const SPIRFunction &func)
-
SPIRBlock::ContinueBlockType continue_block_type(const SPIRBlock &continue_block) const
-
void force_recompile()
-
void force_recompile_guarantee_forward_progress()
-
void clear_force_recompile()
-
bool is_forcing_recompilation() const
-
void inherit_expression_dependencies(uint32_t dst, uint32_t source)
-
void add_implied_read_expression(SPIRExpression &e, uint32_t source)
-
void add_implied_read_expression(SPIRAccessChain &e, uint32_t source)
-
void add_active_interface_variable(uint32_t var_id)
-
bool interface_variable_exists_in_entry_point(uint32_t id) const
-
inline void remap_variable_type_name(const SPIRType &type, const std::string &var_name, std::string &type_name) const
-
void parse_fixup()
-
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<VariableID> *active_variables) const
-
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_non_block_pointer_types()
-
void analyze_variable_scope(SPIRFunction &function, AnalyzeVariableScopeAccessHandler &handler)
-
void find_function_local_luts(SPIRFunction &function, const AnalyzeVariableScopeAccessHandler &handler, bool single_function)
-
void analyze_interlocked_resource_usage()
-
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)
-
void set_extended_decoration(uint32_t id, ExtendedDecorations decoration, uint32_t value = 0)
-
uint32_t get_extended_decoration(uint32_t id, ExtendedDecorations decoration) const
-
bool has_extended_decoration(uint32_t id, ExtendedDecorations decoration) const
-
void unset_extended_decoration(uint32_t id, ExtendedDecorations decoration)
-
void set_extended_member_decoration(uint32_t type, uint32_t index, ExtendedDecorations decoration, uint32_t value = 0)
-
uint32_t get_extended_member_decoration(uint32_t type, uint32_t index, ExtendedDecorations decoration) const
-
bool has_extended_member_decoration(uint32_t type, uint32_t index, ExtendedDecorations decoration) const
-
void unset_extended_member_decoration(uint32_t type, uint32_t index, ExtendedDecorations decoration)
-
bool reflection_ssbo_instance_name_is_significant() const
-
std::string get_remapped_declared_block_name(uint32_t id, bool fallback_prefer_instance_name) const
-
uint32_t evaluate_spec_constant_u32(const SPIRConstantOp &spec) const
-
uint32_t evaluate_constant_u32(uint32_t id) const
-
bool is_vertex_like_shader() const
-
const SmallVector<SPIRBlock::Case> &get_case_list(const SPIRBlock &block) const
Protected Attributes
-
SmallVector<uint32_t> global_variables
-
SmallVector<uint32_t> aliased_variables
-
SPIRFunction *current_function = nullptr
-
uint32_t current_loop_level = 0
-
std::unordered_set<VariableID> active_interface_variables
-
bool check_active_interface_variables = false
-
std::unordered_set<uint32_t> invalid_expressions
-
bool is_force_recompile = false
-
bool is_force_recompile_forward_progress = false
-
SmallVector<CombinedImageSampler> combined_image_samplers
-
SmallVector<uint32_t> global_struct_cache
-
VariableTypeRemapCallback variable_remap_callback
-
std::unordered_set<uint32_t> forced_temporaries
-
std::unordered_set<uint32_t> forwarded_temporaries
-
std::unordered_set<uint32_t> suppressed_usage_tracking
-
std::unordered_set<uint32_t> hoisted_temporaries
-
std::unordered_set<uint32_t> forced_invariant_temporaries
-
uint32_t clip_distance_count = 0
-
uint32_t cull_distance_count = 0
-
bool position_invariant = false
-
std::unordered_set<uint32_t> comparison_ids
-
bool need_subpass_input = false
-
bool need_subpass_input_ms = false
-
uint32_t dummy_sampler_id = 0
-
SmallVector<uint32_t> physical_storage_non_block_pointer_types
-
std::unordered_map<uint32_t, PhysicalBlockMeta> physical_storage_type_to_alignment
-
std::unordered_set<uint32_t> interlocked_resources
-
bool interlocked_is_complex = false
-
std::unordered_map<uint32_t, std::string> declared_block_names
Protected Static Functions
-
static bool is_tessellation_shader(spv::ExecutionModel model)
-
static bool is_desktop_only_format(spv::ImageFormat format)
Friends
- friend class CFG
- friend class DominatorBuilder
-
struct ActiveBuiltinHandler : public SPIRV_CROSS_NAMESPACE::Compiler::OpcodeHandler
-
struct AnalyzeVariableScopeAccessHandler : public SPIRV_CROSS_NAMESPACE::Compiler::OpcodeHandler
Public Functions
-
AnalyzeVariableScopeAccessHandler(Compiler &compiler_, SPIRFunction &entry_)
-
virtual bool follow_function_call(const SPIRFunction&) override
-
void notify_variable_access(uint32_t id, uint32_t block)
-
bool id_is_phi_variable(uint32_t id) const
-
bool id_is_potential_temporary(uint32_t id) const
Public Members
-
SPIRFunction &entry
-
std::unordered_map<uint32_t, std::unordered_set<uint32_t>> accessed_variables_to_block
-
std::unordered_map<uint32_t, std::unordered_set<uint32_t>> accessed_temporaries_to_block
-
std::unordered_map<uint32_t, uint32_t> result_id_to_type
-
std::unordered_map<uint32_t, std::unordered_set<uint32_t>> complete_write_variables_to_block
-
std::unordered_map<uint32_t, std::unordered_set<uint32_t>> partial_write_variables_to_block
-
std::unordered_set<uint32_t> access_chain_expressions
-
std::unordered_map<uint32_t, std::unordered_set<uint32_t>> rvalue_forward_children
-
AnalyzeVariableScopeAccessHandler(Compiler &compiler_, SPIRFunction &entry_)
-
struct BufferAccessHandler : public SPIRV_CROSS_NAMESPACE::Compiler::OpcodeHandler
Public Functions
-
inline BufferAccessHandler(const Compiler &compiler_, SmallVector<BufferRange> &ranges_, uint32_t id_)
-
inline BufferAccessHandler(const Compiler &compiler_, SmallVector<BufferRange> &ranges_, uint32_t id_)
-
struct CFGBuilder : public SPIRV_CROSS_NAMESPACE::Compiler::OpcodeHandler
Public Functions
-
virtual bool follow_function_call(const SPIRFunction &func) override
-
virtual bool follow_function_call(const SPIRFunction &func) override
-
struct CombinedImageSamplerDrefHandler : public SPIRV_CROSS_NAMESPACE::Compiler::OpcodeHandler
Public Functions
-
struct CombinedImageSamplerHandler : public SPIRV_CROSS_NAMESPACE::Compiler::OpcodeHandler
Public Functions
-
virtual bool begin_function_scope(const uint32_t *args, uint32_t length) override
-
virtual bool end_function_scope(const uint32_t *args, uint32_t length) override
-
uint32_t remap_parameter(uint32_t id)
-
void push_remap_parameters(const SPIRFunction &func, const uint32_t *args, uint32_t length)
-
void pop_remap_parameters()
-
void register_combined_image_sampler(SPIRFunction &caller, VariableID combined_id, VariableID texture_id, VariableID sampler_id, bool depth)
Public Members
-
std::stack<std::unordered_map<uint32_t, uint32_t>> parameter_remapping
-
std::stack<SPIRFunction*> functions
-
virtual bool begin_function_scope(const uint32_t *args, uint32_t length) override
-
struct CombinedImageSamplerUsageHandler : public SPIRV_CROSS_NAMESPACE::Compiler::OpcodeHandler
Public Functions
-
inline CombinedImageSamplerUsageHandler(Compiler &compiler_, const std::unordered_set<uint32_t> &dref_combined_samplers_)
-
virtual bool begin_function_scope(const uint32_t *args, uint32_t length) override
-
void add_hierarchy_to_comparison_ids(uint32_t ids)
-
void add_dependency(uint32_t dst, uint32_t src)
-
inline CombinedImageSamplerUsageHandler(Compiler &compiler_, const std::unordered_set<uint32_t> &dref_combined_samplers_)
-
struct DummySamplerForCombinedImageHandler : public SPIRV_CROSS_NAMESPACE::Compiler::OpcodeHandler
Public Functions
-
struct InterfaceVariableAccessHandler : public SPIRV_CROSS_NAMESPACE::Compiler::OpcodeHandler
Public Functions
-
inline InterfaceVariableAccessHandler(const Compiler &compiler_, std::unordered_set<VariableID> &variables_)
-
inline InterfaceVariableAccessHandler(const Compiler &compiler_, std::unordered_set<VariableID> &variables_)
-
struct InterlockedResourceAccessHandler : public SPIRV_CROSS_NAMESPACE::Compiler::OpcodeHandler
-
struct InterlockedResourceAccessPrepassHandler : public SPIRV_CROSS_NAMESPACE::Compiler::OpcodeHandler
-
struct OpcodeHandler
Subclassed by SPIRV_CROSS_NAMESPACE::Compiler::ActiveBuiltinHandler, SPIRV_CROSS_NAMESPACE::Compiler::AnalyzeVariableScopeAccessHandler, SPIRV_CROSS_NAMESPACE::Compiler::BufferAccessHandler, SPIRV_CROSS_NAMESPACE::Compiler::CFGBuilder, SPIRV_CROSS_NAMESPACE::Compiler::CombinedImageSamplerDrefHandler, SPIRV_CROSS_NAMESPACE::Compiler::CombinedImageSamplerHandler, SPIRV_CROSS_NAMESPACE::Compiler::CombinedImageSamplerUsageHandler, SPIRV_CROSS_NAMESPACE::Compiler::DummySamplerForCombinedImageHandler, SPIRV_CROSS_NAMESPACE::Compiler::InterfaceVariableAccessHandler, SPIRV_CROSS_NAMESPACE::Compiler::InterlockedResourceAccessHandler, SPIRV_CROSS_NAMESPACE::Compiler::InterlockedResourceAccessPrepassHandler, SPIRV_CROSS_NAMESPACE::Compiler::PhysicalStorageBufferPointerHandler, SPIRV_CROSS_NAMESPACE::Compiler::StaticExpressionAccessHandler, SPIRV_CROSS_NAMESPACE::CompilerMSL::OpCodePreprocessor, SPIRV_CROSS_NAMESPACE::CompilerMSL::SampledImageScanner
Public Functions
-
virtual ~OpcodeHandler() = default
-
inline virtual bool follow_function_call(const SPIRFunction&)
-
inline virtual bool begin_function_scope(const uint32_t*, uint32_t)
-
inline virtual bool end_function_scope(const uint32_t*, uint32_t)
-
virtual ~OpcodeHandler() = default
-
struct PhysicalStorageBufferPointerHandler : public SPIRV_CROSS_NAMESPACE::Compiler::OpcodeHandler
Public Functions
-
void mark_aligned_access(uint32_t id, const uint32_t *args, uint32_t length)
-
PhysicalBlockMeta *find_block_meta(uint32_t id) const
-
bool type_is_bda_block_entry(uint32_t type_id) const
-
void setup_meta_chain(uint32_t type_id, uint32_t var_id)
-
uint32_t get_base_non_block_type_id(uint32_t type_id) const
Public Members
-
std::unordered_set<uint32_t> non_block_types
-
std::unordered_map<uint32_t, PhysicalBlockMeta> physical_block_type_meta
-
std::unordered_map<uint32_t, PhysicalBlockMeta*> access_chain_to_physical_block
-
void mark_aligned_access(uint32_t id, const uint32_t *args, uint32_t length)
-
struct StaticExpressionAccessHandler : public SPIRV_CROSS_NAMESPACE::Compiler::OpcodeHandler
Public Functions
-
virtual bool follow_function_call(const SPIRFunction&) override
-
virtual bool follow_function_call(const SPIRFunction&) override
-
explicit Compiler(std::vector<uint32_t> ir)