Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
AeonGames::VulkanRenderer Class Referencefinal

Vulkan rendering backend implementing the Renderer interface. More...

#include <C:/Code/AeonEngine/engine/renderers/vulkan/VulkanRenderer.hpp>

Inheritance diagram for AeonGames::VulkanRenderer:
Inheritance graph
Collaboration diagram for AeonGames::VulkanRenderer:
Collaboration graph

Public Member Functions

 VulkanRenderer (void *aWindow)
 Construct from a native window handle.
const VkInstance & GetInstance () const
 Get the Vulkan instance handle.
const VkPhysicalDevice & GetPhysicalDevice () const
 Get the physical device handle.
const VkDevice & GetDevice () const
 Get the logical device handle.
const VkQueue & GetQueue () const
 Get the graphics queue handle.
const VkPhysicalDeviceProperties & GetPhysicalDeviceProperties () const
 Get the physical device properties.
const VkPhysicalDeviceMemoryProperties & GetPhysicalDeviceMemoryProperties () const
 Get the physical device memory properties.
const VkDescriptorSetLayout & GetDescriptorSetLayout (const VkDescriptorSetLayoutCreateInfo &aDescriptorSetLayoutCreateInfo) const
 Get or create a descriptor set layout matching the given create info.
uint32_t GetQueueFamilyIndex () const
 Get the queue family index used for graphics operations.
uint32_t GetMemoryTypeIndex (VkMemoryPropertyFlags aVkMemoryPropertyFlags) const
 Get a memory type index matching the requested property flags.
uint32_t FindMemoryTypeIndex (uint32_t typeFilter, VkMemoryPropertyFlags properties) const
 Find a memory type index matching both a type filter and property flags.
VkCommandBuffer BeginSingleTimeCommands () const
 Begin recording a single-use command buffer.
void EndSingleTimeCommands (VkCommandBuffer commandBuffer) const
 Submit and free a single-use command buffer.
void LoadMesh (const Mesh &aMesh) final
 Loads mesh data into GPU memory.
void UnloadMesh (const Mesh &aMesh) final
 Unloads mesh data from GPU memory.
void LoadPipeline (const Pipeline &aPipeline) final
 Loads a rendering pipeline (shaders and state) into the renderer.
void UnloadPipeline (const Pipeline &aPipeline) final
 Unloads a rendering pipeline from the renderer.
void LoadMaterial (const Material &aMaterial) final
 Loads material data into the renderer.
void UnloadMaterial (const Material &aMaterial) final
 Unloads material data from the renderer.
void LoadTexture (const Texture &aTexture) final
 Loads a texture into GPU memory.
void UnloadTexture (const Texture &aTexture) final
 Unloads a texture from GPU memory.
const VkDescriptorImageInfo * GetTextureDescriptorImageInfo (const Texture &aTexture) const
 Get the descriptor image info for a loaded texture.
void AttachWindow (void *aWindowId) final
 Attach a Window as a rendering surface.
void DetachWindow (void *aWindowId) final
 Detach a Window as a rendering surface.
void SetClearColor (void *aWindowId, float R, float G, float B, float A) final
 Sets the color to be used to clear the window background.
void SetProjectionMatrix (void *aWindowId, const Matrix4x4 &aMatrix) final
 Sets the projection matrix for a specific window surface.
void SetViewMatrix (void *aWindowId, const Matrix4x4 &aMatrix) final
 Sets the view matrix for a specific window surface.
void ResizeViewport (void *aWindowId, int32_t aX, int32_t aY, uint32_t aWidth, uint32_t aHeight) final
 Resizes the specific window surface's viewport.
void BeginRender (void *aWindowId) final
 Begins a render pass for the given window surface.
void EndRender (void *aWindowId) final
 Ends the current render pass for the given window surface.
void Render (void *aWindowId, 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 final
 Issues a draw call for a mesh with the given pipeline and optional material.
const FrustumGetFrustum (void *aWindowId) const final
 Returns the view frustum for the given window surface.
BufferAccessor AllocateSingleFrameUniformMemory (void *aWindowId, size_t aSize) final
 Allocates uniform buffer memory that is valid for a single frame.
VkRenderPass GetRenderPass () const
 Get the common Vulkan render pass.
const VulkanPipelineGetVulkanPipeline (const Pipeline &aPipeline)
 Get the cached VulkanPipeline for a Pipeline resource.
const VulkanMaterialGetVulkanMaterial (const Material &aMaterial)
 Get the cached VulkanMaterial for a Material resource.
const VulkanMeshGetVulkanMesh (const Mesh &aMesh)
 Get the cached VulkanMesh for a Mesh resource.
Public Member Functions inherited from AeonGames::Renderer
virtual DLL ~Renderer ()=0
 Virtual destructor.

Detailed Description

Vulkan rendering backend implementing the Renderer interface.

Definition at line 41 of file VulkanRenderer.hpp.

Constructor & Destructor Documentation

◆ VulkanRenderer()

AeonGames::VulkanRenderer::VulkanRenderer ( void * aWindow)

Construct from a native window handle.

Definition at line 46 of file VulkanRenderer.cpp.

◆ ~VulkanRenderer()

AeonGames::VulkanRenderer::~VulkanRenderer ( )
final

Definition at line 74 of file VulkanRenderer.cpp.

Member Function Documentation

◆ AllocateSingleFrameUniformMemory()

BufferAccessor AeonGames::VulkanRenderer::AllocateSingleFrameUniformMemory ( void * aWindowId,
size_t aSize )
finalvirtual

Allocates uniform buffer memory that is valid for a single frame.

Parameters
aWindowIdPlatform dependent window handle.
aSizeSize in bytes of the requested allocation.
Returns
A BufferAccessor to the allocated memory.

Implements AeonGames::Renderer.

Definition at line 968 of file VulkanRenderer.cpp.

◆ AttachWindow()

void AeonGames::VulkanRenderer::AttachWindow ( void * aWindowId)
finalvirtual

Attach a Window as a rendering surface.

Parameters
aWindowIdPlatform depended window handle.

Implements AeonGames::Renderer.

Definition at line 869 of file VulkanRenderer.cpp.

◆ BeginRender()

void AeonGames::VulkanRenderer::BeginRender ( void * aWindowId)
finalvirtual

Begins a render pass for the given window surface.

Parameters
aWindowIdPlatform dependent window handle.

Implements AeonGames::Renderer.

Definition at line 919 of file VulkanRenderer.cpp.

◆ BeginSingleTimeCommands()

VkCommandBuffer AeonGames::VulkanRenderer::BeginSingleTimeCommands ( ) const

Begin recording a single-use command buffer.

Definition at line 550 of file VulkanRenderer.cpp.

◆ DetachWindow()

void AeonGames::VulkanRenderer::DetachWindow ( void * aWindowId)
finalvirtual

Detach a Window as a rendering surface.

Parameters
aWindowIdPlatform depended window handle.

Implements AeonGames::Renderer.

Definition at line 879 of file VulkanRenderer.cpp.

◆ EndRender()

void AeonGames::VulkanRenderer::EndRender ( void * aWindowId)
finalvirtual

Ends the current render pass for the given window surface.

Parameters
aWindowIdPlatform dependent window handle.

Implements AeonGames::Renderer.

Definition at line 928 of file VulkanRenderer.cpp.

◆ EndSingleTimeCommands()

void AeonGames::VulkanRenderer::EndSingleTimeCommands ( VkCommandBuffer commandBuffer) const

Submit and free a single-use command buffer.

Definition at line 566 of file VulkanRenderer.cpp.

◆ FindMemoryTypeIndex()

uint32_t AeonGames::VulkanRenderer::FindMemoryTypeIndex ( uint32_t typeFilter,
VkMemoryPropertyFlags properties ) const

Find a memory type index matching both a type filter and property flags.

Definition at line 139 of file VulkanRenderer.cpp.

◆ GetDescriptorSetLayout()

const VkDescriptorSetLayout & AeonGames::VulkanRenderer::GetDescriptorSetLayout ( const VkDescriptorSetLayoutCreateInfo & aDescriptorSetLayoutCreateInfo) const

Get or create a descriptor set layout matching the given create info.

Definition at line 750 of file VulkanRenderer.cpp.

◆ GetDevice()

const VkDevice & AeonGames::VulkanRenderer::GetDevice ( ) const

Get the logical device handle.

Definition at line 93 of file VulkanRenderer.cpp.

◆ GetFrustum()

const Frustum & AeonGames::VulkanRenderer::GetFrustum ( void * aWindowId) const
finalvirtual

Returns the view frustum for the given window surface.

Parameters
aWindowIdPlatform dependent window handle.
Returns
A const reference to the current view frustum.

Implements AeonGames::Renderer.

Definition at line 957 of file VulkanRenderer.cpp.

◆ GetInstance()

const VkInstance & AeonGames::VulkanRenderer::GetInstance ( ) const

Get the Vulkan instance handle.

Definition at line 103 of file VulkanRenderer.cpp.

◆ GetMemoryTypeIndex()

uint32_t AeonGames::VulkanRenderer::GetMemoryTypeIndex ( VkMemoryPropertyFlags aVkMemoryPropertyFlags) const

Get a memory type index matching the requested property flags.

Definition at line 158 of file VulkanRenderer.cpp.

◆ GetPhysicalDevice()

const VkPhysicalDevice & AeonGames::VulkanRenderer::GetPhysicalDevice ( ) const

Get the physical device handle.

Definition at line 108 of file VulkanRenderer.cpp.

◆ GetPhysicalDeviceMemoryProperties()

const VkPhysicalDeviceMemoryProperties & AeonGames::VulkanRenderer::GetPhysicalDeviceMemoryProperties ( ) const

Get the physical device memory properties.

Definition at line 118 of file VulkanRenderer.cpp.

◆ GetPhysicalDeviceProperties()

const VkPhysicalDeviceProperties & AeonGames::VulkanRenderer::GetPhysicalDeviceProperties ( ) const

Get the physical device properties.

Definition at line 113 of file VulkanRenderer.cpp.

◆ GetQueue()

const VkQueue & AeonGames::VulkanRenderer::GetQueue ( ) const

Get the graphics queue handle.

Definition at line 98 of file VulkanRenderer.cpp.

◆ GetQueueFamilyIndex()

uint32_t AeonGames::VulkanRenderer::GetQueueFamilyIndex ( ) const

Get the queue family index used for graphics operations.

Definition at line 134 of file VulkanRenderer.cpp.

◆ GetRenderPass()

VkRenderPass AeonGames::VulkanRenderer::GetRenderPass ( ) const

Get the common Vulkan render pass.

Definition at line 123 of file VulkanRenderer.cpp.

◆ GetTextureDescriptorImageInfo()

const VkDescriptorImageInfo * AeonGames::VulkanRenderer::GetTextureDescriptorImageInfo ( const Texture & aTexture) const

Get the descriptor image info for a loaded texture.

Definition at line 736 of file VulkanRenderer.cpp.

◆ GetVulkanMaterial()

const VulkanMaterial * AeonGames::VulkanRenderer::GetVulkanMaterial ( const Material & aMaterial)

Get the cached VulkanMaterial for a Material resource.

Definition at line 634 of file VulkanRenderer.cpp.

◆ GetVulkanMesh()

const VulkanMesh * AeonGames::VulkanRenderer::GetVulkanMesh ( const Mesh & aMesh)

Get the cached VulkanMesh for a Mesh resource.

Definition at line 602 of file VulkanRenderer.cpp.

◆ GetVulkanPipeline()

const VulkanPipeline * AeonGames::VulkanRenderer::GetVulkanPipeline ( const Pipeline & aPipeline)

Get the cached VulkanPipeline for a Pipeline resource.

Definition at line 619 of file VulkanRenderer.cpp.

◆ LoadMaterial()

void AeonGames::VulkanRenderer::LoadMaterial ( const Material & aMaterial)
finalvirtual

Loads material data into the renderer.

Parameters
aMaterialThe material to load.

Implements AeonGames::Renderer.

Definition at line 676 of file VulkanRenderer.cpp.

◆ LoadMesh()

void AeonGames::VulkanRenderer::LoadMesh ( const Mesh & aMesh)
finalvirtual

Loads mesh data into GPU memory.

Parameters
aMeshThe mesh to load.

Implements AeonGames::Renderer.

Definition at line 578 of file VulkanRenderer.cpp.

◆ LoadPipeline()

void AeonGames::VulkanRenderer::LoadPipeline ( const Pipeline & aPipeline)
finalvirtual

Loads a rendering pipeline (shaders and state) into the renderer.

Parameters
aPipelineThe pipeline to load.

Implements AeonGames::Renderer.

Definition at line 650 of file VulkanRenderer.cpp.

◆ LoadTexture()

void AeonGames::VulkanRenderer::LoadTexture ( const Texture & aTexture)
finalvirtual

Loads a texture into GPU memory.

Parameters
aTextureThe texture to load.

Implements AeonGames::Renderer.

Definition at line 715 of file VulkanRenderer.cpp.

◆ Render()

void AeonGames::VulkanRenderer::Render ( void * aWindowId,
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
finalvirtual

Issues a draw call for a mesh with the given pipeline and optional material.

Parameters
aWindowIdPlatform dependent window handle.
aModelMatrixModel transformation matrix.
aMeshMesh to render.
aPipelinePipeline (shaders/state) to use.
aMaterialOptional material to bind.
aSkeletonOptional skeleton buffer for skinned meshes.
aTopologyPrimitive topology (default: TRIANGLE_LIST).
aVertexStartFirst vertex index.
aVertexCountNumber of vertices to draw (default: all).
aInstanceCountNumber of instances to draw.
aFirstInstanceIndex of the first instance.

Implements AeonGames::Renderer.

Definition at line 937 of file VulkanRenderer.cpp.

◆ ResizeViewport()

void AeonGames::VulkanRenderer::ResizeViewport ( void * aWindowId,
int32_t aX,
int32_t aY,
uint32_t aWidth,
uint32_t aHeight )
finalvirtual

Resizes the specific window surface's viewport.

Parameters
aWindowIdPlatform dependent window handle.
aXX coordinate of the viewport.
aYY coordinate of the viewport.
aWidthWidth of the viewport.
aHeightHeight of the viewport.

Implements AeonGames::Renderer.

Definition at line 909 of file VulkanRenderer.cpp.

◆ SetClearColor()

void AeonGames::VulkanRenderer::SetClearColor ( void * aWindowId,
float R,
float G,
float B,
float A )
finalvirtual

Sets the color to be used to clear the window background.

Parameters
aWindowIdPlatform depended window handle.
RRed component of the clear color.
GGreen component of the clear color.
BBlue component of the clear color.
AAlpha component of the clear color.
Todo
finish this

Implements AeonGames::Renderer.

Definition at line 979 of file VulkanRenderer.cpp.

◆ SetProjectionMatrix()

void AeonGames::VulkanRenderer::SetProjectionMatrix ( void * aWindowId,
const Matrix4x4 & aMatrix )
finalvirtual

Sets the projection matrix for a specific window surface.

Parameters
aWindowIdPlatform depended window handle.
aMatrixThe projection matrix.

Implements AeonGames::Renderer.

Definition at line 889 of file VulkanRenderer.cpp.

◆ SetViewMatrix()

void AeonGames::VulkanRenderer::SetViewMatrix ( void * aWindowId,
const Matrix4x4 & aMatrix )
finalvirtual

Sets the view matrix for a specific window surface.

Parameters
aWindowIdPlatform depended window handle.
aMatrixThe view matrix.

Implements AeonGames::Renderer.

Definition at line 899 of file VulkanRenderer.cpp.

◆ UnloadMaterial()

void AeonGames::VulkanRenderer::UnloadMaterial ( const Material & aMaterial)
finalvirtual

Unloads material data from the renderer.

Parameters
aMaterialThe material to unload.

Implements AeonGames::Renderer.

Definition at line 696 of file VulkanRenderer.cpp.

◆ UnloadMesh()

void AeonGames::VulkanRenderer::UnloadMesh ( const Mesh & aMesh)
finalvirtual

Unloads mesh data from GPU memory.

Parameters
aMeshThe mesh to unload.

Implements AeonGames::Renderer.

Definition at line 593 of file VulkanRenderer.cpp.

◆ UnloadPipeline()

void AeonGames::VulkanRenderer::UnloadPipeline ( const Pipeline & aPipeline)
finalvirtual

Unloads a rendering pipeline from the renderer.

Parameters
aPipelineThe pipeline to unload.

Implements AeonGames::Renderer.

Definition at line 661 of file VulkanRenderer.cpp.

◆ UnloadTexture()

void AeonGames::VulkanRenderer::UnloadTexture ( const Texture & aTexture)
finalvirtual

Unloads a texture from GPU memory.

Parameters
aTextureThe texture to unload.

Implements AeonGames::Renderer.

Definition at line 726 of file VulkanRenderer.cpp.


The documentation for this class was generated from the following files: