diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-02-11 12:21:38 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-11 12:21:38 -0500 |
| commit | 44bd4b573bc0cc4fe8c9e4234af0e2883d724381 (patch) | |
| tree | 2a9f78b6bdbbbaf4183f8ce214c8e775f85a8726 | |
| parent | e13fdd8fe19f248a925232e918501f55dafa40d8 (diff) | |
* Use LayoutResourceKind for calcing total num regs used (#838)
* Made diagnostic message more compliant + fixed test output
* Typo fixes
| -rw-r--r-- | source/slang/diagnostic-defs.h | 2 | ||||
| -rw-r--r-- | source/slang/parameter-binding.cpp | 6 | ||||
| -rw-r--r-- | source/slang/type-layout.h | 16 | ||||
| -rw-r--r-- | tests/diagnostics/single-shader-record.slang.expected | 2 |
4 files changed, 13 insertions, 13 deletions
diff --git a/source/slang/diagnostic-defs.h b/source/slang/diagnostic-defs.h index 14eb3e90d..8826490a0 100644 --- a/source/slang/diagnostic-defs.h +++ b/source/slang/diagnostic-defs.h @@ -387,7 +387,7 @@ DIAGNOSTIC(39014, Error, dontExpectInParametersForStage, "the '$0' stage does no DIAGNOSTIC(39016, Error, globalUniformsNotSupported, "'$0' is implicitly a global uniform shader parameter, which is currently unsupported by Slang. If a uniform parameter is intended, use a constant buffer or parameter block. If a global is intended, use the 'static' modifier.") -DIAGNOSTIC(39017, Error, tooManyShaderRecordConstantBuffers, "Can have at most one 'shader record' attributed constant buffer found $0.") +DIAGNOSTIC(39017, Error, tooManyShaderRecordConstantBuffers, "can have at most one 'shader record' attributed constant buffer; found $0.") // // 4xxxx - IL code generation. diff --git a/source/slang/parameter-binding.cpp b/source/slang/parameter-binding.cpp index 826332b15..89226cdd9 100644 --- a/source/slang/parameter-binding.cpp +++ b/source/slang/parameter-binding.cpp @@ -2742,13 +2742,13 @@ void diagnoseGlobalUniform( getSink(sharedContext)->diagnose(varDecl, Diagnostics::globalUniformsNotSupported, varDecl->getName()); } -static int _calcTotalNumUsedRegistersForParameterCategory(ParameterBindingContext* bindingContext, SlangParameterCategory paramCategory) +static int _calcTotalNumUsedRegistersForLayoutResourceKind(ParameterBindingContext* bindingContext, LayoutResourceKind kind) { int numUsed = 0; for (auto& pair : bindingContext->shared->globalSpaceUsedRangeSets) { UsedRangeSet* rangeSet = pair.Value; - const auto& usedRanges = rangeSet->usedResourceRanges[paramCategory]; + const auto& usedRanges = rangeSet->usedResourceRanges[kind]; for (const auto& usedRange : usedRanges.ranges) { numUsed += int(usedRange.end - usedRange.begin); @@ -2962,7 +2962,7 @@ void generateParameterBindings( programLayout->parametersLayout = globalScopeVarLayout; { - const int numShaderRecordRegs = _calcTotalNumUsedRegistersForParameterCategory(&context, SLANG_PARAMETER_CATEGORY_SHADER_RECORD); + const int numShaderRecordRegs = _calcTotalNumUsedRegistersForLayoutResourceKind(&context, LayoutResourceKind::ShaderRecord); if (numShaderRecordRegs > 1) { compileReq->mSink.diagnose(SourceLoc(), Diagnostics::tooManyShaderRecordConstantBuffers, numShaderRecordRegs); diff --git a/source/slang/type-layout.h b/source/slang/type-layout.h index 418f4684d..e20db7f56 100644 --- a/source/slang/type-layout.h +++ b/source/slang/type-layout.h @@ -229,7 +229,7 @@ struct UniformArrayLayoutInfo : UniformLayoutInfo typedef slang::ParameterCategory LayoutResourceKind; // Layout information for a value that only consumes -// a single reosurce kind. +// a single resource kind. struct SimpleLayoutInfo { // What kind of resource should we consume? @@ -301,7 +301,7 @@ class Layout : public RefObject { }; -// A reified reprsentation of a particular laid-out type +// A reified representation of a particular laid-out type class TypeLayout : public Layout { public: @@ -367,7 +367,7 @@ public: /// "Unwrap" any layers of array-ness from this type layout. /// - /// If this is an `ArrayTypeLayout`, returns the result of unwrapping the elemnt type layout. + /// If this is an `ArrayTypeLayout`, returns the result of unwrapping the element type layout. /// Otherwise, returns this type layout. /// RefPtr<TypeLayout> unwrapArray(); @@ -401,7 +401,7 @@ public: String systemValueSemantic; int systemValueSemanticIndex; - // General cse semantic name and index + // General case semantic name and index // TODO: this and the system-value field are redundant // TODO: the `VarLayout` type is getting bloated; we need to not store this // information unless actually required. @@ -568,7 +568,7 @@ public: /// The byte offset for the tag field. /// - /// The tag field will always be allocted as + /// The tag field will always be allocated as /// a `uint`, so we don't store a separate layout /// for it. /// @@ -590,7 +590,7 @@ StructTypeLayout* getScopeStructLayout( // Layout information for a single shader entry point // within a program // -// Treated as a subclass of `StructTypeLayout` becase +// Treated as a subclass of `StructTypeLayout` because // it needs to include computed layout information // for the parameters of the entry point. // @@ -843,7 +843,7 @@ struct TypeLayoutContext TypeLayoutContext getInitialLayoutContextForTarget( TargetRequest* targetReq); -// Get the "simple" layout for a type accordinging to a given set of layout +// Get the "simple" layout for a type according to a given set of layout // rules. Note that a "simple" layout can only consume one `LayoutResourceKind`, // and so this operation may not correctly capture the full resource usage // of a type. @@ -908,4 +908,4 @@ int findGenericParam(List<RefPtr<GenericParamLayout>> & genericParameters, Globa } -#endif
\ No newline at end of file +#endif diff --git a/tests/diagnostics/single-shader-record.slang.expected b/tests/diagnostics/single-shader-record.slang.expected index 1e80ed758..5d843c2e6 100644 --- a/tests/diagnostics/single-shader-record.slang.expected +++ b/tests/diagnostics/single-shader-record.slang.expected @@ -1,6 +1,6 @@ result code = -1 standard error = { -(0): error 39017: Can have at most one 'shader record' attributed constant buffer found 2. +(0): error 39017: can have at most one 'shader record' attributed constant buffer; found 2. } standard output = { } |
