From 9f89c3b2de80c49222c4a6b48e845894c4256a5d Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 3 Jan 2018 12:46:23 -0800 Subject: Add API for querying TypeLayout from a Type Added two API functions: 1. `spReflection_FindTypeByName`, which returns a DeclRefType to the struct type with the given name. The function finds from all loaded modules in a `CompileRequest` for a decl with the given name, construct a `Type` object and cache it in `CompileRequest::types` dictionary. The subsequent calls to `spReflection_FindTypeByName` with the same name will simply returned the cached Type objects. 2. `spReflection_GetTypeLayout`, which returns a `TypeLayout` for a given `Type`. This function creates and caches the `TypeLayout` in the `TargetRequest` object that is used to create the `ProgramLayout`. --- source/slang/parameter-binding.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/slang/parameter-binding.cpp') diff --git a/source/slang/parameter-binding.cpp b/source/slang/parameter-binding.cpp index 6145015f1..6dac47631 100644 --- a/source/slang/parameter-binding.cpp +++ b/source/slang/parameter-binding.cpp @@ -1786,6 +1786,8 @@ void generateParameterBindings( return; RefPtr programLayout = new ProgramLayout(); + programLayout->targetRequest = targetReq; + targetReq->layout = programLayout; // Create a context to hold shared state during the process @@ -2061,6 +2063,7 @@ RefPtr specializeProgramLayout( { RefPtr newProgramLayout; newProgramLayout = new ProgramLayout(); + newProgramLayout->targetRequest = targetReq; newProgramLayout->bindingForHackSampler = programLayout->bindingForHackSampler; newProgramLayout->hackSamplerVar = programLayout->hackSamplerVar; newProgramLayout->globalGenericParams = programLayout->globalGenericParams; -- cgit v1.2.3