diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2019-01-10 11:49:33 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2019-01-10 14:52:56 +0300 |
commit | d92de00cc182a436f4c0340247bde088eee2c921 (patch) | |
tree | 77d3c8a91119dff83d714d905f86a6c563ffc054 /spirv_hlsl.hpp | |
parent | a57b93f6b73a1aa9aaaeb893029f4dce74c907ba (diff) |
Rewrite how IDs are iterated over.
This is a fairly fundamental change on how IDs are handled.
It serves many purposes:
- Improve performance. We only need to iterate over IDs which are
relevant at any one time.
- Makes sure we iterate through IDs in SPIR-V module declaration order
rather than ID space. IDs don't have to be monotonically increasing,
which was an assumption SPIRV-Cross used to have. It has apparently
never been a problem until now.
- Support LUTs of structs. We do this by interleaving declaration of
constants and struct types in SPIR-V module order.
To support this, the ParsedIR interface needed to change slightly.
Before setting any ID with variant_set<T> we let ParsedIR know
that an ID with a specific type has been added. The surface for change
should be minimal.
ParsedIR will maintain a per-type list of IDs which the cross-compiler
will need to consider for later.
Instead of looping over ir.ids[] (which can be extremely large), we loop
over types now, using:
ir.for_each_typed_id<SPIRVariable>([&](uint32_t id, SPIRVariable &var) {
handle_variable(var);
});
Now we make sure that we're never looking at irrelevant types.
Diffstat (limited to 'spirv_hlsl.hpp')
-rw-r--r-- | spirv_hlsl.hpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/spirv_hlsl.hpp b/spirv_hlsl.hpp index 67243637..8b777de3 100644 --- a/spirv_hlsl.hpp +++ b/spirv_hlsl.hpp @@ -148,7 +148,7 @@ private: 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_specialization_constants_and_structs(); void emit_composite_constants(); void emit_fixup() override; std::string builtin_to_glsl(spv::BuiltIn builtin, spv::StorageClass storage) override; |