yum-mirror/slang

Making it easier to work with shaders

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

James Helferty (NVIDIA)render-test: Change D3D12 default to sm_6_5 (#8320)f02b08490

master
2.3 KiB57 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute  -shaderobj -output-using-type
2//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type
3//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12  -shaderobj -output-using-type
4//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile cs_6_0 -shaderobj -output-using-type
5//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type -render-feature hardware-device
6//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute  -shaderobj -output-using-type
7
8// Doesn't work on CUDA, not clear why yet
9//DISABLE_TEST_INPUT: Texture1D(format=R_Float32, size=4, content = one, mipMaps=1):name tLoad1D
10//Texture1D<float> tLoad1D;
11
12// Not supported in WGSL: 1D array texture not supported in WGSL
13//DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -wgpu
14
15//TEST_INPUT: Texture1D(size=4, content = one):name t1D
16Texture1D<float> t1D;
17//TEST_INPUT: Texture2D(size=4, content = one):name t2D
18Texture2D<float> t2D;
19//TEST_INPUT: Texture3D(size=4, content = one):name t3D
20Texture3D<float> t3D;
21//TEST_INPUT: TextureCube(size=4, content = one):name tCube
22TextureCube<float> tCube;
23
24//TEST_INPUT: Texture1D(size=4, content = one, arrayLength=2):name t1DArray
25Texture1DArray<float> t1DArray;
26//TEST_INPUT: Texture2D(size=4, content = one, arrayLength=2):name t2DArray
27Texture2DArray<float> t2DArray;
28//TEST_INPUT: TextureCube(size=4, content = one, arrayLength=2):name tCubeArray
29TextureCubeArray<float> tCubeArray;
30
31//TEST_INPUT: Sampler:name samplerState
32SamplerState samplerState;
33
34//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
35RWStructuredBuffer<float> outputBuffer;
36
37[numthreads(4, 1, 1)]
38void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
39{
40    int idx = dispatchThreadID.x;
41    float u = idx * (1.0f / 4);
42    
43    float val = 0.0f;
44   
45    val += t1D.SampleLevel(samplerState, u, 0);
46    val += t2D.SampleLevel(samplerState, float2(u, u), 0);
47    val += t3D.SampleLevel(samplerState, float3(u, u, u), 0);
48    val += tCube.SampleLevel(samplerState, normalize(float3(u, 1 - u, u)), 0);
49 
50    val += t1DArray.SampleLevel(samplerState, float2(u, 0), 0);
51    val += t2DArray.SampleLevel(samplerState, float3(u, u, 0), 0);
52    val += tCubeArray.SampleLevel(samplerState, float4(u, u, u, 0), 0);
53 
54    //val += tLoad1D.Load(int2(idx, 0));
55 
56    outputBuffer[idx] = val;
57}