diff options
| author | Yong He <yonghe@outlook.com> | 2022-02-09 15:30:38 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-09 15:30:38 -0800 |
| commit | b8982fcf43b86c1e39dcc3dd19bff2821633eda6 (patch) | |
| tree | 0d66dbf46b50e760cce4aee232bd6a020976e6fb /source | |
| parent | 59f3fdc0a372d19ce4e989514ee3e9ecbcbf234c (diff) | |
Various fixes to gfx. (#2120)
* Various fixes to gfx.
* Fix.
* Fixes.
* Fix.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source')
| -rw-r--r-- | source/core/slang-chunked-list.h | 1 | ||||
| -rw-r--r-- | source/slang/slang-parameter-binding.cpp | 10 | ||||
| -rw-r--r-- | source/slang/slang-reflection-api.cpp | 15 | ||||
| -rw-r--r-- | source/slang/slang-type-layout.h | 3 |
4 files changed, 27 insertions, 2 deletions
diff --git a/source/core/slang-chunked-list.h b/source/core/slang-chunked-list.h index fced9834a..36f97cedd 100644 --- a/source/core/slang-chunked-list.h +++ b/source/core/slang-chunked-list.h @@ -243,6 +243,7 @@ private: { auto nextChunk = chunk->next; freeChunk(chunk); + chunk = nextChunk; } m_firstChunk.next = 0; m_firstChunk.size = 0; diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp index 48e637047..abbc010f8 100644 --- a/source/slang/slang-parameter-binding.cpp +++ b/source/slang/slang-parameter-binding.cpp @@ -2477,6 +2477,7 @@ static void removePerEntryPointParameterKinds( static RefPtr<EntryPointLayout> collectEntryPointParameters( ParameterBindingContext* context, EntryPoint* entryPoint, + String entryPointNameOverride, EntryPoint::EntryPointSpecializationInfo* specializationInfo) { auto astBuilder = context->getASTBuilder(); @@ -2487,6 +2488,7 @@ static RefPtr<EntryPointLayout> collectEntryPointParameters( RefPtr<EntryPointLayout> entryPointLayout = new EntryPointLayout(); entryPointLayout->profile = entryPoint->getProfile(); entryPointLayout->name = entryPoint->getName(); + entryPointLayout->nameOverride = entryPointNameOverride; // The entry point layout must be added to the output // program layout so that it can be accessed by reflection. @@ -2836,6 +2838,7 @@ struct CollectParametersVisitor : ComponentTypeVisitor {} ParameterBindingContext* m_context; + String m_currentEntryPointNameOverride; void visitComposite(CompositeComponentType* composite, CompositeComponentType::CompositeSpecializationInfo* specializationInfo) SLANG_OVERRIDE { @@ -2892,15 +2895,18 @@ struct CollectParametersVisitor : ComponentTypeVisitor ParameterBindingContext contextData = *m_context; auto context = &contextData; context->stage = entryPoint->getStage(); - - collectEntryPointParameters(context, entryPoint, specializationInfo); + collectEntryPointParameters( + context, entryPoint, m_currentEntryPointNameOverride, specializationInfo); } void visitRenamedEntryPoint( RenamedEntryPointComponentType* renamedEntryPoint, EntryPoint::EntryPointSpecializationInfo* specializationInfo) SLANG_OVERRIDE { + auto lastNameOverride = m_currentEntryPointNameOverride; + m_currentEntryPointNameOverride = renamedEntryPoint->getEntryPointNameOverride(0); renamedEntryPoint->getBase()->acceptVisitor(this, specializationInfo); + m_currentEntryPointNameOverride = lastNameOverride; } void visitModule(Module* module, Module::ModuleSpecializationInfo* specializationInfo) SLANG_OVERRIDE diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp index 17ceb6842..714dc292f 100644 --- a/source/slang/slang-reflection-api.cpp +++ b/source/slang/slang-reflection-api.cpp @@ -728,6 +728,8 @@ SLANG_API SlangReflectionType * spReflection_FindTypeByName(SlangReflection * re try { Type* result = program->getTypeFromString(name, &sink); + if (as<ErrorType>(result)) + return nullptr; return (SlangReflectionType*)result; } catch( ... ) @@ -2567,6 +2569,19 @@ SLANG_API char const* spReflectionEntryPoint_getName( return entryPointLayout ? getCstr(entryPointLayout->name) : nullptr; } +SLANG_API char const* spReflectionEntryPoint_getNameOverride(SlangReflectionEntryPoint* inEntryPoint) +{ + auto entryPointLayout = convert(inEntryPoint); + if (entryPointLayout) + { + if (entryPointLayout->nameOverride.getLength()) + return entryPointLayout->nameOverride.getBuffer(); + else + return getCstr(entryPointLayout->name); + } + return nullptr; +} + SLANG_API unsigned spReflectionEntryPoint_getParameterCount( SlangReflectionEntryPoint* inEntryPoint) { diff --git a/source/slang/slang-type-layout.h b/source/slang/slang-type-layout.h index 8c50b4eb3..82d333fa9 100644 --- a/source/slang/slang-type-layout.h +++ b/source/slang/slang-type-layout.h @@ -761,6 +761,9 @@ public: // The name of the entry point. Always available even if entryPoint is nullptr (for example when it came from a library) Name* name = nullptr; + // The overrided name of the entry point. + String nameOverride; + // Layout for any results of the entry point RefPtr<VarLayout> resultLayout; |
