summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-02-12 16:47:14 -0500
committerGitHub <noreply@github.com>2020-02-12 16:47:14 -0500
commitf07834e19a34d5f9c03d681083b5ba30e262889d (patch)
treead0b29fe3de15cad85ba6ecfa6bd35115ab34785 /tests
parente1e7a6eec04ee1d04dc7e0d0212208d4c7a9592b (diff)
Nvrtc disable warnings/Float literal improvements (#1220)
* Added 'truncate' for fixing floats, for floats near the max value (as opposed to making infinite). Put AreNearlyEqual into Math * Test for ::make static method.
Diffstat (limited to 'tests')
-rw-r--r--tests/compute/struct-make.slang30
-rw-r--r--tests/compute/struct-make.slang.expected.txt4
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/compute/struct-make.slang b/tests/compute/struct-make.slang
new file mode 100644
index 000000000..265370b89
--- /dev/null
+++ b/tests/compute/struct-make.slang
@@ -0,0 +1,30 @@
+// scope.slang
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute
+//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute
+//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute
+
+// Confirm that scoping on enums and types works
+
+struct Thing
+{
+ int a;
+ static Thing make(int v)
+ {
+ Thing thing;
+ thing.a = v;
+ return thing;
+ }
+};
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+
+ Thing thing = Thing::make(tid);
+
+ outputBuffer[tid] = thing.a;
+} \ No newline at end of file
diff --git a/tests/compute/struct-make.slang.expected.txt b/tests/compute/struct-make.slang.expected.txt
new file mode 100644
index 000000000..bc856dafa
--- /dev/null
+++ b/tests/compute/struct-make.slang.expected.txt
@@ -0,0 +1,4 @@
+0
+1
+2
+3