yum-mirror/slang

Making it easier to work with shaders

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

CopilotFix confusing error messages for interface return type mismatches (#7854)2d23a9627

master
680 B37 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -target spirv
2
3public interface ITest {
4    public void testIn(int a);
5    public void testOut(out int b);
6};
7
8public struct TestImpl : ITest {
9    // CHECK: ([[# @LINE + 1]]): error 38108
10    public void testIn(out int a) {
11        a = 5;
12    }
13    // CHECK: ([[# @LINE + 1]]): error 38108
14    public void testOut(int b) {
15        b = 6;
16    }
17}
18
19RWStructuredBuffer<int> output;
20
21void doSomething<T>(T data) where T : ITest {
22    int a = 516;
23    data.testIn(a);
24    int b = 687;
25    data.testOut(b);
26
27    output[0] = a;
28    output[1] = b;
29}
30
31[shader("compute")]
32[numthreads(1,1,1)]
33void computeMain()
34{
35    TestImpl data;
36    doSomething(data);
37}