Nebula
Loading...
Searching...
No Matches
vkgraphicsdevice.cc File Reference

Classes

struct  Vulkan::GraphicsDeviceState
 
struct  Vulkan::GraphicsDeviceState::ConstantsRingBuffer
 
struct  Vulkan::GraphicsDeviceState::ConstantsRingBuffer::FlushedRanges
 
struct  Vulkan::GraphicsDeviceState::SparseImageBind
 
struct  Vulkan::GraphicsDeviceState::SparseBufferBind
 
struct  Vulkan::GraphicsDeviceState::PendingDeletes
 
struct  Vulkan::GraphicsDeviceState::PendingMarkers
 
struct  Vulkan::GraphicsDeviceState::Queries
 

Namespaces

namespace  Vulkan
 Vulkan implementation of GPU acceleration structure.
 
namespace  CoreGraphics
 Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
 

Functions

void Vulkan::SetupAdapter (CoreGraphics::GraphicsDeviceCreateInfo::Features features)
 setup graphics adapter
 
VkInstance Vulkan::GetInstance ()
 get vk instance
 
VkDevice Vulkan::GetCurrentDevice ()
 get the currently activated device
 
VkPhysicalDevice Vulkan::GetCurrentPhysicalDevice ()
 get the currently activated physical device
 
VkPhysicalDeviceFeatures Vulkan::GetCurrentFeatures ()
 get the current device features
 
VkPipelineCache Vulkan::GetPipelineCache ()
 get pipeline cache
 
VkPhysicalDeviceMemoryProperties Vulkan::GetMemoryProperties ()
 get memory properties
 
VkSemaphore Vulkan::GetRenderingSemaphore ()
 get final rendering semaphore
 
VkFence Vulkan::GetPresentFence ()
 get the present fence
 
void Vulkan::DelayedDeleteVkBuffer (const VkDevice dev, const VkBuffer buf)
 Add VkBuffer for late delete.
 
VkQueryPool Vulkan::GetQueryPool (const CoreGraphics::QueryType query)
 Get query pool.
 
void Vulkan::WaitForPresent (VkSemaphore sem)
 
const VkQueue Vulkan::GetQueue (const CoreGraphics::QueueType type, const IndexT index)
 get queue from index and family
 
const VkQueue Vulkan::GetCurrentQueue (const CoreGraphics::QueueType type)
 get currently active queue of type
 
VkPipeline Vulkan::GetOrCreatePipeline (CoreGraphics::PassId pass, uint subpass, CoreGraphics::ShaderProgramId program, const CoreGraphics::InputAssemblyKey inputAssembly, const VkGraphicsPipelineCreateInfo &info)
 Generate or return cached VkPipeline.
 
void Vulkan::SparseTextureBind (const VkImage img, const Util::Array< VkSparseMemoryBind > &opaqueBinds, const Util::Array< VkSparseImageMemoryBind > &pageBinds)
 perform a set of sparse image binding operations
 
void Vulkan::SparseBufferBind (const VkBuffer buf, const Util::Array< VkSparseMemoryBind > &binds)
 Perform a set of sparse binding operations for buffers.
 
void Vulkan::ClearPending ()
 Clear pending resources.
 
void Vulkan::DeviceLost ()
 Handle VK Results.
 
VKAPI_ATTR VkBool32 VKAPI_CALL NebulaVulkanErrorDebugCallback (VkDebugUtilsMessageSeverityFlagBitsEXT severity, VkDebugUtilsMessageTypeFlagsEXT type, const VkDebugUtilsMessengerCallbackDataEXT *callbackData, void *userData)
 
 CoreGraphics::N_DECLARE_COUNTER (N_CONSTANT_MEMORY, Graphics Constant Memory)
 
 CoreGraphics::N_DECLARE_COUNTER (N_VERTEX_MEMORY, Vertex Memory)
 
 CoreGraphics::N_DECLARE_COUNTER (N_INDEX_MEMORY, Index Memory)
 
 CoreGraphics::N_DECLARE_COUNTER (N_UPLOAD_MEMORY, Upload Memory)
 
bool CoreGraphics::CreateGraphicsDevice (const GraphicsDeviceCreateInfo &info)
 create graphics device
 
void CoreGraphics::DestroyGraphicsDevice ()
 destroy graphics device
 
SizeT CoreGraphics::GetNumBufferedFrames ()
 get number of buffered frames
 
IndexT CoreGraphics::GetBufferedFrameIndex ()
 get current frame index, which is between 0 and GetNumBufferedFrames
 
void CoreGraphics::AttachEventHandler (const Ptr< CoreGraphics::RenderEventHandler > &h)
 attach a render event handler
 
void CoreGraphics::RemoveEventHandler (const Ptr< CoreGraphics::RenderEventHandler > &h)
 remove a render event handler
 
bool CoreGraphics::NotifyEventHandlers (const CoreGraphics::RenderEvent &e)
 notify event handlers about an event
 
void CoreGraphics::AddBackBufferTexture (const CoreGraphics::TextureId tex)
 add a render texture used by the back buffer
 
void CoreGraphics::RemoveBackBufferTexture (const CoreGraphics::TextureId tex)
 remove a render texture
 
const CoreGraphics::CmdBufferId CoreGraphics::LockTransferSetupCommandBuffer ()
 Lock resource command buffer.
 
void CoreGraphics::UnlockTransferSetupCommandBuffer (CoreGraphics::CmdBufferId cmdBuf)
 Release lock on resource command buffer.
 
const CoreGraphics::CmdBufferId CoreGraphics::LockGraphicsSetupCommandBuffer (const char *name=nullptr)
 Lock immediate graphics command buffer.
 
void CoreGraphics::UnlockGraphicsSetupCommandBuffer (CoreGraphics::CmdBufferId cmdBuf)
 Release lock on immediate graphics command buffer.
 
const CoreGraphics::CmdBufferId CoreGraphics::LockTransferHandoverSetupCommandBuffer ()
 Lock handover transfer command buffer.
 
void CoreGraphics::UnlockTransferHandoverSetupCommandBuffer (CoreGraphics::CmdBufferId cmdBuf)
 Release lock on handover command buffer.
 
bool CoreGraphics::PollSubmissionIndex (const CoreGraphics::QueueType queue, uint64 index)
 Poll a submission for completion.
 
void CoreGraphics::AddSubmissionEvent (const CoreGraphics::SubmissionWaitEvent &event)
 
SubmissionWaitEvent CoreGraphics::SubmitCommandBuffers (const Util::Array< CoreGraphics::CmdBufferId, 8 > &cmds, CoreGraphics::QueueType type, Util::Array< CoreGraphics::SubmissionWaitEvent, 8 > waitEvents=nullptr)
 Submit a command buffer, but doesn't necessarily execute it immediately.
 
void CoreGraphics::SubmitImmediateCommandBuffers ()
 Submit immediate command buffers.
 
void CoreGraphics::UnlockConstantUpdates ()
 Unlock constants.
 
void CoreGraphics::LockConstantUpdates ()
 Lock constant updates.
 
void CoreGraphics::SetConstantsInternal (ConstantBufferOffset offset, const void *data, SizeT size)
 Use pre-allocated range of memory to update graphics constants.
 
ConstantBufferOffset CoreGraphics::AllocateConstantBufferMemory (uint size)
 Reserve range of constant buffer memory and return offset.
 
CoreGraphics::BufferId CoreGraphics::GetConstantBuffer (IndexT i)
 return id to global graphics constant buffer
 
void CoreGraphics::ReloadShaderProgram (const CoreGraphics::ShaderProgramId &pro)
 trigger reloading a shader
 
void CoreGraphics::FinishFrame (IndexT frameIndex)
 Finish current frame.
 
void CoreGraphics::WaitForQueue (CoreGraphics::QueueType queue)
 wait for an individual queue to finish
 
void CoreGraphics::WaitAndClearPendingCommands ()
 wait for all queues to finish
 
void CoreGraphics::DelayedDeleteBuffer (const CoreGraphics::BufferId id)
 Add buffer to delete queue.
 
void CoreGraphics::DelayedDeleteTexture (const CoreGraphics::TextureId id)
 Add texture to delete queue.
 
void CoreGraphics::DelayedDeleteTextureView (const CoreGraphics::TextureViewId id)
 Add texture view to delete queue.
 
void CoreGraphics::DelayedDeleteCommandBuffer (const CoreGraphics::CmdBufferId id)
 Add command buffer to late deletion.
 
void CoreGraphics::DelayedFreeMemory (const CoreGraphics::Alloc alloc)
 Add memory allocation to delete queue.
 
void CoreGraphics::DelayedDeleteDescriptorSet (const CoreGraphics::ResourceTableId id)
 Add a descriptor set to delete queue.
 
void CoreGraphics::DelayedDeletePass (const CoreGraphics::PassId id)
 Add a pass to delayed delete.
 
void CoreGraphics::DelayedDeleteBlas (const CoreGraphics::BlasId id)
 Add a blas for delayed delete.
 
void CoreGraphics::DelayedDeleteTlas (const CoreGraphics::TlasId id)
 Add a tlas for delayed delete.
 
uint CoreGraphics::AllocateQueries (const CoreGraphics::QueryType type, uint numQueries)
 Allocate a range of queries.
 
void CoreGraphics::FinishQueries (const CoreGraphics::CmdBufferId cmdBuf, const CoreGraphics::QueryType type, IndexT *starts, SizeT *counts, SizeT numCopies)
 Copy query results to buffer.
 
IndexT CoreGraphics::GetQueueIndex (const QueueType queue)
 Get queue index.
 
const Util::Set< uint32_t > & CoreGraphics::GetQueueIndices ()
 Get queue indices.
 
const VertexAlloc CoreGraphics::AllocateVertices (const SizeT numVertices, const SizeT vertexSize)
 Allocate vertices from the global vertex pool.
 
const VertexAlloc CoreGraphics::AllocateVertices (const SizeT bytes)
 Allocate vertices from the global vertex pool by bytes.
 
void CoreGraphics::DeallocateVertices (const VertexAlloc &alloc)
 Deallocate vertices.
 
const CoreGraphics::BufferId CoreGraphics::GetVertexBuffer ()
 Get vertex buffer.
 
const VertexAlloc CoreGraphics::AllocateIndices (const SizeT numIndices, const IndexType::Code indexType)
 Allocate indices from the global index pool.
 
const VertexAlloc CoreGraphics::AllocateIndices (const SizeT bytes)
 Allocate indices from the global index pool by bytes.
 
void CoreGraphics::DeallocateIndices (const VertexAlloc &alloc)
 Deallocate indices.
 
const CoreGraphics::BufferId CoreGraphics::GetIndexBuffer ()
 Get index buffer.
 
Util::Pair< Memory::RangeAllocation, CoreGraphics::BufferIdCoreGraphics::AllocateUpload (const SizeT numBytes, const SizeT alignment=1)
 Allocate upload memory.
 
void CoreGraphics::UploadInternal (const CoreGraphics::BufferId buffer, uint offset, const void *data, SizeT size)
 Upload memory to upload buffer with given offset, return offset.
 
void CoreGraphics::FreeUploads (const Util::Array< Memory::RangeAllocation > &allocations)
 Free upload allocations directly.
 
void CoreGraphics::FlushUploads (const Util::Array< Memory::RangeAllocation > &allocations)
 Flush upload allocations directly.
 
void CoreGraphics::EnqueueUploadsFlushAndFree (const Util::Array< Memory::RangeAllocation > &allocations)
 Queue uploads to flush and free at immediate submit.
 
void CoreGraphics::ParseMarkersAndTime (CoreGraphics::FrameProfilingMarker &marker, uint64 *data, const uint64 &offset)
 
void CoreGraphics::NewFrame ()
 Progress to next frame.
 
CoreGraphics::ImageFileFormat::Code CoreGraphics::SaveScreenshot (CoreGraphics::ImageFileFormat::Code fmt, const Ptr< IO::Stream > &outStream)
 save a screenshot to the provided stream
 
CoreGraphics::ImageFileFormat::Code CoreGraphics::SaveScreenshot (CoreGraphics::ImageFileFormat::Code fmt, const Ptr< IO::Stream > &outStream, const Math::rectangle< int > &rect, int x, int y)
 save a region of the screen to the provided stream
 
bool CoreGraphics::GetVisualizeMipMaps ()
 get visualization of mipmaps flag

 
void CoreGraphics::SetVisualizeMipMaps (bool val)
 set visualization of mipmaps flag

 
bool CoreGraphics::GetRenderWireframe ()
 get the render as wireframe flag
 
void CoreGraphics::SetRenderWireframe (bool b)
 set the render as wireframe flag
 

Variables

static Threading::CriticalSection Vulkan::delayedDeleteSection
 
static Threading::CriticalSection Vulkan::transferLock
 
static Threading::CriticalSection Vulkan::setupLock
 
static Threading::CriticalSection Vulkan::submitLock
 
Vulkan::GraphicsDeviceState Vulkan::state
 
VkDebugUtilsMessengerEXT Vulkan::VkErrorDebugMessageHandle = nullptr
 
PFN_vkCreateDebugUtilsMessengerEXT Vulkan::VkCreateDebugMessenger = nullptr
 
PFN_vkDestroyDebugUtilsMessengerEXT Vulkan::VkDestroyDebugMessenger = nullptr
 
PFN_vkSetDebugUtilsObjectTagEXT Vulkan::VkDebugObjectTag = nullptr
 
PFN_vkQueueBeginDebugUtilsLabelEXT Vulkan::VkQueueBeginLabel = nullptr
 
PFN_vkQueueEndDebugUtilsLabelEXT Vulkan::VkQueueEndLabel = nullptr
 
PFN_vkQueueInsertDebugUtilsLabelEXT Vulkan::VkQueueInsertLabel = nullptr
 
static Threading::CriticalSection Vulkan::pipelineMutex
 
Threading::CriticalSection CoreGraphics::vertexAllocationMutex
 
Threading::CriticalSection CoreGraphics::UploadLock
 

Function Documentation

◆ NebulaVulkanErrorDebugCallback()

VKAPI_ATTR VkBool32 VKAPI_CALL NebulaVulkanErrorDebugCallback ( VkDebugUtilsMessageSeverityFlagBitsEXT severity,
VkDebugUtilsMessageTypeFlagsEXT type,
const VkDebugUtilsMessengerCallbackDataEXT * callbackData,
void * userData )