Fix fast synch when fence is waited before a command buffer is created (#2657)

This commit is contained in:
Awni Hannun
2025-10-08 11:23:46 -07:00
committed by GitHub
parent 343e33b6d5
commit f5d4397e5c

View File

@@ -471,6 +471,10 @@ void Device::end_encoding(int index) {
CommandEncoder& Device::get_command_encoder(int index) { CommandEncoder& Device::get_command_encoder(int index) {
auto& stream = get_stream_(index); auto& stream = get_stream_(index);
if (stream.encoder == nullptr) { if (stream.encoder == nullptr) {
// Ensure there is an active command buffer
if (stream.buffer == nullptr) {
get_command_buffer(index);
}
stream.encoder = std::make_unique<CommandEncoder>(stream); stream.encoder = std::make_unique<CommandEncoder>(stream);
stream.fence = std::make_shared<Fence>(device_->newFence()); stream.fence = std::make_shared<Fence>(device_->newFence());
} }