yum-mirror/slang

Making it easier to work with shaders

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

jsmall-nvidiaMatrix tests and assorted bug tests (#1814)599129dea

master
667 B25 linesraw
1// missing-loc-on-assignment.slang
2
3//DIAGNOSTIC_TEST:SIMPLE:-target hlsl -stage compute -entry computeMain
4
5//TEST_INPUT:cbuffer(data=[1.0 0.0 0.0 0.0  0.0 1.0 0.0 0.0  0.0 0.0 1.0 0.0 10.0 20.0 30.0 1.0]):name matrixBuffer
6ConstantBuffer<float4x4> matrixBuffer;
7
8//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name output
9RWStructuredBuffer<float> output;
10
11[numthreads(1, 1, 1)]
12void computeMain(uint3 tid : SV_DispatchThreadID)
13{
14    float4 v = float4(1, 2, 3, 1);
15
16    // Produces an error but not a location(!)
17    float4 M = matrixBuffer;
18    
19    float4 r = mul(v, M);
20
21    output[0] = r.x;
22    output[1] = r.y;
23    output[2] = r.z;
24    output[3] = r.w;
25}