yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f02b08490
master
1//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -compute -cpu 2//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -vk -compute 3//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -vk -compute -emit-spirv-via-glsl 4//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -cuda -compute 5//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -mtl -compute 6// No support for uint64_t on fxc - we need SM6.0 and dxil to use uint64_t with d3d12 7// https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/hlsl-shader-model-6-0-features-for-direct3d-12 8//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -compute -dx12 -profile cs_6_0 -shaderobj -render-feature hardware-device 9// wgpu only has 32-bit support, so we do not try and test it here 10 11//CHK:1 12 13//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer 14RWStructuredBuffer<uint> outputBuffer; 15 16[numthreads(1, 1, 1)] 17void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 18{ 19 uint r1 = countbits(0b1ULL << 32); 20 uint2 r2 = countbits(uint64_t2(0b0ULL << 32, 0b1ULL << 32)); 21 uint3 r3 = countbits(uint64_t3(0b0ULL << 32, 0b1ULL << 32, 0b11ULL << 32)); 22 uint4 r4 = countbits(uint64_t4(0b0ULL << 32, 0b1ULL << 32, 0b11ULL << 32, 0b111ULL << 32)); 23 24 uint r5 = countbits(0b1LL << 32); 25 uint2 r6 = countbits(int64_t2(0b0LL << 32, 0b1LL << 32)); 26 uint3 r7 = countbits(int64_t3(0b0LL << 32, 0b1LL << 32, 0b11LL << 32)); 27 uint4 r8 = countbits(int64_t4(0b0LL << 32, 0b1LL << 32, 0b11LL << 32, 0b111LL << 32)); 28 29 uint bigShiftU32 = 0b111U << 32; 30 int bigShiftI32 = 0b1111 << 32; 31 32 uint bitCountBigShiftU32 = countbits(bigShiftU32); 33 uint bitCountBigShiftI32 = countbits(bigShiftI32); 34 35 outputBuffer[0] = true 36 && (r1 == 1) 37 && (r2.x == 0 && r2.y == 1) 38 && (r3.x == 0 && r3.y == 1 && r3.z == 2) 39 && (r4.x == 0 && r4.y == 1 && r4.z == 2 && r4.w == 3) 40 && (r5 == 1) 41 && (r6.x == 0 && r6.y == 1) 42 && (r7.x == 0 && r7.y == 1 && r7.z == 2) 43 && (r8.x == 0 && r8.y == 1 && r8.z == 2 && r8.w == 3) 44 && (bitCountBigShiftU32 == 0 && bitCountBigShiftI32 == 0) 45 ; 46}