evan 2026.1.4
Evan
Loading...
Searching...
No Matches
DeviceContext.hpp
1/*
2** ETIB PROJECT, 2026
3** evan
4** File description:
5** DeviceContext
6*/
7
8#pragma once
9
10#include "evan/EvanPlatform.hpp"
11#include "evan/ADeviceBackend.hpp"
12#include "evan/PipelineCache.hpp"
13#include "evan/TransferManager.hpp"
14
15#include "evan/IPlatform.hpp"
16
17#include <utility/logging/loggable.hpp>
18#include <utility/logging/default_logger.hpp>
19
20#include <iostream>
21#include <memory>
22
23namespace evan
24{
37 protected utility::logging::Loggable<DeviceContext,
38 utility::logging::DefaultLogger>
39 {
40 public:
69 DeviceContext(const IPlatform &platform);
70
72
83 VkSampleCountFlagBits getMsaaSamples() const;
84
102 void setMsaaSamples(VkSampleCountFlagBits samples);
103
112 VkSampleCountFlagBits getMaxSupportedMsaaSamples() const;
113
125 std::shared_ptr<ADeviceBackend> getDeviceBackend() const;
126
136 VkCommandPool getCommandPool() const;
137
147 VkQueue getGraphicsQueue() const;
148
157
169
170 protected:
176
182 VkCommandPool _commandPool;
183
188
196
205 VkSampleCountFlagBits _msaaSamples = VK_SAMPLE_COUNT_1_BIT;
206
213 std::shared_ptr<ADeviceBackend> _deviceBackend;
214
230 VkDebugUtilsMessengerEXT _debugMessenger = VK_NULL_HANDLE;
231
232 private:
241 VkSampleCountFlags getFramebufferSampleCounts() const;
242
257 void createCommandPool();
258
267 void createGraphicsQueue();
268
278 bool checkDebugUtilsSupport(VkInstance instance);
279
293 bool checkDebugUtilsEnabled(VkInstance instance);
294
305 void destroyDebugUtilsMessengerEXT(
306 VkInstance instance, VkDebugUtilsMessengerEXT debugMessenger);
307
317 void setupDebugMessenger();
318
335 void populateDebugMessengerCreateInfo(
336 VkDebugUtilsMessengerCreateInfoEXT &createInfo,
337 PFN_vkDebugUtilsMessengerCallbackEXT debugCallback);
338
364 VkResult createDebugUtilsMessengerEXT(
365 VkInstance instance,
366 const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo,
367 const VkAllocationCallbacks *pAllocator,
368 VkDebugUtilsMessengerEXT *pDebugMessenger);
369 };
370} // namespace evan
Represents the device context for the engine, managing Vulkan-related resources and operations.
VkCommandPool getCommandPool() const
Retrieves the Vulkan command pool associated with this device context.
DeviceContext(const IPlatform &platform)
Constructs a DeviceContext instance using the provided platform.
TransferManager _transferManager
void setMsaaSamples(VkSampleCountFlagBits samples)
Overrides the MSAA sample count used by this device context.
VkSampleCountFlagBits _msaaSamples
VkSampleCountFlagBits getMsaaSamples() const
Retrieves the number of MSAA samples used by this device context.
VkCommandPool _commandPool
VkSampleCountFlagBits getMaxSupportedMsaaSamples() const
Retrieves the highest MSAA sample count this device accepts.
std::shared_ptr< ADeviceBackend > getDeviceBackend() const
Retrieves a shared pointer to the ADeviceBackend instance associated with this device context.
VkDebugUtilsMessengerEXT _debugMessenger
std::shared_ptr< ADeviceBackend > _deviceBackend
PipelineCache _pipelineCache
TransferManager & getTransferManager()
Retrieves the transfer manager used to upload resources asynchronously without draining the graphics ...
VkQueue getGraphicsQueue() const
Retrieves the Vulkan graphics queue associated with this device context.
const PipelineCache & getPipelineCache() const
Retrieves the pipeline cache used when creating pipelines.
Abstract interface for platform-specific functionality.
Definition IPlatform.hpp:36
Owns the Vulkan pipeline cache used when creating pipelines and persists it across runs.
Owns staging memory and command buffers used to upload data to device-local resources without drainin...