yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f02b08490
master
1//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -xslang -zero-initialize 2//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -entry computeMain -emit-spirv-directly -allow-glsl -xslang -zero-initialize 3//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cpu -compute -entry computeMain -allow-glsl -xslang -zero-initialize 4//DISABLE_TEST(smoke,compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-dx12 -compute -entry computeMain -allow-glsl -profile sm_6_2 -xslang -zero-initialize -xslang -DDX12 5 6//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer 7RWStructuredBuffer<int> outputBuffer; 8 9__generic<T : __BuiltinArithmeticType> 10bool getValue() 11{ 12 T genericOut; 13 return genericOut == T(0); 14} 15bool getValueBoolean() 16{ 17 bool genericOut; 18 return genericOut == bool(0); 19} 20 21__generic<T : __BuiltinArithmeticType, let N : int> 22bool getValueVector() 23{ 24 typealias gvec = vector<T, N>; 25 26 gvec genericOut; 27 for (int i = 0; i < N; ++i) 28 if (genericOut[i] != T(0)) 29 return false; 30 return true; 31} 32__generic<let N : int> 33bool getValueVectorBoolean() 34{ 35 typealias gvec = vector<bool, N>; 36 37 gvec genericOut; 38 for (int i = 0; i < N; ++i) 39 if (genericOut[i] != bool(0)) 40 return false; 41 return true; 42} 43 44[numthreads(1, 1, 1)] 45void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) 46{ 47// BUF: 1 48 outputBuffer[0] = true 49 && getValue<int>() 50#ifndef DX12 51 && getValue<uint8_t>() 52 && getValue<int8_t>() 53#endif 54 && getValue<uint16_t>() 55 && getValue<int16_t>() 56 && getValue<uint32_t>() 57 && getValue<int32_t>() 58 && getValue<uint64_t>() 59 && getValue<int64_t>() 60 && getValue<half>() 61 && getValue<float>() 62 && getValue<double>() 63 && getValueBoolean() 64 65 && getValueVector<int, 2>() 66#ifndef DX12 67 && getValueVector<uint8_t, 2>() 68 && getValueVector<int8_t, 2>() 69#endif 70 && getValueVector<uint16_t, 2>() 71 && getValueVector<int16_t, 2>() 72 && getValueVector<uint32_t, 2>() 73 && getValueVector<int32_t, 2>() 74 && getValueVector<uint64_t, 2>() 75 && getValueVector<int64_t, 2>() 76 && getValueVector<half, 2>() 77 && getValueVector<float, 2>() 78 && getValueVector<double, 2>() 79 && getValueVectorBoolean<2>() 80 81 && getValueVector<int, 3>() 82#ifndef DX12 83 && getValueVector<uint8_t, 3>() 84 && getValueVector<int8_t, 3>() 85#endif 86 && getValueVector<uint16_t, 3>() 87 && getValueVector<int16_t, 3>() 88 && getValueVector<uint32_t, 3>() 89 && getValueVector<int32_t, 3>() 90 && getValueVector<uint64_t, 3>() 91 && getValueVector<int64_t, 3>() 92 && getValueVector<half, 3>() 93 && getValueVector<float, 3>() 94 && getValueVector<double, 3>() 95 && getValueVectorBoolean<3>() 96 97 && getValueVector<int, 4>() 98#ifndef DX12 99 && getValueVector<uint8_t, 4>() 100 && getValueVector<int8_t, 4>() 101#endif 102 && getValueVector<uint16_t, 4>() 103 && getValueVector<int16_t, 4>() 104 && getValueVector<uint32_t, 4>() 105 && getValueVector<int32_t, 4>() 106 && getValueVector<uint64_t, 4>() 107 && getValueVector<int64_t, 4>() 108 && getValueVector<half, 4>() 109 && getValueVector<float, 4>() 110 && getValueVector<double, 4>() 111 && getValueVectorBoolean<4>() 112 ; 113}