diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2020-07-01 14:02:11 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2020-07-06 11:03:44 +0300 |
commit | fa5b206d97a89e70a919d081c98728a66d742932 (patch) | |
tree | 94e808ec7936f55ec83956c6fe8c98f320a76e2a /spirv_glsl.hpp | |
parent | fab75792a92137771159f6352e8f93160f69bf5e (diff) |
MSL: Workaround broken vector -> scalar access chain in MSL.
On MSL, the compiler refuses to allow access chains into a normal vector type.
What happens in practice instead is a read-modify-write where a vector type is
loaded, modified and written back.
The workaround is to convert a vector into a pointer-to-scalar before
the access chain continues to add the scalar index.
Diffstat (limited to 'spirv_glsl.hpp')
-rw-r--r-- | spirv_glsl.hpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/spirv_glsl.hpp b/spirv_glsl.hpp index de415bbe..05c06167 100644 --- a/spirv_glsl.hpp +++ b/spirv_glsl.hpp @@ -565,6 +565,9 @@ protected: std::string access_chain_internal(uint32_t base, const uint32_t *indices, uint32_t count, AccessChainFlags flags, AccessChainMeta *meta); + virtual void prepare_access_chain_for_scalar_access(std::string &expr, const SPIRType &type, + spv::StorageClass storage, bool &is_packed); + std::string access_chain(uint32_t base, const uint32_t *indices, uint32_t count, const SPIRType &target_type, AccessChainMeta *meta = nullptr, bool ptr_chain = false); |