aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vulkan/pipeline.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vulkan/pipeline.cc b/src/vulkan/pipeline.cc
index cdfc5f7..bce91f5 100644
--- a/src/vulkan/pipeline.cc
+++ b/src/vulkan/pipeline.cc
@@ -304,7 +304,27 @@ Result Pipeline::SendDescriptorDataToDeviceIfNeeded() {
memory_properties_);
if (!r.IsSuccess())
return r;
+ }
+
+ r = command_->End();
+ if (!r.IsSuccess())
+ return r;
+ // Note that if a buffer for a descriptor is host accessible and
+ // does not need to record a command to copy data to device, it
+ // directly writes data to the buffer. The direct write must be
+ // done after resizing backed buffer i.e., copying data to the new
+ // buffer from the old one. Thus, we must submit commands here to
+ // guarantee this.
+ r = command_->SubmitAndReset(GetFenceTimeout());
+ if (!r.IsSuccess())
+ return r;
+
+ r = command_->BeginIfNotInRecording();
+ if (!r.IsSuccess())
+ return r;
+
+ for (const auto& desc : descriptors_) {
desc->UpdateResourceIfNeeded(command_->GetCommandBuffer());
}