yum-mirror/slang

Making it easier to work with shaders

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

Ellie HermaszewskaMVP for higher order functions (#2849)332f60c19

master
682 B26 linesraw
1//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX():-vk -compute -shaderobj -output-using-type
2//DISABLE_TEST(compute):COMPARE_COMPUTE_EX():-slang -compute -shaderobj -output-using-type
3// Disabled due to https://github.com/shader-slang/slang/issues/2198
4
5//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
6RWStructuredBuffer<uint> outputBuffer;
7
8func fix(float x) -> float
9{
10    let epsilon = 0.01;
11    let x_ = go(x);
12    if(abs(x_ - x) < epsilon)
13        return x_;
14    return fix(x_);
15}
16
17func go(x : float) -> float
18{
19    return (x + 121 / x) / 2;
20}
21
22[numthreads(4, 1, 1)]
23void computeMain(uint tig : SV_GroupIndex)
24{
25    outputBuffer[tig] = uint(fix(11));
26}