Debian Codegraph @

Sources/nCine/Graphics/RHI/Vulkan/VulkanRhiCapabilities.h

raw
1 #pragma once
2
3 #include "../RhiCapabilitiesBase.h"
4 #include "VulkanDevice.h"
5 #include "VulkanRenderTarget.h"
6 #include "VulkanTexture.h"
7
8 namespace nCine::RHI::Vulkan
9 {
10 /**
11 @brief Runtime capabilities of the Vulkan backend
12
13 Vulkan has no queryable API context of the OpenGL kind, so the limits come from the physical device the
14 window backend has already selected (see @ref RhiCapabilitiesBase::SetDeviceCapabilities()).
15 */
16 class VulkanRhiCapabilities : public RhiCapabilitiesBase
17 {
18 public:
19 VulkanRhiCapabilities()
20 {
21 // Real limits of the selected VkPhysicalDevice, queried at device creation: maxImageDimension2D,
22 // maxUniformBufferRange (normalized into the [16 KB, 64 KB] window exactly like the OpenGL path) and
23 // minUniformBufferOffsetAlignment. The backend re-aligns its own per-frame uniform ring at bind time
24 // (see AllocUbo), so the engine-side suballocation does not strictly need the device alignment - it
25 // follows it anyway so the published value is the real one. The render passes drive a single color
26 // attachment today (MRT unimplemented); VulkanRenderTarget::MaxColorAttachments mirrors the common
27 // device limit and only bounds Viewport::SetTexture().
28 SetDeviceCapabilities("Vulkan", VulkanDevice::GetMaxTextureDimension(), std::int32_t(VulkanTexture::MaxTextureUnits),
29 VulkanDevice::GetMaxUniformBufferRange(), VulkanDevice::GetUniformBufferOffsetAlignment(),
30 std::int32_t(VulkanRenderTarget::MaxColorAttachments));
31
32 LogCapabilities();
33 }
34 };
35 }