diff options
| author | Yong He <yonghe@outlook.com> | 2020-06-05 18:34:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-05 18:34:24 -0700 |
| commit | 52026c7c26e48921fdf18b3f8cdacad77a792643 (patch) | |
| tree | d439487223ee8ec4a2052d8855db310da878c001 /source/slang/slang-parameter-binding.cpp | |
| parent | 92fc3aaa835315ff08750c7b5a7498b7228e2c33 (diff) | |
| parent | 43c146794aab638924d2ab838d10f8af2ebf02a7 (diff) | |
Merge branch 'master' into findtypebynamefix
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; |
