summaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-10-08 16:46:18 -0400
committerGitHub <noreply@github.com>2022-10-08 16:46:18 -0400
commit05de8d86370d7a329bdf4cb4b9e5b270f6696076 (patch)
treeb7115ba3e3f46b44f007c403afb58c1214d47f7c /tests/bugs
parent34ba10d1b883700992f34c68ed72f659d3644461 (diff)
Fix for issue with user attribute lookup (#2437)
* #include an absolute path didn't work - because paths were taken to always be relative. * Add handling for root paths. * Fixes around absolute paths. * Add SimplifyStyle * Remove unrequire include. * Fix some details around RelativeFileSystem canonical paths. * For MemoryFileSystem make sure "/a" and "a" maps to same canonical path. * Add test for canonicalPath. * Improve comment. * More testing around canonical paths. * Fix for user attribute lookup issue. * Add a test. * Small improvements in test. * Improve the comments around lookup workaround.
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/user-attribute-lookup.slang32
-rw-r--r--tests/bugs/user-attribute-lookup.slang.expected.txt4
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/bugs/user-attribute-lookup.slang b/tests/bugs/user-attribute-lookup.slang
new file mode 100644
index 000000000..96cd3ad19
--- /dev/null
+++ b/tests/bugs/user-attribute-lookup.slang
@@ -0,0 +1,32 @@
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
+//TEST(compute,vulkan):COMPARE_COMPUTE_EX:-vk -slang -compute -shaderobj
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+// To test for a bug where a user attribute, gets incorrectly looked up
+// as a cached lookup made before creation will make it multiply defined.
+
+// Define an attribute that will appear in reflection
+[__AttributeUsage(_AttributeTargets.Var)]
+struct StaticSamplerAttribute {};
+
+struct Thing
+{
+ [StaticSampler] SamplerState samplerState1;
+ [StaticSampler] SamplerState samplerState2;
+}
+
+[StaticSampler] SamplerState samplerState;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+
+ float inVal = float(tid);
+
+ outputBuffer[tid] = int(inVal);
+}
+
+
diff --git a/tests/bugs/user-attribute-lookup.slang.expected.txt b/tests/bugs/user-attribute-lookup.slang.expected.txt
new file mode 100644
index 000000000..bc856dafa
--- /dev/null
+++ b/tests/bugs/user-attribute-lookup.slang.expected.txt
@@ -0,0 +1,4 @@
+0
+1
+2
+3