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
1.5 KiB39 linesraw
1// hit-object-assign.slang
2
3//TEST:SIMPLE: -target dxil -entry rayGenerationMain -stage raygeneration -profile sm_6_5 -DNV_SHADER_EXTN_SLOT=u0 
4//TEST:SIMPLE(filecheck=SPIRV): -target spirv -entry rayGenerationMain -stage raygeneration -profile glsl_460+GL_EXT_ray_tracing -O0 -line-directive-mode none 
5//TEST:SIMPLE(filecheck=SPIRV): -target spirv -entry rayGenerationMain -stage raygeneration -O0  -emit-spirv-directly
6
7//DISABLE_TEST:COMPARE_COMPUTE_EX:-slang -compute -dx12 -output-using-type -profile sm_6_5 -nvapi-slot u0 
8//DISABLE_TEST(compute):COMPARE_COMPUTE:-d3d12 -output-using-type -profile sm_6_5 -render-feature ray-query
9//DISABLE_TEST(compute):COMPARE_COMPUTE:-vk -output-using-type -render-feature ray-query
10
11//TEST_INPUT:ubuffer(data=[0 0 0 0 0], stride=4):out,name=outputBuffer
12RWStructuredBuffer<uint> outputBuffer;
13
14// SPIRV: OpHitObjectRecordMissNV
15// SPIRV: OpHitObjectIsMissNV
16
17void rayGenerationMain()
18{    
19    int2 launchID = int2(DispatchRaysIndex().xy);
20    int2 launchSize = int2(DispatchRaysDimensions().xy);
21
22    int idx = int(launchID.x);
23
24    RayDesc ray;  
25    ray.Origin = float3(idx, 0, 0);
26    ray.TMin = 0.01f;
27    ray.Direction = float3(0, 1, 0);
28    ray.TMax = 1e4f;
29    
30    HitObject hit = HitObject::MakeMiss(idx, ray);
31    
32    // Let's try assigning. This should work on VK
33    // because it will SSA out such there isn't an assignment in GLSL output.
34    hit = HitObject::MakeMiss(idx + 1, ray);
35    
36    int r = int(hit.IsMiss());
37    
38    outputBuffer[idx] = r;
39}