yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f02b08490
master
1// byte-address-buffer.slang 2 3//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj 4//TEST(compute):COMPARE_COMPUTE_EX:-d3d12 -compute -shaderobj -profile cs_6_0 5//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj 6 7//TEST_INPUT:ubuffer(data=[0 1 2 3]):name=inputBuffer 8RWByteAddressBuffer inputBuffer; 9 10//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0]):out,name=outputBuffer 11RWByteAddressBuffer outputBuffer; 12 13void testInt64(uint val) 14{ 15 // Load a 32-bit value from the input buffer 16 uint tmp = inputBuffer.Load(uint(val * 4)); 17 18 // Cast to uint64_t 19 uint64_t tmp64 = uint64_t(tmp) + 1; 20 21 // Store the result back as uint64_t 22 outputBuffer.Store(uint(val * 8), tmp64); 23} 24 25[numthreads(4, 1, 1)] 26[shader("compute")] 27void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 28{ 29 uint tid = dispatchThreadID.x; 30 31 testInt64(tid); 32}