yum-mirror/slang

Making it easier to work with shaders

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

jsmall-nvidiaTexture Sample available in CUDA (#1176)b8f294445

master
632 B22 linesraw
1//TEST(compute):COMPARE_COMPUTE:-cpu -compute 
2//TEST(compute):COMPARE_COMPUTE:-cuda -compute 
3
4//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
5RWStructuredBuffer<float> outputBuffer : register(u0);
6
7//TEST_INPUT: Texture2D(size=4, content=one):name texture
8Texture2D<float> texture;
9
10//TEST_INPUT: Sampler:name sampler
11SamplerState sampler;
12
13[numthreads(4, 1, 1)]
14void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
15{
16	int tid = int(dispatchThreadID.x);
17    float u = tid * (1.0f / 3.0f);
18    float v = 1.0f - u;
19    float2 uv = float2(u, v);
20
21    outputBuffer[tid] = texture.Sample(sampler, uv);
22}