Diligent::IDeviceContext struct

Device context interface.

Base classes

struct IObject
Base interface for all dynamic objects in the engine.

Derived classes

struct IDeviceContextD3D11
Exposes Direct3D11-specific functionality of a device context.
struct IDeviceContextD3D12
Exposes Direct3D12-specific functionality of a device context.
struct IDeviceContextGL
Exposes OpenGL-specific functionality of a device context.
class IDeviceContextMtl
Exposes Metal-specific functionality of a device context.
struct IDeviceContextVk
Exposes Vulkan-specific functionality of a device context.

Public functions

auto SetPipelineState(IPipelineState* pPipelineState) -> void METHOD() virtual
Sets the pipeline state.
auto TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding) -> void METHOD() virtual
Transitions shader resources to the states required by Draw or Dispatch command.
auto CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) -> void METHOD() virtual
Commits shader resources to the device context.
auto SetStencilRef(Uint32 StencilRef) -> void METHOD() virtual
Sets the stencil reference value.
auto SetBlendFactors(const float* pBlendFactors = nullptr) -> void METHOD() virtual
auto SetVertexBuffers(Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer** ppBuffers, Uint32* pOffsets, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode, SET_VERTEX_BUFFERS_FLAGS Flags) -> void METHOD() virtual
Binds vertex buffers to the pipeline.
auto InvalidateState() -> void METHOD() virtual
Invalidates the cached context state.
auto SetIndexBuffer(IBuffer* pIndexBuffer, Uint32 ByteOffset, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) -> void METHOD() virtual
Binds an index buffer to the pipeline.
auto SetViewports(Uint32 NumViewports, const Viewport* pViewports, Uint32 RTWidth, Uint32 RTHeight) -> void METHOD() virtual
Sets an array of viewports.
auto SetScissorRects(Uint32 NumRects, const Rect* pRects, Uint32 RTWidth, Uint32 RTHeight) -> void METHOD() virtual
Sets active scissor rects.
auto SetRenderTargets(Uint32 NumRenderTargets, ITextureView* ppRenderTargets[], ITextureView* pDepthStencil, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) -> void METHOD() virtual
Binds one or more render targets and the depth-stencil buffer to the context. It also sets the viewport to match the first non-null render target or depth-stencil buffer.
auto BeginRenderPass(const BeginRenderPassAttribs& Attribs) -> void METHOD() virtual
Begins a new render pass.
auto NextSubpass() -> void METHOD() virtual
Transitions to the next subpass in the render pass instance.
auto EndRenderPass() -> void METHOD() virtual
Ends current render pass.
auto Draw(const DrawAttribs& Attribs) -> void METHOD() virtual
Executes a draw command.
auto DrawIndexed(const DrawIndexedAttribs& Attribs) -> void METHOD() virtual
Executes an indexed draw command.
auto DrawIndirect(const DrawIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) -> void METHOD() virtual
Executes an indirect draw command.
auto DrawIndexedIndirect(const DrawIndexedIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) -> void METHOD() virtual
Executes an indexed indirect draw command.
auto DrawMesh(const DrawMeshAttribs& Attribs) -> void METHOD() virtual
Executes a mesh draw command.
auto DrawMeshIndirect(const DrawMeshIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) -> void METHOD() virtual
Executes an mesh indirect draw command.
auto DrawMeshIndirectCount(const DrawMeshIndirectCountAttribs& Attribs, IBuffer* pAttribsBuffer, IBuffer* pCountBuffer) -> void METHOD() virtual
Executes an mesh indirect draw command with indirect command count buffer.
auto DispatchCompute(const DispatchComputeAttribs& Attribs) -> void METHOD() virtual
Executes a dispatch compute command.
auto DispatchComputeIndirect(const DispatchComputeIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) -> void METHOD() virtual
Executes an indirect dispatch compute command.
auto ClearDepthStencil(ITextureView* pView, CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, float fDepth, Uint8 Stencil, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) -> void METHOD() virtual
Clears a depth-stencil view.
auto ClearRenderTarget(ITextureView* pView, const float* RGBA, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) -> void METHOD() virtual
Clears a render target view.
auto FinishCommandList(ICommandList** ppCommandList) -> void METHOD() virtual
Finishes recording commands and generates a command list.
auto ExecuteCommandLists(Uint32 NumCommandLists, ICommandList*const* ppCommandLists) -> void METHOD() virtual
Submits an array of recorded command lists for execution.
auto SignalFence(IFence* pFence, Uint64 Value) -> void METHOD() virtual
Tells the GPU to set a fence to a specified value after all previous work has completed.
auto WaitForFence(IFence* pFence, Uint64 Value, bool FlushContext) -> void METHOD() virtual
Waits until the specified fence reaches or exceeds the specified value, on the host.
auto WaitForIdle() -> void METHOD() virtual
Submits all outstanding commands for execution to the GPU and waits until they are complete.
auto BeginQuery(IQuery* pQuery) -> void METHOD() virtual
Marks the beginning of a query.
auto EndQuery(IQuery* pQuery) -> void METHOD() virtual
Marks the end of a query.
auto Flush() -> void METHOD() virtual
Submits all pending commands in the context for execution to the command queue.
auto UpdateBuffer(IBuffer* pBuffer, Uint32 Offset, Uint32 Size, const void* pData, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) -> void METHOD() virtual
Updates the data in the buffer.
auto CopyBuffer(IBuffer* pSrcBuffer, Uint32 SrcOffset, RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, IBuffer* pDstBuffer, Uint32 DstOffset, Uint32 Size, RESOURCE_STATE_TRANSITION_MODE DstBufferTransitionMode) -> void METHOD() virtual
Copies the data from one buffer to another.
auto MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData) -> void METHOD() virtual
Maps the buffer.
auto UnmapBuffer(IBuffer* pBuffer, MAP_TYPE MapType) -> void METHOD() virtual
Unmaps the previously mapped buffer.
auto UpdateTexture(ITexture* pTexture, Uint32 MipLevel, Uint32 Slice, const Box& DstBox, const TextureSubResData& SubresData, RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, RESOURCE_STATE_TRANSITION_MODE TextureTransitionMode) -> void METHOD() virtual
Updates the data in the texture.
auto CopyTexture(const CopyTextureAttribs& CopyAttribs) -> void METHOD() virtual
Copies data from one texture to another.
auto MapTextureSubresource(ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice, MAP_TYPE MapType, MAP_FLAGS MapFlags, const Box* pMapRegion, MappedTextureSubresource& MappedData) -> void METHOD() virtual
Maps the texture subresource.
auto UnmapTextureSubresource(ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice) -> void METHOD() virtual
Unmaps the texture subresource.
auto GenerateMips(ITextureView* pTextureView) -> void METHOD() virtual
Generates a mipmap chain.
auto FinishFrame() -> void METHOD() virtual
Finishes the current frame and releases dynamic resources allocated by the context.
auto GetFrameNumber() const -> Uint64 METHOD() virtual
Returns the current frame number.
auto TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers) -> void METHOD() virtual
Transitions resource states.
auto ResolveTextureSubresource(ITexture* pSrcTexture, ITexture* pDstTexture, const ResolveTextureSubresourceAttribs& ResolveAttribs) -> void METHOD() virtual
Resolves a multi-sampled texture subresource into a non-multi-sampled texture subresource.
auto BuildBLAS(const BuildBLASAttribs& Attribs) -> void METHOD() virtual
Builds a bottom-level acceleration structure with the specified geometries.
auto BuildTLAS(const BuildTLASAttribs& Attribs) -> void METHOD() virtual
Builds a top-level acceleration structure with the specified instances.
auto CopyBLAS(const CopyBLASAttribs& Attribs) -> void METHOD() virtual
Copies data from one acceleration structure to another.
auto CopyTLAS(const CopyTLASAttribs& Attribs) -> void METHOD() virtual
Copies data from one acceleration structure to another.
auto WriteBLASCompactedSize(const WriteBLASCompactedSizeAttribs& Attribs) -> void METHOD() virtual
Writes a bottom-level acceleration structure memory size required for compacting operation to a buffer.
auto WriteTLASCompactedSize(const WriteTLASCompactedSizeAttribs& Attribs) -> void METHOD() virtual
Writes a top-level acceleration structure memory size required for compacting operation to a buffer.
auto TraceRays(const TraceRaysAttribs& Attribs) -> void METHOD() virtual
Executes a trace rays command.
auto TraceRaysIndirect(const TraceRaysIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) -> void METHOD() virtual
Executes an indirect trace rays command.
auto UpdateSBT(IShaderBindingTable* pSBT, const UpdateIndirectRTBufferAttribs* pUpdateIndirectBufferAttribs = nullptr) -> void METHOD() virtual
Updates SBT with the pending data that were recorded in IShaderBindingTable::Bind*** calls.

Function documentation

void METHOD() Diligent::IDeviceContext::SetPipelineState(IPipelineState* pPipelineState) virtual

Sets the pipeline state.

Parameters
pPipelineState in - Pointer to IPipelineState interface to bind to the context.

void METHOD() Diligent::IDeviceContext::TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding) virtual

Transitions shader resources to the states required by Draw or Dispatch command.

Parameters
pPipelineState in - Pipeline state object that was used to create the shader resource binding.
pShaderResourceBinding in - Shader resource binding whose resources will be transitioned.

If the application intends to use the same resources in other threads simultaneously, it needs to explicitly manage the states using IDeviceContext::TransitionResourceStates() method. Refer to http://diligentgraphics.com/2018/12/09/resource-state-management/ for detailed explanation of resource state management in Diligent Engine.

void METHOD() Diligent::IDeviceContext::CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) virtual

Commits shader resources to the device context.

Parameters
pShaderResourceBinding in - Shader resource binding whose resources will be committed. If pipeline state contains no shader resources, this parameter can be null.
StateTransitionMode in - State transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE).

void METHOD() Diligent::IDeviceContext::SetStencilRef(Uint32 StencilRef) virtual

Sets the stencil reference value.

Parameters
StencilRef in - Stencil reference value.

void METHOD() Diligent::IDeviceContext::SetBlendFactors(const float* pBlendFactors = nullptr) virtual

Parameters
pBlendFactors in - Array of four blend factors, one for each RGBA component. Theses factors are used if the blend state uses one of the Diligent::BLEND_FACTOR_BLEND_FACTOR or Diligent::BLEND_FACTOR_INV_BLEND_FACTOR blend factors. If nullptr is provided, default blend factors array {1,1,1,1} will be used.

void METHOD() Diligent::IDeviceContext::SetVertexBuffers(Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer** ppBuffers, Uint32* pOffsets, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode, SET_VERTEX_BUFFERS_FLAGS Flags) virtual

Binds vertex buffers to the pipeline.

Parameters
StartSlot in - The first input slot for binding. The first vertex buffer is explicitly bound to the start slot; each additional vertex buffer in the array is implicitly bound to each subsequent input slot.
NumBuffersSet in - The number of vertex buffers in the array.
ppBuffers in - A pointer to an array of vertex buffers. The buffers must have been created with the Diligent::BIND_VERTEX_BUFFER flag.
pOffsets in - Pointer to an array of offset values; one offset value for each buffer in the vertex-buffer array. Each offset is the number of bytes between the first element of a vertex buffer and the first element that will be used. If this parameter is nullptr, zero offsets for all buffers will be used.
StateTransitionMode in - State transition mode for buffers being set (see Diligent::RESOURCE_STATE_TRANSITION_MODE).
Flags in - Additional flags. See Diligent::SET_VERTEX_BUFFERS_FLAGS for a list of allowed values.

If the application intends to use the same resources in other threads simultaneously, it needs to explicitly manage the states using IDeviceContext::TransitionResourceStates() method. Refer to http://diligentgraphics.com/2018/12/09/resource-state-management/ for detailed explanation of resource state management in Diligent Engine.

void METHOD() Diligent::IDeviceContext::InvalidateState() virtual

Invalidates the cached context state.

This method should be called by an application to invalidate internal cached states.

void METHOD() Diligent::IDeviceContext::SetIndexBuffer(IBuffer* pIndexBuffer, Uint32 ByteOffset, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) virtual

Binds an index buffer to the pipeline.

Parameters
pIndexBuffer in - Pointer to the index buffer. The buffer must have been created with the Diligent::BIND_INDEX_BUFFER flag.
ByteOffset in - Offset from the beginning of the buffer to the start of index data.
StateTransitionMode in - State transiton mode for the index buffer to bind (see Diligent::RESOURCE_STATE_TRANSITION_MODE).

If the application intends to use the same resource in other threads simultaneously, it needs to explicitly manage the states using IDeviceContext::TransitionResourceStates() method. Refer to http://diligentgraphics.com/2018/12/09/resource-state-management/ for detailed explanation of resource state management in Diligent Engine.

void METHOD() Diligent::IDeviceContext::SetViewports(Uint32 NumViewports, const Viewport* pViewports, Uint32 RTWidth, Uint32 RTHeight) virtual

Sets an array of viewports.

Parameters
NumViewports in - Number of viewports to set.
pViewports in - An array of Viewport structures describing the viewports to bind.
RTWidth in - Render target width. If 0 is provided, width of the currently bound render target will be used.
RTHeight in - Render target height. If 0 is provided, height of the currently bound render target will be used.

void METHOD() Diligent::IDeviceContext::SetScissorRects(Uint32 NumRects, const Rect* pRects, Uint32 RTWidth, Uint32 RTHeight) virtual

Sets active scissor rects.

Parameters
NumRects in - Number of scissor rectangles to set.
pRects in - An array of Rect structures describing the scissor rectangles to bind.
RTWidth in - Render target width. If 0 is provided, width of the currently bound render target will be used.
RTHeight in - Render target height. If 0 is provided, height of the currently bound render target will be used.

void METHOD() Diligent::IDeviceContext::SetRenderTargets(Uint32 NumRenderTargets, ITextureView* ppRenderTargets[], ITextureView* pDepthStencil, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) virtual

Binds one or more render targets and the depth-stencil buffer to the context. It also sets the viewport to match the first non-null render target or depth-stencil buffer.

Parameters
NumRenderTargets in - Number of render targets to bind.
ppRenderTargets in - Array of pointers to ITextureView that represent the render targets to bind to the device. The type of each view in the array must be Diligent::TEXTURE_VIEW_RENDER_TARGET.
pDepthStencil in - Pointer to the ITextureView that represents the depth stencil to bind to the device. The view type must be Diligent::TEXTURE_VIEW_DEPTH_STENCIL.
StateTransitionMode in - State transition mode of the render targets and depth stencil buffer being set (see Diligent::RESOURCE_STATE_TRANSITION_MODE).

If the application intends to use the same resource in other threads simultaneously, it needs to explicitly manage the states using IDeviceContext::TransitionResourceStates() method. Refer to http://diligentgraphics.com/2018/12/09/resource-state-management/ for detailed explanation of resource state management in Diligent Engine.

void METHOD() Diligent::IDeviceContext::BeginRenderPass(const BeginRenderPassAttribs& Attribs) virtual

Begins a new render pass.

Parameters
Attribs in - The command attributes, see Diligent::BeginRenderPassAttribs for details.

void METHOD() Diligent::IDeviceContext::Draw(const DrawAttribs& Attribs) virtual

Executes a draw command.

Parameters
Attribs in - Draw command attributes, see Diligent::DrawAttribs for details.

If the application intends to use the same resources in other threads simultaneously, it needs to explicitly manage the states using IDeviceContext::TransitionResourceStates() method.

void METHOD() Diligent::IDeviceContext::DrawIndexed(const DrawIndexedAttribs& Attribs) virtual

Executes an indexed draw command.

Parameters
Attribs in - Draw command attributes, see Diligent::DrawIndexedAttribs for details.

If the application intends to use the same resources in other threads simultaneously, it needs to explicitly manage the states using IDeviceContext::TransitionResourceStates() method.

void METHOD() Diligent::IDeviceContext::DrawIndirect(const DrawIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) virtual

Executes an indirect draw command.

Parameters
Attribs in - Structure describing the command attributes, see Diligent::DrawIndirectAttribs for details.
pAttribsBuffer in - Pointer to the buffer, from which indirect draw attributes will be read. The buffer must contain the following arguments at the specified offset: Uint32 NumVertices; Uint32 NumInstances; Uint32 StartVertexLocation; Uint32 FirstInstanceLocation;

If Diligent::DRAW_FLAG_VERIFY_STATES flag is set, the method reads the state of vertex/index buffers, so no other threads are allowed to alter the states of the same resources. It is OK to read these states.

If the application intends to use the same resources in other threads simultaneously, it needs to explicitly manage the states using IDeviceContext::TransitionResourceStates() method.

void METHOD() Diligent::IDeviceContext::DrawIndexedIndirect(const DrawIndexedIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) virtual

Executes an indexed indirect draw command.

Parameters
Attribs in - Structure describing the command attributes, see Diligent::DrawIndexedIndirectAttribs for details.
pAttribsBuffer in - Pointer to the buffer, from which indirect draw attributes will be read. The buffer must contain the following arguments at the specified offset: Uint32 NumIndices; Uint32 NumInstances; Uint32 FirstIndexLocation; Uint32 BaseVertex; Uint32 FirstInstanceLocation

If Diligent::DRAW_FLAG_VERIFY_STATES flag is set, the method reads the state of vertex/index buffers, so no other threads are allowed to alter the states of the same resources. It is OK to read these states.

If the application intends to use the same resources in other threads simultaneously, it needs to explicitly manage the states using IDeviceContext::TransitionResourceStates() method.

void METHOD() Diligent::IDeviceContext::DrawMesh(const DrawMeshAttribs& Attribs) virtual

Executes a mesh draw command.

Parameters
Attribs in - Draw command attributes, see Diligent::DrawMeshAttribs for details.

void METHOD() Diligent::IDeviceContext::DrawMeshIndirect(const DrawMeshIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) virtual

Executes an mesh indirect draw command.

Parameters
Attribs in - Structure describing the command attributes, see Diligent::DrawMeshIndirectAttribs for details.
pAttribsBuffer in - Pointer to the buffer, from which indirect draw attributes will be read. The buffer must contain the following arguments at the specified offset: Direct3D12: Uint32 ThreadGroupCountX; Uint32 ThreadGroupCountY; Uint32 ThreadGroupCountZ; Vulkan: Uint32 TaskCount; Uint32 FirstTask;

If the application intends to use the same resources in other threads simultaneously, it needs to explicitly manage the states using IDeviceContext::TransitionResourceStates() method.

void METHOD() Diligent::IDeviceContext::DrawMeshIndirectCount(const DrawMeshIndirectCountAttribs& Attribs, IBuffer* pAttribsBuffer, IBuffer* pCountBuffer) virtual

Executes an mesh indirect draw command with indirect command count buffer.

Parameters
Attribs in - Structure describing the command attributes, see Diligent::DrawMeshIndirectCountAttribs for details.
pAttribsBuffer in - Pointer to the buffer, from which indirect draw attributes will be read. The buffer must contain the following arguments at the specified offset: Direct3D12: Uint32 ThreadGroupCountX; Uint32 ThreadGroupCountY; Uint32 ThreadGroupCountZ; Vulkan: Uint32 TaskCount; Uint32 FirstTask; Size of the buffer must be sizeof(Uint32[3]) * Attribs.MaxDrawCommands.
pCountBuffer in - Pointer to the buffer, from which Uint32 value with draw count will be read.

If the application intends to use the same resources in other threads simultaneously, it needs to explicitly manage the states using IDeviceContext::TransitionResourceStates() method.

void METHOD() Diligent::IDeviceContext::DispatchCompute(const DispatchComputeAttribs& Attribs) virtual

Executes a dispatch compute command.

Parameters
Attribs in - Dispatch command attributes, see Diligent::DispatchComputeAttribs for details.

void METHOD() Diligent::IDeviceContext::DispatchComputeIndirect(const DispatchComputeIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) virtual

Executes an indirect dispatch compute command.

Parameters
Attribs in - The command attributes, see Diligent::DispatchComputeIndirectAttribs for details.
pAttribsBuffer in - Pointer to the buffer containing indirect dispatch attributes. The buffer must contain the following arguments at the specified offset: Uint32 ThreadGroupCountX; Uint32 ThreadGroupCountY; Uint32 ThreadGroupCountZ;

If the application intends to use the same resources in other threads simultaneously, it needs to explicitly manage the states using IDeviceContext::TransitionResourceStates() method.

void METHOD() Diligent::IDeviceContext::ClearDepthStencil(ITextureView* pView, CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, float fDepth, Uint8 Stencil, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) virtual

Clears a depth-stencil view.

Parameters
pView in - Pointer to ITextureView interface to clear. The view type must be Diligent::TEXTURE_VIEW_DEPTH_STENCIL.
ClearFlags in - Idicates which parts of the buffer to clear, see Diligent::CLEAR_DEPTH_STENCIL_FLAGS.
fDepth in - Value to clear depth part of the view with.
Stencil in - Value to clear stencil part of the view with.
StateTransitionMode in - state transition mode of the depth-stencil buffer to clear.

Resource state transitioning is not thread safe, so no other thread is allowed to read or write the state of resources used by the command. Refer to http://diligentgraphics.com/2018/12/09/resource-state-management/ for detailed explanation of resource state management in Diligent Engine.

void METHOD() Diligent::IDeviceContext::ClearRenderTarget(ITextureView* pView, const float* RGBA, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) virtual

Clears a render target view.

Parameters
pView in - Pointer to ITextureView interface to clear. The view type must be Diligent::TEXTURE_VIEW_RENDER_TARGET.
RGBA in - A 4-component array that represents the color to fill the render target with. If nullptr is provided, the default array {0,0,0,0} will be used.
StateTransitionMode in - Defines required state transitions (see Diligent::RESOURCE_STATE_TRANSITION_MODE)

If the application intends to use the same resource in other threads simultaneously, it needs to explicitly manage the states using IDeviceContext::TransitionResourceStates() method.

void METHOD() Diligent::IDeviceContext::FinishCommandList(ICommandList** ppCommandList) virtual

Finishes recording commands and generates a command list.

Parameters
ppCommandList out - Memory location where pointer to the recorded command list will be written.

void METHOD() Diligent::IDeviceContext::ExecuteCommandLists(Uint32 NumCommandLists, ICommandList*const* ppCommandLists) virtual

Submits an array of recorded command lists for execution.

Parameters
NumCommandLists in - The number of command lists to execute.
ppCommandLists in - Pointer to the array of NumCommandLists command lists to execute.

void METHOD() Diligent::IDeviceContext::SignalFence(IFence* pFence, Uint64 Value) virtual

Tells the GPU to set a fence to a specified value after all previous work has completed.

Parameters
pFence in - The fence to signal
Value in - The value to set the fence to. This value must be greater than the previously signaled value on the same fence.

void METHOD() Diligent::IDeviceContext::WaitForFence(IFence* pFence, Uint64 Value, bool FlushContext) virtual

Waits until the specified fence reaches or exceeds the specified value, on the host.

Parameters
pFence in - The fence to wait.
Value in - The value that the context is waiting for the fence to reach.
FlushContext in - Whether to flush the commands in the context before initiating the wait.

void METHOD() Diligent::IDeviceContext::WaitForIdle() virtual

Submits all outstanding commands for execution to the GPU and waits until they are complete.

void METHOD() Diligent::IDeviceContext::BeginQuery(IQuery* pQuery) virtual

Marks the beginning of a query.

Parameters
pQuery in - A pointer to a query object.

void METHOD() Diligent::IDeviceContext::EndQuery(IQuery* pQuery) virtual

Marks the end of a query.

Parameters
pQuery in - A pointer to a query object.

void METHOD() Diligent::IDeviceContext::Flush() virtual

Submits all pending commands in the context for execution to the command queue.

void METHOD() Diligent::IDeviceContext::UpdateBuffer(IBuffer* pBuffer, Uint32 Offset, Uint32 Size, const void* pData, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) virtual

Updates the data in the buffer.

Parameters
pBuffer in - Pointer to the buffer to updates.
Offset in - Offset in bytes from the beginning of the buffer to the update region.
Size in - Size in bytes of the data region to update.
pData in - Pointer to the data to write to the buffer.
StateTransitionMode in - Buffer state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE)

void METHOD() Diligent::IDeviceContext::CopyBuffer(IBuffer* pSrcBuffer, Uint32 SrcOffset, RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, IBuffer* pDstBuffer, Uint32 DstOffset, Uint32 Size, RESOURCE_STATE_TRANSITION_MODE DstBufferTransitionMode) virtual

Copies the data from one buffer to another.

Parameters
pSrcBuffer in - Source buffer to copy data from.
SrcOffset in - Offset in bytes from the beginning of the source buffer to the beginning of data to copy.
SrcBufferTransitionMode in - State transition mode of the source buffer (see Diligent::RESOURCE_STATE_TRANSITION_MODE).
pDstBuffer in - Destination buffer to copy data to.
DstOffset in - Offset in bytes from the beginning of the destination buffer to the beginning of the destination region.
Size in - Size in bytes of data to copy.
DstBufferTransitionMode in - State transition mode of the destination buffer (see Diligent::RESOURCE_STATE_TRANSITION_MODE).

void METHOD() Diligent::IDeviceContext::MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData) virtual

Maps the buffer.

Parameters
pBuffer in - Pointer to the buffer to map.
MapType in - Type of the map operation. See Diligent::MAP_TYPE.
MapFlags in - Special map flags. See Diligent::MAP_FLAGS.
pMappedData out - Reference to the void pointer to store the address of the mapped region.

void METHOD() Diligent::IDeviceContext::UnmapBuffer(IBuffer* pBuffer, MAP_TYPE MapType) virtual

Unmaps the previously mapped buffer.

Parameters
pBuffer in - Pointer to the buffer to unmap.
MapType in - Type of the map operation. This parameter must match the type that was provided to the Map() method.

void METHOD() Diligent::IDeviceContext::UpdateTexture(ITexture* pTexture, Uint32 MipLevel, Uint32 Slice, const Box& DstBox, const TextureSubResData& SubresData, RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, RESOURCE_STATE_TRANSITION_MODE TextureTransitionMode) virtual

Updates the data in the texture.

Parameters
pTexture in - Pointer to the device context interface to be used to perform the operation.
MipLevel in - Mip level of the texture subresource to update.
Slice in - Array slice. Should be 0 for non-array textures.
DstBox in - Destination region on the texture to update.
SubresData in - Source data to copy to the texture.
SrcBufferTransitionMode in - If pSrcBuffer member of TextureSubResData structure is not null, this parameter defines state transition mode of the source buffer. If pSrcBuffer is null, this parameter is ignored.
TextureTransitionMode in - Texture state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE)

void METHOD() Diligent::IDeviceContext::CopyTexture(const CopyTextureAttribs& CopyAttribs) virtual

Copies data from one texture to another.

Parameters
CopyAttribs in - Structure describing copy command attributes, see Diligent::CopyTextureAttribs for details.

void METHOD() Diligent::IDeviceContext::MapTextureSubresource(ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice, MAP_TYPE MapType, MAP_FLAGS MapFlags, const Box* pMapRegion, MappedTextureSubresource& MappedData) virtual

Maps the texture subresource.

Parameters
pTexture in - Pointer to the texture to map.
MipLevel in - Mip level to map.
ArraySlice in - Array slice to map. This parameter must be 0 for non-array textures.
MapType in - Type of the map operation. See Diligent::MAP_TYPE.
MapFlags in - Special map flags. See Diligent::MAP_FLAGS.
pMapRegion in - Texture region to map. If this parameter is null, the entire subresource is mapped.
MappedData out - Mapped texture region data

void METHOD() Diligent::IDeviceContext::GenerateMips(ITextureView* pTextureView) virtual

Generates a mipmap chain.

Parameters
pTextureView in - Texture view to generate mip maps for.

void METHOD() Diligent::IDeviceContext::FinishFrame() virtual

Finishes the current frame and releases dynamic resources allocated by the context.

For immediate context, this method is called automatically by ISwapChain::Present() of the primary swap chain, but can also be called explicitly. For deferred contexts, the method must be called by the application to release dynamic resources. The method has some overhead, so it is better to call it once per frame, though it can be called with different frequency. Note that unless the GPU is idled, the resources may actually be released several frames after the one they were used in last time.

Uint64 METHOD() Diligent::IDeviceContext::GetFrameNumber() const virtual

Returns the current frame number.

void METHOD() Diligent::IDeviceContext::TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers) virtual

Transitions resource states.

Parameters
BarrierCount in - Number of barriers in pResourceBarriers array
pResourceBarriers in - Pointer to the array of resource barriers

The method always reads the states of all resources to transition. If the state of a resource is managed by multiple threads in parallel, the resource must first be transitioned to unknown state (Diligent::RESOURCE_STATE_UNKNOWN) to disable automatic state management in the engine.

When StateTransitionDesc::UpdateResourceState is set to true, the method may update the state of the corresponding resource which is not thread safe. No other threads should read or write the sate of that resource.

Refer to http://diligentgraphics.com/2018/12/09/resource-state-management/ for detailed explanation of resource state management in Diligent Engine.

void METHOD() Diligent::IDeviceContext::ResolveTextureSubresource(ITexture* pSrcTexture, ITexture* pDstTexture, const ResolveTextureSubresourceAttribs& ResolveAttribs) virtual

Resolves a multi-sampled texture subresource into a non-multi-sampled texture subresource.

Parameters
pSrcTexture in - Source multi-sampled texture.
pDstTexture in - Destination non-multi-sampled texture.
ResolveAttribs in - Resolve command attributes, see Diligent::ResolveTextureSubresourceAttribs for details.

void METHOD() Diligent::IDeviceContext::BuildBLAS(const BuildBLASAttribs& Attribs) virtual

Builds a bottom-level acceleration structure with the specified geometries.

Parameters
Attribs in - Structure describing build BLAS command attributes, see Diligent::BuildBLASAttribs for details.

void METHOD() Diligent::IDeviceContext::BuildTLAS(const BuildTLASAttribs& Attribs) virtual

Builds a top-level acceleration structure with the specified instances.

Parameters
Attribs in - Structure describing build TLAS command attributes, see Diligent::BuildTLASAttribs for details.

void METHOD() Diligent::IDeviceContext::CopyBLAS(const CopyBLASAttribs& Attribs) virtual

Copies data from one acceleration structure to another.

Parameters
Attribs in - Structure describing copy BLAS command attributes, see Diligent::CopyBLASAttribs for details.

void METHOD() Diligent::IDeviceContext::CopyTLAS(const CopyTLASAttribs& Attribs) virtual

Copies data from one acceleration structure to another.

Parameters
Attribs in - Structure describing copy TLAS command attributes, see Diligent::CopyTLASAttribs for details.

void METHOD() Diligent::IDeviceContext::WriteBLASCompactedSize(const WriteBLASCompactedSizeAttribs& Attribs) virtual

Writes a bottom-level acceleration structure memory size required for compacting operation to a buffer.

Parameters
Attribs in - Structure describing write BLAS compacted size command attributes, see Diligent::WriteBLASCompactedSizeAttribs for details.

void METHOD() Diligent::IDeviceContext::WriteTLASCompactedSize(const WriteTLASCompactedSizeAttribs& Attribs) virtual

Writes a top-level acceleration structure memory size required for compacting operation to a buffer.

Parameters
Attribs in - Structure describing write TLAS compacted size command attributes, see Diligent::WriteTLASCompactedSizeAttribs for details.

void METHOD() Diligent::IDeviceContext::TraceRays(const TraceRaysAttribs& Attribs) virtual

Executes a trace rays command.

Parameters
Attribs in - Trace rays command attributes, see Diligent::TraceRaysAttribs for details.

void METHOD() Diligent::IDeviceContext::TraceRaysIndirect(const TraceRaysIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) virtual

Executes an indirect trace rays command.

Parameters
Attribs
pAttribsBuffer in - Pointer to the buffer containing indirect trace rays attributes. The buffer must contain the following arguments at the specified offset: [88 bytes reserved] - for Direct3D12 backend Uint32 DimensionX; Uint32 DimensionY; Uint32 DimensionZ; You must call IDeviceContext::UpdateSBT() to initialize the first 88 bytes with the same shader binding table as specified in TraceRaysIndirectAttribs::pSBT.

void METHOD() Diligent::IDeviceContext::UpdateSBT(IShaderBindingTable* pSBT, const UpdateIndirectRTBufferAttribs* pUpdateIndirectBufferAttribs = nullptr) virtual

Updates SBT with the pending data that were recorded in IShaderBindingTable::Bind*** calls.

Parameters
pSBT in - Shader binding table that will be updated if there are pending data.
pUpdateIndirectBufferAttribs in - Indirect ray tracing attributes buffer update attributes (optional, may be null).