https://github.com/shader-slang/slang
Raw File
Tip revision: ebf0e524d61d81a845daaf244b7ceef6c279f95e authored by jsmall-nvidia on 29 July 2021, 14:39:46 UTC
Improvements around glslang optimization (#1916)
Tip revision: ebf0e52
texture-sampler-2d.slang
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type

//TEST_INPUT: TextureSampler2D(size=4, content=one):name t2D
Sampler2D<float> t2D;

//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
RWStructuredBuffer<float> outputBuffer;

[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    int idx = dispatchThreadID.x;
    float u = idx * (1.0f / 4);
    
    float val = 0.0f;
   
    val += t2D.SampleLevel(float2(u, u), 0);

    outputBuffer[idx] = val;
}
back to top