From a9e1beeb003644f4034b9485ad00e273ad52c9f1 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 27 Jan 2020 15:04:29 -0500 Subject: CUDA implement StructuredBuffer/ByteAddressBuffer as pointer/count as is on CPU. (#1182) Allow bounds check to zero index. Update docs. --- source/core/slang-nvrtc-compiler.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'source/core/slang-nvrtc-compiler.cpp') diff --git a/source/core/slang-nvrtc-compiler.cpp b/source/core/slang-nvrtc-compiler.cpp index bc7d1f4f6..6464592a5 100644 --- a/source/core/slang-nvrtc-compiler.cpp +++ b/source/core/slang-nvrtc-compiler.cpp @@ -174,6 +174,16 @@ static SlangResult _parseLocation(const UnownedStringSlice& in, DownstreamDiagno return SLANG_OK; } +static bool _isDriveLetter(char c) +{ + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); +} + +static bool _hasDriveLetter(const UnownedStringSlice& line) +{ + return line.size() > 2 && line[1] == ':' && _isDriveLetter(line[0]); +} + static SlangResult _parseNVRTCLine(const UnownedStringSlice& line, DownstreamDiagnostic& outDiagnostic) { typedef DownstreamDiagnostic Diagnostic; @@ -182,7 +192,17 @@ static SlangResult _parseNVRTCLine(const UnownedStringSlice& line, DownstreamDia outDiagnostic.stage = Diagnostic::Stage::Compile; List split; - StringUtil::split(line, ':', split); + if (_hasDriveLetter(line)) + { + // The drive letter has :, which confuses things, so skip that and then fix up first entry + UnownedStringSlice lineWithoutDrive(line.begin() + 2, line.end()); + StringUtil::split(lineWithoutDrive, ':', split); + split[0] = UnownedStringSlice(line.begin(), split[0].end()); + } + else + { + StringUtil::split(line, ':', split); + } if (split.getCount() == 3) { -- cgit v1.2.3