yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeDiagnose on use of struct inheritance. (#7419)4ae6e9d8b

master
785 B32 linesraw
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUFFER):-shaderobj -vk
2//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUFFER):-shaderobj
3
4#pragma warning(disable:30816)
5
6
7struct Base<let ND:int>
8{
9    int a = 1;
10}
11
12struct Derived<let ND:int>: Base<ND>
13{
14    bool x;
15    bool y;
16}
17
18//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=result
19RWStructuredBuffer<int> result;
20
21[shader("compute")]
22[numthreads(1, 1, 1)]
23void computeMain()
24{
25    // Previously, this test is just test we can handle the base constructor invoke correctly,
26    // so we don't construct the Derived object, since #6058, there will not be implicit constructor
27    // to construct the struct, we will have to invoke the constructor explicitly.
28    Derived<3> d = {1,1,1};
29
30    // BUFFER: 1
31    result[0] = d.a;
32}