Skip to content

Commit

Permalink
Hydrogent: minor updates/comments
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Nov 23, 2024
1 parent b15bcc8 commit 8909177
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Hydrogent/interface/HnMaterial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ class HnMaterial final : public pxr::HdMaterial

PBR_Renderer::PSO_FLAGS m_PSOFlags = PBR_Renderer::PSO_FLAG_NONE;

// Material attribs data resides in a single buffer shared by all SRBs.
//
// Size
// | |-------------| x x x x |
// Offset Alignment

// Material attribs shader data size in bytes.
Uint32 m_PBRMaterialAttribsSize = 0;

Expand Down
3 changes: 3 additions & 0 deletions Hydrogent/src/HnMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,8 @@ class HnMaterialSRBCache : public ObjectBase<IObject>
m_DirtyRangeEnd = m_MaterialAttribsData.size();
}
pContext->UpdateBuffer(pBuffer, m_DirtyRangeStart, m_DirtyRangeEnd - m_DirtyRangeStart, &m_MaterialAttribsData[m_DirtyRangeStart], RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
m_DirtyRangeStart = 0;
m_DirtyRangeEnd = 0;
}
return pBuffer;
}
Expand Down Expand Up @@ -775,6 +777,7 @@ class HnMaterialSRBCache : public ObjectBase<IObject>
Uint32 m_CurrBufferOffset = 0;
Uint32 m_RequiredBufferSize = 0;

// Material attribs data resides in a single buffer shared by all SRBs.
DynamicBuffer m_MaterialAttribsBuffer;
std::vector<Uint8> m_MaterialAttribsData;
Uint32 m_DirtyRangeStart = 0;
Expand Down
1 change: 1 addition & 0 deletions Hydrogent/src/HnRenderPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,7 @@ void HnRenderPass::UpdateDrawListItemGPUResources(DrawListItem& ListItem, Render
"Attribs data size (", ListItem.ShaderAttribsDataSize, ") computed from the PSO flags exceeds the attribs buffer range (",
ListItem.PrimitiveAttribsBufferRange, ") computed from material PSO flags. The latter is used by HnMaterial to set the buffer range.");

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

0 comments on commit 8909177

Please sign in to comment.