Skip to content

Commit

Permalink
Fix for previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhdanNV committed Aug 27, 2024
1 parent 8a04d97 commit 00699e1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Source/VK/CommandBufferVK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,12 @@ inline void CommandBufferVK::ClearAttachments(const ClearDesc* clearDescs, uint3
memcpy(&attachment.clearValue, &desc.value, sizeof(VkClearValue));
}

VkClearRect* clearRects = StackAlloc(VkClearRect, rectNum ? rectNum : clearDescNum);
if (rectNum) {
bool hasRects = rectNum != 0;
if (!hasRects)
rectNum = clearDescNum;

VkClearRect* clearRects = StackAlloc(VkClearRect, rectNum);
if (hasRects) {
for (uint32_t i = 0; i < rectNum; i++) {
const Rect& rect = rects[i];
VkClearRect& clearRect = clearRects[i];
Expand All @@ -185,7 +189,7 @@ inline void CommandBufferVK::ClearAttachments(const ClearDesc* clearDescs, uint3
clearRect.rect = {{rect.x, rect.y}, {rect.width, rect.height}};
}
} else {
for (uint32_t i = 0; i < clearDescNum; i++) {
for (uint32_t i = 0; i < rectNum; i++) {
VkClearRect& clearRect = clearRects[i];
clearRect.baseArrayLayer = 0;
clearRect.layerCount = m_RenderLayerNum;
Expand Down

0 comments on commit 00699e1

Please sign in to comment.