Vookoo
Public Types | Public Member Functions | Static Public Member Functions | List of all members
vku::Window Class Reference

This class wraps a window, a surface and a swap chain for that surface. More...

#include <vku_framework.hpp>

Public Types

typedef void( renderFunc_t) (vk::CommandBuffer cb, int imageIndex, vk::RenderPassBeginInfo &rpbi)
 

Public Member Functions

 Window (const vk::Instance &instance, const vk::Device &device, const vk::PhysicalDevice &physicalDevice, uint32_t graphicsQueueFamilyIndex, GLFWwindow *window)
 Construct a window, surface and swapchain using a GLFW window.
 
 Window (const vk::Instance &instance, const vk::Device &device, const vk::PhysicalDevice &physicalDevice, uint32_t graphicsQueueFamilyIndex, vk::SurfaceKHR surface)
 
void init (const vk::Instance &instance, const vk::Device &device, const vk::PhysicalDevice &physicalDevice, uint32_t graphicsQueueFamilyIndex, vk::SurfaceKHR surface)
 
void dumpCaps (std::ostream &os, vk::PhysicalDevice pd) const
 Dump the capabilities of the physical device used by this window.
 
void setStaticCommands (const std::function< renderFunc_t > &func)
 Build a static draw buffer. This will be rendered after any dynamic content generated in draw()
 
void draw (const vk::Device &device, const vk::Queue &graphicsQueue, const std::function< void(vk::CommandBuffer cb, int imageIndex, vk::RenderPassBeginInfo &rpbi)> &dynamic=defaultRenderFunc)
 
uint32_t presentQueueFamily () const
 Return the queue family index used to present the surface to the display.
 
const vk::Queue presentQueue () const
 Get the queue used to submit graphics jobs.
 
bool ok () const
 Return true if this window was created sucessfully.
 
vk::RenderPass renderPass () const
 Return the renderpass used by this window.
 
const std::vector< vk::UniqueFramebuffer > & framebuffers () const
 Return the frame buffers used by this window.
 
 ~Window ()
 Destroy resources when shutting down.
 
Windowoperator= (Window &&rhs)=default
 
uint32_t width () const
 Return the width of the display.
 
uint32_t height () const
 Return the height of the display.
 
vk::Format swapchainImageFormat () const
 Return the format of the back buffer.
 
vk::ColorSpaceKHR swapchainColorSpace () const
 Return the colour space of the back buffer (Usually sRGB)
 
const vk::SwapchainKHR swapchain () const
 Return the swapchain object.
 
const std::vector< vk::ImageView > & imageViews () const
 Return the views of the swap chain images.
 
const std::vector< vk::Image > & images () const
 Return the swap chain images.
 
const std::vector< vk::UniqueCommandBuffer > & commandBuffers () const
 Return the static command buffers.
 
const std::vector< vk::Fence > & commandBufferFences () const
 Return the fences used to control the static buffers.
 
vk::Semaphore imageAcquireSemaphore () const
 Return the semaphore signalled when an image is acquired.
 
vk::Semaphore commandCompleteSemaphore () const
 Return the semaphore signalled when the command buffers are finished.
 
vk::CommandPool commandPool () const
 Return a defult command Pool to use to create new command buffers.
 
int numImageIndices () const
 Return the number of swap chain images.
 

Static Public Member Functions

static void defaultRenderFunc (vk::CommandBuffer cb, int imageIndex, vk::RenderPassBeginInfo &rpbi)
 

Detailed Description

This class wraps a window, a surface and a swap chain for that surface.

Member Function Documentation

void vku::Window::draw ( const vk::Device &  device,
const vk::Queue &  graphicsQueue,
const std::function< void(vk::CommandBuffer cb, int imageIndex, vk::RenderPassBeginInfo &rpbi)> &  dynamic = defaultRenderFunc 
)
inline

Queue the static command buffer for the next image in the swap chain. Optionally call a function to create a dynamic command buffer for uploading textures, changing uniforms etc.


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