yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
37e8917d1
master
1//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -output-using-type -shaderobj 2 3//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer 4RWStructuredBuffer<int> outputBuffer : register(u0); 5 6#define WRITE_TYPE_ALIGN(base, type) \ 7 outputBuffer[base * 4 + 0] = __alignOf<type>(); \ 8 outputBuffer[base * 4 + 1] = __alignOf<vector<type, 2> >(); \ 9 outputBuffer[base * 4 + 2] = __alignOf<vector<type, 3> >(); \ 10 outputBuffer[base * 4 + 3] = __alignOf<vector<type, 4> >(); 11 12 13[numthreads(1, 1, 1)] 14void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 15{ 16 WRITE_TYPE_ALIGN(0, uint8_t) 17 WRITE_TYPE_ALIGN(1, uint16_t) 18 WRITE_TYPE_ALIGN(2, int) 19 WRITE_TYPE_ALIGN(3, int64_t) 20 21 WRITE_TYPE_ALIGN(4, half) 22 WRITE_TYPE_ALIGN(5, float) 23 WRITE_TYPE_ALIGN(6, double) 24}