summaryrefslogtreecommitdiff
path: root/tests/bugs/generic-default-value.slang
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-03-24 11:42:56 -0400
committerGitHub <noreply@github.com>2022-03-24 11:42:56 -0400
commitb8617af2888db01f80efba9e0a103e6a61989c9c (patch)
tree66830e801ac0dc78180ac8d9cda8af75d59bb557 /tests/bugs/generic-default-value.slang
parente1a331a2e2945f2b90c00d0af4d1ba5f67dbd256 (diff)
Fix for default initialization with generic field (#2168)
* #include an absolute path didn't work - because paths were taken to always be relative. * Fix for = {} initialization with a field that is generic type parameter. * Handling for if a non type is passed to a generic parameter which requires a type. * Small comment improvements. Fix some tab issues. * This fixes the matrix.slang issue. Move the matrix.slang test into bugs as generic-default-matrix.slang
Diffstat (limited to 'tests/bugs/generic-default-value.slang')
-rw-r--r--tests/bugs/generic-default-value.slang23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/bugs/generic-default-value.slang b/tests/bugs/generic-default-value.slang
new file mode 100644
index 000000000..b3805e317
--- /dev/null
+++ b/tests/bugs/generic-default-value.slang
@@ -0,0 +1,23 @@
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+/* Tests purpose is to confirm that use of `= {}` initialization
+works with a generic */
+
+struct Check<T>
+{
+ T v;
+};
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int index = dispatchThreadID.x;
+
+ Check<float> v = {};
+
+ outputBuffer[index] = index + v.v;
+}
+