summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-c-like.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-11-02 09:47:35 -0400
committerGitHub <noreply@github.com>2022-11-02 09:47:35 -0400
commitfb29bd32cc3404455ff92916a91c517823f486dd (patch)
tree8d847489dc2e9a46c73c01c4c4a8fc79930c75a0 /source/slang/slang-emit-c-like.cpp
parent487855ecb46ec4360464d2f028cedf8c24a66d29 (diff)
Shader Execution Reordering (via NVAPI) (#2484)
* #include an absolute path didn't work - because paths were taken to always be relative. * Preliminary SER NVAPI support. * Set the DXC compiler version. Fix typo in premake5.lua * Improve DXC version detection. Enable HLSL2021 on late enough version of DXC. * Fix typo. * Fix launch. * Test via DXIL output. * Update dxc-error output.
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
-rw-r--r--source/slang/slang-emit-c-like.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp
index dcd25419e..09a18a31c 100644
--- a/source/slang/slang-emit-c-like.cpp
+++ b/source/slang/slang-emit-c-like.cpp
@@ -1472,20 +1472,31 @@ IRTargetIntrinsicDecoration* CLikeSourceEmitter::findBestTargetIntrinsicDecorati
/* static */bool CLikeSourceEmitter::isOrdinaryName(UnownedStringSlice const& name)
{
char const* cursor = name.begin();
- char const* end = name.end();
+ char const*const end = name.end();
// Consume an optional `.` at the start, which indicates
// the ordinary name is for a member function.
- if(cursor != end && *cursor == '.')
+ if(cursor < end && *cursor == '.')
cursor++;
- while(cursor != end)
+ // Must have at least one char, and first char can't be a digit
+ if (cursor >= end || CharUtil::isDigit(cursor[0]))
+ return false;
+
+ for(; cursor < end; ++cursor)
{
- int c = *cursor++;
- if( (c >= 'a') && (c <= 'z') ) continue;
- if( (c >= 'A') && (c <= 'Z') ) continue;
- if( (c >= '0') && (c <= '9') ) continue;
- if( c == '_' ) continue;
+ const auto c = *cursor;
+ if (CharUtil::isAlphaOrDigit(c) || c == '_')
+ {
+ continue;
+ }
+
+ // We allow :: for scope
+ if (c == ':' && cursor + 1 < end && cursor[1] == ':')
+ {
+ ++cursor;
+ continue;
+ }
return false;
}