vOOlkan
An object oriented approach to Vulkan
Vulkan::Drawer Class Reference

A Drawer is a class which holds all of the resources to draw frames on screen, such as the synchronization primitives, the framebuffers, the swapchain, ... and the function to actually draw a frame. More...

#include <Drawer.h>

Public Member Functions

 Drawer (const LogicalDevice &virtualGpu, const PhysicalDevice &realGpu, const Window &window, const WindowSurface &windowSurface, Swapchain &swapchain, DepthImage &depthBuffer, const CommandBufferPool &commandBufferPool, const PipelineOptions::RenderPass &renderPass, std::vector< Pipeline * > pipelines, const std::vector< std::reference_wrapper< StaticSet > > &globalSets, const std::vector< std::reference_wrapper< DynamicSet > > &perObjectSets, unsigned int framesInFlight=2)
 Creates all the resources needed to draw something on screen. More...
 
template<template< typename, typename >class... P>
requires (std::same_as<P<int, int>, std::pair<int, int>> && ...)
void draw (const P< std::reference_wrapper< Buffers::VertexBuffer >, std::reference_wrapper< Buffers::IndexBuffer > > &... buffers)
 Draws the vertexBuffer by running the specified commands. More...
 

Detailed Description

A Drawer is a class which holds all of the resources to draw frames on screen, such as the synchronization primitives, the framebuffers, the swapchain, ... and the function to actually draw a frame.

Constructor & Destructor Documentation

◆ Drawer()

Vulkan::Drawer::Drawer ( const LogicalDevice virtualGpu,
const PhysicalDevice realGpu,
const Window window,
const WindowSurface windowSurface,
Swapchain swapchain,
DepthImage depthBuffer,
const CommandBufferPool commandBufferPool,
const PipelineOptions::RenderPass renderPass,
std::vector< Pipeline * >  pipelines,
const std::vector< std::reference_wrapper< StaticSet > > &  globalSets,
const std::vector< std::reference_wrapper< DynamicSet > > &  perObjectSets,
unsigned int  framesInFlight = 2 
)
inline

Creates all the resources needed to draw something on screen.

These resources more specifically are: Swapchain, Framebuffer(s), CommandBufferPool, COmmandBuffer(s), Fence(s), Semaphore(s).

Parameters
virtualGpuThe LogicalDevice.
realGpuThe PhysiscalDevice.
windowThe Window ehre to draw.
windowSurfaceThe WindowSurface of the window (also serves to poll for window resizes and such).
renderPassHow to draw a frame.
pipelineThe stages to draw a frame.
framesInFlightHow many frames can be rendered concurrently.

Member Function Documentation

◆ draw()

template<template< typename, typename >class... P>
requires (std::same_as<P<int, int>, std::pair<int, int>> && ...)
void Vulkan::Drawer::draw ( const P< std::reference_wrapper< Buffers::VertexBuffer >, std::reference_wrapper< Buffers::IndexBuffer > > &...  buffers)
inline

Draws the vertexBuffer by running the specified commands.

Parameters
vertexBufferVertices to draw.
...commandsVulkan Functions to execute on the vertices.
Template Parameters
...ArgsThe types of the arguments to pass to each Vulkan function.
...CommandThe tuples, each containing the Vulkan function and its arguments (of type ...Args).

Draws the vertexBuffer.

This function will simply bind the vertex buffer (vertexBuffer) and then draw it.

Parameters
vertexBufferVertices to draw.
indexBufferIndeces of the vertices to draw (for indexed drawing).

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