RenderPipeline

Description

sealed class Tinman.AddOns.DirectX12.Pipeline.RenderPipeline

Derived from

Disposable abstract
INativeHandle

Full source code is included in the Tinman 3D SDK download.

Represents the low-level D3D12 rendering pipeline logic that is required by the IGraphicsContext API.

The native handle (see INativeHandle) of a render pipeline is the ID3D12CommandQueue* pointer to the command queue.

Public / Methods

Begin


public method Begin → (1)

state opt : bool = false

(Re-)establish the command list state?

returns → bool

true if the render pipeline is functional,
false if the render pipeline is in failure mode.

Prepares the command list for a new piece of work.

Descriptor​Allocate


public method DescriptorAllocate → (2)

pool in : DescriptorPool

The descriptor pool.

count opt : int32 = 1

[>0]
The number of consecutive descriptors to allocate.

returns → int32

The descriptor range ID that represents the allocation or -1 if in failure state.

Allocates a range of descriptors from the given pool.

The descriptor range ID 0 refers to an empty range of descriptors and may be used as a null value.

Descriptor​Allocate​Throw


public method DescriptorAllocateThrow → (2)

pool in : DescriptorPool

The descriptor pool.

count opt : int32 = 1

[>0]
The number of consecutive descriptors to allocate.

returns → int32

The descriptor range ID that represents the allocation.

Allocates a range of descriptors from the given pool.

The descriptor range ID 0 refers to an empty range of descriptors and may be used as a null value.

RenderException

If the descriptor pool is exhausted.

Descriptor​Count


[Pure]
public method DescriptorCount → (1)

range in : int32

The descriptor range ID, as returned by DescriptorAllocate.

returns → int32

The number of descriptors in range in.

Returns the size of the given range of descriptors.

Descriptor​Handle​Cpu


[Pure]
public method DescriptorHandleCpu → (2)

range in : int32

The descriptor range ID, as returned by DescriptorAllocate.

index opt : int32 = 0

The zero-based descriptor index.

returns → IntPtr

The D3D12_CPU_DESCRIPTOR_HANDLE value for the index opt-th descriptor in the given range in.

Returns the D3D12_CPU_DESCRIPTOR_HANDLE value for the given range of descriptors.

This method guarantees to return the same D3D12_CPU_DESCRIPTOR_HANDLE value for each descriptor in the given range in, unless Reset is called: in this case, different D3D12_CPU_DESCRIPTOR_HANDLE values may be returned.

Descriptor​Handle​Gpu


[Pure]
public method DescriptorHandleGpu → (2)

range in : int32

The descriptor range ID, as returned by DescriptorAllocate.

index opt : int32 = 0

The zero-based descriptor index.

returns → int64

The D3D12_GPU_DESCRIPTOR_HANDLE value for the index opt-th descriptor in the given range in.

Returns the D3D12_GPU_DESCRIPTOR_HANDLE value for the given range of descriptors.

This method guarantees to return the same D3D12_GPU_DESCRIPTOR_HANDLE value for each descriptor in the given range in, unless Reset is called: in this case, different D3D12_GPU_DESCRIPTOR_HANDLE values may be returned.

Descriptor​Release


public method DescriptorRelease → (1)

range in : int32

The descriptor range ID, as returned by DescriptorAllocate.

Releases the given range of descriptors.

Descriptor​Release​When​Done


public method DescriptorReleaseWhenDone → (1)

range in : int32

The descriptor range ID, as returned by DescriptorAllocate.

Releases the given range of descriptors once the GPU has finished all work that has been submitted so far.

End


public method End → ()

Ends the current piece of work.

Fence​Reached


public method FenceReached → (1)

value in : int64

The fence value.

returns → bool

true if FenceGpu is greater than or equal to value in, false if not.

Checks if the given fence value has been reached.

Flush


public method Flush → (1)

fence opt : int64 = Maths.MaxLong

The largest fence value (inclusive) to include in the flush.

returns → int64

The fence value that will be set by the GPU when all flushed commands have finished.

Flushes the command list, if necessary.

Reset


public method Reset → ()

Resets the pipeline for a new IBeginEnd.Begin/IBeginEnd.End cycle of the IGraphicsContext.

This method will wait until all GPU work for the last frame has finished, blocking the calling thread if necessary.

State​Cleanup


public method StateCleanup → (1)

disposed in : object

The object that is being disposed.

Removes all cached pipeline state objects that are based on the given object.

Upload​Bytes


public method UploadBytes → (5)

data in : IntPtr

The CPU memory address of the data to upload. This pointer needs to be valid only during the duration of this method call.

resource in : IntPtr

The ID3D12Resource* pointer of the GPU buffer resource to copy to.

state in : int32

The D3D12_RESOURCE_STATE value of resource in, before and after the copy operation.

offset in : int64

[>=0]
Byte offset into resource in.

size in : int32

[>=0]
The number of bytes to transfer.

returns → bool

true if all bytes have been submitted for upload,
false if the upload has failed.

Uploads bytes from system memory to GPU buffer while obeying GpuUpdateFlag.Discard semantic.

Upload​Texels


public method UploadTexels → (7)

data in : TexelBuffer

[not-null]
The texel buffer to upload. This buffer needs to be valid only during the duration of this method call.

resource in : IntPtr

The ID3D12Resource* pointer of the GPU texture resource to copy to.

subResource in : int32

[>=0]
The sub-resource in resource in to copy to.

in : int32

[>=0]
X-coordinate of top-left texel in resource in to copy to. Must be aligned with the block size.

in : int32

[>=0]
Y-coordinate of top-left texel in resource in to copy to. Must be aligned with the block size.

width in : int32

[>=1]
Width of texel block to copy.

height in : int32

[>=1]
Height of texel block to copy.

returns → bool

true if all texels have been submitted for upload,
false if the upload has failed.

Uploads texels from system memory to a GPU texture while obeying GpuUpdateFlag.Discard semantic.

A texel upload may be rejected iff:

  • The amount of data to upload is greater than the capacity of the upload buffer.

  • After waiting for 1000ms for the GPU to process finish pending texel upload jobs, in order to make sufficient room in the upload buffer.

Use​Blend​Factors


public method UseBlendFactors → (1)

factors in : Vec4F

The blend factors value.

Subsequent work on the command list shall use the given blend factors.

Use​Geometry


public method UseGeometry → (1)

geometry in : IPipelineGeometry

The geometry buffer or null for none.

Subsequent work on the command list shall use the vertex and index buffers of the given geometry.

Use​Root​Signature


public method UseRootSignature → (1)

rootSignature in : RootSignature

The root signature or null for none.

Subsequent work on the command list shall use the given root signature.

Use​Scissor


public method UseScissor → (1)

scissor in : Box2I

The scissor rectangle.

Subsequent work on the command list shall use the given scissor rectangle.

Use​Stencil​Ref


public method UseStencilRef → (1)

value in : int32

The stencil reference value.

Subsequent work on the command list shall use the given stencil reference value.

Use​Targets


public method UseTargets → (1)

targets in : RenderTargets

The render targets.

Subsequent work on the command list shall use the given render targets.

Each render target (see RenderTargets.Get) must either be null or an instance of IPipelineRenderTarget.

Use​Topology


public method UseTopology → (1)

topology in : int32

The D3D_PRIMITIVE_TOPOLOGY value.

Subsequent work on the command list shall use the given primitive topology.

Use​Viewport


public method UseViewport → (1)

viewport in : Box2I

The viewport rectangle.

Subsequent work on the command list shall use the given viewport rectangle.

Validate


public method Validate → ()

returns → bool

true if the render pipeline is operational,
false if the render pipeline has entered failure mode.

Checks if the render pipeline is in failure mode.

Wait​For​Gpu


public method WaitForGpu → (2)

fence in : int64

The fence value to wait for.

timeout opt : int32 = 1000

[>=0]
The timeout, in milli-seconds.

returns → bool

true if the GPU has reported the given fence in value,
false if the timeout opt has expired or if the GPU has stopped processing commands.

Blocks the calling thread until the GPU has reported the given fence value.

Work


public method Work → (1)

frame opt : bool = true

Does the work belong to the current frame?

Tells the pipeline that work has been submitted to the command list.

Calling the method will increment the fence counter.

Public / Attributes

Fence​Cpu


public attribute FenceCpu → (get)

value : int64

The current CPU fence value.

Returns the current fence value, as declared by the CPU.

This value represents the amount of work that has been accumulated to the command list.

Fence​Gpu


public attribute FenceGpu → (get)

value : int64

The current GPU fence value.

Returns the current fence value, as reported by the GPU.

This value represents the amount of work the has been processed by the GPU.

Pipeline​State


public attribute PipelineState → (get,set)

value : PipelineStateHandle

The pipeline state handle.

The current pipeline state.

The current pipeline state will be applied when Begin is called, passing true to the state parameter.