Kale
Loading...
Searching...
No Matches
Device.hpp
Go to the documentation of this file.
1/*
2 Copyright 2022 Rishi Challa
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#pragma once
18
19#ifdef KALE_VULKAN
20
24
25#include <vulkan/vulkan.hpp>
26#include <map>
27#include <list>
28
29namespace Kale::Vulkan {
30
34 enum class QueueType {
36 };
37
41 class Device : public ParentResource<Device> {
42 private:
43
48
52 void getQueues();
53
54 public:
55
59 vk::UniqueDevice logicalDevice;
60
64 vk::PhysicalDeviceProperties physicalDeviceProperties;
65
69 vk::PhysicalDevice physicalDevice;
70
74 std::map<QueueType, vk::Queue> queueMap;
75
80
84 vk::PhysicalDeviceMemoryProperties memoryProperties;
85
89 Device();
90
96 Device(const vk::PhysicalDevice& device);
97
103 Device(uint32_t deviceId);
104
109 void init(const vk::PhysicalDevice& device);
110
115 void init(uint32_t deviceId);
116
120 void freeResources();
121
128 uint32_t findMemoryType(uint32_t typeFilter, vk::MemoryPropertyFlags properties) const;
129
134 static std::vector<vk::PhysicalDevice> availableDevices();
135
141 static bool deviceSupported(const vk::PhysicalDevice& physicalDevice);
142 };
143}
144
145#endif
vk::PhysicalDevice physicalDevice
Definition Device.hpp:69
void init(const vk::PhysicalDevice &device)
Definition Device.cpp:83
static bool deviceSupported(const vk::PhysicalDevice &physicalDevice)
Definition Device.cpp:204
std::map< QueueType, vk::Queue > queueMap
Definition Device.hpp:74
vk::UniqueDevice logicalDevice
Definition Device.hpp:59
void createLogicalDevice()
Definition Device.cpp:123
uint32_t findMemoryType(uint32_t typeFilter, vk::MemoryPropertyFlags properties) const
Definition Device.cpp:178
QueueFamilyIndices queueIndices
Definition Device.hpp:79
vk::PhysicalDeviceProperties physicalDeviceProperties
Definition Device.hpp:64
vk::PhysicalDeviceMemoryProperties memoryProperties
Definition Device.hpp:84
static std::vector< vk::PhysicalDevice > availableDevices()
Definition Device.cpp:191