blob: 221c18d9692836d91d98222edf2c4196e3e21411 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GPU_VULKAN_VULKAN_DEVICE_QUEUE_H_
#define GPU_VULKAN_VULKAN_DEVICE_QUEUE_H_
#include <vulkan/vulkan.h>
#include <memory>
#include "base/logging.h"
#include "base/macros.h"
#include "gpu/vulkan/vulkan_export.h"
namespace gpu {
class VulkanCommandPool;
class VULKAN_EXPORT VulkanDeviceQueue {
public:
enum DeviceQueueOption {
GRAPHICS_QUEUE_FLAG = 0x01,
PRESENTATION_SUPPORT_QUEUE_FLAG = 0x02,
};
VulkanDeviceQueue();
~VulkanDeviceQueue();
bool Initialize(uint32_t option);
void Destroy();
VkPhysicalDevice GetVulkanPhysicalDevice() const {
DCHECK_NE(static_cast<VkPhysicalDevice>(VK_NULL_HANDLE),
vk_physical_device_);
return vk_physical_device_;
}
VkDevice GetVulkanDevice() const {
DCHECK_NE(static_cast<VkDevice>(VK_NULL_HANDLE), vk_device_);
return vk_device_;
}
VkQueue GetVulkanQueue() const {
DCHECK_NE(static_cast<VkQueue>(VK_NULL_HANDLE), vk_queue_);
return vk_queue_;
}
VkInstance GetVulkanInstance() const { return vk_instance_; }
uint32_t GetVulkanQueueIndex() const { return vk_queue_index_; }
std::unique_ptr<gpu::VulkanCommandPool> CreateCommandPool();
private:
VkPhysicalDevice vk_physical_device_ = VK_NULL_HANDLE;
VkDevice vk_device_ = VK_NULL_HANDLE;
VkQueue vk_queue_ = VK_NULL_HANDLE;
uint32_t vk_queue_index_ = 0;
VkInstance vk_instance_ = VK_NULL_HANDLE;
DISALLOW_COPY_AND_ASSIGN(VulkanDeviceQueue);
};
} // namespace gpu
#endif // GPU_VULKAN_VULKAN_DEVICE_QUEUE_H_
|