summaryrefslogtreecommitdiffstats
path: root/tests/experiments/generic
diff options
context:
space:
mode:
Diffstat (limited to 'tests/experiments/generic')
-rw-r--r--tests/experiments/generic/generic-func-static-const-var.slang24
-rw-r--r--tests/experiments/generic/generic-struct-func-static-const-var.slang (renamed from tests/experiments/generic/meta-2.slang)18
2 files changed, 32 insertions, 10 deletions
diff --git a/tests/experiments/generic/generic-func-static-const-var.slang b/tests/experiments/generic/generic-func-static-const-var.slang
new file mode 100644
index 000000000..2c8ea0398
--- /dev/null
+++ b/tests/experiments/generic/generic-func-static-const-var.slang
@@ -0,0 +1,24 @@
+//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -Xslang -dump-ir
+
+/* Doesn't work correctly failing in emit with a 'generic' instruction that is not expected. */
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+struct GetValue2<let N : int>
+{
+ static int getValue()
+ {
+ static const int v = N;
+ return v;
+ }
+};
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int index = dispatchThreadID.x;
+
+ outputBuffer[index] = GetValue2<20>::getValue();
+}
+
diff --git a/tests/experiments/generic/meta-2.slang b/tests/experiments/generic/generic-struct-func-static-const-var.slang
index 98ae09ce5..db6fc6225 100644
--- a/tests/experiments/generic/meta-2.slang
+++ b/tests/experiments/generic/generic-struct-func-static-const-var.slang
@@ -1,23 +1,21 @@
-//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
+//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -Xslang -dump-ir
-/* A test meta programing.
-
-CRASHES the compiler(!). Stack overrun.
- */
+/* Doesn't work correctly failing in emit with a 'generic' instruction that is not expected. */
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
RWStructuredBuffer<int> outputBuffer;
-struct GetValue<let N : int>
+static int getValue<let N: int>()
{
- static const int Value = N;
-};
-
+ static const int v = N;
+ return v;
+}
+
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
int index = dispatchThreadID.x;
- outputBuffer[index] = GetValue<10>::Value;
+ outputBuffer[index] = getValue<10>();
}