yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
2275e18fc
master
1//TEST(compute):SIMPLE(filecheck=CHECK_EXPLICIT): -target spirv-asm -entry computeMain -stage compute -DEXPLICIT 2//TEST(compute):SIMPLE(filecheck=CHECK_OVERLOAD): -target spirv-asm -entry computeMain -stage compute -DOVERLOAD 3 4enum CoopMatMatrixLayout 5{ 6 RowMajor = 0, 7 ColumnMajor = 1, 8}; 9 10int Load<let me : CoopMatMatrixLayout>(int inVal) 11{ 12 return int(inVal % 10); 13} 14 15#if !defined(EXPLICIT) 16int Load<let Dim : uint, let ClampMode : uint>(int inVal, int inVal2) 17{ 18 return Load<CoopMatMatrixLayout.RowMajor>(inVal); 19} 20#endif 21 22[Shader("compute")] 23[NumThreads(4, 1, 1)] 24void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) 25{ 26 int tid = dispatchThreadID.x; 27 28#if defined(EXPLICIT) 29 //CHECK_EXPLICIT: error 30019: expected an expression of type 'CoopMatMatrixLayout', got 'int' 30 //CHECK_EXPLICIT: note: explicit conversion from 'int' to 'CoopMatMatrixLayout' is possible 31 int outVal = Load<0>(tid); 32 33#elif defined(OVERLOAD) 34 //CHECK_OVERLOAD-NOT: error {{[1-9][0-9]*}} 35 int outVal = Load<CoopMatMatrixLayout.RowMajor>(tid); 36#endif 37}