summaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-09-05 11:53:56 -0700
committerGitHub <noreply@github.com>2024-09-05 11:53:56 -0700
commit33e8bfd43f66613f6f834fb0e1816ef43071f2e4 (patch)
tree65ea9179edd27325fe4d8dfb0c6d4ca33db67671 /tests/bugs
parent879ee3d187e577189eba9aed7bc6326b740cb627 (diff)
Fix SPIRV SV_TessFactor type adaptation logic. (#5010)
* Fix SPIRV SV_TessFactor type adaptation logic. * Fix compile error.
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/gh-4456.slang52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/bugs/gh-4456.slang b/tests/bugs/gh-4456.slang
new file mode 100644
index 000000000..05b346e77
--- /dev/null
+++ b/tests/bugs/gh-4456.slang
@@ -0,0 +1,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;
+}