8983920edf
It's not safe to enable subgroup support without this actually working correctly.
42 lines
1.1 KiB
Plaintext
42 lines
1.1 KiB
Plaintext
#version 450
|
|
#extension GL_KHR_shader_subgroup_basic : require
|
|
#extension GL_KHR_shader_subgroup_shuffle : require
|
|
#extension GL_KHR_shader_subgroup_shuffle_relative : require
|
|
#extension GL_KHR_shader_subgroup_quad : require
|
|
layout(local_size_x = 1) in;
|
|
|
|
layout(std430, binding = 0) buffer SSBO
|
|
{
|
|
float FragColor;
|
|
};
|
|
|
|
// Reduced test for functionality exposed on iOS.
|
|
|
|
void main()
|
|
{
|
|
// basic
|
|
FragColor = float(gl_NumSubgroups);
|
|
FragColor = float(gl_SubgroupID);
|
|
FragColor = float(gl_SubgroupSize);
|
|
FragColor = float(gl_SubgroupInvocationID);
|
|
subgroupBarrier();
|
|
subgroupMemoryBarrier();
|
|
subgroupMemoryBarrierBuffer();
|
|
subgroupMemoryBarrierShared();
|
|
subgroupMemoryBarrierImage();
|
|
|
|
// shuffle
|
|
uint shuffled = subgroupShuffle(10u, 8u);
|
|
uint shuffled_xor = subgroupShuffleXor(30u, 8u);
|
|
|
|
// shuffle relative
|
|
uint shuffled_up = subgroupShuffleUp(20u, 4u);
|
|
uint shuffled_down = subgroupShuffleDown(20u, 4u);
|
|
|
|
// quad
|
|
vec4 swap_horiz = subgroupQuadSwapHorizontal(vec4(20.0));
|
|
vec4 swap_vertical = subgroupQuadSwapVertical(vec4(20.0));
|
|
vec4 swap_diagonal = subgroupQuadSwapDiagonal(vec4(20.0));
|
|
vec4 quad_broadcast = subgroupQuadBroadcast(vec4(20.0), 3u);
|
|
}
|