yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f90a7631a
master
1//TEST:SIMPLE(filecheck=CHK): 2 3// Test if the variable name is a part of the error message 4// when it is used inside of for-loop 5 6RWStructuredBuffer<float> gInput; 7RWStructuredBuffer<float> outputBuffer; 8 9//CHK-DAG: ([[#@LINE+1]]): warning 41016: use of uninitialized variable 'a' 10float func1() { float a; return a; } 11 12//CHK-DAG: ([[#@LINE+1]]): warning 41016: use of uninitialized variable 'b' 13float func2() { float b; return b; } 14 15int test(int inVal) 16{ 17 return inVal; 18} 19 20[Shader("compute")] 21[NumThreads(4, 1, 1)] 22void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) 23{ 24 int tid = dispatchThreadID.x; 25 int inVal1; // intentionally uninitialized 26 int inVal2; // intentionally uninitialized 27 28 for (int i = 0; i <2; ++i) 29 { 30 // CHK-DAG: ([[#@LINE+1]]): warning 41016: use of uninitialized variable 'inVal1' 31 int outVal = test(inVal1); 32 33 // CHK-DAG: ([[#@LINE+1]]): warning 41016: use of uninitialized variable 'inVal2' 34 outVal += test(inVal2); 35 outputBuffer[tid] = outVal; 36 } 37}