RetroArch
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
spirv_cross::CompilerHLSL Class Reference

#include <spirv_hlsl.hpp>

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

Classes

struct  Options
 

Public Member Functions

 CompilerHLSL (std::vector< uint32_t > spirv_)
 
 CompilerHLSL (const uint32_t *ir, size_t size)
 
 SPIRV_CROSS_DEPRECATED ("CompilerHLSL::get_options() is obsolete, use get_hlsl_options() instead.") const Options &get_options() const
 
const Optionsget_hlsl_options () const
 
 SPIRV_CROSS_DEPRECATED ("CompilerHLSL::get_options() is obsolete, use set_hlsl_options() instead.") void set_options(Options &opts)
 
void set_hlsl_options (const Options &opts)
 
void set_root_constant_layouts (std::vector< RootConstants > layout)
 
std::string compile (std::vector< HLSLVertexAttributeRemap > vertex_attributes)
 
std::string compile () override
 
uint32_t remap_num_workgroups_builtin ()
 
- Public Member Functions inherited from spirv_cross::CompilerGLSL
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 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
 

Private Types

enum  TextureQueryVariantDim {
  Query1D = 0, Query1DArray, Query2D, Query2DArray,
  Query3D, QueryBuffer, QueryCube, QueryCubeArray,
  Query2DMS, Query2DMSArray, QueryDimCount
}
 
enum  TextureQueryVariantType { QueryTypeFloat = 0, QueryTypeInt = 16, QueryTypeUInt = 32, QueryTypeCount = 3 }
 

Private Member Functions

std::string type_to_glsl (const SPIRType &type, uint32_t id=0) override
 
std::string image_type_hlsl (const SPIRType &type, uint32_t id)
 
std::string image_type_hlsl_modern (const SPIRType &type, uint32_t id)
 
std::string image_type_hlsl_legacy (const SPIRType &type, uint32_t id)
 
void emit_function_prototype (SPIRFunction &func, const Bitset &return_flags) override
 
void emit_hlsl_entry_point ()
 
void emit_header () override
 
void emit_resources ()
 
void emit_interface_block_globally (const SPIRVariable &type)
 
void emit_interface_block_in_struct (const SPIRVariable &type, std::unordered_set< uint32_t > &active_locations)
 
void emit_builtin_inputs_in_struct ()
 
void emit_builtin_outputs_in_struct ()
 
void emit_texture_op (const Instruction &i) override
 
void emit_instruction (const Instruction &instruction) override
 
void emit_glsl_op (uint32_t result_type, uint32_t result_id, uint32_t op, const uint32_t *args, uint32_t count) override
 
void emit_buffer_block (const SPIRVariable &type) override
 
void emit_push_constant_block (const SPIRVariable &var) override
 
void emit_uniform (const SPIRVariable &var) override
 
void emit_modern_uniform (const SPIRVariable &var)
 
void emit_legacy_uniform (const SPIRVariable &var)
 
void emit_specialization_constants ()
 
void emit_composite_constants ()
 
void emit_fixup () override
 
std::string builtin_to_glsl (spv::BuiltIn builtin, spv::StorageClass storage) override
 
std::string layout_for_member (const SPIRType &type, uint32_t index) override
 
std::string to_interpolation_qualifiers (const Bitset &flags) override
 
std::string bitcast_glsl_op (const SPIRType &result_type, const SPIRType &argument_type) override
 
std::string to_func_call_arg (uint32_t id) override
 
std::string to_sampler_expression (uint32_t id)
 
std::string to_resource_binding (const SPIRVariable &var)
 
std::string to_resource_binding_sampler (const SPIRVariable &var)
 
std::string to_resource_register (char space, uint32_t binding, uint32_t set)
 
void emit_sampled_image_op (uint32_t result_type, uint32_t result_id, uint32_t image_id, uint32_t samp_id) override
 
void emit_access_chain (const Instruction &instruction)
 
void emit_load (const Instruction &instruction)
 
std::string read_access_chain (const SPIRAccessChain &chain)
 
void write_access_chain (const SPIRAccessChain &chain, uint32_t value)
 
void emit_store (const Instruction &instruction)
 
void emit_atomic (const uint32_t *ops, uint32_t length, spv::Op op)
 
void emit_subgroup_op (const Instruction &i) override
 
void emit_block_hints (const SPIRBlock &block) override
 
void emit_struct_member (const SPIRType &type, uint32_t member_type_id, uint32_t index, const std::string &qualifier, uint32_t base_offset=0) override
 
const char * to_storage_qualifiers_glsl (const SPIRVariable &var) override
 
void replace_illegal_names () override
 
void require_texture_query_variant (const SPIRType &type)
 
void emit_builtin_variables ()
 
uint32_t type_to_consumed_locations (const SPIRType &type) const
 
void emit_io_block (const SPIRVariable &var)
 
std::string to_semantic (uint32_t vertex_location)
 

Private Attributes

Options hlsl_options
 
bool requires_op_fmod = false
 
bool requires_textureProj = false
 
bool requires_fp16_packing = false
 
bool requires_explicit_fp16_packing = false
 
bool requires_unorm8_packing = false
 
bool requires_snorm8_packing = false
 
bool requires_unorm16_packing = false
 
bool requires_snorm16_packing = false
 
bool requires_bitfield_insert = false
 
bool requires_bitfield_extract = false
 
bool requires_inverse_2x2 = false
 
bool requires_inverse_3x3 = false
 
bool requires_inverse_4x4 = false
 
uint64_t required_textureSizeVariants = 0
 
bool require_output = false
 
bool require_input = false
 
std::vector< HLSLVertexAttributeRemapremap_vertex_attributes
 
uint32_t num_workgroups_builtin = 0
 
std::vector< RootConstantsroot_constants_layout
 

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
 
- Protected Member Functions inherited from spirv_cross::CompilerGLSL
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)
 
void emit_block_instructions (SPIRBlock &block)
 
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 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 std::string variable_decl (const SPIRType &type, const std::string &name, uint32_t id=0)
 
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 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)
 
const char * flags_to_precision_qualifiers_glsl (const SPIRType &type, const Bitset &flags)
 
const char * format_to_glsl (spv::ImageFormat format)
 
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 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)
 
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 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 inherited from spirv_cross::CompilerGLSL
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 inherited from spirv_cross::CompilerGLSL
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
 

Member Enumeration Documentation

◆ TextureQueryVariantDim

Enumerator
Query1D 
Query1DArray 
Query2D 
Query2DArray 
Query3D 
QueryBuffer 
QueryCube 
QueryCubeArray 
Query2DMS 
Query2DMSArray 
QueryDimCount 

◆ TextureQueryVariantType

Enumerator
QueryTypeFloat 
QueryTypeInt 
QueryTypeUInt 
QueryTypeCount 

Constructor & Destructor Documentation

◆ CompilerHLSL() [1/2]

spirv_cross::CompilerHLSL::CompilerHLSL ( std::vector< uint32_t spirv_)
inline

◆ CompilerHLSL() [2/2]

spirv_cross::CompilerHLSL::CompilerHLSL ( const uint32_t ir,
size_t  size 
)
inline

Member Function Documentation

◆ bitcast_glsl_op()

string CompilerHLSL::bitcast_glsl_op ( const SPIRType result_type,
const SPIRType argument_type 
)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

◆ builtin_to_glsl()

std::string CompilerHLSL::builtin_to_glsl ( spv::BuiltIn  builtin,
spv::StorageClass  storage 
)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

Here is the call graph for this function:

◆ compile() [1/2]

string CompilerHLSL::compile ( std::vector< HLSLVertexAttributeRemap vertex_attributes)
Here is the caller graph for this function:

◆ compile() [2/2]

string CompilerHLSL::compile ( )
overridevirtual

Reimplemented from spirv_cross::CompilerGLSL.

◆ emit_access_chain()

void CompilerHLSL::emit_access_chain ( const Instruction instruction)
private

◆ emit_atomic()

void CompilerHLSL::emit_atomic ( const uint32_t ops,
uint32_t  length,
spv::Op  op 
)
private
Here is the call graph for this function:

◆ emit_block_hints()

void CompilerHLSL::emit_block_hints ( const SPIRBlock block)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

Here is the call graph for this function:

◆ emit_buffer_block()

void CompilerHLSL::emit_buffer_block ( const SPIRVariable type)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

Here is the call graph for this function:

◆ emit_builtin_inputs_in_struct()

void CompilerHLSL::emit_builtin_inputs_in_struct ( )
private
Here is the call graph for this function:

◆ emit_builtin_outputs_in_struct()

void CompilerHLSL::emit_builtin_outputs_in_struct ( )
private
Here is the call graph for this function:

◆ emit_builtin_variables()

void CompilerHLSL::emit_builtin_variables ( )
private
Here is the call graph for this function:

◆ emit_composite_constants()

void CompilerHLSL::emit_composite_constants ( )
private
Here is the call graph for this function:

◆ emit_fixup()

void CompilerHLSL::emit_fixup ( )
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

Here is the call graph for this function:

◆ emit_function_prototype()

void CompilerHLSL::emit_function_prototype ( SPIRFunction func,
const Bitset return_flags 
)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

Here is the call graph for this function:

◆ emit_glsl_op()

void CompilerHLSL::emit_glsl_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  op,
const uint32_t args,
uint32_t  count 
)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

◆ emit_header()

void CompilerHLSL::emit_header ( )
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

Here is the call graph for this function:

◆ emit_hlsl_entry_point()

void CompilerHLSL::emit_hlsl_entry_point ( )
private
Here is the call graph for this function:

◆ emit_instruction()

void CompilerHLSL::emit_instruction ( const Instruction instruction)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

Here is the call graph for this function:

◆ emit_interface_block_globally()

void CompilerHLSL::emit_interface_block_globally ( const SPIRVariable type)
private
Here is the call graph for this function:

◆ emit_interface_block_in_struct()

void spirv_cross::CompilerHLSL::emit_interface_block_in_struct ( const SPIRVariable type,
std::unordered_set< uint32_t > &  active_locations 
)
private

◆ emit_io_block()

void CompilerHLSL::emit_io_block ( const SPIRVariable var)
private
Here is the call graph for this function:

◆ emit_legacy_uniform()

void CompilerHLSL::emit_legacy_uniform ( const SPIRVariable var)
private
Here is the call graph for this function:

◆ emit_load()

void CompilerHLSL::emit_load ( const Instruction instruction)
private

◆ emit_modern_uniform()

void CompilerHLSL::emit_modern_uniform ( const SPIRVariable var)
private
Here is the call graph for this function:

◆ emit_push_constant_block()

void CompilerHLSL::emit_push_constant_block ( const SPIRVariable var)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

Here is the call graph for this function:

◆ emit_resources()

void CompilerHLSL::emit_resources ( )
private
Here is the call graph for this function:

◆ emit_sampled_image_op()

void CompilerHLSL::emit_sampled_image_op ( uint32_t  result_type,
uint32_t  result_id,
uint32_t  image_id,
uint32_t  samp_id 
)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

◆ emit_specialization_constants()

void CompilerHLSL::emit_specialization_constants ( )
private
Here is the call graph for this function:

◆ emit_store()

void CompilerHLSL::emit_store ( const Instruction instruction)
private

◆ emit_struct_member()

void CompilerHLSL::emit_struct_member ( const SPIRType type,
uint32_t  member_type_id,
uint32_t  index,
const std::string qualifier,
uint32_t  base_offset = 0 
)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

Here is the call graph for this function:

◆ emit_subgroup_op()

void CompilerHLSL::emit_subgroup_op ( const Instruction i)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

Here is the call graph for this function:

◆ emit_texture_op()

void CompilerHLSL::emit_texture_op ( const Instruction i)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

Here is the call graph for this function:

◆ emit_uniform()

void CompilerHLSL::emit_uniform ( const SPIRVariable var)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

◆ get_hlsl_options()

const Options& spirv_cross::CompilerHLSL::get_hlsl_options ( ) const
inline
Here is the caller graph for this function:

◆ image_type_hlsl()

string CompilerHLSL::image_type_hlsl ( const SPIRType type,
uint32_t  id 
)
private

◆ image_type_hlsl_legacy()

string CompilerHLSL::image_type_hlsl_legacy ( const SPIRType type,
uint32_t  id 
)
private

◆ image_type_hlsl_modern()

string CompilerHLSL::image_type_hlsl_modern ( const SPIRType type,
uint32_t  id 
)
private
Here is the call graph for this function:

◆ layout_for_member()

string CompilerHLSL::layout_for_member ( const SPIRType type,
uint32_t  index 
)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

◆ read_access_chain()

string CompilerHLSL::read_access_chain ( const SPIRAccessChain chain)
private
Here is the call graph for this function:

◆ remap_num_workgroups_builtin()

uint32_t CompilerHLSL::remap_num_workgroups_builtin ( )
Here is the caller graph for this function:

◆ replace_illegal_names()

void CompilerHLSL::replace_illegal_names ( )
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

Here is the call graph for this function:

◆ require_texture_query_variant()

void CompilerHLSL::require_texture_query_variant ( const SPIRType type)
private

◆ set_hlsl_options()

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

◆ set_root_constant_layouts()

void spirv_cross::CompilerHLSL::set_root_constant_layouts ( std::vector< RootConstants layout)
inline

◆ SPIRV_CROSS_DEPRECATED() [1/2]

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

◆ SPIRV_CROSS_DEPRECATED() [2/2]

spirv_cross::CompilerHLSL::SPIRV_CROSS_DEPRECATED ( "CompilerHLSL::get_options() is  obsolete,
use set_hlsl_options() instead."   
) &
inline

◆ to_func_call_arg()

string CompilerHLSL::to_func_call_arg ( uint32_t  id)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

◆ to_interpolation_qualifiers()

string CompilerHLSL::to_interpolation_qualifiers ( const Bitset flags)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

◆ to_resource_binding()

string CompilerHLSL::to_resource_binding ( const SPIRVariable var)
private

◆ to_resource_binding_sampler()

string CompilerHLSL::to_resource_binding_sampler ( const SPIRVariable var)
private

◆ to_resource_register()

string CompilerHLSL::to_resource_register ( char  space,
uint32_t  binding,
uint32_t  set 
)
private
Here is the call graph for this function:

◆ to_sampler_expression()

string CompilerHLSL::to_sampler_expression ( uint32_t  id)
private
Here is the call graph for this function:

◆ to_semantic()

std::string CompilerHLSL::to_semantic ( uint32_t  vertex_location)
private
Here is the call graph for this function:

◆ to_storage_qualifiers_glsl()

const char * CompilerHLSL::to_storage_qualifiers_glsl ( const SPIRVariable var)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

◆ type_to_consumed_locations()

uint32_t CompilerHLSL::type_to_consumed_locations ( const SPIRType type) const
private

◆ type_to_glsl()

string CompilerHLSL::type_to_glsl ( const SPIRType type,
uint32_t  id = 0 
)
overrideprivatevirtual

Reimplemented from spirv_cross::CompilerGLSL.

Here is the call graph for this function:

◆ write_access_chain()

void CompilerHLSL::write_access_chain ( const SPIRAccessChain chain,
uint32_t  value 
)
private
Here is the call graph for this function:

Member Data Documentation

◆ hlsl_options

Options spirv_cross::CompilerHLSL::hlsl_options
private

◆ num_workgroups_builtin

uint32_t spirv_cross::CompilerHLSL::num_workgroups_builtin = 0
private

◆ remap_vertex_attributes

std::vector<HLSLVertexAttributeRemap> spirv_cross::CompilerHLSL::remap_vertex_attributes
private

◆ require_input

bool spirv_cross::CompilerHLSL::require_input = false
private

◆ require_output

bool spirv_cross::CompilerHLSL::require_output = false
private

◆ required_textureSizeVariants

uint64_t spirv_cross::CompilerHLSL::required_textureSizeVariants = 0
private

◆ requires_bitfield_extract

bool spirv_cross::CompilerHLSL::requires_bitfield_extract = false
private

◆ requires_bitfield_insert

bool spirv_cross::CompilerHLSL::requires_bitfield_insert = false
private

◆ requires_explicit_fp16_packing

bool spirv_cross::CompilerHLSL::requires_explicit_fp16_packing = false
private

◆ requires_fp16_packing

bool spirv_cross::CompilerHLSL::requires_fp16_packing = false
private

◆ requires_inverse_2x2

bool spirv_cross::CompilerHLSL::requires_inverse_2x2 = false
private

◆ requires_inverse_3x3

bool spirv_cross::CompilerHLSL::requires_inverse_3x3 = false
private

◆ requires_inverse_4x4

bool spirv_cross::CompilerHLSL::requires_inverse_4x4 = false
private

◆ requires_op_fmod

bool spirv_cross::CompilerHLSL::requires_op_fmod = false
private

◆ requires_snorm16_packing

bool spirv_cross::CompilerHLSL::requires_snorm16_packing = false
private

◆ requires_snorm8_packing

bool spirv_cross::CompilerHLSL::requires_snorm8_packing = false
private

◆ requires_textureProj

bool spirv_cross::CompilerHLSL::requires_textureProj = false
private

◆ requires_unorm16_packing

bool spirv_cross::CompilerHLSL::requires_unorm16_packing = false
private

◆ requires_unorm8_packing

bool spirv_cross::CompilerHLSL::requires_unorm8_packing = false
private

◆ root_constants_layout

std::vector<RootConstants> spirv_cross::CompilerHLSL::root_constants_layout
private

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