summaryrefslogtreecommitdiff
path: root/spirv_msl.hpp
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2022-09-20 11:57:19 +0200
committerHans-Kristian Arntzen <post@arntzen-software.no>2022-09-20 15:21:56 +0200
commit24dc49e692c7196b2f0e888e12eeb998a8912ce4 (patch)
treee675a59342fec3a418d88721549e5dfdc4a46b3f /spirv_msl.hpp
parent1ad60061307765a0a0b400612f94cb4c3d43393d (diff)
downloadSPIRV-Cross-24dc49e692c7196b2f0e888e12eeb998a8912ce4.tar.gz
SPIRV-Cross-24dc49e692c7196b2f0e888e12eeb998a8912ce4.tar.bz2
SPIRV-Cross-24dc49e692c7196b2f0e888e12eeb998a8912ce4.zip
MSL: Handle descriptor aliasing of raw buffer descriptors.
It is allowed to redeclare descriptors with different types in Vulkan. MSL in general does not allow this, but for raw buffers, we can cast the reference type at the very least. For typed resources we are kinda hosed. Without descriptor indexing's PARTIALLY_BOUND_BIT, descriptors must be valid if they are statically accessed, so it would not be valid to access differently typed aliases unless that flag is used. There might be a way to reinterpret cast descriptors, but that seems very sketchy. Implements support for: - Single discrete descriptor - Single argument buffer descriptor - Array of argument buffer descriptors Other cases are unimplemented for now since they are extremely painful to unroll.
Diffstat (limited to 'spirv_msl.hpp')
-rw-r--r--spirv_msl.hpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/spirv_msl.hpp b/spirv_msl.hpp
index 0e5c76db..1a7ee5c0 100644
--- a/spirv_msl.hpp
+++ b/spirv_msl.hpp
@@ -1107,7 +1107,9 @@ protected:
const MSLConstexprSampler *find_constexpr_sampler(uint32_t id) const;
std::unordered_set<uint32_t> buffers_requiring_array_length;
- SmallVector<uint32_t> buffer_arrays;
+ SmallVector<uint32_t> buffer_arrays_discrete;
+ SmallVector<std::pair<uint32_t, uint32_t>> buffer_aliases_argument;
+ SmallVector<uint32_t> buffer_aliases_discrete;
std::unordered_set<uint32_t> atomic_image_vars; // Emulate texture2D atomic operations
std::unordered_set<uint32_t> pull_model_inputs;