summaryrefslogtreecommitdiffstats
path: root/tests/bugs/mutating/buffer-write-dce.slang
blob: 114b52280301f39cbf098f4b0db330feace83293 (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
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj

// Confirm that calling a mutating method to write to a buffer location doesn't
// get DCE'd.

struct C
{
    int a;
    [mutating]
    void set(int val)
    {
        a = val;
    }
}

//TEST_INPUT:ubuffer(data=[0], stride=4):out, name outputBuffer
RWStructuredBuffer<C> outputBuffer;
void writeOutput(int tid)
{
    outputBuffer[tid].set(1);
}

[numthreads(1, 1, 1)]
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
{
    int tid = dispatchThreadID.x;
    writeOutput(tid);
}