Skip to content

Commit

Permalink
HnRenderPass: do not call UnmapBuffer if the buffer failed to map
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Nov 24, 2024
1 parent 8a9e68e commit 5be06fb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Hydrogent/src/HnRenderPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,10 @@ HnRenderPass::EXECUTE_RESULT HnRenderPass::Execute(HnRenderPassState& RPState, c
size_t DataSize) {
if (BuffDesc.Usage == USAGE_DYNAMIC)
{
VERIFY_EXPR(pMappedData != nullptr);
pCtx->UnmapBuffer(pBuffer, MAP_WRITE);
if (pMappedData != nullptr)
{
pCtx->UnmapBuffer(pBuffer, MAP_WRITE);
}
pMappedData = nullptr;
}
else
Expand Down Expand Up @@ -598,7 +600,7 @@ HnRenderPass::EXECUTE_RESULT HnRenderPass::Execute(HnRenderPassState& RPState, c
pCtx->MapBuffer(pBuffer, MAP_WRITE, MAP_FLAG_DISCARD, pMappedData);
if (pMappedData == nullptr)
{
UNEXPECTED("Failed to map the buffer");
LOG_DVP_ERROR_MESSAGE("Failed to map buffer '", BuffDesc.Name, "'.");
return nullptr;
}
}
Expand Down

0 comments on commit 5be06fb

Please sign in to comment.