FastEngine 0.9.4
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
C_logicalDevice.hpp
1/*
2 * Copyright 2025 Guillaume Guillet
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#ifndef _FGE_VULKAN_C_LOGICALDEVICE_HPP_INCLUDED
18#define _FGE_VULKAN_C_LOGICALDEVICE_HPP_INCLUDED
19
20#include "FastEngine/fge_extern.hpp"
21#include "volk.h"
22
23namespace fge::vulkan
24{
25
26class PhysicalDevice;
27
36class FGE_API LogicalDevice
37{
38public:
39 LogicalDevice();
40 LogicalDevice(LogicalDevice const& r) = delete;
41 LogicalDevice(LogicalDevice&& r) noexcept;
42 ~LogicalDevice();
43
44 LogicalDevice& operator=(LogicalDevice const& r) = delete;
45 LogicalDevice& operator=(LogicalDevice&& r) noexcept = delete;
46
47 void create(PhysicalDevice& physicalDevice, VkSurfaceKHR surface);
48 void destroy();
49
50 [[nodiscard]] VkDevice getDevice() const;
51 [[nodiscard]] VkQueue getGraphicQueue() const;
52 [[nodiscard]] VkQueue getComputeQueue() const;
53 [[nodiscard]] VkQueue getTransferQueue() const;
54 [[nodiscard]] VkQueue getPresentQueue() const;
55 [[nodiscard]] VkPhysicalDeviceFeatures getEnabledFeatures() const;
56
57 [[nodiscard]] VkImageView createImageView(VkImage image, VkFormat format, uint32_t mipLevels) const;
58
59private:
60 VkDevice g_device;
61 VkQueue g_graphicQueue;
62 VkQueue g_computeQueue;
63 VkQueue g_transferQueue;
64 VkQueue g_presentQueue;
65 VkPhysicalDeviceFeatures g_enabledFeatures;
66};
67
68} // namespace fge::vulkan
69
70#endif //_FGE_VULKAN_C_LOGICALDEVICE_HPP_INCLUDED
Vulkan physical device abstraction.
Definition C_physicalDevice.hpp:34