diff options
Diffstat (limited to 'tools/gfx/cpu/cpu-shader-object-layout.cpp')
| -rw-r--r-- | tools/gfx/cpu/cpu-shader-object-layout.cpp | 64 |
1 files changed, 44 insertions, 20 deletions
diff --git a/tools/gfx/cpu/cpu-shader-object-layout.cpp b/tools/gfx/cpu/cpu-shader-object-layout.cpp index 4f4c33a6a..aeeadfc23 100644 --- a/tools/gfx/cpu/cpu-shader-object-layout.cpp +++ b/tools/gfx/cpu/cpu-shader-object-layout.cpp @@ -8,13 +8,16 @@ using namespace Slang; namespace cpu { -ShaderObjectLayoutImpl::ShaderObjectLayoutImpl(RendererBase* renderer, slang::ISession* session, slang::TypeLayoutReflection* layout) +ShaderObjectLayoutImpl::ShaderObjectLayoutImpl( + RendererBase* renderer, + slang::ISession* session, + slang::TypeLayoutReflection* layout) { initBase(renderer, session, layout); m_subObjectCount = 0; m_resourceCount = 0; - + m_elementTypeLayout = _unwrapParameterGroups(layout, m_containerType); m_size = m_elementTypeLayout->getSize(); @@ -44,7 +47,8 @@ ShaderObjectLayoutImpl::ShaderObjectLayoutImpl(RendererBase* renderer, slang::IS // linear search over the descriptor ranges for a specific binding range. // auto uniformOffset = m_elementTypeLayout->getDescriptorSetDescriptorRangeIndexOffset( - descriptorSetIndex, rangeIndexInDescriptorSet); + descriptorSetIndex, + rangeIndexInDescriptorSet); Index baseIndex = 0; Index subObjectIndex = 0; @@ -103,8 +107,10 @@ ShaderObjectLayoutImpl::ShaderObjectLayoutImpl(RendererBase* renderer, slang::IS RefPtr<ShaderObjectLayoutImpl> subObjectLayout; if (slangBindingType != slang::BindingType::ExistentialValue) { - subObjectLayout = - new ShaderObjectLayoutImpl(renderer, m_slangSession, slangLeafTypeLayout->getElementTypeLayout()); + subObjectLayout = new ShaderObjectLayoutImpl( + renderer, + m_slangSession, + slangLeafTypeLayout->getElementTypeLayout()); } SubObjectRangeInfo subObjectRange; @@ -119,35 +125,50 @@ size_t ShaderObjectLayoutImpl::getSize() return m_size; } -Index ShaderObjectLayoutImpl::getResourceCount() const { return m_resourceCount; } -Index ShaderObjectLayoutImpl::getSubObjectCount() const { return m_subObjectCount; } -List<SubObjectRangeInfo>& ShaderObjectLayoutImpl::getSubObjectRanges() { return subObjectRanges; } -BindingRangeInfo ShaderObjectLayoutImpl::getBindingRange(Index index) { return m_bindingRanges[index]; } -Index ShaderObjectLayoutImpl::getBindingRangeCount() const { return m_bindingRanges.getCount(); } +Index ShaderObjectLayoutImpl::getResourceCount() const +{ + return m_resourceCount; +} +Index ShaderObjectLayoutImpl::getSubObjectCount() const +{ + return m_subObjectCount; +} +List<SubObjectRangeInfo>& ShaderObjectLayoutImpl::getSubObjectRanges() +{ + return subObjectRanges; +} +BindingRangeInfo ShaderObjectLayoutImpl::getBindingRange(Index index) +{ + return m_bindingRanges[index]; +} +Index ShaderObjectLayoutImpl::getBindingRangeCount() const +{ + return m_bindingRanges.getCount(); +} const char* EntryPointLayoutImpl::getEntryPointName() { return m_entryPointLayout->getName(); } -RootShaderObjectLayoutImpl::RootShaderObjectLayoutImpl(RendererBase* renderer, slang::ISession* session, slang::ProgramLayout* programLayout) +RootShaderObjectLayoutImpl::RootShaderObjectLayoutImpl( + RendererBase* renderer, + slang::ISession* session, + slang::ProgramLayout* programLayout) : ShaderObjectLayoutImpl(renderer, session, programLayout->getGlobalParamsTypeLayout()) , m_programLayout(programLayout) { - for (UInt i =0; i< programLayout->getEntryPointCount(); i++) + for (UInt i = 0; i < programLayout->getEntryPointCount(); i++) { - m_entryPointLayouts.add(new EntryPointLayoutImpl( - renderer, - session, - programLayout->getEntryPointByIndex(i))); + m_entryPointLayouts.add( + new EntryPointLayoutImpl(renderer, session, programLayout->getEntryPointByIndex(i))); } - } int RootShaderObjectLayoutImpl::getKernelIndex(UnownedStringSlice kernelName) { - auto entryPointCount = (int) m_programLayout->getEntryPointCount(); - for(int i = 0; i < entryPointCount; i++) + auto entryPointCount = (int)m_programLayout->getEntryPointCount(); + for (int i = 0; i < entryPointCount; i++) { auto entryPoint = m_programLayout->getEntryPointByIndex(i); if (kernelName == entryPoint->getName()) @@ -164,7 +185,10 @@ void RootShaderObjectLayoutImpl::getKernelThreadGroupSize(int kernelIndex, UInt* entryPoint->getComputeThreadGroupSize(3, threadGroupSizes); } -EntryPointLayoutImpl* RootShaderObjectLayoutImpl::getEntryPoint(Index index) { return m_entryPointLayouts[index]; } +EntryPointLayoutImpl* RootShaderObjectLayoutImpl::getEntryPoint(Index index) +{ + return m_entryPointLayouts[index]; +} } // namespace cpu } // namespace gfx |
