Plasma Engine  2.0
Loading...
Searching...
No Matches
ConversionUtilsVulkan.h
1#pragma once
2
3#include <RendererVulkan/RendererVulkanDLL.h>
4
5#include <RendererFoundation/Descriptors/Descriptors.h>
6#include <RendererFoundation/RendererFoundationDLL.h>
7
8#include <vulkan/vulkan.hpp>
9
10PL_DEFINE_AS_POD_TYPE(vk::PresentModeKHR);
11
13class PL_RENDERERVULKAN_DLL plConversionUtilsVulkan
14{
15public:
17 template <typename T, typename R = typename std::underlying_type<T>::type>
18 static R GetUnderlyingValue(T value)
19 {
20 return static_cast<typename std::underlying_type<T>::type>(value);
21 }
22
24 template <typename T>
25 static auto GetUnderlyingFlagsValue(T value)
26 {
27 return static_cast<typename T::MaskType>(value);
28 }
29
30 static vk::SampleCountFlagBits GetSamples(plEnum<plGALMSAASampleCount> samples);
31 static vk::PresentModeKHR GetPresentMode(plEnum<plGALPresentMode> presentMode, const plDynamicArray<vk::PresentModeKHR>& supportedModes);
32 static vk::ImageSubresourceRange GetSubresourceRange(const plGALTextureCreationDescription& texDesc, const plGALRenderTargetViewCreationDescription& desc);
33 static vk::ImageSubresourceRange GetSubresourceRange(const plGALTextureCreationDescription& texDesc, const plGALTextureResourceViewCreationDescription& viewDesc);
34 static vk::ImageSubresourceRange GetSubresourceRange(const plGALTextureCreationDescription& texDesc, const plGALTextureUnorderedAccessViewCreationDescription& viewDesc);
35 static vk::ImageSubresourceRange GetSubresourceRange(const vk::ImageSubresourceLayers& layers);
36 static vk::ImageViewType GetImageViewType(plEnum<plGALTextureType> texType, bool bIsArray);
37
38 static bool IsDepthFormat(vk::Format format);
39 static bool IsStencilFormat(vk::Format format);
40 static vk::ImageLayout GetDefaultLayout(vk::Format format);
41 static vk::PrimitiveTopology GetPrimitiveTopology(plEnum<plGALPrimitiveTopology> topology);
42 static vk::ShaderStageFlagBits GetShaderStage(plGALShaderStage::Enum stage);
43 static vk::ShaderStageFlagBits GetShaderStages(plBitflags<plGALShaderStageFlags> stages);
44 static vk::PipelineStageFlags GetPipelineStage(plGALShaderStage::Enum stage);
45 static vk::PipelineStageFlags GetPipelineStage(vk::ShaderStageFlags flags);
46 static vk::PipelineStageFlags GetPipelineStages(plBitflags<plGALShaderStageFlags> stages);
47 static vk::DescriptorType GetDescriptorType(plGALShaderResourceType::Enum type);
48};
49
50#include <RendererVulkan/Utils/Implementation/ConversionUtilsVulkan.inl.h>
Helper functions to convert and extract Vulkan objects from PL objects.
Definition ConversionUtilsVulkan.h:14
static R GetUnderlyingValue(T value)
Helper function to hash vk enums.
Definition ConversionUtilsVulkan.h:18
static auto GetUnderlyingFlagsValue(T value)
Helper function to hash vk flags.
Definition ConversionUtilsVulkan.h:25
Definition DynamicArray.h:81
The plBitflags class allows you to work with type-safe bitflags.
Definition Bitflags.h:82
A custom enum implementation that allows to define the underlying storage type to control its memory ...
Definition Enum.h:37
Definition Descriptors.h:220
Enum
Definition Enumerations.h:12
Definition Descriptors.h:177