summaryrefslogtreecommitdiff
path: root/tools/gfx/d3d11/d3d11-shader-object-layout.cpp
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-10-29 14:49:26 +0800
committerGitHub <noreply@github.com>2024-10-29 14:49:26 +0800
commitf65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 (patch)
treeea1d61342cd29368e19135000ec2948813096205 /tools/gfx/d3d11/d3d11-shader-object-layout.cpp
parenta729c15e9dce9f5116a38afc66329ab2ca4cea54 (diff)
format
* format * Minor test fixes * enable checking cpp format in ci
Diffstat (limited to 'tools/gfx/d3d11/d3d11-shader-object-layout.cpp')
-rw-r--r--tools/gfx/d3d11/d3d11-shader-object-layout.cpp60
1 files changed, 33 insertions, 27 deletions
diff --git a/tools/gfx/d3d11/d3d11-shader-object-layout.cpp b/tools/gfx/d3d11/d3d11-shader-object-layout.cpp
index 70204e4c0..b2b851760 100644
--- a/tools/gfx/d3d11/d3d11-shader-object-layout.cpp
+++ b/tools/gfx/d3d11/d3d11-shader-object-layout.cpp
@@ -29,7 +29,8 @@ ShaderObjectLayoutImpl::SubObjectRangeStride::SubObjectRangeStride(
}
}
-Result ShaderObjectLayoutImpl::Builder::setElementTypeLayout(slang::TypeLayoutReflection* typeLayout)
+Result ShaderObjectLayoutImpl::Builder::setElementTypeLayout(
+ slang::TypeLayoutReflection* typeLayout)
{
typeLayout = _unwrapParameterGroups(typeLayout, m_containerType);
@@ -89,8 +90,7 @@ Result ShaderObjectLayoutImpl::Builder::setElementTypeLayout(slang::TypeLayoutRe
m_samplerRanges.add(r);
break;
- case slang::BindingType::CombinedTextureSampler:
- break;
+ case slang::BindingType::CombinedTextureSampler: break;
case slang::BindingType::MutableTexture:
case slang::BindingType::MutableTypedBuffer:
bindingRangeInfo.baseIndex = m_uavCount;
@@ -98,11 +98,9 @@ Result ShaderObjectLayoutImpl::Builder::setElementTypeLayout(slang::TypeLayoutRe
m_uavRanges.add(r);
break;
- case slang::BindingType::VaryingInput:
- break;
+ case slang::BindingType::VaryingInput: break;
- case slang::BindingType::VaryingOutput:
- break;
+ case slang::BindingType::VaryingOutput: break;
default:
bindingRangeInfo.baseIndex = m_srvCount;
@@ -138,7 +136,9 @@ Result ShaderObjectLayoutImpl::Builder::setElementTypeLayout(slang::TypeLayoutRe
SLANG_ASSERT(descriptorSetIndex == 0);
SlangInt descriptorRangeIndex = typeLayout->getBindingRangeFirstDescriptorRangeIndex(r);
- auto registerOffset = typeLayout->getDescriptorSetDescriptorRangeIndexOffset(descriptorSetIndex, descriptorRangeIndex);
+ auto registerOffset = typeLayout->getDescriptorSetDescriptorRangeIndexOffset(
+ descriptorSetIndex,
+ descriptorRangeIndex);
bindingRangeInfo.registerOffset = (uint32_t)registerOffset;
}
@@ -173,18 +173,18 @@ Result ShaderObjectLayoutImpl::Builder::setElementTypeLayout(slang::TypeLayoutRe
switch (slangBindingType)
{
default:
- {
- // In the case of `ConstantBuffer<X>` or `ParameterBlock<X>`
- // we can construct a layout from the element type directly.
- //
- auto elementTypeLayout = slangLeafTypeLayout->getElementTypeLayout();
- createForElementType(
- m_renderer,
- m_session,
- elementTypeLayout,
- subObjectLayout.writeRef());
- }
- break;
+ {
+ // In the case of `ConstantBuffer<X>` or `ParameterBlock<X>`
+ // we can construct a layout from the element type directly.
+ //
+ auto elementTypeLayout = slangLeafTypeLayout->getElementTypeLayout();
+ createForElementType(
+ m_renderer,
+ m_session,
+ elementTypeLayout,
+ subObjectLayout.writeRef());
+ }
+ break;
case slang::BindingType::ExistentialValue:
// In the case of an interface-type sub-object range, we can only
@@ -207,8 +207,9 @@ Result ShaderObjectLayoutImpl::Builder::setElementTypeLayout(slang::TypeLayoutRe
// increase the size of the ordinary data buffer we need to
// allocate for the parent object.
//
- uint32_t ordinaryDataEnd = subObjectRange.offset.pendingOrdinaryData
- + (uint32_t)bindingRange.count * subObjectRange.stride.pendingOrdinaryData;
+ uint32_t ordinaryDataEnd =
+ subObjectRange.offset.pendingOrdinaryData +
+ (uint32_t)bindingRange.count * subObjectRange.stride.pendingOrdinaryData;
if (ordinaryDataEnd > m_totalOrdinaryDataSize)
{
@@ -225,8 +226,7 @@ Result ShaderObjectLayoutImpl::Builder::setElementTypeLayout(slang::TypeLayoutRe
SlangResult ShaderObjectLayoutImpl::Builder::build(ShaderObjectLayoutImpl** outLayout)
{
- auto layout =
- RefPtr<ShaderObjectLayoutImpl>(new ShaderObjectLayoutImpl());
+ auto layout = RefPtr<ShaderObjectLayoutImpl>(new ShaderObjectLayoutImpl());
SLANG_RETURN_ON_FAIL(layout->_init(this));
returnRefPtrMove(outLayout, layout);
@@ -276,14 +276,17 @@ Result RootShaderObjectLayoutImpl::Builder::build(RootShaderObjectLayoutImpl** o
return SLANG_OK;
}
-void RootShaderObjectLayoutImpl::Builder::addGlobalParams(slang::VariableLayoutReflection* globalsLayout)
+void RootShaderObjectLayoutImpl::Builder::addGlobalParams(
+ slang::VariableLayoutReflection* globalsLayout)
{
setElementTypeLayout(globalsLayout->getTypeLayout());
m_pendingDataOffset = BindingOffset(globalsLayout).pending;
}
void RootShaderObjectLayoutImpl::Builder::addEntryPoint(
- SlangStage stage, ShaderObjectLayoutImpl* entryPointLayout, slang::EntryPointLayout* slangEntryPoint)
+ SlangStage stage,
+ ShaderObjectLayoutImpl* entryPointLayout,
+ slang::EntryPointLayout* slangEntryPoint)
{
EntryPointInfo info;
info.layout = entryPointLayout;
@@ -306,7 +309,10 @@ Result RootShaderObjectLayoutImpl::create(
auto slangEntryPoint = programLayout->getEntryPointByIndex(e);
RefPtr<ShaderObjectLayoutImpl> entryPointLayout;
SLANG_RETURN_ON_FAIL(ShaderObjectLayoutImpl::createForElementType(
- renderer, program->getSession(), slangEntryPoint->getTypeLayout(), entryPointLayout.writeRef()));
+ renderer,
+ program->getSession(),
+ slangEntryPoint->getTypeLayout(),
+ entryPointLayout.writeRef()));
builder.addEntryPoint(slangEntryPoint->getStage(), entryPointLayout, slangEntryPoint);
}