VkCV Framework
0.0.1
CV Vulkan framework
|
Public Member Functions | |
~Core () noexcept | |
Core (const Core &other)=delete | |
Core (Core &&other)=delete | |
Core & | operator= (const Core &other)=delete |
Core & | operator= (Core &&other)=delete |
const Context & | getContext () 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) |
Window & | getWindow (const WindowHandle &handle) |
Swapchain & | getSwapchainOfCurrentWindow () |
Swapchain & | getSwapchain (const SwapchainHandle &handle) |
Swapchain & | getSwapchain (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< PassManager > | m_PassManager |
std::unique_ptr< GraphicsPipelineManager > | m_PipelineManager |
std::unique_ptr< ComputePipelineManager > | m_ComputePipelineManager |
std::unique_ptr< DescriptorManager > | m_DescriptorManager |
std::unique_ptr< BufferManager > | m_BufferManager |
std::unique_ptr< SamplerManager > | m_SamplerManager |
std::unique_ptr< ImageManager > | m_ImageManager |
std::unique_ptr< CommandStreamManager > | m_CommandStreamManager |
std::unique_ptr< WindowManager > | m_WindowManager |
std::unique_ptr< SwapchainManager > | m_SwapchainManager |
CommandResources | m_CommandResources |
SyncResources | m_SyncResources |
uint32_t | m_currentSwapchainImageIndex |
|
privatenoexcept |
Constructor of Core requires an context
.
context | encapsulates various Vulkan objects |
|
noexcept |
Destructor of Core destroys the Vulkan objects contained in the core's context.
|
delete |
Copy-constructor of Core is deleted!
other | Other instance of #Context |
|
delete |
Move-constructor of Core uses default behavior!
other | Other instance of #Context |
|
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().
[in] | applicationName | Name of the application |
[in] | applicationVersion | Version of the application |
[in] | queueFlags | (optional) Requested flags of queues |
[in] | instanceExtensions | (optional) Requested instance extensions |
[in] | deviceExtensions | (optional) Requested device extensions |
|
inline |
Creates a #Buffer with data-type T and bufferType
type | Type of Buffer created |
count | Count of elements of type T |
memoryType | Type of Buffers memory return Buffer-Object |
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.
config | Contains the compiles compute shader and the corresponding descriptor set layout |
DescriptorSetHandle vkcv::Core::createDescriptorSet | ( | const DescriptorSetLayoutHandle & | layoutHandle | ) |
TODO:
setDescriptions |
DescriptorSetLayoutHandle vkcv::Core::createDescriptorSetLayout | ( | const std::unordered_map< uint32_t, DescriptorBinding > & | bindingsMap | ) |
TODO:
bindings |
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.
config | a pipeline config object from the pipeline config class |
handle | a handle to return the created vulkan handle |
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 |
||
) |
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.
config | a render pass config object from the render pass config class |
handle | a handle to return the created vulkan handle |
SamplerHandle vkcv::Core::createSampler | ( | SamplerFilterType | magFilter, |
SamplerFilterType | minFilter, | ||
SamplerMipmapMode | mipmapMode, | ||
SamplerAddressMode | addressMode, | ||
float | mipLodBias = 0.0f |
||
) |
Creates a Sampler with given attributes.
magFilter | Magnifying filter |
minFilter | Minimizing filter |
mipmapMode | Mipmapping filter |
addressMode | Address mode |
mipLodBias | Mip level of detail bias |
WindowHandle vkcv::Core::createWindow | ( | const char * | applicationName, |
uint32_t | windowWidth, | ||
uint32_t | windowHeight, | ||
bool | resizeable | ||
) |
creates a new window and returns it's handle
applicationName | window name |
windowWidth | |
windowHeight | |
resizeable | resizeability bool |
vk::Format vkcv::Core::getImageFormat | ( | const ImageHandle & | image | ) |
returns the image format of the image
image | handle |
uint32_t vkcv::Core::getImageHeight | ( | const ImageHandle & | image | ) |
returns the image height
image | handle |
uint32_t vkcv::Core::getImageWidth | ( | const ImageHandle & | image | ) |
returns the image width
image | handle |
Swapchain & vkcv::Core::getSwapchain | ( | const SwapchainHandle & | handle | ) |
returns the swapchain reference
handle | of the swapchain |
References vkcv::Swapchain::getSwapchain().
Referenced by vkcv::gui::GUI::beginGUI(), vkcv::gui::GUI::endGUI(), and vkcv::gui::GUI::GUI().
Swapchain & vkcv::Core::getSwapchain | ( | const WindowHandle & | handle | ) |
gets the swapchain handle from the window
handle | of the window |
Swapchain & vkcv::Core::getSwapchainOfCurrentWindow | ( | ) |
gets the swapchain of the current focused window
References vkcv::Swapchain::getSwapchain().
Window & vkcv::Core::getWindow | ( | const WindowHandle & | handle | ) |
getter for window reference
handle | of the window |
References vkcv::Window::getWindow().
Referenced by vkcv::gui::GUI::GUI(), recordRayGenerationToCmdStream(), and vkcv::gui::GUI::~GUI().
Copy assignment operator of Core is deleted!
other | Other instance of #Context |
Move assignment operator of Core uses default behavior!
other | Other instance of #Context |
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.
submitInfo | Submit information |
record | Record-command-function |
finish | Finish-command-function or nullptr |
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 .
cmdStreamHandle | The command stream handle which receives relevant commands for drawing. |
rtxPipeline | The raytracing pipeline from the RTXModule. |
rtxPipelineLayout | The raytracing pipeline layout from the RTXModule. |
rgenRegion | The shader binding table region for ray generation shaders. |
rmissRegion | The shader binding table region for ray miss shaders. |
rchitRegion | The shader binding table region for ray closest hit shaders. |
rcallRegion | The shader binding table region for callable shaders. |
descriptorSetUsages | The descriptor set usages. |
pushConstants | The push constants. |
windowHandle | The window handle defining in which window to render. |
References getWindow().
|
private |
sets up swapchain images
swapchainHandles | of swapchain |
References vkcv::Swapchain::getExtent(), vkcv::Swapchain::getFormat(), and vkcv::Swapchain::getSwapchain().
Referenced by beginFrame().