summaryrefslogtreecommitdiffstats
path: root/tests/glsl-intrinsic/shader-invocation-group/shader-invocation-group.slang
blob: d689796758796605dc1b60af9efdef8742964bb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//TEST:SIMPLE(filecheck=CHECK_GLSL):  -allow-glsl -stage compute -entry computeMain -target glsl
//TEST:SIMPLE(filecheck=CHECK_SPV):  -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly
//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl
//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly

#version 460

//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
buffer MyBlockName2
{
    uint data[];
} outputBuffer;

layout(local_size_x = 4) in;

bool testAnyInvocation()
{
    return true
        && anyInvocation(gl_GlobalInvocationID.x == 0)
        && anyInvocation(gl_GlobalInvocationID.x == 8) == false
        ;
}
bool testAllInvocations()
{
    return true
        && allInvocations(true)
        && allInvocations(gl_GlobalInvocationID.x == 0) == false
        ;
}
bool testAllInvocationsEqual()
{
    return true
        && allInvocationsEqual(false)
        && allInvocationsEqual(gl_GlobalInvocationID.x == 0) == false
        ;
}

[shader("compute")]
void computeMain()
{
    outputBuffer.data[0] = true
        && testAnyInvocation()
        && testAllInvocations()
        && testAllInvocationsEqual()
        ;
    // CHECK_GLSL: void main(
    // CHECK_SPV: OpEntryPoint
    // BUF: 1
}