aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordan sinclair <dj2@everburning.com>2019-03-19 16:11:15 -0700
committerGitHub <noreply@github.com>2019-03-19 16:11:15 -0700
commitbe94d5ca2eb722f730dc76fcf1f728a5c00f4343 (patch)
tree080cfda50c9e025f8bed967efe658cc69db542fd /src
parent5dfa7d01262fd775329e99cb58106326622dcae4 (diff)
downloadamber-be94d5ca2eb722f730dc76fcf1f728a5c00f4343.tar.gz
[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.
Diffstat (limited to 'src')
-rw-r--r--src/vulkan/compute_pipeline.cc10
-rw-r--r--src/vulkan/graphics_pipeline.cc10
-rw-r--r--src/vulkan/pipeline.cc11
-rw-r--r--src/vulkan/pipeline.h5
4 files changed, 5 insertions, 31 deletions
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_; }