From e4d7def727f75cee3f8fdfe6f286da2b8114b329 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 10 Jul 2023 12:23:07 -0700 Subject: Fix hit object emit for HLSL + FuncType specialization bug fix. (#2976) * Fix hit object emit for HLSL. * Fix a bug involving specialization of functon type. * Add a test case. --------- Co-authored-by: Yong He --- tests/bugs/func-type-specialize.slang | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/bugs/func-type-specialize.slang (limited to 'tests') diff --git a/tests/bugs/func-type-specialize.slang b/tests/bugs/func-type-specialize.slang new file mode 100644 index 000000000..7e17c5c3d --- /dev/null +++ b/tests/bugs/func-type-specialize.slang @@ -0,0 +1,36 @@ +//TEST:SIMPLE(filecheck=CHECK):-target hlsl -entry computeMain -profile cs_6_5 -validate-ir +//TEST_INPUT:ubuffer(data=[0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +// CHECK: void computeMain +// CHECK: RayQuery<0 +interface IFoo +{ + int doThing(RayQuery arr); +} + + +struct HitInfo +{ + static int makeHitInfo(RayQuery q) + { + return 0; + } +} + +struct Impl : IFoo +{ + int doThing(RayQuery arr) + { + return HitInfo.makeHitInfo(arr); + } +} + +RWStructuredBuffer outVal; +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID) +{ + Impl impl; + RayQuery<0> q; + outVal[dispatchThreadID.x] = impl.doThing(q); +} \ No newline at end of file -- cgit v1.2.3