diff options
| author | Yong He <yonghe@outlook.com> | 2023-11-01 21:42:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-01 21:42:12 -0700 |
| commit | 6aca3813c4ccc496c0f9b2db293acb546aa11d2d (patch) | |
| tree | 5281f0ac62946787db90409c1ab3da5ed3f0fc5c /source/slang/slang-parameter-binding.cpp | |
| parent | 532c4322c9d9ab2c95a5bb573c89062456b59236 (diff) | |
Parameter binding and gfx fixes. (#3302)
* Parameter binding and gfx fixes.
* Add diagnostics on entry point parameters.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-parameter-binding.cpp')
| -rw-r--r-- | source/slang/slang-parameter-binding.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp index 7d7cfeefe..7241fdd6e 100644 --- a/source/slang/slang-parameter-binding.cpp +++ b/source/slang/slang-parameter-binding.cpp @@ -515,7 +515,7 @@ LayoutResourceKind findRegisterClassFromName(UnownedStringSlice const& registerC case 5: if( registerClassName == toSlice("space") ) { - return LayoutResourceKind::RegisterSpace; + return LayoutResourceKind::SubElementRegisterSpace; } break; @@ -583,7 +583,7 @@ LayoutSemanticInfo extractHLSLLayoutSemanticInfo( UnownedStringSlice spaceDigits; splitNameAndIndex(spaceName, spaceSpelling, spaceDigits); - if( kind == LayoutResourceKind::RegisterSpace ) + if( kind == LayoutResourceKind::SubElementRegisterSpace) { sink->diagnose(spaceLoc, Diagnostics::unexpectedSpecifierAfterSpace, spaceName); } @@ -902,7 +902,7 @@ static void addExplicitParameterBinding( bindingInfo.space = semanticInfo.space; VarLayout* overlappedVarLayout = nullptr; - if( kind == LayoutResourceKind::RegisterSpace ) + if( kind == LayoutResourceKind::RegisterSpace || kind == LayoutResourceKind::SubElementRegisterSpace ) { // Parameter is being bound to an entire space, so we // need to mark the given space as used and report @@ -1071,7 +1071,7 @@ static void addExplicitParameterBindings_GLSL( semanticInfo.space = attr->set; } } - else if( (foundResInfo = typeLayout->FindResourceInfo(LayoutResourceKind::RegisterSpace)) != nullptr ) + else if( (foundResInfo = typeLayout->FindResourceInfo(LayoutResourceKind::SubElementRegisterSpace)) != nullptr ) { // Try to find `set` if (auto attr = varDecl.getDecl()->findModifier<GLSLBindingAttribute>()) @@ -1243,7 +1243,7 @@ static void completeBindingsForParameterImpl( } break; - case LayoutResourceKind::RegisterSpace: + case LayoutResourceKind::SubElementRegisterSpace: // If the parameter consumes any full spaces (e.g., it // is a `struct` type with one or more unbounded arrays // for fields), then we will include those spaces in @@ -1312,7 +1312,7 @@ static void completeBindingsForParameterImpl( // switch( kind ) { - case LayoutResourceKind::RegisterSpace: + case LayoutResourceKind::SubElementRegisterSpace: { // The parameter's type needs to consume some number of whole // register spaces, and we have already allocated a contiguous @@ -3547,6 +3547,7 @@ static bool _calcNeedsDefaultSpace(SharedParameterBindingContext& sharedContext) switch (resInfo.kind) { case LayoutResourceKind::RegisterSpace: + case LayoutResourceKind::SubElementRegisterSpace: case LayoutResourceKind::PushConstantBuffer: continue; case LayoutResourceKind::Uniform: @@ -3579,7 +3580,7 @@ static bool _calcNeedsDefaultSpace(SharedParameterBindingContext& sharedContext) // for (auto& entryPoint : sharedContext.programLayout->entryPoints) { - auto paramsLayout = entryPoint->parametersLayout; + auto paramsLayout = entryPoint->parametersLayout->getTypeLayout(); for (auto resInfo : paramsLayout->resourceInfos) { switch (resInfo.kind) |
