diff options
Diffstat (limited to 'source/slang/slang-parameter-binding.cpp')
| -rw-r--r-- | source/slang/slang-parameter-binding.cpp | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp index a2353824c..33ad32918 100644 --- a/source/slang/slang-parameter-binding.cpp +++ b/source/slang/slang-parameter-binding.cpp @@ -2161,8 +2161,37 @@ static RefPtr<EntryPointLayout> collectEntryPointParameters( EntryPoint* entryPoint, EntryPoint::EntryPointSpecializationInfo* specializationInfo) { + // We will take responsibility for creating and filling in + // the `EntryPointLayout` object here. + // + RefPtr<EntryPointLayout> entryPointLayout = new EntryPointLayout(); + entryPointLayout->profile = entryPoint->getProfile(); + + // The entry point layout must be added to the output + // program layout so that it can be accessed by reflection. + // + context->shared->programLayout->entryPoints.add(entryPointLayout); + DeclRef<FuncDecl> entryPointFuncDeclRef = entryPoint->getFuncDeclRef(); + // HACK: We might have an `EntryPoint` that has been deserialized, in + // which case we don't currently have access to its AST-level information, + // and as a result we cannot collect parameter information from it. + // + if( !entryPointFuncDeclRef ) + { + // TODO: figure out what fields we absolutely need to fill in. + + RefPtr<StructTypeLayout> paramsTypeLayout = new StructTypeLayout(); + + RefPtr<VarLayout> paramsLayout = new VarLayout(); + paramsLayout->typeLayout = paramsTypeLayout; + + entryPointLayout->parametersLayout = paramsLayout; + + return entryPointLayout; + } + // If specialization was applied to the entry point, then the side-band // information that was generated will have a more specialized reference // to the entry point with generic parameters filled in. We should @@ -2173,18 +2202,8 @@ static RefPtr<EntryPointLayout> collectEntryPointParameters( auto entryPointType = DeclRefType::Create(context->getLinkage()->getSessionImpl(), entryPointFuncDeclRef); - // We will take responsibility for creating and filling in - // the `EntryPointLayout` object here. - // - RefPtr<EntryPointLayout> entryPointLayout = new EntryPointLayout(); - entryPointLayout->profile = entryPoint->getProfile(); entryPointLayout->entryPoint = entryPointFuncDeclRef; - // The entry point layout must be added to the output - // program layout so that it can be accessed by reflection. - // - context->shared->programLayout->entryPoints.add(entryPointLayout); - // For the duration of our parameter collection work we will // establish this entry point as the current one in the context. // |
