summaryrefslogtreecommitdiffstats
path: root/tests/bugs/gh-3792.slang
blob: 6b6a7451c365cf453031ed2879fb4ab7201dbf03 (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
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF): -shaderobj -output-using-type

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer

interface From<X> {
  __init(const X x);
}
extension float: From<float> {
  __init(const float x) { this = x; }
}
T test<T : From<float>>(float v)
{
    T u;
    u = T(5.0f);
    return u;
}

RWStructuredBuffer<float> outputBuffer;
[numthreads(1,1,1)]
void computeMain()
{
    float v = test<float>(5.0);
    //BUF: 5.0
    outputBuffer[0] = v;
}