summaryrefslogtreecommitdiffstats
path: root/tests/bugs/gh-4456.slang
blob: 05b346e77c0dad8521fa7c3bb978e7bbdb7d7b08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//TEST:SIMPLE(filecheck=CHECK): -target spirv -lang slang -D__spirv__ -emit-spirv-directly -profile ds_6_5 -entry main

// CHECK: OpEntryPoint

struct VSSceneIn {
  float3 pos : POSITION;
};

struct PSSceneIn {
  float4 pos : SV_Position;
};

struct HSPerVertexData {
  PSSceneIn v;
};

struct HSPerPatchData {
  float edges[3] : SV_TessFactor;
  float inside : SV_InsideTessFactor;
};

RaytracingAccelerationStructure AccelerationStructure : register(t0);
RayDesc MakeRayDesc()
{
    RayDesc desc;
    desc.Origin = float3(0,0,0);
    desc.Direction = float3(1,0,0);
    desc.TMin = 0.0f;
    desc.TMax = 9999.0;
    return desc;
}
void doInitialize(out RayQuery<RAY_FLAG_FORCE_OPAQUE> query, RayDesc ray)
{
    query.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_NON_OPAQUE,0xFF,ray);
}

[domain("tri")] PSSceneIn main(
    const float3 bary : SV_DomainLocation,
    const OutputPatch<HSPerVertexData, 3> patch,
    const HSPerPatchData perPatchData) 
{
    PSSceneIn v;
    v.pos = patch[0].v.pos * bary.x + patch[1].v.pos * bary.y + patch[2].v.pos * bary.z + perPatchData.edges[1];

    RayQuery<RAY_FLAG_FORCE_OPAQUE> q;
    RayDesc ray = MakeRayDesc();

    q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray);
    doInitialize(q, ray);

 	return v;
}