Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1121)

Unified Diff: gpu/vulkan/vulkan_command_pool.cc

Issue 1829163003: Added initial implementation of the Vulkan Context Provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@vk_surface_patch
Patch Set: Block off vulkan_cc with enable_vulkan (not relevant in future patch) Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/vulkan/vulkan_command_pool.h ('k') | gpu/vulkan/vulkan_device_queue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/vulkan/vulkan_command_pool.cc
diff --git a/gpu/vulkan/vulkan_command_pool.cc b/gpu/vulkan/vulkan_command_pool.cc
index c771dbd6b9e9617f2e16edc0984fb97970d8e14f..da7810397200fd41d64b72229be0b2a269ac9e10 100644
--- a/gpu/vulkan/vulkan_command_pool.cc
+++ b/gpu/vulkan/vulkan_command_pool.cc
@@ -6,12 +6,13 @@
#include "base/logging.h"
#include "gpu/vulkan/vulkan_command_buffer.h"
+#include "gpu/vulkan/vulkan_device_queue.h"
#include "gpu/vulkan/vulkan_implementation.h"
namespace gpu {
-VulkanCommandPool::VulkanCommandPool(VkDevice device, uint32_t queue_index)
- : device_(device), queue_index_(queue_index) {}
+VulkanCommandPool::VulkanCommandPool(VulkanDeviceQueue* device_queue)
+ : device_queue_(device_queue) {}
VulkanCommandPool::~VulkanCommandPool() {
DCHECK_EQ(0u, command_buffer_count_);
@@ -23,10 +24,12 @@ bool VulkanCommandPool::Initialize() {
command_pool_create_info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
command_pool_create_info.flags =
VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
- command_pool_create_info.queueFamilyIndex = queue_index_;
+ command_pool_create_info.queueFamilyIndex =
+ device_queue_->GetVulkanQueueIndex();
- VkResult result = vkCreateCommandPool(device_, &command_pool_create_info,
- nullptr, &handle_);
+ VkResult result =
+ vkCreateCommandPool(device_queue_->GetVulkanDevice(),
+ &command_pool_create_info, nullptr, &handle_);
if (VK_SUCCESS != result) {
DLOG(ERROR) << "vkCreateCommandPool() failed: " << result;
return false;
@@ -38,7 +41,7 @@ bool VulkanCommandPool::Initialize() {
void VulkanCommandPool::Destroy() {
DCHECK_EQ(0u, command_buffer_count_);
if (VK_NULL_HANDLE != handle_) {
- vkDestroyCommandPool(device_, handle_, nullptr);
+ vkDestroyCommandPool(device_queue_->GetVulkanDevice(), handle_, nullptr);
handle_ = VK_NULL_HANDLE;
}
}
@@ -46,7 +49,7 @@ void VulkanCommandPool::Destroy() {
scoped_ptr<VulkanCommandBuffer>
VulkanCommandPool::CreatePrimaryCommandBuffer() {
scoped_ptr<VulkanCommandBuffer> command_buffer(
- new VulkanCommandBuffer(this, true));
+ new VulkanCommandBuffer(device_queue_, this, true));
if (!command_buffer->Initialize())
return nullptr;
@@ -56,7 +59,7 @@ VulkanCommandPool::CreatePrimaryCommandBuffer() {
scoped_ptr<VulkanCommandBuffer>
VulkanCommandPool::CreateSecondaryCommandBuffer() {
scoped_ptr<VulkanCommandBuffer> command_buffer(
- new VulkanCommandBuffer(this, false));
+ new VulkanCommandBuffer(device_queue_, this, false));
if (!command_buffer->Initialize())
return nullptr;
« no previous file with comments | « gpu/vulkan/vulkan_command_pool.h ('k') | gpu/vulkan/vulkan_device_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698