Skip to content

Commit 02dc821

Browse files
authored
Don't end command buffers before resetting them (google#969)
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.
1 parent 209d92e commit 02dc821

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

src/vulkan/command_buffer.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ Result CommandBuffer::SubmitAndReset(uint32_t timeout_ms) {
108108

109109
void CommandBuffer::Reset() {
110110
if (guarded_) {
111-
device_->GetPtrs()->vkEndCommandBuffer(command_);
112111
device_->GetPtrs()->vkResetCommandBuffer(command_, 0);
113112
guarded_ = false;
114113
}

0 commit comments

Comments
 (0)