summaryrefslogtreecommitdiff
path: root/tests/experiments/generic/generic-in-function.slang
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-02-09 11:26:04 -0500
committerGitHub <noreply@github.com>2022-02-09 11:26:04 -0500
commit160111a0e27c9325ddfc49a53fbb82d3c6f06c90 (patch)
treef71557856792e01bd4f55ad3013b16946bc866b6 /tests/experiments/generic/generic-in-function.slang
parentd06a78d935b2743494d47ed5cd3f36e38ac9c5ac (diff)
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.
Diffstat (limited to 'tests/experiments/generic/generic-in-function.slang')
-rw-r--r--tests/experiments/generic/generic-in-function.slang30
1 files changed, 30 insertions, 0 deletions
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<float> outputBuffer;
+
+int doThing()
+{
+ int getValue<let N : int>() { 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();
+}