From 160111a0e27c9325ddfc49a53fbb82d3c6f06c90 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 9 Feb 2022 11:26:04 -0500 Subject: Generic experiments (#2119) * #include an absolute path didn't work - because paths were taken to always be relative. * Small fixes. Added compiler crash with generic defined in a function. Added enum-flags test that works (by limiting backing type to int), and using __EnumType constraint. * Add comment about crash. * Disable crashing test. --- .../experiments/generic/generic-in-function.slang | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/experiments/generic/generic-in-function.slang (limited to 'tests/experiments/generic/generic-in-function.slang') diff --git a/tests/experiments/generic/generic-in-function.slang b/tests/experiments/generic/generic-in-function.slang new file mode 100644 index 000000000..7a45d43de --- /dev/null +++ b/tests/experiments/generic/generic-in-function.slang @@ -0,0 +1,30 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj + +/* It appears the use of a generic defined within a function appears to trigger a crash + + +``` +void Type::accept(ITypeVisitor* visitor, void* extra) +``` + +As this is nullptr. +*/ + +RWStructuredBuffer outputBuffer; + +int doThing() +{ + int getValue() { return N; } + + return getValue<10>(); +} + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + + float inVal = float(tid); + + outputBuffer[tid] = doThing(); +} -- cgit v1.2.3