Nebula
Loading...
Searching...
No Matches
graphicsdevice.h File Reference
#include "pass.h"
#include "profiling/profiling.h"
#include "frame/framescript.h"
#include "primitivegroup.h"
#include "buffer.h"
#include "imagefileformat.h"
#include "io/stream.h"
#include "fence.h"
#include "debug/debugcounter.h"
#include "coregraphics/rendereventhandler.h"
#include "coregraphics/resourcetable.h"
#include "memory/rangeallocator.h"
#include "memory.h"
#include "util/set.h"

Go to the source code of this file.

Classes

struct  CoreGraphics::GraphicsDeviceCreateInfo
 
struct  CoreGraphics::GraphicsDeviceCreateInfo::Features
 
struct  CoreGraphics::DrawThreadResult
 
struct  CoreGraphics::SubmissionWaitEvent
 
struct  CoreGraphics::GraphicsDeviceState
 
struct  CoreGraphics::GraphicsDeviceThreadState
 

Namespaces

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

Functions

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.
 
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.
 
template<class TYPE >
uint CoreGraphics::SetConstants (const TYPE &data)
 Allocate range of memory and set data, return offset (thread safe)
 
template<class TYPE >
uint CoreGraphics::SetConstants (const TYPE *data, SizeT elements)
 Allocate range of memory and set data as an array of elements, return offset (thread safe)
 
template<class TYPE >
void CoreGraphics::SetConstants (ConstantBufferOffset offset, const TYPE &data)
 Set constants based on pre-allocated memory (thread safe)
 
template<class TYPE >
void CoreGraphics::SetConstants (ConstantBufferOffset offset, const TYPE *data, SizeT numElements)
 Set constants based on pre-allocated memory (thread safe)
 
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
 
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.
 
template<class TYPE >
Util::Pair< Memory::RangeAllocation, CoreGraphics::BufferIdCoreGraphics::Upload (const TYPE &data, const SizeT alignment=1)
 Upload single item to GPU source buffer.
 
template<class TYPE >
Util::Pair< Memory::RangeAllocation, CoreGraphics::BufferIdCoreGraphics::UploadArray (const TYPE *data, SizeT elements, const SizeT alignment=1)
 Upload array of items to GPU source buffer.
 
template<class TYPE >
void CoreGraphics::Upload (const CoreGraphics::BufferId buffer, uint offset, const TYPE &data)
 Upload item to GPU source buffer with preallocated memory.
 
template<class TYPE >
void CoreGraphics::Upload (const CoreGraphics::BufferId buffer, uint offset, const TYPE *data, SizeT elements)
 Upload array of items GPU source buffer with preallocated 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::ReloadShaderProgram (const CoreGraphics::ShaderProgramId &pro)
 trigger reloading a shader
 
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.
 
void CoreGraphics::FinishFrame (IndexT frameIndex)
 Finish current frame.
 
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
 
template<class TYPE >
ConstantBufferOffset CoreGraphics::SetConstants (const TYPE &data)
 Allocate range of memory and set data, return offset (thread safe)
 
template<class TYPE >
ConstantBufferOffset CoreGraphics::SetConstants (const TYPE *data, SizeT numElements)
 Allocate range of memory and set data as an array of elements, return offset (thread safe)
 
template<>
Util::Pair< Memory::RangeAllocation, CoreGraphics::BufferIdCoreGraphics::UploadArray (const void *data, SizeT numBytes, SizeT alignment)
 

Variables

bool CoreGraphics::RayTracingSupported = false
 
bool CoreGraphics::DynamicVertexInputSupported = false
 
bool CoreGraphics::VariableRateShadingSupported = false
 
bool CoreGraphics::MeshShadersSupported = false
 
bool CoreGraphics::NvidiaCheckpointsSupported = false
 
uint CoreGraphics::ReadWriteBufferAlignment = UINT_MAX
 
uint CoreGraphics::ConstantBufferAlignment = UINT_MAX
 
uint64 CoreGraphics::MaxConstantBufferSize = UINT_MAX
 
uint CoreGraphics::MaxPushConstantSize = UINT_MAX
 
uint64 CoreGraphics::SparseAddressSize = UINT_MAX
 
uint CoreGraphics::MaxPerStageConstantBuffers = UINT_MAX
 
uint CoreGraphics::MaxPerStageReadWriteBuffers = UINT_MAX
 
uint CoreGraphics::MaxPerStageSampledImages = UINT_MAX
 
uint CoreGraphics::MaxPerStageReadWriteImages = UINT_MAX
 
uint CoreGraphics::MaxPerStageSamplers = UINT_MAX
 
uint CoreGraphics::MaxPerStageInputAttachments = UINT_MAX
 
uint CoreGraphics::MaxResourceTableConstantBuffers = UINT_MAX
 
uint CoreGraphics::MaxResourceTableDynamicOffsetConstantBuffers = UINT_MAX
 
uint CoreGraphics::MaxResourceTableReadWriteBuffers = UINT_MAX
 
uint CoreGraphics::MaxResourceTableDynamicOffsetReadWriteBuffers = UINT_MAX
 
uint CoreGraphics::MaxResourceTableSampledImages = UINT_MAX
 
uint CoreGraphics::MaxResourceTableReadWriteImages = UINT_MAX
 
uint CoreGraphics::MaxResourceTableSamplers = UINT_MAX
 
uint CoreGraphics::MaxResourceTableInputAttachments = UINT_MAX
 
uint CoreGraphics::MemoryRangeGranularity = UINT_MAX
 
uint CoreGraphics::TimestampPeriod = UINT_MAX
 
uint CoreGraphics::AccelerationStructureScratchAlignment = UINT_MAX
 Raytracing properties.
 
uint CoreGraphics::ShaderGroupAlignment = UINT_MAX
 
uint64 CoreGraphics::ShaderGroupSize = UINT_MAX
 
uint CoreGraphics::MaxRecursionDepth = UINT_MAX