16#ifndef AEONGAMES_VULKANWINDOW_HPP
17#define AEONGAMES_VULKANWINDOW_HPP
21#include <vulkan/vulkan.h>
24#include "VulkanMemoryPoolBuffer.hpp"
25#include "VulkanPipeline.hpp"
68 uint32_t aVertexStart = 0,
69 uint32_t aVertexCount = 0xffffffff,
70 uint32_t aInstanceCount = 1,
71 uint32_t aFirstInstance = 0 )
const;
83 void ResizeViewport ( int32_t aX, int32_t aY, uint32_t aWidth, uint32_t aHeight );
93 void InitializeSurface();
94 void InitializeSwapchain();
95 void InitializeImageViews();
96 void InitializeDepthStencil();
97 void InitializeRenderPass();
98 void InitializeFrameBuffers();
99 void InitializeCommandBuffer();
100 void InitializeMatrices();
101 void FinalizeSurface();
102 void FinalizeSwapchain();
103 void FinalizeImageViews();
104 void FinalizeDepthStencil();
105 void FinalizeRenderPass();
106 void FinalizeFrameBuffers();
107 void FinalizeCommandBuffer();
108 void FinalizeMatrices();
117 VkFormat mVkDepthStencilFormat{ VK_FORMAT_UNDEFINED };
118 VkSurfaceFormatKHR mVkSurfaceFormatKHR{};
119 VkRenderPass mVkRenderPass{ VK_NULL_HANDLE };
120 VkSurfaceKHR mVkSurfaceKHR{ VK_NULL_HANDLE };
121 VkSurfaceCapabilitiesKHR mVkSurfaceCapabilitiesKHR {};
122 uint32_t mSwapchainImageCount{ 2 };
123 VkSwapchainKHR mVkSwapchainKHR{ VK_NULL_HANDLE };
124 VkImage mVkDepthStencilImage{ VK_NULL_HANDLE };
125 VkDeviceMemory mVkDepthStencilImageMemory{ VK_NULL_HANDLE };
126 VkImageView mVkDepthStencilImageView { VK_NULL_HANDLE};
127 VkCommandPool mVkCommandPool{ VK_NULL_HANDLE };
128 VkCommandBuffer mVkCommandBuffer{ VK_NULL_HANDLE };
129 bool mHasStencil{
false };
130 uint32_t mActiveImageIndex{ UINT32_MAX };
131 VkViewport mVkViewport{0, 0, 1, 1, 0, 1};
132 VkRect2D mVkScissor{};
134 VkDescriptorPool mMatricesDescriptorPool{VK_NULL_HANDLE};
135 VkDescriptorSet mMatricesDescriptorSet{VK_NULL_HANDLE};
136 VkSemaphore mVkAcquireSemaphore{VK_NULL_HANDLE};
137 VkFence mVkFence{ VK_NULL_HANDLE };
139 ::std::vector<VkImage> mVkSwapchainImages{};
140 ::std::vector<VkImageView> mVkSwapchainImageViews{};
141 ::std::vector<VkFramebuffer> mVkFramebuffers{};
142 ::std::vector<VkSemaphore> mVkSubmitSemaphores{};
Header for the frustum class.
Header for 4x4 matrix class.
Provides access to a region within a memory pool buffer.
View frustum defined by six clipping planes, extracted from a projection (or view-projection) matrix.
Represents a surface material with uniform properties and texture samplers.
4 by 4 matrix in colum mayor order.
Represents a polygon mesh with vertex attributes and index data.
Rendering pipeline resource.
Vulkan GPU buffer wrapper implementing the Buffer interface.
Vulkan memory pool buffer for transient per-frame uniform allocations.
Vulkan rendering backend implementing the Renderer interface.
VkRenderPass GetRenderPass() const
Get the Vulkan render pass for this window.
void SetViewMatrix(const Matrix4x4 &aMatrix)
Set the view matrix for this window.
VulkanWindow(VulkanRenderer &aVulkanRenderer, void *aWindowId)
Construct from a renderer and native window handle.
BufferAccessor AllocateSingleFrameUniformMemory(size_t aSize)
Allocate transient uniform memory for the current frame.
void EndRender()
End the current frame, submit commands, and present.
const Matrix4x4 & GetProjectionMatrix() const
Get the current projection matrix.
VkCommandBuffer GetCommandBuffer() const
Get the current command buffer being recorded.
void ResizeViewport(int32_t aX, int32_t aY, uint32_t aWidth, uint32_t aHeight)
Resize the rendering viewport.
void Render(const Matrix4x4 &aModelMatrix, const Mesh &aMesh, const Pipeline &aPipeline, const Material *aMaterial=nullptr, const BufferAccessor *aSkeleton=nullptr, Topology aTopology=Topology::TRIANGLE_LIST, uint32_t aVertexStart=0, uint32_t aVertexCount=0xffffffff, uint32_t aInstanceCount=1, uint32_t aFirstInstance=0) const
Render a mesh with the given pipeline, material, and transform.
const Frustum & GetFrustum() const
Get the view frustum derived from the current matrices.
const Matrix4x4 & GetViewMatrix() const
Get the current view matrix.
void SetProjectionMatrix(const Matrix4x4 &aMatrix)
Set the projection matrix for this window.
<- This is here just for the literals
Topology
Primitive topology types for rendering.
@ TRIANGLE_LIST
Independent triangles.