Skip to content

Commit 8909177

Browse files
Hydrogent: minor updates/comments
1 parent b15bcc8 commit 8909177

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

Hydrogent/interface/HnMaterial.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ class HnMaterial final : public pxr::HdMaterial
192192

193193
PBR_Renderer::PSO_FLAGS m_PSOFlags = PBR_Renderer::PSO_FLAG_NONE;
194194

195+
// Material attribs data resides in a single buffer shared by all SRBs.
196+
//
197+
// Size
198+
// | |-------------| x x x x |
199+
// Offset Alignment
200+
195201
// Material attribs shader data size in bytes.
196202
Uint32 m_PBRMaterialAttribsSize = 0;
197203

Hydrogent/src/HnMaterial.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,8 @@ class HnMaterialSRBCache : public ObjectBase<IObject>
743743
m_DirtyRangeEnd = m_MaterialAttribsData.size();
744744
}
745745
pContext->UpdateBuffer(pBuffer, m_DirtyRangeStart, m_DirtyRangeEnd - m_DirtyRangeStart, &m_MaterialAttribsData[m_DirtyRangeStart], RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
746+
m_DirtyRangeStart = 0;
747+
m_DirtyRangeEnd = 0;
746748
}
747749
return pBuffer;
748750
}
@@ -775,6 +777,7 @@ class HnMaterialSRBCache : public ObjectBase<IObject>
775777
Uint32 m_CurrBufferOffset = 0;
776778
Uint32 m_RequiredBufferSize = 0;
777779

780+
// Material attribs data resides in a single buffer shared by all SRBs.
778781
DynamicBuffer m_MaterialAttribsBuffer;
779782
std::vector<Uint8> m_MaterialAttribsData;
780783
Uint32 m_DirtyRangeStart = 0;

Hydrogent/src/HnRenderPass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,7 @@ void HnRenderPass::UpdateDrawListItemGPUResources(DrawListItem& ListItem, Render
11581158
"Attribs data size (", ListItem.ShaderAttribsDataSize, ") computed from the PSO flags exceeds the attribs buffer range (",
11591159
ListItem.PrimitiveAttribsBufferRange, ") computed from material PSO flags. The latter is used by HnMaterial to set the buffer range.");
11601160

1161+
// Note: some PSOs (e.g. shadow) may not use the full range of the material attribs buffer.
11611162
VERIFY(ListItem.pMaterial->GetPBRMaterialAttribsSize() >= State.USDRenderer.GetPBRMaterialAttribsSize(ListItem.PSOFlags),
11621163
"Material attribs size is smaller than required by the PSO flags");
11631164
VERIFY_EXPR(ListItem.pPSO != nullptr);

0 commit comments

Comments
 (0)