summaryrefslogtreecommitdiffstats
path: root/tests/bugs/gh-4863.slang
blob: b1de7134f3042b71aac7845e7e55be9ceb6e4de4 (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
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUFFER):-compute -output-using-type
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUFFER):-vk -compute -output-using-type

//TEST_INPUT:ubuffer(data=[0 0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<int> outputBuffer;

interface IFoo
{
  property float bar1 {get; set;}
};

struct Foo : IFoo
{
  uint4 data = 0;
  property float bar1
  {
    get { return asfloat(data.w); }
    set { data.w = asuint(newValue); }
  }
};

void doThing(inout Foo foo, uint2 ipos)
{
  foo.bar1 = 2;
  foo.bar1 += 1.0f;
}

[shader("compute")]
[numthreads(1, 1, 1)]
void computeMain(uint2 ipos : SV_DispatchThreadID)
{
  Foo foo = {};
  doThing(foo, ipos);
  // BUFFER: 3
  outputBuffer[0] = (int)foo.bar1;
}