VkCV Framework  0.0.1
CV Vulkan framework
vkcv::Core Class Referencefinal
Collaboration diagram for vkcv::Core:

Public Member Functions

 ~Core () noexcept
 
 Core (const Core &other)=delete
 
 Core (Core &&other)=delete
 
Coreoperator= (const Core &other)=delete
 
Coreoperator= (Core &&other)=delete
 
const ContextgetContext () const
 
const SwapchaingetSwapchain () const
 
PipelineHandle createGraphicsPipeline (const PipelineConfig &config)
 
PipelineHandle createComputePipeline (const ShaderProgram &config, const std::vector< vk::DescriptorSetLayout > &descriptorSetLayouts)
 
PassHandle createPass (const PassConfig &config)
 
template<typename T >
Buffer< T > createBuffer (vkcv::BufferType type, size_t count, BufferMemoryType memoryType=BufferMemoryType::DEVICE_LOCAL)
 
SamplerHandle createSampler (SamplerFilterType magFilter, SamplerFilterType minFilter, SamplerMipmapMode mipmapMode, SamplerAddressMode addressMode)
 
Image createImage (vk::Format format, uint32_t width, uint32_t height, uint32_t depth=1, bool createMipChain=false, bool supportStorage=false, bool supportColorAttachment=false, Multisampling multisampling=Multisampling::None)
 
const uint32_t getImageWidth (ImageHandle imageHandle)
 
const uint32_t getImageHeight (ImageHandle imageHandle)
 
DescriptorSetHandle createDescriptorSet (const std::vector< DescriptorBinding > &bindings)
 
void writeDescriptorSet (DescriptorSetHandle handle, const DescriptorWrites &writes)
 
DescriptorSet getDescriptorSet (const DescriptorSetHandle handle) const
 
bool beginFrame (uint32_t &width, uint32_t &height)
 start recording command buffers and increment frame index
 
void recordDrawcallsToCmdStream (const CommandStreamHandle cmdStreamHandle, const PassHandle renderpassHandle, const PipelineHandle pipelineHandle, const PushConstantData &pushConstantData, const std::vector< DrawcallInfo > &drawcalls, const std::vector< ImageHandle > &renderTargets)
 
void recordComputeDispatchToCmdStream (CommandStreamHandle cmdStream, PipelineHandle computePipeline, const uint32_t dispatchCount[3], const std::vector< DescriptorSetUsage > &descriptorSetUsages, const PushConstantData &pushConstantData)
 
void endFrame ()
 end recording and present image
 
void recordAndSubmitCommandsImmediate (const SubmitInfo &submitInfo, const RecordCommandFunction &record, const FinishCommandFunction &finish)
 
CommandStreamHandle createCommandStream (QueueType queueType)
 
void recordCommandsToStream (const CommandStreamHandle cmdStreamHandle, const RecordCommandFunction &record, const FinishCommandFunction &finish)
 
void submitCommandStream (const CommandStreamHandle handle)
 
void prepareSwapchainImageForPresent (const CommandStreamHandle handle)
 
void prepareImageForSampling (const CommandStreamHandle cmdStream, const ImageHandle image)
 
void prepareImageForStorage (const CommandStreamHandle cmdStream, const ImageHandle image)
 
void recordImageMemoryBarrier (const CommandStreamHandle cmdStream, const ImageHandle image)
 
void recordBufferMemoryBarrier (const CommandStreamHandle cmdStream, const BufferHandle buffer)
 
void resolveMSAAImage (CommandStreamHandle cmdStream, ImageHandle src, ImageHandle dst)
 
vk::ImageView getSwapchainImageView () const
 

Static Public Member Functions

static Core create (Window &window, const char *applicationName, uint32_t applicationVersion, std::vector< vk::QueueFlagBits > queueFlags={}, std::vector< const char * > instanceExtensions={}, std::vector< const char * > deviceExtensions={})
 

Private Member Functions

 Core (Context &&context, Window &window, const Swapchain &swapChain, std::vector< vk::ImageView > imageViews, const CommandResources &commandResources, const SyncResources &syncResources) noexcept
 
Result acquireSwapchainImage ()
 

Private Attributes

Context m_Context
 
Swapchain m_swapchain
 
Windowm_window
 
std::unique_ptr< PassManagerm_PassManager
 
std::unique_ptr< PipelineManagerm_PipelineManager
 
std::unique_ptr< DescriptorManagerm_DescriptorManager
 
std::unique_ptr< BufferManagerm_BufferManager
 
std::unique_ptr< SamplerManagerm_SamplerManager
 
std::unique_ptr< ImageManagerm_ImageManager
 
std::unique_ptr< CommandStreamManagerm_CommandStreamManager
 
CommandResources m_CommandResources
 
SyncResources m_SyncResources
 
uint32_t m_currentSwapchainImageIndex
 
event_handle< int, int > e_resizeHandle
 

Detailed Description

Constructor & Destructor Documentation

◆ Core() [1/3]

vkcv::Core::Core ( Context &&  context,
Window window,
const Swapchain swapChain,
std::vector< vk::ImageView >  imageViews,
const CommandResources commandResources,
const SyncResources syncResources 
)
privatenoexcept

Constructor of Core requires an context.

Parameters
contextencapsulates various Vulkan objects

◆ ~Core()

vkcv::Core::~Core ( )
noexcept

Destructor of Core destroys the Vulkan objects contained in the core's context.

References vkcv::Swapchain::getSurface(), vkcv::Swapchain::getSwapchain(), and vkcv::event< T >::remove().

Here is the call graph for this function:

◆ Core() [2/3]

vkcv::Core::Core ( const Core other)
delete

Copy-constructor of Core is deleted!

Parameters
otherOther instance of #Context

◆ Core() [3/3]

vkcv::Core::Core ( Core &&  other)
delete

Move-constructor of Core uses default behavior!

Parameters
otherOther instance of #Context

Member Function Documentation

◆ create()

Core vkcv::Core::create ( Window window,
const char *  applicationName,
uint32_t  applicationVersion,
std::vector< vk::QueueFlagBits >  queueFlags = {},
std::vector< const char * >  instanceExtensions = {},
std::vector< const char * >  deviceExtensions = {} 
)
static

Creates a Core with given applicationName and applicationVersion for your application.

It is also possible to require a specific amount of queues, ask for specific queue-flags or extensions. This function will take care of the required arguments as best as possible.

To pass a valid version for your application, you should use #VK_MAKE_VERSION().

Parameters
[in]applicationNameName of the application
[in]applicationVersionVersion of the application
[in]queueFlags(optional) Requested flags of queues
[in]instanceExtensions(optional) Requested instance extensions
[in]deviceExtensions(optional) Requested device extensions
Returns
New instance of #Context

References vkcv::Swapchain::create(), and vkcv::Swapchain::getSwapchain().

Here is the call graph for this function:

◆ createBuffer()

template<typename T >
Buffer<T> vkcv::Core::createBuffer ( vkcv::BufferType  type,
size_t  count,
BufferMemoryType  memoryType = BufferMemoryType::DEVICE_LOCAL 
)
inline

Creates a #Buffer with data-type T and bufferType

Parameters
typeType of Buffer created
countCount of elements of type T
memoryTypeType of Buffers memory return Buffer-Object

◆ createComputePipeline()

PipelineHandle vkcv::Core::createComputePipeline ( const ShaderProgram config,
const std::vector< vk::DescriptorSetLayout > &  descriptorSetLayouts 
)

Creates a basic vulkan compute pipeline using shader program and returns it using the handle. Fixed Functions for pipeline are set with standard values.

Parameters
shaderprogram that hold the compiles compute shader
handlea handle to return the created vulkan handle
Returns
True if pipeline creation was successful, False if not

◆ createDescriptorSet()

DescriptorSetHandle vkcv::Core::createDescriptorSet ( const std::vector< DescriptorBinding > &  bindings)

TODO:

Parameters
setDescriptions
Returns

◆ createGraphicsPipeline()

PipelineHandle vkcv::Core::createGraphicsPipeline ( const PipelineConfig config)

Creates a basic vulkan graphics pipeline using config from the pipeline config class and returns it using the handle. Fixed Functions for pipeline are set with standard values.

Parameters
configa pipeline config object from the pipeline config class
handlea handle to return the created vulkan handle
Returns
True if pipeline creation was successful, False if not

◆ createImage()

Image vkcv::Core::createImage ( vk::Format  format,
uint32_t  width,
uint32_t  height,
uint32_t  depth = 1,
bool  createMipChain = false,
bool  supportStorage = false,
bool  supportColorAttachment = false,
Multisampling  multisampling = Multisampling::None 
)

Creates an #Image with a given format, width, height and depth.

Parameters
formatImage format
widthImage width
heightImage height
depthImage depth
Returns
Image-Object

◆ createPass()

PassHandle vkcv::Core::createPass ( const PassConfig config)

Creates a basic vulkan render pass using config from the render pass config class and returns it using the handle. Fixed Functions for pipeline are set with standard values.

Parameters
configa render pass config object from the render pass config class
handlea handle to return the created vulkan handle
Returns
True if render pass creation was successful, False if not

◆ createSampler()

SamplerHandle vkcv::Core::createSampler ( SamplerFilterType  magFilter,
SamplerFilterType  minFilter,
SamplerMipmapMode  mipmapMode,
SamplerAddressMode  addressMode 
)

Creates a Sampler with given attributes.

Parameters
magFilterMagnifying filter
minFilterMinimizing filter
mipmapModeMipmapping filter
addressModeAddress mode
Returns
Sampler handle

◆ operator=() [1/2]

Core& vkcv::Core::operator= ( const Core other)
delete

Copy assignment operator of Core is deleted!

Parameters
otherOther instance of #Context
Returns
Reference to itself

◆ operator=() [2/2]

Core& vkcv::Core::operator= ( Core &&  other)
delete

Move assignment operator of Core uses default behavior!

Parameters
otherOther instance of #Context
Returns
Reference to itself

◆ recordAndSubmitCommandsImmediate()

void vkcv::Core::recordAndSubmitCommandsImmediate ( const SubmitInfo submitInfo,
const RecordCommandFunction &  record,
const FinishCommandFunction &  finish 
)

Submit a command buffer to any queue of selected type. The recording can be customized by a custom record-command-function. If the command submission has finished, an optional finish-function will be called.

Parameters
submitInfoSubmit information
recordRecord-command-function
finishFinish-command-function or nullptr

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