Skip to content

Commit

Permalink
Don't end command buffers before resetting them (google#969)
Browse files Browse the repository at this point in the history
This isn't necessary.  The Vulkan spec has only one restriction on the
state of a command buffer when vkResetCommandBuffer is called:

    "commandBuffer must not be in the pending state"

So as long as it's not currently waiting to be executed on the GPU, we
can reset it.  By contrast, vkEndCommandBuffer is tightly restricted and
can only be called when a command buffer is in the recording state which
it's not guaranteed to be when the guard is destroyed.  This fixes a
crash that happens in certain Amber-based Vulkan CTS tests after a
VK_ERROR_DEVICE_LOST because Amber is calling vkEndCommandBuffer on
command buffers that were never begun.
  • Loading branch information
gfxstrand authored Nov 12, 2021
1 parent 209d92e commit 02dc821
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/vulkan/command_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ Result CommandBuffer::SubmitAndReset(uint32_t timeout_ms) {

void CommandBuffer::Reset() {
if (guarded_) {
device_->GetPtrs()->vkEndCommandBuffer(command_);
device_->GetPtrs()->vkResetCommandBuffer(command_, 0);
guarded_ = false;
}
Expand Down

0 comments on commit 02dc821

Please sign in to comment.