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
 
GraphicsPipelineHandle createGraphicsPipeline (const GraphicsPipelineConfig &config)
 
ComputePipelineHandle createComputePipeline (const ComputePipelineConfig &config)
 
PassHandle createPass (const PassConfig &config)
 
template<typename T >
Buffer< T > createBuffer (vkcv::BufferType type, size_t count, BufferMemoryType memoryType=BufferMemoryType::DEVICE_LOCAL, bool supportIndirect=false)
 
SamplerHandle createSampler (SamplerFilterType magFilter, SamplerFilterType minFilter, SamplerMipmapMode mipmapMode, SamplerAddressMode addressMode, float mipLodBias=0.0f)
 
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)
 
WindowHandle createWindow (const char *applicationName, uint32_t windowWidth, uint32_t windowHeight, bool resizeable)
 
WindowgetWindow (const WindowHandle &handle)
 
SwapchaingetSwapchainOfCurrentWindow ()
 
SwapchaingetSwapchain (const SwapchainHandle &handle)
 
SwapchaingetSwapchain (const WindowHandle &handle)
 
uint32_t getImageWidth (const ImageHandle &image)
 
uint32_t getImageHeight (const ImageHandle &image)
 
vk::Format getImageFormat (const ImageHandle &image)
 
DescriptorSetLayoutHandle createDescriptorSetLayout (const std::unordered_map< uint32_t, DescriptorBinding > &bindingsMap)
 
DescriptorSetLayout getDescriptorSetLayout (const DescriptorSetLayoutHandle handle) const
 
DescriptorSetHandle createDescriptorSet (const DescriptorSetLayoutHandle &layoutHandle)
 
void writeDescriptorSet (DescriptorSetHandle handle, const DescriptorWrites &writes)
 
DescriptorSet getDescriptorSet (const DescriptorSetHandle handle) const
 
bool beginFrame (uint32_t &width, uint32_t &height, const WindowHandle &windowHandle)
 start recording command buffers and increment frame index
 
void recordDrawcallsToCmdStream (const CommandStreamHandle &cmdStreamHandle, const PassHandle &renderpassHandle, const GraphicsPipelineHandle &pipelineHandle, const PushConstants &pushConstants, const std::vector< DrawcallInfo > &drawcalls, const std::vector< ImageHandle > &renderTargets, const WindowHandle &windowHandle)
 
void recordIndexedIndirectDrawcallsToCmdStream (const CommandStreamHandle cmdStreamHandle, const PassHandle renderpassHandle, const GraphicsPipelineHandle &pipelineHandle, const PushConstants &pushConstantData, const vkcv::DescriptorSetHandle &compiledDescriptorSet, const vkcv::Mesh &compiledMesh, const std::vector< ImageHandle > &renderTargets, const vkcv::Buffer< vk::DrawIndexedIndirectCommand > &indirectBuffer, const uint32_t drawCount, const WindowHandle &windowHandle)
 
void recordMeshShaderDrawcalls (const CommandStreamHandle &cmdStreamHandle, const PassHandle &renderpassHandle, const GraphicsPipelineHandle &pipelineHandle, const PushConstants &pushConstantData, const std::vector< MeshShaderDrawcall > &drawcalls, const std::vector< ImageHandle > &renderTargets, const WindowHandle &windowHandle)
 
void recordRayGenerationToCmdStream (CommandStreamHandle cmdStreamHandle, vk::Pipeline rtxPipeline, vk::PipelineLayout rtxPipelineLayout, vk::StridedDeviceAddressRegionKHR rgenRegion, vk::StridedDeviceAddressRegionKHR rmissRegion, vk::StridedDeviceAddressRegionKHR rchitRegion, vk::StridedDeviceAddressRegionKHR rcallRegion, const std::vector< DescriptorSetUsage > &descriptorSetUsages, const PushConstants &pushConstants, const WindowHandle windowHandle)
 
void recordComputeDispatchToCmdStream (CommandStreamHandle cmdStream, ComputePipelineHandle computePipeline, const uint32_t dispatchCount[3], const std::vector< DescriptorSetUsage > &descriptorSetUsages, const PushConstants &pushConstants)
 
void recordBeginDebugLabel (const CommandStreamHandle &cmdStream, const std::string &label, const std::array< float, 4 > &color)
 
void recordEndDebugLabel (const CommandStreamHandle &cmdStream)
 
void recordComputeIndirectDispatchToCmdStream (const CommandStreamHandle cmdStream, const ComputePipelineHandle computePipeline, const vkcv::BufferHandle buffer, const size_t bufferArgOffset, const std::vector< DescriptorSetUsage > &descriptorSetUsages, const PushConstants &pushConstants)
 
void endFrame (const WindowHandle &windowHandle)
 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 prepareImageForAttachmentManually (const vk::CommandBuffer &cmdBuffer, const ImageHandle &image)
 
void updateImageLayoutManual (const vkcv::ImageHandle &image, const vk::ImageLayout layout)
 
void recordImageMemoryBarrier (const CommandStreamHandle &cmdStream, const ImageHandle &image)
 
void recordBufferMemoryBarrier (const CommandStreamHandle &cmdStream, const BufferHandle &buffer)
 
void resolveMSAAImage (const CommandStreamHandle &cmdStream, const ImageHandle &src, const ImageHandle &dst)
 
vk::ImageView getSwapchainImageView () const
 
void recordMemoryBarrier (const CommandStreamHandle &cmdStream)
 
void recordBlitImage (const CommandStreamHandle &cmdStream, const ImageHandle &src, const ImageHandle &dst, SamplerFilterType filterType)
 
void setDebugLabel (const BufferHandle &handle, const std::string &label)
 
void setDebugLabel (const PassHandle &handle, const std::string &label)
 
void setDebugLabel (const GraphicsPipelineHandle &handle, const std::string &label)
 
void setDebugLabel (const ComputePipelineHandle &handle, const std::string &label)
 
void setDebugLabel (const DescriptorSetHandle &handle, const std::string &label)
 
void setDebugLabel (const SamplerHandle &handle, const std::string &label)
 
void setDebugLabel (const ImageHandle &handle, const std::string &label)
 
void setDebugLabel (const CommandStreamHandle &handle, const std::string &label)
 

Static Public Member Functions

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

Private Member Functions

 Core (Context &&context, const CommandResources &commandResources, const SyncResources &syncResources) noexcept
 
Result acquireSwapchainImage (const SwapchainHandle &swapchainHandle)
 
void setSwapchainImages (SwapchainHandle handle)
 

Private Attributes

Context m_Context
 
std::unique_ptr< PassManagerm_PassManager
 
std::unique_ptr< GraphicsPipelineManagerm_PipelineManager
 
std::unique_ptr< ComputePipelineManagerm_ComputePipelineManager
 
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
 
std::unique_ptr< WindowManagerm_WindowManager
 
std::unique_ptr< SwapchainManagerm_SwapchainManager
 
CommandResources m_CommandResources
 
SyncResources m_SyncResources
 
uint32_t m_currentSwapchainImageIndex
 

Detailed Description

Constructor & Destructor Documentation

◆ Core() [1/3]

vkcv::Core::Core ( Context &&  context,
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.

◆ 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 ( const char *  applicationName,
uint32_t  applicationVersion,
const std::vector< vk::QueueFlagBits > &  queueFlags = {},
const Features features = {},
const std::vector< const char * > &  instanceExtensions = {} 
)
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

◆ createBuffer()

template<typename T >
Buffer<T> vkcv::Core::createBuffer ( vkcv::BufferType  type,
size_t  count,
BufferMemoryType  memoryType = BufferMemoryType::DEVICE_LOCAL,
bool  supportIndirect = false 
)
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()

ComputePipelineHandle vkcv::Core::createComputePipeline ( const ComputePipelineConfig config)

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
configContains the compiles compute shader and the corresponding descriptor set layout
Returns
True if pipeline creation was successful, False if not

◆ createDescriptorSet()

DescriptorSetHandle vkcv::Core::createDescriptorSet ( const DescriptorSetLayoutHandle layoutHandle)

TODO:

Parameters
setDescriptions
Returns

◆ createDescriptorSetLayout()

DescriptorSetLayoutHandle vkcv::Core::createDescriptorSetLayout ( const std::unordered_map< uint32_t, DescriptorBinding > &  bindingsMap)

TODO:

Parameters
bindings
Returns

◆ createGraphicsPipeline()

GraphicsPipelineHandle vkcv::Core::createGraphicsPipeline ( const GraphicsPipelineConfig 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,
float  mipLodBias = 0.0f 
)

Creates a Sampler with given attributes.

Parameters
magFilterMagnifying filter
minFilterMinimizing filter
mipmapModeMipmapping filter
addressModeAddress mode
mipLodBiasMip level of detail bias
Returns
Sampler handle

◆ createWindow()

WindowHandle vkcv::Core::createWindow ( const char *  applicationName,
uint32_t  windowWidth,
uint32_t  windowHeight,
bool  resizeable 
)

creates a new window and returns it's handle

Parameters
applicationNamewindow name
windowWidth
windowHeight
resizeableresizeability bool
Returns
windowHandle

◆ getImageFormat()

vk::Format vkcv::Core::getImageFormat ( const ImageHandle image)

returns the image format of the image

Parameters
imagehandle
Returns
imageFormat

◆ getImageHeight()

uint32_t vkcv::Core::getImageHeight ( const ImageHandle image)

returns the image height

Parameters
imagehandle
Returns
imageHeight

◆ getImageWidth()

uint32_t vkcv::Core::getImageWidth ( const ImageHandle image)

returns the image width

Parameters
imagehandle
Returns
imageWidth

◆ getSwapchain() [1/2]

Swapchain & vkcv::Core::getSwapchain ( const SwapchainHandle handle)

returns the swapchain reference

Parameters
handleof the swapchain
Returns
swapchain

References vkcv::Swapchain::getSwapchain().

Referenced by vkcv::gui::GUI::beginGUI(), vkcv::gui::GUI::endGUI(), and vkcv::gui::GUI::GUI().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSwapchain() [2/2]

Swapchain & vkcv::Core::getSwapchain ( const WindowHandle handle)

gets the swapchain handle from the window

Parameters
handleof the window
Returns
the swapchain from getSwapchain( SwapchainHandle )

◆ getSwapchainOfCurrentWindow()

Swapchain & vkcv::Core::getSwapchainOfCurrentWindow ( )

gets the swapchain of the current focused window

Returns
swapchain

References vkcv::Swapchain::getSwapchain().

Here is the call graph for this function:

◆ getWindow()

Window & vkcv::Core::getWindow ( const WindowHandle handle)

getter for window reference

Parameters
handleof the window
Returns
the window

References vkcv::Window::getWindow().

Referenced by vkcv::gui::GUI::GUI(), recordRayGenerationToCmdStream(), and vkcv::gui::GUI::~GUI().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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

◆ recordRayGenerationToCmdStream()

void vkcv::Core::recordRayGenerationToCmdStream ( CommandStreamHandle  cmdStreamHandle,
vk::Pipeline  rtxPipeline,
vk::PipelineLayout  rtxPipelineLayout,
vk::StridedDeviceAddressRegionKHR  rgenRegion,
vk::StridedDeviceAddressRegionKHR  rmissRegion,
vk::StridedDeviceAddressRegionKHR  rchitRegion,
vk::StridedDeviceAddressRegionKHR  rcallRegion,
const std::vector< DescriptorSetUsage > &  descriptorSetUsages,
const PushConstants pushConstants,
const WindowHandle  windowHandle 
)

Records the rtx ray generation to the cmdStreamHandle. Currently only supports closestHit, rayGen and miss shaderstages .

Parameters
cmdStreamHandleThe command stream handle which receives relevant commands for drawing.
rtxPipelineThe raytracing pipeline from the RTXModule.
rtxPipelineLayoutThe raytracing pipeline layout from the RTXModule.
rgenRegionThe shader binding table region for ray generation shaders.
rmissRegionThe shader binding table region for ray miss shaders.
rchitRegionThe shader binding table region for ray closest hit shaders.
rcallRegionThe shader binding table region for callable shaders.
descriptorSetUsagesThe descriptor set usages.
pushConstantsThe push constants.
windowHandleThe window handle defining in which window to render.

References getWindow().

Here is the call graph for this function:

◆ setSwapchainImages()

void vkcv::Core::setSwapchainImages ( SwapchainHandle  handle)
private

sets up swapchain images

Parameters
swapchainHandlesof swapchain

References vkcv::Swapchain::getExtent(), vkcv::Swapchain::getFormat(), and vkcv::Swapchain::getSwapchain().

Referenced by beginFrame().

Here is the call graph for this function:
Here is the caller graph for this function:

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