diff options
author | dan sinclair <dj2@everburning.com> | 2019-02-21 17:27:25 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-21 17:27:25 -0500 |
commit | 12389f2889a16b6f9f9a2fe7d9176af9710d9af2 (patch) | |
tree | 5d99df0fd1067cd65c5181f478987fc0fff51748 /src/vulkan/graphics_pipeline.cc | |
parent | 4c4ad39c0dca8621c6f8c00a9402b28cc760306c (diff) | |
download | amber-12389f2889a16b6f9f9a2fe7d9176af9710d9af2.tar.gz |
[vulkan] Code cleanup (#310)
This CL cleans up various things in the src/vulkan directory. Code is
moved closer to usage if a subclass is the only caller. CommandBuffer
and CommandPool are passed instead of VkCommandBuffer and VkCommandPool.
Diffstat (limited to 'src/vulkan/graphics_pipeline.cc')
-rw-r--r-- | src/vulkan/graphics_pipeline.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/vulkan/graphics_pipeline.cc b/src/vulkan/graphics_pipeline.cc index 2684f14..7ef24b9 100644 --- a/src/vulkan/graphics_pipeline.cc +++ b/src/vulkan/graphics_pipeline.cc @@ -19,6 +19,7 @@ #include "src/command.h" #include "src/make_unique.h" +#include "src/vulkan/command_pool.h" #include "src/vulkan/device.h" #include "src/vulkan/format_data.h" @@ -651,7 +652,7 @@ Result GraphicsPipeline::CreateVkGraphicsPipeline( Result GraphicsPipeline::Initialize(uint32_t width, uint32_t height, - VkCommandPool pool, + CommandPool* pool, VkQueue queue) { Result r = Pipeline::Initialize(pool, queue); if (!r.IsSuccess()) @@ -687,8 +688,7 @@ Result GraphicsPipeline::SendVertexBufferDataIfNeeded( DeactivateRenderPassIfNeeded(); - return vertex_buffer->SendVertexData(command_->GetCommandBuffer(), - memory_properties_); + return vertex_buffer->SendVertexData(command_.get(), memory_properties_); } Result GraphicsPipeline::SetIndexBuffer(const std::vector<Value>& values) { @@ -706,8 +706,7 @@ Result GraphicsPipeline::SetIndexBuffer(const std::vector<Value>& values) { DeactivateRenderPassIfNeeded(); - r = index_buffer_->SendIndexData(command_->GetCommandBuffer(), - memory_properties_, values); + r = index_buffer_->SendIndexData(command_.get(), memory_properties_, values); if (!r.IsSuccess()) return r; @@ -722,7 +721,7 @@ Result GraphicsPipeline::ActivateRenderPassIfNeeded() { if (render_pass_state_ == RenderPassState::kActive) return {}; - Result r = frame_->ChangeFrameImageLayout(command_->GetCommandBuffer(), + Result r = frame_->ChangeFrameImageLayout(command_.get(), FrameImageState::kClearOrDraw); if (!r.IsSuccess()) return r; @@ -835,7 +834,7 @@ Result GraphicsPipeline::ClearBuffer(const VkClearValue& clear_value, DeactivateRenderPassIfNeeded(); - return frame_->CopyColorImageToHost(command_->GetCommandBuffer()); + return frame_->CopyColorImageToHost(command_.get()); } Result GraphicsPipeline::ResetPipeline() { @@ -918,7 +917,7 @@ Result GraphicsPipeline::Draw(const DrawArraysCommand* command, return r; if (vertex_buffer != nullptr) - vertex_buffer->BindToCommandBuffer(command_->GetCommandBuffer()); + vertex_buffer->BindToCommandBuffer(command_.get()); uint32_t instance_count = command->GetInstanceCount(); if (instance_count == 0 && command->GetVertexCount() != 0) @@ -928,7 +927,7 @@ Result GraphicsPipeline::Draw(const DrawArraysCommand* command, if (!index_buffer_) return Result("Vulkan: Draw indexed is used without given indices"); - r = index_buffer_->BindToCommandBuffer(command_->GetCommandBuffer()); + r = index_buffer_->BindToCommandBuffer(command_.get()); if (!r.IsSuccess()) return r; @@ -950,7 +949,7 @@ Result GraphicsPipeline::Draw(const DrawArraysCommand* command, DeactivateRenderPassIfNeeded(); - r = frame_->CopyColorImageToHost(command_->GetCommandBuffer()); + r = frame_->CopyColorImageToHost(command_.get()); if (!r.IsSuccess()) return r; |