diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-02-27 15:17:13 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-27 15:17:13 -0500 |
| commit | eee68205636f26ac8060dbb2b1725fd3c80e54a8 (patch) | |
| tree | b07d0be17046a763d80b04b211dd6869bff2bd9d /source | |
| parent | 8ac4452754292b74fa6bf2713dd9f1458ce5243d (diff) | |
Hotfix/fix stdlib error reporting (#866)
* * Add 'identity' version of bit casts (asint, asuint, asfloat) for scalar and vector
* Added identity bit casts for matrix (cos no op). We don't support matrix asint on glsl targets
* Added tests in bit-cast.slang
* Use kIRPseudoOp_Pos for identity asuint/asint/asfloat casts.
* * Stop crash if error in stdlib
* Use the buildin source manager when compiling stdlib - fixes that line numbers are displayed
* Typo fix
* Output line directives for 'meta' slang souce files into stdlib
* Improve comments and function names.
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/compiler.h | 2 | ||||
| -rw-r--r-- | source/slang/core.meta.slang.h | 4 | ||||
| -rw-r--r-- | source/slang/emit.cpp | 4 | ||||
| -rw-r--r-- | source/slang/hlsl.meta.slang.h | 5 | ||||
| -rw-r--r-- | source/slang/slang.cpp | 8 |
5 files changed, 20 insertions, 3 deletions
diff --git a/source/slang/compiler.h b/source/slang/compiler.h index 246b34ea7..49d777931 100644 --- a/source/slang/compiler.h +++ b/source/slang/compiler.h @@ -706,7 +706,7 @@ namespace Slang { // TODO: We really shouldn't need this type in the long run. // The few places that rely on it should be refactored to just - // depend on the unerlying information (a linkage and a diagnostic + // depend on the underlying information (a linkage and a diagnostic // sink) directly. // // The flags to control dumping and validation of IR should be diff --git a/source/slang/core.meta.slang.h b/source/slang/core.meta.slang.h index 2c59689a2..25feb0005 100644 --- a/source/slang/core.meta.slang.h +++ b/source/slang/core.meta.slang.h @@ -142,6 +142,7 @@ for (int tt = 0; tt < kBaseTypeCount; ++tt) // TODO: should this cover the full gamut of integer types? case BaseType::Int: case BaseType::UInt: +SLANG_RAW("#line 145 \"core.meta.slang\"") SLANG_RAW("\n") SLANG_RAW(" __generic<T:__EnumType>\n") SLANG_RAW(" __init(T value);\n") @@ -157,6 +158,7 @@ SLANG_RAW(" __init(T value);\n") // Declare built-in pointer type // (eventually we can have the traditional syntax sugar for this) +SLANG_RAW("#line 160 \"core.meta.slang\"") SLANG_RAW("\n") SLANG_RAW("\n") SLANG_RAW("__generic<T>\n") @@ -218,6 +220,7 @@ sb << " __init(T value);\n"; sb << " __init(vector<T,N> value);\n"; sb << "};\n"; +SLANG_RAW("#line 206 \"core.meta.slang\"") SLANG_RAW("\n") SLANG_RAW("\n") SLANG_RAW("__generic<T = float, let R : int = 4, let C : int = 4>\n") @@ -1194,6 +1197,7 @@ for (auto op : binaryOps) sb << "__intrinsic_op(" << int(op.opCode) << ") matrix<" << resultType << ",N,M> operator" << op.opName << "(" << leftQual << "matrix<" << leftType << ",N,M> left, " << rightType << " right);\n"; } } +SLANG_RAW("#line 1182 \"core.meta.slang\"") SLANG_RAW("\n") SLANG_RAW("\n") SLANG_RAW("// Operators to apply to `enum` types\n") diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 6260ac218..815f27bfe 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -6970,8 +6970,8 @@ String emitEntryPoint( String code = sharedContext.sb.ProduceString(); sharedContext.sb.Clear(); - // Now that we've emitted the code for all the declaratiosn in the file, - // it is time to stich together the final output. + // Now that we've emitted the code for all the declarations in the file, + // it is time to stitch together the final output. // There may be global-scope modifiers that we should emit now visitor.emitGLSLPreprocessorDirectives(); diff --git a/source/slang/hlsl.meta.slang.h b/source/slang/hlsl.meta.slang.h index e26269c3c..375c8aab0 100644 --- a/source/slang/hlsl.meta.slang.h +++ b/source/slang/hlsl.meta.slang.h @@ -119,6 +119,7 @@ static const struct { { kIROp_HLSLRasterizerOrderedByteAddressBufferType, "RasterizerOrderedByteAddressBuffer" }, }; for(auto item : kMutableByteAddressBufferCases) { +SLANG_RAW("#line 104 \"hlsl.meta.slang\"") SLANG_RAW("\n") SLANG_RAW("\n") SLANG_RAW("__magic_type(HLSL") @@ -271,6 +272,7 @@ SLANG_RAW("};\n") SLANG_RAW("\n") } +SLANG_RAW("#line 247 \"hlsl.meta.slang\"") SLANG_RAW("\n") SLANG_RAW("\n") @@ -283,6 +285,7 @@ static const struct { { kIROp_HLSLRasterizerOrderedStructuredBufferType, "RasterizerOrderedStructuredBuffer" }, }; for(auto item : kMutableStructuredBufferCases) { +SLANG_RAW("#line 259 \"hlsl.meta.slang\"") SLANG_RAW("\n") SLANG_RAW("\n") SLANG_RAW("\n") @@ -320,6 +323,7 @@ SLANG_RAW("};\n") SLANG_RAW("\n") } +SLANG_RAW("#line 287 \"hlsl.meta.slang\"") SLANG_RAW("\n") SLANG_RAW("\n") SLANG_RAW("__generic<T>\n") @@ -1509,6 +1513,7 @@ for (int aa = 0; aa < kBaseBufferAccessLevelCount; ++aa) sb << "};\n"; } +SLANG_RAW("#line 1440 \"hlsl.meta.slang\"") SLANG_RAW("\n") SLANG_RAW("\n") SLANG_RAW("\n") diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 45834c31d..0bba68aa6 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -1488,6 +1488,14 @@ void Session::addBuiltinSource( m_builtinLinkage, &sink); + SourceManager* sourceManager = getBuiltinSourceManager(); + + // Set the source manager on the sink + sink.sourceManager = sourceManager; + // Make the linkage use the builtin source manager + Linkage* linkage = compileRequest->getLinkage(); + linkage->setSourceManager(sourceManager); + Name* moduleName = getNamePool()->getName(path); auto translationUnitIndex = compileRequest->addTranslationUnit(SourceLanguage::Slang, moduleName); |
