8983920edf
It's not safe to enable subgroup support without this actually working correctly.
32 lines
1.3 KiB
Plaintext
32 lines
1.3 KiB
Plaintext
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
struct SSBO
|
|
{
|
|
float FragColor;
|
|
};
|
|
|
|
kernel void main0(device SSBO& _9 [[buffer(0)]], uint gl_NumSubgroups [[quadgroups_per_threadgroup]], uint gl_SubgroupID [[quadgroup_index_in_threadgroup]], uint gl_SubgroupSize [[thread_execution_width]], uint gl_SubgroupInvocationID [[thread_index_in_quadgroup]])
|
|
{
|
|
_9.FragColor = float(gl_NumSubgroups);
|
|
_9.FragColor = float(gl_SubgroupID);
|
|
_9.FragColor = float(gl_SubgroupSize);
|
|
_9.FragColor = float(gl_SubgroupInvocationID);
|
|
simdgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture);
|
|
simdgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture);
|
|
simdgroup_barrier(mem_flags::mem_device);
|
|
simdgroup_barrier(mem_flags::mem_threadgroup);
|
|
simdgroup_barrier(mem_flags::mem_texture);
|
|
uint shuffled = quad_shuffle(10u, 8u);
|
|
uint shuffled_xor = quad_shuffle_xor(30u, 8u);
|
|
uint shuffled_up = quad_shuffle_up(20u, 4u);
|
|
uint shuffled_down = quad_shuffle_down(20u, 4u);
|
|
float4 swap_horiz = quad_shuffle_xor(float4(20.0), 1u);
|
|
float4 swap_vertical = quad_shuffle_xor(float4(20.0), 2u);
|
|
float4 swap_diagonal = quad_shuffle_xor(float4(20.0), 3u);
|
|
float4 quad_broadcast0 = quad_broadcast(float4(20.0), 3u);
|
|
}
|
|
|