|
|
@@ -27,12 +27,20 @@
|
|
|
#ifndef SPV_ENABLE_UTILITY_CODE
|
|
|
#define SPV_ENABLE_UTILITY_CODE
|
|
|
#endif
|
|
|
+
|
|
|
+// Pragmatic hack to avoid symbol conflicts when including both hpp11 and hpp headers in same translation unit.
|
|
|
+// This is an unfortunate SPIRV-Headers issue that we cannot easily deal with ourselves.
|
|
|
+#ifdef SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE
|
|
|
+#define spv SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE
|
|
|
+#endif
|
|
|
+
|
|
|
#include "spirv.hpp"
|
|
|
#include "spirv_cfg.hpp"
|
|
|
#include "spirv_cross_parsed_ir.hpp"
|
|
|
|
|
|
namespace SPIRV_CROSS_NAMESPACE
|
|
|
{
|
|
|
+using namespace SPIRV_CROSS_SPV_HEADER_NAMESPACE;
|
|
|
struct Resource
|
|
|
{
|
|
|
// Resources are identified with their SPIR-V ID.
|
|
|
@@ -69,7 +77,7 @@ struct BuiltInResource
|
|
|
// A builtin present here does not necessarily mean it's considered an active builtin,
|
|
|
// since variable ID "activeness" is only tracked on OpVariable level, not Block members.
|
|
|
// For that, update_active_builtins() -> has_active_builtin() can be used to further refine the reflection.
|
|
|
- spv::BuiltIn builtin;
|
|
|
+ BuiltIn builtin;
|
|
|
|
|
|
// This is the actual value type of the builtin.
|
|
|
// Typically float4, float, array<float, N> for the gl_PerVertex builtins.
|
|
|
@@ -152,7 +160,7 @@ enum BufferPackingStandard
|
|
|
struct EntryPoint
|
|
|
{
|
|
|
std::string name;
|
|
|
- spv::ExecutionModel execution_model;
|
|
|
+ ExecutionModel execution_model;
|
|
|
};
|
|
|
|
|
|
class Compiler
|
|
|
@@ -183,8 +191,8 @@ public:
|
|
|
const std::string &get_name(ID id) const;
|
|
|
|
|
|
// Applies a decoration to an ID. Effectively injects OpDecorate.
|
|
|
- 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);
|
|
|
+ void set_decoration(ID id, Decoration decoration, uint32_t argument = 0);
|
|
|
+ void set_decoration_string(ID id, Decoration decoration, const std::string &argument);
|
|
|
|
|
|
// Overrides the identifier OpName of an ID.
|
|
|
// Identifiers beginning with underscores or identifiers which contain double underscores
|
|
|
@@ -192,22 +200,22 @@ public:
|
|
|
void set_name(ID id, const std::string &name);
|
|
|
|
|
|
// Gets a bitmask for the decorations which are applied to ID.
|
|
|
- // I.e. (1ull << spv::DecorationFoo) | (1ull << spv::DecorationBar)
|
|
|
+ // I.e. (1ull << DecorationFoo) | (1ull << DecorationBar)
|
|
|
const Bitset &get_decoration_bitset(ID id) const;
|
|
|
|
|
|
// Returns whether the decoration has been applied to the ID.
|
|
|
- bool has_decoration(ID id, spv::Decoration decoration) const;
|
|
|
+ bool has_decoration(ID id, Decoration decoration) const;
|
|
|
|
|
|
// Gets the value for decorations which take arguments.
|
|
|
- // If the decoration is a boolean (i.e. spv::DecorationNonWritable),
|
|
|
+ // If the decoration is a boolean (i.e. DecorationNonWritable),
|
|
|
// 1 will be returned.
|
|
|
// If decoration doesn't exist or decoration is not recognized,
|
|
|
// 0 will be returned.
|
|
|
- uint32_t get_decoration(ID id, spv::Decoration decoration) const;
|
|
|
- const std::string &get_decoration_string(ID id, spv::Decoration decoration) const;
|
|
|
+ uint32_t get_decoration(ID id, Decoration decoration) const;
|
|
|
+ const std::string &get_decoration_string(ID id, Decoration decoration) const;
|
|
|
|
|
|
// Removes the decoration for an ID.
|
|
|
- void unset_decoration(ID id, spv::Decoration decoration);
|
|
|
+ void unset_decoration(ID id, Decoration decoration);
|
|
|
|
|
|
// Gets the SPIR-V type associated with ID.
|
|
|
// Mostly used with Resource::type_id and Resource::base_type_id to parse the underlying type of a resource.
|
|
|
@@ -217,7 +225,7 @@ public:
|
|
|
const SPIRType &get_type_from_variable(VariableID id) const;
|
|
|
|
|
|
// Gets the underlying storage class for an OpVariable.
|
|
|
- spv::StorageClass get_storage_class(VariableID id) const;
|
|
|
+ StorageClass get_storage_class(VariableID id) const;
|
|
|
|
|
|
// If get_name() is an empty string, get the fallback name which will be used
|
|
|
// instead in the disassembled source.
|
|
|
@@ -232,8 +240,8 @@ public:
|
|
|
const std::string &get_member_name(TypeID id, uint32_t index) const;
|
|
|
|
|
|
// Given an OpTypeStruct in ID, obtain the OpMemberDecoration for member number "index".
|
|
|
- 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;
|
|
|
+ uint32_t get_member_decoration(TypeID id, uint32_t index, Decoration decoration) const;
|
|
|
+ const std::string &get_member_decoration_string(TypeID id, uint32_t index, Decoration decoration) const;
|
|
|
|
|
|
// Sets the member identifier for OpTypeStruct ID, member number "index".
|
|
|
void set_member_name(TypeID id, uint32_t index, const std::string &name);
|
|
|
@@ -246,15 +254,15 @@ public:
|
|
|
const Bitset &get_member_decoration_bitset(TypeID id, uint32_t index) const;
|
|
|
|
|
|
// Returns whether the decoration has been applied to a member of a struct.
|
|
|
- bool has_member_decoration(TypeID id, uint32_t index, spv::Decoration decoration) const;
|
|
|
+ bool has_member_decoration(TypeID id, uint32_t index, Decoration decoration) const;
|
|
|
|
|
|
// Similar to set_decoration, but for struct members.
|
|
|
- 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,
|
|
|
+ void set_member_decoration(TypeID id, uint32_t index, Decoration decoration, uint32_t argument = 0);
|
|
|
+ void set_member_decoration_string(TypeID id, uint32_t index, Decoration decoration,
|
|
|
const std::string &argument);
|
|
|
|
|
|
// Unsets a member decoration, similar to unset_decoration.
|
|
|
- void unset_member_decoration(TypeID id, uint32_t index, spv::Decoration decoration);
|
|
|
+ void unset_member_decoration(TypeID id, uint32_t index, Decoration decoration);
|
|
|
|
|
|
// Gets the fallback name for a member, similar to get_fallback_name.
|
|
|
virtual const std::string get_fallback_member_name(uint32_t index) const
|
|
|
@@ -340,28 +348,28 @@ public:
|
|
|
// Names for entry points in the SPIR-V module may alias if they belong to different execution models.
|
|
|
// To disambiguate, we must pass along with the entry point names the execution model.
|
|
|
SmallVector<EntryPoint> get_entry_points_and_stages() const;
|
|
|
- void set_entry_point(const std::string &entry, spv::ExecutionModel execution_model);
|
|
|
+ void set_entry_point(const std::string &entry, ExecutionModel execution_model);
|
|
|
|
|
|
// Renames an entry point from old_name to new_name.
|
|
|
// If old_name is currently selected as the current entry point, it will continue to be the current entry point,
|
|
|
// albeit with a new name.
|
|
|
// get_entry_points() is essentially invalidated at this point.
|
|
|
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);
|
|
|
+ ExecutionModel execution_model);
|
|
|
+ const SPIREntryPoint &get_entry_point(const std::string &name, ExecutionModel execution_model) const;
|
|
|
+ SPIREntryPoint &get_entry_point(const std::string &name, ExecutionModel execution_model);
|
|
|
const std::string &get_cleansed_entry_point_name(const std::string &name,
|
|
|
- spv::ExecutionModel execution_model) const;
|
|
|
+ ExecutionModel execution_model) const;
|
|
|
|
|
|
// Traverses all reachable opcodes and sets active_builtins to a bitmask of all builtin variables which are accessed in the shader.
|
|
|
void update_active_builtins();
|
|
|
- bool has_active_builtin(spv::BuiltIn builtin, spv::StorageClass storage) const;
|
|
|
+ bool has_active_builtin(BuiltIn builtin, StorageClass storage) const;
|
|
|
|
|
|
// Query and modify OpExecutionMode.
|
|
|
const Bitset &get_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);
|
|
|
+ void unset_execution_mode(ExecutionMode mode);
|
|
|
+ void set_execution_mode(ExecutionMode mode, uint32_t arg0 = 0, uint32_t arg1 = 0, uint32_t arg2 = 0);
|
|
|
|
|
|
// Gets argument for an execution mode (LocalSize, Invocations, OutputVertices).
|
|
|
// For LocalSize or LocalSizeId, the index argument is used to select the dimension (X = 0, Y = 1, Z = 2).
|
|
|
@@ -369,8 +377,8 @@ public:
|
|
|
// LocalSizeId query returns an ID. If LocalSizeId execution mode is not used, it returns 0.
|
|
|
// LocalSize always returns a literal. If execution mode is LocalSizeId,
|
|
|
// the literal (spec constant or not) is still returned.
|
|
|
- uint32_t get_execution_mode_argument(spv::ExecutionMode mode, uint32_t index = 0) const;
|
|
|
- spv::ExecutionModel get_execution_model() const;
|
|
|
+ uint32_t get_execution_mode_argument(ExecutionMode mode, uint32_t index = 0) const;
|
|
|
+ ExecutionModel get_execution_model() const;
|
|
|
|
|
|
bool is_tessellation_shader() const;
|
|
|
bool is_tessellating_triangles() const;
|
|
|
@@ -483,7 +491,7 @@ public:
|
|
|
// If the decoration was declared, sets the word_offset to an offset into the provided SPIR-V binary buffer and returns true,
|
|
|
// otherwise, returns false.
|
|
|
// If the decoration does not have any value attached to it (e.g. DecorationRelaxedPrecision), this function will also return false.
|
|
|
- bool get_binary_offset_for_decoration(VariableID id, spv::Decoration decoration, uint32_t &word_offset) const;
|
|
|
+ bool get_binary_offset_for_decoration(VariableID id, Decoration decoration, uint32_t &word_offset) const;
|
|
|
|
|
|
// HLSL counter buffer reflection interface.
|
|
|
// Append/Consume/Increment/Decrement in HLSL is implemented as two "neighbor" buffer objects where
|
|
|
@@ -509,7 +517,7 @@ public:
|
|
|
bool buffer_get_hlsl_counter_buffer(VariableID id, uint32_t &counter_id) const;
|
|
|
|
|
|
// Gets the list of all SPIR-V Capabilities which were declared in the SPIR-V module.
|
|
|
- const SmallVector<spv::Capability> &get_declared_capabilities() const;
|
|
|
+ const SmallVector<Capability> &get_declared_capabilities() const;
|
|
|
|
|
|
// Gets the list of all SPIR-V extensions which were declared in the SPIR-V module.
|
|
|
const SmallVector<std::string> &get_declared_extensions() const;
|
|
|
@@ -672,14 +680,14 @@ protected:
|
|
|
|
|
|
const SPIREntryPoint &get_entry_point() const;
|
|
|
SPIREntryPoint &get_entry_point();
|
|
|
- static bool is_tessellation_shader(spv::ExecutionModel model);
|
|
|
+ static bool is_tessellation_shader(ExecutionModel model);
|
|
|
|
|
|
virtual std::string to_name(uint32_t id, bool allow_alias = true) const;
|
|
|
bool is_builtin_variable(const SPIRVariable &var) const;
|
|
|
bool is_builtin_type(const SPIRType &type) 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_member_builtin(const SPIRType &type, uint32_t index, BuiltIn *builtin) const;
|
|
|
bool is_scalar(const SPIRType &type) const;
|
|
|
bool is_vector(const SPIRType &type) const;
|
|
|
bool is_matrix(const SPIRType &type) const;
|
|
|
@@ -788,11 +796,12 @@ protected:
|
|
|
// Used internally to implement various traversals for queries.
|
|
|
struct OpcodeHandler
|
|
|
{
|
|
|
+ explicit OpcodeHandler(Compiler &compiler_) : compiler(compiler_) {}
|
|
|
virtual ~OpcodeHandler() = default;
|
|
|
|
|
|
// Return true if traversal should continue.
|
|
|
// If false, traversal will end immediately.
|
|
|
- virtual bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) = 0;
|
|
|
+ virtual bool handle(Op opcode, const uint32_t *args, uint32_t length) = 0;
|
|
|
virtual bool handle_terminator(const SPIRBlock &)
|
|
|
{
|
|
|
return true;
|
|
|
@@ -823,20 +832,40 @@ protected:
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ Compiler &compiler;
|
|
|
+ std::unordered_map<uint32_t, uint32_t> result_types;
|
|
|
+ const SPIRType *get_expression_result_type(uint32_t id) const;
|
|
|
+ bool enable_result_types = false;
|
|
|
+
|
|
|
+ template <typename T> T &get(uint32_t id)
|
|
|
+ {
|
|
|
+ return compiler.get<T>(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ template <typename T> const T &get(uint32_t id) const
|
|
|
+ {
|
|
|
+ return compiler.get<T>(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ template <typename T, typename... P>
|
|
|
+ T &set(uint32_t id, P &&... args)
|
|
|
+ {
|
|
|
+ return compiler.set<T>(id, std::forward<P>(args)...);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
struct BufferAccessHandler : OpcodeHandler
|
|
|
{
|
|
|
BufferAccessHandler(const Compiler &compiler_, SmallVector<BufferRange> &ranges_, uint32_t id_)
|
|
|
- : compiler(compiler_)
|
|
|
+ : OpcodeHandler(const_cast<Compiler &>(compiler_))
|
|
|
, ranges(ranges_)
|
|
|
, id(id_)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
- bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
+ bool handle(Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
|
|
|
- const Compiler &compiler;
|
|
|
SmallVector<BufferRange> &ranges;
|
|
|
uint32_t id;
|
|
|
|
|
|
@@ -846,29 +875,26 @@ protected:
|
|
|
struct InterfaceVariableAccessHandler : OpcodeHandler
|
|
|
{
|
|
|
InterfaceVariableAccessHandler(const Compiler &compiler_, std::unordered_set<VariableID> &variables_)
|
|
|
- : compiler(compiler_)
|
|
|
+ : OpcodeHandler(const_cast<Compiler &>(compiler_))
|
|
|
, variables(variables_)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
- bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
+ bool handle(Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
|
|
|
- const Compiler &compiler;
|
|
|
std::unordered_set<VariableID> &variables;
|
|
|
};
|
|
|
|
|
|
struct CombinedImageSamplerHandler : OpcodeHandler
|
|
|
{
|
|
|
- CombinedImageSamplerHandler(Compiler &compiler_)
|
|
|
- : compiler(compiler_)
|
|
|
+ explicit CombinedImageSamplerHandler(Compiler &compiler_)
|
|
|
+ : OpcodeHandler(compiler_)
|
|
|
{
|
|
|
}
|
|
|
- bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
+ bool handle(Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
bool begin_function_scope(const uint32_t *args, uint32_t length) override;
|
|
|
bool end_function_scope(const uint32_t *args, uint32_t length) override;
|
|
|
|
|
|
- Compiler &compiler;
|
|
|
-
|
|
|
// Each function in the call stack needs its own remapping for parameters so we can deduce which global variable each texture/sampler the parameter is statically bound to.
|
|
|
std::stack<std::unordered_map<uint32_t, uint32_t>> parameter_remapping;
|
|
|
std::stack<SPIRFunction *> functions;
|
|
|
@@ -882,27 +908,24 @@ protected:
|
|
|
|
|
|
struct DummySamplerForCombinedImageHandler : OpcodeHandler
|
|
|
{
|
|
|
- DummySamplerForCombinedImageHandler(Compiler &compiler_)
|
|
|
- : compiler(compiler_)
|
|
|
+ explicit DummySamplerForCombinedImageHandler(Compiler &compiler_)
|
|
|
+ : OpcodeHandler(compiler_)
|
|
|
{
|
|
|
}
|
|
|
- bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
-
|
|
|
- Compiler &compiler;
|
|
|
+ bool handle(Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
bool need_dummy_sampler = false;
|
|
|
};
|
|
|
|
|
|
struct ActiveBuiltinHandler : OpcodeHandler
|
|
|
{
|
|
|
- ActiveBuiltinHandler(Compiler &compiler_)
|
|
|
- : compiler(compiler_)
|
|
|
+ explicit ActiveBuiltinHandler(Compiler &compiler_)
|
|
|
+ : OpcodeHandler(compiler_)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
- bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
- Compiler &compiler;
|
|
|
+ bool handle(Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
|
|
|
- void handle_builtin(const SPIRType &type, spv::BuiltIn builtin, const Bitset &decoration_flags);
|
|
|
+ void handle_builtin(const SPIRType &type, BuiltIn builtin, const Bitset &decoration_flags);
|
|
|
void add_if_builtin(uint32_t id);
|
|
|
void add_if_builtin_or_block(uint32_t id);
|
|
|
void add_if_builtin(uint32_t id, bool allow_blocks);
|
|
|
@@ -954,13 +977,12 @@ protected:
|
|
|
|
|
|
struct CombinedImageSamplerDrefHandler : OpcodeHandler
|
|
|
{
|
|
|
- CombinedImageSamplerDrefHandler(Compiler &compiler_)
|
|
|
- : compiler(compiler_)
|
|
|
+ explicit CombinedImageSamplerDrefHandler(Compiler &compiler_)
|
|
|
+ : OpcodeHandler(compiler_)
|
|
|
{
|
|
|
}
|
|
|
- bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
+ bool handle(Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
|
|
|
- Compiler &compiler;
|
|
|
std::unordered_set<uint32_t> dref_combined_samplers;
|
|
|
};
|
|
|
|
|
|
@@ -968,14 +990,13 @@ protected:
|
|
|
{
|
|
|
CombinedImageSamplerUsageHandler(Compiler &compiler_,
|
|
|
const std::unordered_set<uint32_t> &dref_combined_samplers_)
|
|
|
- : compiler(compiler_)
|
|
|
+ : OpcodeHandler(compiler_)
|
|
|
, dref_combined_samplers(dref_combined_samplers_)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
bool begin_function_scope(const uint32_t *args, uint32_t length) override;
|
|
|
- bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
- Compiler &compiler;
|
|
|
+ bool handle(Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
const std::unordered_set<uint32_t> &dref_combined_samplers;
|
|
|
|
|
|
std::unordered_map<uint32_t, std::unordered_set<uint32_t>> dependency_hierarchy;
|
|
|
@@ -997,8 +1018,7 @@ protected:
|
|
|
explicit CFGBuilder(Compiler &compiler_);
|
|
|
|
|
|
bool follow_function_call(const SPIRFunction &func) override;
|
|
|
- bool handle(spv::Op op, const uint32_t *args, uint32_t length) override;
|
|
|
- Compiler &compiler;
|
|
|
+ bool handle(Op op, const uint32_t *args, uint32_t length) override;
|
|
|
std::unordered_map<uint32_t, std::unique_ptr<CFG>> function_cfgs;
|
|
|
};
|
|
|
|
|
|
@@ -1012,10 +1032,9 @@ protected:
|
|
|
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;
|
|
|
- bool handle(spv::Op op, const uint32_t *args, uint32_t length) override;
|
|
|
+ bool handle(Op op, const uint32_t *args, uint32_t length) override;
|
|
|
bool handle_terminator(const SPIRBlock &block) override;
|
|
|
|
|
|
- Compiler &compiler;
|
|
|
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;
|
|
|
@@ -1033,9 +1052,8 @@ protected:
|
|
|
{
|
|
|
StaticExpressionAccessHandler(Compiler &compiler_, uint32_t variable_id_);
|
|
|
bool follow_function_call(const SPIRFunction &) override;
|
|
|
- bool handle(spv::Op op, const uint32_t *args, uint32_t length) override;
|
|
|
+ bool handle(Op op, const uint32_t *args, uint32_t length) override;
|
|
|
|
|
|
- Compiler &compiler;
|
|
|
uint32_t variable_id;
|
|
|
uint32_t static_expression = 0;
|
|
|
uint32_t write_count = 0;
|
|
|
@@ -1049,8 +1067,7 @@ protected:
|
|
|
struct PhysicalStorageBufferPointerHandler : OpcodeHandler
|
|
|
{
|
|
|
explicit PhysicalStorageBufferPointerHandler(Compiler &compiler_);
|
|
|
- bool handle(spv::Op op, const uint32_t *args, uint32_t length) override;
|
|
|
- Compiler &compiler;
|
|
|
+ bool handle(Op op, const uint32_t *args, uint32_t length) override;
|
|
|
|
|
|
std::unordered_set<uint32_t> non_block_types;
|
|
|
std::unordered_map<uint32_t, PhysicalBlockMeta> physical_block_type_meta;
|
|
|
@@ -1077,12 +1094,11 @@ protected:
|
|
|
struct GeometryEmitDisocveryHandler : OpcodeHandler
|
|
|
{
|
|
|
explicit GeometryEmitDisocveryHandler(Compiler &compiler_)
|
|
|
- : compiler(compiler_)
|
|
|
+ : OpcodeHandler(compiler_)
|
|
|
{
|
|
|
}
|
|
|
- Compiler &compiler;
|
|
|
|
|
|
- bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
+ bool handle(Op opcode, const uint32_t *args, uint32_t length) override;
|
|
|
bool begin_function_scope(const uint32_t *, uint32_t) override;
|
|
|
bool end_function_scope(const uint32_t *, uint32_t) override;
|
|
|
SmallVector<SPIRFunction *> function_stack;
|
|
|
@@ -1097,16 +1113,15 @@ protected:
|
|
|
struct InterlockedResourceAccessHandler : OpcodeHandler
|
|
|
{
|
|
|
InterlockedResourceAccessHandler(Compiler &compiler_, uint32_t entry_point_id)
|
|
|
- : compiler(compiler_)
|
|
|
+ : OpcodeHandler(compiler_)
|
|
|
{
|
|
|
call_stack.push_back(entry_point_id);
|
|
|
}
|
|
|
|
|
|
- bool handle(spv::Op op, const uint32_t *args, uint32_t length) override;
|
|
|
+ bool handle(Op op, const uint32_t *args, uint32_t length) override;
|
|
|
bool begin_function_scope(const uint32_t *args, uint32_t length) override;
|
|
|
bool end_function_scope(const uint32_t *args, uint32_t length) override;
|
|
|
|
|
|
- Compiler &compiler;
|
|
|
bool in_crit_sec = false;
|
|
|
|
|
|
uint32_t interlock_function_id = 0;
|
|
|
@@ -1122,17 +1137,16 @@ protected:
|
|
|
struct InterlockedResourceAccessPrepassHandler : OpcodeHandler
|
|
|
{
|
|
|
InterlockedResourceAccessPrepassHandler(Compiler &compiler_, uint32_t entry_point_id)
|
|
|
- : compiler(compiler_)
|
|
|
+ : OpcodeHandler(compiler_)
|
|
|
{
|
|
|
call_stack.push_back(entry_point_id);
|
|
|
}
|
|
|
|
|
|
void rearm_current_block(const SPIRBlock &block) override;
|
|
|
- bool handle(spv::Op op, const uint32_t *args, uint32_t length) override;
|
|
|
+ bool handle(Op op, const uint32_t *args, uint32_t length) override;
|
|
|
bool begin_function_scope(const uint32_t *args, uint32_t length) override;
|
|
|
bool end_function_scope(const uint32_t *args, uint32_t length) override;
|
|
|
|
|
|
- Compiler &compiler;
|
|
|
uint32_t interlock_function_id = 0;
|
|
|
uint32_t current_block_id = 0;
|
|
|
bool split_function_case = false;
|
|
|
@@ -1149,11 +1163,11 @@ protected:
|
|
|
|
|
|
std::unordered_map<uint32_t, std::string> declared_block_names;
|
|
|
|
|
|
- bool instruction_to_result_type(uint32_t &result_type, uint32_t &result_id, spv::Op op, const uint32_t *args,
|
|
|
- uint32_t length);
|
|
|
+ static bool instruction_to_result_type(
|
|
|
+ uint32_t &result_type, uint32_t &result_id, Op op, const uint32_t *args, uint32_t length);
|
|
|
|
|
|
Bitset combined_decoration_for_member(const SPIRType &type, uint32_t index) const;
|
|
|
- static bool is_desktop_only_format(spv::ImageFormat format);
|
|
|
+ static bool is_desktop_only_format(ImageFormat format);
|
|
|
|
|
|
bool is_depth_image(const SPIRType &type, uint32_t id) const;
|
|
|
|
|
|
@@ -1198,4 +1212,8 @@ private:
|
|
|
};
|
|
|
} // namespace SPIRV_CROSS_NAMESPACE
|
|
|
|
|
|
+#ifdef SPIRV_CROSS_SPV_HEADER_NAMESPACE_OVERRIDE
|
|
|
+#undef spv
|
|
|
+#endif
|
|
|
+
|
|
|
#endif
|