summaryrefslogtreecommitdiffstats
path: root/tests/spirv/forceinline-nohoist.slang
blob: 54db2838f40977b63857c5073de0217133757612 (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
//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry main

// Verify that the call to dot is after the conditional branch.

// CHECK: OpBranchConditional
// CHECK: OpDot

[ForceInline]
float test(bool x, float3 a, float3 b) {
    float result = 0;
    if(x) {
        result = dot(a, b);
    }
    return result;
}

float caller(uniform bool x, uniform float3 a, uniform float3 b) {
    return test(x, a, b);
}

RWStructuredBuffer<float> output;

uniform bool branchCheck;
uniform float3 uniformA;
uniform float3 uniformB;

[numthreads(1,1,1)]
[shader("compute")]
void main()
{
    output[0] = caller(branchCheck, uniformA, uniformB);
}