yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

jsmall-nvidiaRuns all gfx unit tests through a 'test proxy' (#1981)62b1e58a7

master
772 B24 linesraw
1//TEST(compute):COMPARE_COMPUTE:-cuda -output-using-type -shaderobj
2//TEST(compute):COMPARE_COMPUTE:-cpu -output-using-type -shaderobj
3//TEST(compute):COMPARE_COMPUTE: -output-using-type -shaderobj
4//TEST(compute,vulkan):COMPARE_COMPUTE:-vk -output-using-type -shaderobj
5
6//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer
7RWStructuredBuffer<float> outputBuffer;
8
9float quantize(float value)
10{
11    return int(value * 256) * 1.0f / 256.0f;
12}
13
14[numthreads(4, 1, 1)]
15void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
16{
17    float values[] = { -9, 9, -3, 3 };
18
19	int tid = int(dispatchThreadID.x);
20    float value = values[tid];
21    
22    outputBuffer[tid * 2] = quantize(sin(value));
23    outputBuffer[tid * 2 + 1] = quantize(cos(value));
24}