Gorgon
Show / Hide Table of Contents

Class GorgonDispatchCallBuilder

A builder used to create GorgonDispatchCall objects.

Inheritance
object
GorgonDispatchCallBuilder
Implements
IGorgonFluentBuilderAllocator<GorgonDispatchCallBuilder, GorgonDispatchCall, IGorgonAllocator<GorgonDispatchCall>>
IGorgonFluentBuilder<GorgonDispatchCallBuilder, GorgonDispatchCall>
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: Gorgon.Graphics.Core
Assembly: Gorgon.Graphics.Core.dll
Syntax
public class GorgonDispatchCallBuilder : IGorgonFluentBuilderAllocator<GorgonDispatchCallBuilder, GorgonDispatchCall, IGorgonAllocator<GorgonDispatchCall>>, IGorgonFluentBuilder<GorgonDispatchCallBuilder, GorgonDispatchCall>

Constructors

| Edit this page View Source

GorgonDispatchCallBuilder()

Initializes a new instance of the GorgonDispatchCallBuilder class.

Declaration
public GorgonDispatchCallBuilder()
See Also
GorgonDispatchCall

Methods

| Edit this page View Source

Build()

Function to return the dispatch call.

Declaration
public GorgonDispatchCall Build()
Returns
Type Description
GorgonDispatchCall

The dispatch call created or updated by this builder.

Exceptions
Type Condition
GorgonException

Thrown if a GorgonComputeShader is not assigned to the GorgonComputeShader property with the ComputeShader(GorgonComputeShader) command.

See Also
GorgonDispatchCall
| Edit this page View Source

Build(IGorgonAllocator<GorgonDispatchCall>)

Function to return the dispatch call.

Declaration
public GorgonDispatchCall Build(IGorgonAllocator<GorgonDispatchCall> allocator)
Parameters
Type Name Description
IGorgonAllocator<GorgonDispatchCall> allocator

The allocator used to create an instance of the object

Returns
Type Description
GorgonDispatchCall

The dispatch call created or updated by this builder.

Remarks

Using an allocator can provide different strategies when building dispatch calls. If omitted, the dispatch call will be created using the standard new keyword.

A custom allocator can be beneficial because it allows us to use a pool for allocating the objects, and thus allows for recycling of objects. This keeps the garbage collector happy by keeping objects around for as long as we need them, instead of creating objects that can potentially end up in the large object heap or in Gen 2.

A dispatch call requires that at least a vertex shader be bound. If none is present, then the method will throw an exception.

Exceptions
Type Condition
GorgonException

Thrown if a GorgonComputeShader is not assigned to the GorgonComputeShader property with the ComputeShader(GorgonComputeShader) command.

See Also
GorgonDispatchCall
| Edit this page View Source

Clear()

Function to clear the builder to a default state.

Declaration
public GorgonDispatchCallBuilder Clear()
Returns
Type Description
GorgonDispatchCallBuilder

The fluent builder interface.

See Also
GorgonDispatchCall
| Edit this page View Source

ComputeShader(GorgonComputeShader)

Function to assign a compute shader to the call.

Declaration
public GorgonDispatchCallBuilder ComputeShader(GorgonComputeShader shader)
Parameters
Type Name Description
GorgonComputeShader shader

The shader to assign.

Returns
Type Description
GorgonDispatchCallBuilder

The fluent builder interface.

Exceptions
Type Condition
ArgumentNullException

Thrown when the shader parameter is null.

See Also
GorgonDispatchCall
| Edit this page View Source

ConstantBuffer(GorgonConstantBufferView, int)

Function to set a constant buffer for a compute shader stage.

Declaration
public GorgonDispatchCallBuilder ConstantBuffer(GorgonConstantBufferView constantBuffer, int slot = 0)
Parameters
Type Name Description
GorgonConstantBufferView constantBuffer

The constant buffer to assign.

int slot

The slot for the constant buffer.

Returns
Type Description
GorgonDispatchCallBuilder

The fluent builder interface.

Exceptions
Type Condition
ArgumentNullException

Thrown when the slot is less than 0, or greater than/equal to MaximumConstantBufferCount.

See Also
GorgonDispatchCall
| Edit this page View Source

ConstantBuffers(IReadOnlyList<GorgonConstantBufferView>, int)

Function to set the constant buffers for a compute shader stage.

Declaration
public GorgonDispatchCallBuilder ConstantBuffers(IReadOnlyList<GorgonConstantBufferView> constantBuffers, int startSlot = 0)
Parameters
Type Name Description
IReadOnlyList<GorgonConstantBufferView> constantBuffers

The constant buffers to copy.

int startSlot

[Optional] The starting slot to use when copying the list.

Returns
Type Description
GorgonDispatchCallBuilder

The fluent builder interface.

Exceptions
Type Condition
ArgumentNullException

Thrown when the startSlot is less than 0, or greater than/equal to MaximumConstantBufferCount.

See Also
GorgonDispatchCall
| Edit this page View Source

ReadWriteView(in GorgonReadWriteViewBinding, int)

Function to assign a single read/write (unordered access) view to the dispatch call.

Declaration
public GorgonDispatchCallBuilder ReadWriteView(in GorgonReadWriteViewBinding resourceView, int slot = 0)
Parameters
Type Name Description
GorgonReadWriteViewBinding resourceView

The shader resource view to assign.

int slot

[Optional] The slot used to asign the view.

Returns
Type Description
GorgonDispatchCallBuilder

The fluent builder interface.

Exceptions
Type Condition
ArgumentNullException

Thrown when the slot is less than 0, or greater than/equal to MaximumShaderResourceViewCount.

See Also
GorgonDispatchCall
| Edit this page View Source

ReadWriteViews(IReadOnlyList<GorgonReadWriteViewBinding>, int)

Function to assign the list of read/write (unordered access) views to the dispatch call.

Declaration
public GorgonDispatchCallBuilder ReadWriteViews(IReadOnlyList<GorgonReadWriteViewBinding> resourceViews, int startSlot = 0)
Parameters
Type Name Description
IReadOnlyList<GorgonReadWriteViewBinding> resourceViews

The shader resource views to copy.

int startSlot

[Optional] The starting slot to use when copying the list.

Returns
Type Description
GorgonDispatchCallBuilder

The fluent builder interface .

Exceptions
Type Condition
ArgumentNullException

Thrown when the startSlot is less than 0, or greater than/equal to MaximumShaderResourceViewCount.

See Also
GorgonDispatchCall
| Edit this page View Source

ResetTo(GorgonDispatchCall)

Function to reset the builder to the specified dispatch call state.

Declaration
public GorgonDispatchCallBuilder ResetTo(GorgonDispatchCall dispatchCall = null)
Parameters
Type Name Description
GorgonDispatchCall dispatchCall

[Optional] The specified dispatch call state to copy.

Returns
Type Description
GorgonDispatchCallBuilder

The fluent builder interface.

See Also
GorgonDispatchCall
| Edit this page View Source

SamplerState(GorgonSamplerState, int)

Function to assign a sampler to a shader on the pipeline.

Declaration
public GorgonDispatchCallBuilder SamplerState(GorgonSamplerState sampler, int index = 0)
Parameters
Type Name Description
GorgonSamplerState sampler

The sampler to assign.

int index

[Optional] The index of the sampler.

Returns
Type Description
GorgonDispatchCallBuilder

The fluent interface for this builder.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown if the index parameter is less than 0, or greater than/equal to MaximumSamplerStateCount.

See Also
GorgonDispatchCall
| Edit this page View Source

SamplerState(GorgonSamplerStateBuilder, int)

Function to assign a sampler to a compute shader on the pipeline.

Declaration
public GorgonDispatchCallBuilder SamplerState(GorgonSamplerStateBuilder sampler, int index = 0)
Parameters
Type Name Description
GorgonSamplerStateBuilder sampler

The sampler to assign.

int index

[Optional] The index of the sampler.

Returns
Type Description
GorgonDispatchCallBuilder

The fluent interface for this builder.

See Also
GorgonDispatchCall
| Edit this page View Source

SamplerStates(IReadOnlyList<GorgonSamplerState>, int)

Function to assign a list of samplers to a compute shader on the pipeline.

Declaration
public GorgonDispatchCallBuilder SamplerStates(IReadOnlyList<GorgonSamplerState> samplers, int index = 0)
Parameters
Type Name Description
IReadOnlyList<GorgonSamplerState> samplers

The samplers to assign.

int index

[Optional] The starting index to use when copying the list.

Returns
Type Description
GorgonDispatchCallBuilder

The fluent interface for this builder.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown if the index parameter is less than 0, or greater than/equal to MaximumSamplerStateCount.

See Also
GorgonDispatchCall
| Edit this page View Source

ShaderResource(GorgonShaderResourceView, int)

Function to assign a single shader resource view to the dispatch call.

Declaration
public GorgonDispatchCallBuilder ShaderResource(GorgonShaderResourceView resourceView, int slot = 0)
Parameters
Type Name Description
GorgonShaderResourceView resourceView

The shader resource view to assign.

int slot

[Optional] The slot used to asign the view.

Returns
Type Description
GorgonDispatchCallBuilder

The fluent builder interface.

Exceptions
Type Condition
ArgumentNullException

Thrown when the slot is less than 0, or greater than/equal to MaximumShaderResourceViewCount.

See Also
GorgonDispatchCall
| Edit this page View Source

ShaderResources(IReadOnlyList<GorgonShaderResourceView>, int)

Function to assign the list of shader resource views to the dispatch call.

Declaration
public GorgonDispatchCallBuilder ShaderResources(IReadOnlyList<GorgonShaderResourceView> resourceViews, int startSlot = 0)
Parameters
Type Name Description
IReadOnlyList<GorgonShaderResourceView> resourceViews

The shader resource views to copy.

int startSlot

[Optional] The starting slot to use when copying the list.

Returns
Type Description
GorgonDispatchCallBuilder

The fluent builder interface .

Exceptions
Type Condition
ArgumentNullException

Thrown when the startSlot is less than 0, or greater than/equal to MaximumShaderResourceViewCount.

See Also
GorgonDispatchCall

Implements

IGorgonFluentBuilderAllocator<TB, TBo, TBa>
IGorgonFluentBuilder<TB, TBo>

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)

See Also

GorgonDispatchCall
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author