yum-mirror/slang

Making it easier to work with shaders

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

jsmall-nvidiaLanguage experiments (#2068)447b7e0e2

master
916 B37 linesraw
1//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
2
3/* Tests around inheritance.
4
5Works.
6
7Docs state inheritance isn't available (although states it might in the future).
8
9https://github.com/shader-slang/slang/blob/master/docs/language-reference/07-declarations.md
10
11> Currently only interface types may be named in the inheritance clause of a structure type. When a structure type declares that it inherits from an interface, the programmer asserts that the structure type implements the required members of the interface.
12
13*/
14
15//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
16RWStructuredBuffer<int> outputBuffer;
17
18struct A<T>
19{
20    T a;
21};
22
23struct B : A<float>
24{
25    int b;
26};
27
28
29[numthreads(4, 1, 1)]
30void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
31{    
32    int index = dispatchThreadID.x;
33
34    B b = { 1, 2 + index };
35    
36	outputBuffer[index] = b.b * b.a;
37}