diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-06-05 18:20:09 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-05 18:20:09 -0400 |
| commit | 43c146794aab638924d2ab838d10f8af2ebf02a7 (patch) | |
| tree | 520eed8f2ae02c6953cf2aee7c87959a0008badc /source/slang/slang-parameter-binding.cpp | |
| parent | e3e1cf2045f14837cfecb14e252c0e1083787b93 (diff) | |
ASTNodes use MemoryArena (#1376)
* Add a ASTBuilder to a Module
Only construct on valid ASTBuilder (was being called on nullptr on occassion)
* Add nodes to ASTBuilder.
* Compiles with RefPtr removed from AST node types.
* Initialize all AST node pointer variables in headers to nullptr;
* Initialize AST node variables as nullptr.
Make ASTBuilder keep a ref on node types.
Make SyntaxParseCallback returns a NodeBase
* Don't release canonicalType on dtor (managed by ASTBuilder).
* Give ASTBuilders a name and id, to help in debugging.
For now destroy the session TypeCache, to stop it holding things released when the compile request destroys ASTBuilders.
* Moved the TypeCheckingCache over to Linkage from Session.
* NodeBase no longer derived from RefObject.
* Only add/dtor nodes that need destruction.
First pass compile on linux.
Diffstat (limited to 'source/slang/slang-parameter-binding.cpp')
| -rw-r--r-- | source/slang/slang-parameter-binding.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp index 58ce76c45..ea45612ec 100644 --- a/source/slang/slang-parameter-binding.cpp +++ b/source/slang/slang-parameter-binding.cpp @@ -584,7 +584,7 @@ LayoutSemanticInfo ExtractLayoutSemanticInfo( // a particular sub-argument and extract its value if present. template<typename T> static bool findLayoutArg( - RefPtr<ModifiableSyntaxNode> syntax, + ModifiableSyntaxNode* syntax, UInt* outVal) { for( auto modifier : syntax->getModifiersOfType<T>() ) @@ -674,7 +674,7 @@ struct EntryPointParameterState static RefPtr<TypeLayout> processEntryPointVaryingParameter( ParameterBindingContext* context, - RefPtr<Type> type, + Type* type, EntryPointParameterState const& state, RefPtr<VarLayout> varLayout); @@ -707,7 +707,7 @@ static void collectGlobalScopeParameter( auto varDeclRef = shaderParamInfo.paramDeclRef; // We apply any substitutions for global generic parameters here. - auto type = getType(astBuilder, varDeclRef)->substitute(astBuilder, globalGenericSubst).as<Type>(); + auto type = as<Type>(getType(astBuilder, varDeclRef)->substitute(astBuilder, globalGenericSubst)); // We use a single operation to both check whether the // variable represents a shader parameter, and to compute @@ -1014,8 +1014,10 @@ static void addExplicitParameterBindings_GLSL( } else if( (resInfo = typeLayout->FindResourceInfo(LayoutResourceKind::SpecializationConstant)) != nullptr ) { + DeclRef<Decl> varDecl2(varDecl); + // Try to find `constant_id` binding - if(!findLayoutArg<GLSLConstantIDLayoutModifier>(varDecl, &semanticInfo.index)) + if(!findLayoutArg<GLSLConstantIDLayoutModifier>(varDecl2, &semanticInfo.index)) return; } @@ -1382,7 +1384,7 @@ SimpleSemanticInfo decomposeSimpleSemantic( static RefPtr<TypeLayout> processSimpleEntryPointParameter( ParameterBindingContext* context, - RefPtr<Type> type, + Type* type, EntryPointParameterState const& inState, RefPtr<VarLayout> varLayout, int semanticSlotCount = 1) @@ -1546,7 +1548,7 @@ static RefPtr<TypeLayout> processSimpleEntryPointParameter( static RefPtr<TypeLayout> processEntryPointVaryingParameterDecl( ParameterBindingContext* context, Decl* decl, - RefPtr<Type> type, + Type* type, EntryPointParameterState const& inState, RefPtr<VarLayout> varLayout) { @@ -1703,7 +1705,7 @@ static RefPtr<TypeLayout> processEntryPointVaryingParameterDecl( static RefPtr<TypeLayout> processEntryPointVaryingParameter( ParameterBindingContext* context, - RefPtr<Type> type, + Type* type, EntryPointParameterState const& state, RefPtr<VarLayout> varLayout) { @@ -2712,7 +2714,7 @@ static void collectSpecializationParams( case SpecializationParam::Flavor::GenericValue: { RefPtr<GenericSpecializationParamLayout> paramLayout = new GenericSpecializationParamLayout(); - paramLayout->decl = specializationParam.object.as<Decl>(); + paramLayout->decl = as<Decl>(specializationParam.object); context->shared->programLayout->specializationParams.add(paramLayout); } break; @@ -2721,7 +2723,7 @@ static void collectSpecializationParams( case SpecializationParam::Flavor::ExistentialValue: { RefPtr<ExistentialSpecializationParamLayout> paramLayout = new ExistentialSpecializationParamLayout(); - paramLayout->type = specializationParam.object.as<Type>(); + paramLayout->type = as<Type>(specializationParam.object); context->shared->programLayout->specializationParams.add(paramLayout); } break; |
