From 50676c741e10ffe6f710c5de86387eaacd274a9a Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 26 Jan 2021 16:04:44 -0500 Subject: Obfuscation naming issue fix (#1676) * #include an absolute path didn't work - because paths were taken to always be relative. * Work around for issue with obfuscation (and lack of name hints) leading to names in output not being correctly uniquified. * Improve appendChar Remove unrequired memory juggling to scrub names. * Remove test code. * Small fixes in comments and method called. * Remove linkage decoration on functions that are specialized. * Obfuscation naming with specialization test. * Fix instruction deletion. Co-authored-by: Tim Foley --- tests/bugs/obfuscate-specialization-naming.slang | 23 ++++++++++++++++++++++ ...uscate-specialization-naming.slang.expected.txt | 4 ++++ 2 files changed, 27 insertions(+) create mode 100644 tests/bugs/obfuscate-specialization-naming.slang create mode 100644 tests/bugs/obfuscate-specialization-naming.slang.expected.txt (limited to 'tests') diff --git a/tests/bugs/obfuscate-specialization-naming.slang b/tests/bugs/obfuscate-specialization-naming.slang new file mode 100644 index 000000000..2511adbea --- /dev/null +++ b/tests/bugs/obfuscate-specialization-naming.slang @@ -0,0 +1,23 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -compile-arg -obfuscate -shaderobj +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -compile-arg -obfuscate -shaderobj + +//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):name a +RWStructuredBuffer a; +//TEST_INPUT:ubuffer(data=[0 2 4 6], stride=4):name b +RWStructuredBuffer b; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name output +RWStructuredBuffer output; + +int doThing(RWStructuredBuffer buf, int index) +{ + return buf[index]; +} + +[numthreads(16, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int tid = int(dispatchThreadID.x); + + output[tid] = doThing(a, tid) | doThing(b, tid); +} \ No newline at end of file diff --git a/tests/bugs/obfuscate-specialization-naming.slang.expected.txt b/tests/bugs/obfuscate-specialization-naming.slang.expected.txt new file mode 100644 index 000000000..4a384c4be --- /dev/null +++ b/tests/bugs/obfuscate-specialization-naming.slang.expected.txt @@ -0,0 +1,4 @@ +0 +3 +6 +7 -- cgit v1.2.3