summaryrefslogtreecommitdiffstats
path: root/source/slang/parameter-binding.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-02-07 18:04:46 -0500
committerGitHub <noreply@github.com>2019-02-07 18:04:46 -0500
commit4d593fe34ff89ce13882e47ccd95881ef4743c6b (patch)
tree532fc80cb72da150647c0bd50ee1bcaf3b4bc297 /source/slang/parameter-binding.cpp
parent2d1291ae4f3de66e2d958b148d0811cbf2ee9c60 (diff)
Hotfix/remove null this work around (#831)
* Re-enable warnings around null this. * Remove testing for nullptr in Substitution::Equals tests * Fix ref counting problem in vulkan render. * * Remove SLANG_ASSERT(this) in mthods * Place asserts conservatively at method call sites where appropriate.
Diffstat (limited to 'source/slang/parameter-binding.cpp')
-rw-r--r--source/slang/parameter-binding.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/slang/parameter-binding.cpp b/source/slang/parameter-binding.cpp
index 583d4fe54..ba5a68341 100644
--- a/source/slang/parameter-binding.cpp
+++ b/source/slang/parameter-binding.cpp
@@ -2259,7 +2259,10 @@ static RefPtr<TypeLayout> computeEntryPointParameterTypeLayout(
RefPtr<VarLayout> paramVarLayout,
EntryPointParameterState& state)
{
- auto paramType = GetType(paramDeclRef)->Substitute(typeSubst).as<Type>();
+ auto paramDeclRefType = GetType(paramDeclRef);
+ SLANG_ASSERT(paramDeclRefType);
+
+ auto paramType = paramDeclRefType->Substitute(typeSubst).as<Type>();
if( paramDeclRef.getDecl()->HasModifier<HLSLUniformModifier>() )
{
@@ -2489,6 +2492,7 @@ static void collectEntryPointParameters(
//
for( auto taggedUnionType : entryPoint->taggedUnionTypes )
{
+ SLANG_ASSERT(taggedUnionType);
auto substType = taggedUnionType->Substitute(typeSubst).as<Type>();
auto typeLayout = CreateTypeLayout(context->layoutContext, substType);
entryPointLayout->taggedUnionTypeLayouts.Add(typeLayout);
@@ -2594,6 +2598,8 @@ static void collectEntryPointParameters(
// types and apply this logic unconditionally.
//
auto resultType = GetResultType(entryPointFuncDeclRef)->Substitute(typeSubst).as<Type>();
+ SLANG_ASSERT(resultType);
+
if( !resultType->Equals(resultType->getSession()->getVoidType()) )
{
state.loc = entryPointFuncDeclRef.getLoc();
@@ -3106,9 +3112,10 @@ RefPtr<ProgramLayout> specializeProgramLayout(
// In the case where things are generic-dependent, we need to re-do
// the type layout process on the type that results from doing
- // substutition with the global generic arguments.
+ // substitution with the global generic arguments.
//
RefPtr<Type> oldType = oldVarLayout->getTypeLayout()->getType();
+ SLANG_ASSERT(oldType);
RefPtr<Type> newType = oldType->Substitute(typeSubst).as<Type>();
RefPtr<TypeLayout> newTypeLayout = getTypeLayoutForGlobalShaderParameter(