Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2021-10-25 11:55:11 +0300
committerHans-Kristian Arntzen <post@arntzen-software.no>2021-10-25 11:55:11 +0300
commitedf247fb1c632a0c4487207a51151bd1f7f8aef5 (patch)
tree9c7c909f2b400d0a2dad9d8f2a9f146241fe072c /reference/opt/shaders-msl
parent43eecb23603a5eccaefdc423a8b488931609c85f (diff)
MSL: Workaround compiler crashes when using threadgroup bool.
Promote to short instead and do simple casts on load/store instead. Not 100% complete fix since structs can contain booleans, but this is getting into pretty ridiculously complicated territory.
Diffstat (limited to 'reference/opt/shaders-msl')
-rw-r--r--reference/opt/shaders-msl/comp/threadgroup-boolean-workaround.comp20
1 files changed, 20 insertions, 0 deletions
diff --git a/reference/opt/shaders-msl/comp/threadgroup-boolean-workaround.comp b/reference/opt/shaders-msl/comp/threadgroup-boolean-workaround.comp
new file mode 100644
index 00000000..8b80929a
--- /dev/null
+++ b/reference/opt/shaders-msl/comp/threadgroup-boolean-workaround.comp
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct SSBO
+{
+ float4 values[1];
+};
+
+constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u);
+
+kernel void main0(device SSBO& _23 [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
+{
+ threadgroup short4 foo[4];
+ foo[gl_LocalInvocationIndex] = short4((isunordered(_23.values[gl_GlobalInvocationID.x], float4(10.0)) || _23.values[gl_GlobalInvocationID.x] != float4(10.0)));
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ _23.values[gl_GlobalInvocationID.x] = select(float4(40.0), float4(30.0), bool4(foo[gl_LocalInvocationIndex ^ 3u]));
+}
+