3#if !defined (LITEFX_VULKAN_API)
4# if defined(LiteFX_Backends_Vulkan_EXPORTS) && (defined _WIN32 || defined WINCE)
5# define LITEFX_VULKAN_API __declspec(dllexport)
6# elif (defined(LiteFX_Backends_Vulkan_EXPORTS) || defined(__APPLE__)) && defined __GNUC__ && __GNUC__ >= 4
7# define LITEFX_VULKAN_API __attribute__ ((visibility ("default")))
8# elif !defined(LiteFX_Backends_Vulkan_EXPORTS) && (defined _WIN32 || defined WINCE)
9# define LITEFX_VULKAN_API __declspec(dllimport)
13#ifndef LITEFX_VULKAN_API
14# define LITEFX_VULKAN_API
17#if (defined _WIN32 || defined WINCE)
18# define VK_USE_PLATFORM_WIN32_KHR
20# pragma message ("Vulkan: No supported surface platform detected.")
23#include <litefx/config.h>
24#include <litefx/rendering.hpp>
25#include <vulkan/vulkan.h>
66#if defined(BUILD_DEFINE_BUILDERS)
68 class VulkanVertexBufferLayoutBuilder;
69 class VulkanDescriptorSetLayoutBuilder;
70 class VulkanPushConstantsLayoutBuilder;
71 class VulkanPipelineLayoutBuilder;
72 class VulkanShaderProgramBuilder;
73 class VulkanInputAssemblerBuilder;
74 class VulkanRasterizerBuilder;
75 class VulkanRenderPipelineBuilder;
76 class VulkanComputePipelineBuilder;
77 class VulkanRenderPassBuilder;
88 Format LITEFX_VULKAN_API
getFormat(
const VkFormat& format);
93 VkFormat LITEFX_VULKAN_API
getFormat(
const Format& format);
103 VkFormat LITEFX_VULKAN_API
getFormat(
const BufferFormat& format);
108 PolygonMode LITEFX_VULKAN_API
getPolygonMode(
const VkPolygonMode& mode);
113 VkPolygonMode LITEFX_VULKAN_API
getPolygonMode(
const PolygonMode& mode);
118 CullMode LITEFX_VULKAN_API
getCullMode(
const VkCullModeFlags& mode);
123 VkCullModeFlags LITEFX_VULKAN_API
getCullMode(
const CullMode& mode);
138 ShaderStage LITEFX_VULKAN_API
getShaderStage(
const VkShaderStageFlagBits& shaderType);
143 VkShaderStageFlagBits LITEFX_VULKAN_API
getShaderStage(
const ShaderStage& shaderType);
148 MultiSamplingLevel LITEFX_VULKAN_API
getSamples(
const VkSampleCountFlagBits& samples);
153 VkImageType LITEFX_VULKAN_API
getImageType(
const ImageDimensions& dimension);
158 VkImageViewType LITEFX_VULKAN_API
getImageViewType(
const ImageDimensions& dimension,
const UInt32& layers = 1);
163 VkSampleCountFlagBits LITEFX_VULKAN_API
getSamples(
const MultiSamplingLevel& samples);
168 VkCompareOp LITEFX_VULKAN_API
getCompareOp(
const CompareOperation& compareOp);
173 VkStencilOp LITEFX_VULKAN_API
getStencilOp(
const StencilOperation& stencilOp);
178 VkBlendFactor LITEFX_VULKAN_API
getBlendFactor(
const BlendFactor& blendFactor);
183 VkBlendOp LITEFX_VULKAN_API
getBlendOperation(
const BlendOperation& blendOperation);
188 VkImageLayout LITEFX_VULKAN_API
getImageLayout(
const ResourceState& resourceState);
193 VkAccessFlags LITEFX_VULKAN_API
getAccessFlags(
const ResourceState& resourceState);
214 virtual
String name() const noexcept override;
217 virtual
UInt64 uniqueId() const noexcept override;
220 virtual
UInt32 vendorId() const noexcept override;
223 virtual
UInt32 deviceId() const noexcept override;
226 virtual GraphicsAdapterType type() const noexcept override;
229 virtual
UInt32 driverVersion() const noexcept override;
232 virtual
UInt32 apiVersion() const noexcept override;
235 virtual
UInt64 dedicatedMemory() const noexcept override;
242 VkPhysicalDeviceLimits limits() const noexcept;
249 bool validateDeviceExtensions(
Span<const
String> extensions) const noexcept;
256 Array<
String> getAvailableDeviceExtensions() const noexcept;
263 bool validateDeviceLayers(const
Span<const
String> validationLayers) const noexcept;
270 Array<
String> deviceValidationLayers() const noexcept;
280#ifdef VK_USE_PLATFORM_WIN32_KHR
287 VulkanSurface(
const VkSurfaceKHR& surface,
const VkInstance& instance,
const HWND hwnd);
294 VulkanSurface(
const VkSurfaceKHR& surface,
const VkInstance& instance);
306 const VkInstance& instance() const noexcept;
308#ifdef VK_USE_PLATFORM_WIN32_KHR
314 const HWND windowHandle() const noexcept;
328 template <
typename TException,
typename ...TArgs>
330 if (result == VK_SUCCESS) [[likely]]
333 throw TException(VulkanPlatformException(
"Result: {0}", result),
fmt::format(fmt::runtime(message), std::forward<TArgs>(args)...));
Represents the base interface for a Vulkan buffer implementation.
Definition: vulkan.hpp:92
Represents a Vulkan sampled image or the base interface for a texture.
Definition: vulkan.hpp:125
Represents a Vulkan index buffer.
Definition: vulkan.hpp:112
Represents a Vulkan sampler.
Definition: vulkan.hpp:167
Represents a Vulkan vertex buffer.
Definition: vulkan.hpp:102
Defines a rendering backend that creates a Vulkan device.
Definition: vulkan.hpp:1593
Records commands for a VulkanCommandQueue
Definition: vulkan.hpp:802
Implements a Vulkan ComputePipeline.
Definition: vulkan.hpp:954
Implements a Vulkan IDescriptorLayout
Definition: vulkan.hpp:386
Implements a Vulkan DescriptorSet.
Definition: vulkan.hpp:343
Implements a Vulkan DescriptorSetLayout.
Definition: vulkan.hpp:439
Implements a Vulkan graphics device.
Definition: vulkan.hpp:1469
Implements a Vulkan frame buffer.
Definition: vulkan.hpp:999
Represents a Vulkan IGraphicsAdapter.
Definition: vulkan_api.hpp:199
VulkanGraphicsAdapter(const VulkanGraphicsAdapter &)=delete
virtual ~VulkanGraphicsAdapter() noexcept
VulkanGraphicsAdapter(VulkanGraphicsAdapter &&)=delete
A graphics factory that produces objects for a VulkanDevice.
Definition: vulkan.hpp:1409
Implements a Vulkan index buffer layout.
Definition: vulkan.hpp:55
Implements a Vulkan PipelineLayout.
Definition: vulkan.hpp:648
Defines the base class for Vulkan pipeline state objects.
Definition: vulkan.hpp:778
Implements the Vulkan PushConstantsLayout.
Definition: vulkan.hpp:596
Implements the Vulkan IPushConstantsRange.
Definition: vulkan.hpp:556
Implements a Vulkan command queue.
Definition: vulkan.hpp:1278
Implements a Vulkan IRasterizer.
Definition: vulkan.hpp:734
Implements a Vulkan render pass.
Definition: vulkan.hpp:1067
Implements a Vulkan RenderPipeline.
Definition: vulkan.hpp:881
Implements a Vulkan IShaderModule.
Definition: vulkan.hpp:247
Implements a Vulkan ShaderProgram.
Definition: vulkan.hpp:304
Represents a Vulkan ISurface.
Definition: vulkan_api.hpp:276
VulkanSurface(VulkanSurface &&)=delete
VulkanSurface(const VulkanSurface &)=delete
Implements a Vulkan swap chain.
Definition: vulkan.hpp:1222
Implements a Vulkan vertex buffer layout.
Definition: vulkan.hpp:18
Represents a physical graphics adapter.
Definition: rendering_api.hpp:1754
Represents a surface to render to.
Definition: rendering_api.hpp:1815
Implements the IResource interface.
Definition: containers.hpp:371
Definition: surface.cpp:9
uint32_t UInt32
Definition: math.hpp:37
uint64_t UInt64
Definition: math.hpp:39
Format LITEFX_VULKAN_API getFormat(const VkFormat &format)
Definition: convert.cpp:5
VkImageLayout LITEFX_VULKAN_API getImageLayout(const ResourceState &resourceState)
Definition: convert.cpp:956
MultiSamplingLevel LITEFX_VULKAN_API getSamples(const VkSampleCountFlagBits &samples)
Definition: convert.cpp:809
VkImageViewType LITEFX_VULKAN_API getImageViewType(const ImageDimensions &dimension, const UInt32 &layers=1)
Definition: convert.cpp:848
VkCompareOp LITEFX_VULKAN_API getCompareOp(const CompareOperation &compareOp)
Definition: convert.cpp:888
ShaderStage LITEFX_VULKAN_API getShaderStage(const VkShaderStageFlagBits &shaderType)
Definition: convert.cpp:766
PolygonMode LITEFX_VULKAN_API getPolygonMode(const VkPolygonMode &mode)
Definition: convert.cpp:664
VkBlendFactor LITEFX_VULKAN_API getBlendFactor(const BlendFactor &blendFactor)
Definition: convert.cpp:918
VkStencilOp LITEFX_VULKAN_API getStencilOp(const StencilOperation &stencilOp)
Definition: convert.cpp:903
PrimitiveTopology LITEFX_VULKAN_API getPrimitiveTopology(const VkPrimitiveTopology &topology)
Definition: convert.cpp:728
VkBlendOp LITEFX_VULKAN_API getBlendOperation(const BlendOperation &blendOperation)
Definition: convert.cpp:944
CullMode LITEFX_VULKAN_API getCullMode(const VkCullModeFlags &mode)
Definition: convert.cpp:694
VkImageType LITEFX_VULKAN_API getImageType(const ImageDimensions &dimension)
Definition: convert.cpp:832
VkAccessFlags LITEFX_VULKAN_API getAccessFlags(const ResourceState &resourceState)
Definition: convert.cpp:974
void raiseIfFailed(HRESULT hr, StringView message, TArgs &&... args)
Definition: dx12_api.hpp:266
DEFINE_EXCEPTION(DX12PlatformException, std::runtime_error)
constexpr char VULKAN_LOG[]
Definition: vulkan_api.hpp:31
std::string String
Definition: string.hpp:19
std::vector< T > Array
Represents a dynamic array.
Definition: containers.hpp:58
std::span< T > Span
Represents a view of an array.
Definition: containers.hpp:72
std::string_view StringView
Definition: string.hpp:21
auto format(LiteFX::Platform t, FormatContext &ctx) const
Definition: app_formatters.hpp:8