summaryrefslogtreecommitdiffstats
path: root/tests/hlsl/tbuffer.slang
blob: cb014bf2b87a10f91211e0a00c06552692a55633 (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
//TEST:SIMPLE(filecheck=HLSL): -target hlsl -stage compute -entry computeMain
//TEST:SIMPLE(filecheck=GLSL): -target glsl -stage compute -entry computeMain

// Metal backend requires a new legalization pass to support emitting `TextureBufferType`
//DISABLE_TEST:SIMPLE(filecheck=METAL): -target metal -stage compute -entry computeMain
//DISABLE_TEST:SIMPLE(filecheck=METALLIB): -target metallib -stage compute -entry computeMain

// SPIRV backend has no support for emitting `TextureBufferType`
//DISABLE_TEST:SIMPLE(filecheck=SPIRV): -target spirv -stage compute -entry computeMain

tbuffer tbuf : register(t0)
{
    float4 tb_val1;
}

tbuffer tbuf2 : register(t1)
{
    Texture2D<float4> texture2D;
    float4 tb_val2;
}


// HLSL-DAG: t0
// HLSL-DAG: t1
// HLSL-DAG: t2

// GLSL-DAG: binding = 0
// GLSL-DAG: binding = 1
// GLSL-DAG: binding = 2

// METAL-DAG: [texture(0)]
// METAL-DAG: [texture(1)]
// METAL-DAG: [texture(2)]
// METALLIB: @computeMain

RWStructuredBuffer<float4> outputBuffer;
[numthreads(1,1,1)]
void computeMain() {
    outputBuffer[0] = tb_val1 + texture2D[0] + tb_val2;
}