From be94d5ca2eb722f730dc76fcf1f728a5c00f4343 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Tue, 19 Mar 2019 16:11:15 -0700 Subject: [vulkan] Remove redundant record and submit commands. (#385) The SendDescriptorDataToDevice method always begins and submits recording. This Cl removes the calls to begin/submit recording which wrap around the SendDescriptorDataToDevice method. --- src/vulkan/compute_pipeline.cc | 10 +--------- src/vulkan/graphics_pipeline.cc | 10 +--------- src/vulkan/pipeline.cc | 11 +++-------- src/vulkan/pipeline.h | 5 ----- 4 files changed, 5 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/vulkan/compute_pipeline.cc b/src/vulkan/compute_pipeline.cc index 262b822..377b0c9 100644 --- a/src/vulkan/compute_pipeline.cc +++ b/src/vulkan/compute_pipeline.cc @@ -69,15 +69,7 @@ Result ComputePipeline::CreateVkComputePipeline( } Result ComputePipeline::Compute(uint32_t x, uint32_t y, uint32_t z) { - Result r = command_->BeginIfNotInRecording(); - if (!r.IsSuccess()) - return r; - - r = SendDescriptorDataToDeviceIfNeeded(); - if (!r.IsSuccess()) - return r; - - r = command_->SubmitAndReset(GetFenceTimeout()); + Result r = SendDescriptorDataToDeviceIfNeeded(); if (!r.IsSuccess()) return r; diff --git a/src/vulkan/graphics_pipeline.cc b/src/vulkan/graphics_pipeline.cc index 3244f31..08add8a 100644 --- a/src/vulkan/graphics_pipeline.cc +++ b/src/vulkan/graphics_pipeline.cc @@ -822,15 +822,7 @@ Result GraphicsPipeline::ClearBuffer(const VkClearValue& clear_value, Result GraphicsPipeline::Draw(const DrawArraysCommand* command, VertexBuffer* vertex_buffer) { - Result r = command_->BeginIfNotInRecording(); - if (!r.IsSuccess()) - return r; - - r = SendDescriptorDataToDeviceIfNeeded(); - if (!r.IsSuccess()) - return r; - - r = command_->SubmitAndReset(GetFenceTimeout()); + Result r = SendDescriptorDataToDeviceIfNeeded(); if (!r.IsSuccess()) return r; diff --git a/src/vulkan/pipeline.cc b/src/vulkan/pipeline.cc index b01d636..c5cd9c5 100644 --- a/src/vulkan/pipeline.cc +++ b/src/vulkan/pipeline.cc @@ -355,6 +355,9 @@ Result Pipeline::SendDescriptorDataToDeviceIfNeeded() { } } + r = command_->SubmitAndReset(GetFenceTimeout()); + if (!r.IsSuccess()) + return r; return {}; } @@ -408,13 +411,5 @@ const char* Pipeline::GetEntryPointName(VkShaderStageFlagBits stage) const { return kDefaultEntryPointName; } -Result Pipeline::ProcessCommands() { - Result r = command_->BeginIfNotInRecording(); - if (!r.IsSuccess()) - return r; - - return command_->SubmitAndReset(GetFenceTimeout()); -} - } // namespace vulkan } // namespace amber diff --git a/src/vulkan/pipeline.h b/src/vulkan/pipeline.h index 3b71f2a..070b121 100644 --- a/src/vulkan/pipeline.h +++ b/src/vulkan/pipeline.h @@ -62,11 +62,6 @@ class Pipeline { entry_points_[stage] = entry; } - // End recording command buffer if it is in recording state. This - // method also submits commands in the command buffer and reset - // the command buffer. - Result ProcessCommands(); - CommandBuffer* GetCommandBuffer() const { return command_.get(); } Device* GetDevice() const { return device_; } -- cgit v1.2.3