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
999 B28 linesraw
1//DISABLE_TEST(compute):COMPARE_COMPUTE:-dx12 -compute -profile cs_6_2 -render-features half -shaderobj
2//DISABLE_TEST(compute):COMPARE_COMPUTE:-vk -compute -profile cs_6_2 -render-features half -shaderobj
3//TEST(compute):COMPARE_COMPUTE:-cuda -compute -render-features half -shaderobj
4
5//DISABLE_TEST(compute):SIMPLE:-target ptx -stage compute -entry computeMain
6
7// The following test shows if half can be processed as an opaque type. This means
8// it can be copied, and converted to and from float types, but nothing else. 
9// No maths, no swizzling.
10
11//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
12RWStructuredBuffer<float> outputBuffer;
13
14[numthreads(4, 1, 1)]
15void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
16{
17    uint tid = dispatchThreadID.x;
18    
19    float a = (1.0f / 2.0f) * tid.x;
20    
21    // Convert into half
22    half ha = f32tof16_(a);
23    // Convert back to float
24    float fa = f16tof32(ha);
25    
26    // Write it out
27    outputBuffer[tid] = fa;
28}