Gorgon
Show / Hide Table of Contents

Class GorgonStreamOutCallBuilder

A builder used to create stream out draw call objects.

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

The draw call builder object allow applications to build the immutable draw call objects needed to send data and state information to the GPU.

A draw call is an immutable object that contains all of the state required to render mesh information. For each mesh an application needs to render, an single draw call should be issued via the SubmitStreamOut(GorgonStreamOutCall, in GorgonColor?, int, int) method.

State management is handled internally by Gorgon so that duplicate states are not set and thus, performance is not impacted by redundant states.

Because a draw call is immutable, it is not possible to modify a draw call after it's been created. However, a copy of a draw call can be created using the ResetTo(TDc) method on this object. Or, the builder can be modified after the creation of your draw call that needs to be updated and a new call may be built then.

This draw call type sends a series of state changes and resource bindings to the GPU. However, unlike the various GorgonDrawCallCommon objects, this object uses pre-processed data from the vertex and stream out stages. This means that the GorgonVertexBuffer attached to the a previous draw call must have been assigned to the StreamOutBufferBindings and had data deposited into it from the stream out stage. After that, it should be removed from the StreamOutBufferBindings and assigned to the SharpDX.Direct3D11.VertexBufferBinding .

warning

The GorgonVertexBuffer being rendered must have been created with the StreamOut flag set.

Constructors

| Edit this page View Source

GorgonStreamOutCallBuilder()

Initializes a new instance of the GorgonDrawCallBuilder class.

Declaration
public GorgonStreamOutCallBuilder()
See Also
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding

Methods

| Edit this page View Source

Build()

Function to return the draw call.

Declaration
public GorgonStreamOutCall Build()
Returns
Type Description
GorgonStreamOutCall

The draw call created or updated by this builder.

Exceptions
Type Condition
GorgonException

Thrown if a GorgonVertexShader is not assigned to the VertexShader property with the PipelineState(GorgonStreamOutPipelineState) command.

See Also
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
| Edit this page View Source

Build(IGorgonAllocator<GorgonStreamOutCall>)

Function to return the draw call.

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

The allocator used to create an instance of the object

Returns
Type Description
GorgonStreamOutCall

The draw call created or updated by this builder.

Remarks

Using an allocator can provide different strategies when building draw calls. If omitted, the draw 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 stream out 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 GorgonVertexShader is not assigned to the VertexShader property with the PipelineState(GorgonStreamOutPipelineState) command.

See Also
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
| Edit this page View Source

Clear()

Function to clear the builder to a default state.

Declaration
public GorgonStreamOutCallBuilder Clear()
Returns
Type Description
GorgonStreamOutCallBuilder

The fluent builder interface.

See Also
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
| Edit this page View Source

ConstantBuffer(GorgonConstantBufferView, int)

Function to set a constant buffer for a pixel shader.

Declaration
public GorgonStreamOutCallBuilder 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
GorgonStreamOutCallBuilder

The fluent builder interface.

Exceptions
Type Condition
ArgumentNullException

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

See Also
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
| Edit this page View Source

ConstantBuffers(IReadOnlyList<GorgonConstantBufferView>, int)

Function to set the constant buffers for a pixel shader.

Declaration
public GorgonStreamOutCallBuilder 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
GorgonStreamOutCallBuilder

The fluent builder interface.

Exceptions
Type Condition
ArgumentNullException

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

See Also
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
| Edit this page View Source

PipelineState(GorgonStreamOutPipelineState)

Function to set the pipeline state for this draw call.

Declaration
public GorgonStreamOutCallBuilder PipelineState(GorgonStreamOutPipelineState pipelineState)
Parameters
Type Name Description
GorgonStreamOutPipelineState pipelineState

The pipeline state to assign.

Returns
Type Description
GorgonStreamOutCallBuilder

The fluent builder interface.

Exceptions
Type Condition
ArgumentNullException

Thrown when the pipelineState parameter is null.

See Also
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
| Edit this page View Source

PipelineState(GorgonStreamOutPipelineStateBuilder)

Function to set the pipeline state for this draw call.

Declaration
public GorgonStreamOutCallBuilder PipelineState(GorgonStreamOutPipelineStateBuilder pipelineState)
Parameters
Type Name Description
GorgonStreamOutPipelineStateBuilder pipelineState

The pipeline state to assign.

Returns
Type Description
GorgonStreamOutCallBuilder

The fluent builder interface.

See Also
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
| Edit this page View Source

ReadWriteView(in GorgonReadWriteViewBinding, int)

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

Declaration
public GorgonStreamOutCallBuilder 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
GorgonStreamOutCallBuilder

The fluent builder interface.

Exceptions
Type Condition
ArgumentNullException

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

See Also
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
| Edit this page View Source

ReadWriteViews(IReadOnlyList<GorgonReadWriteViewBinding>, int)

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

Declaration
public GorgonStreamOutCallBuilder 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
GorgonStreamOutCallBuilder

The fluent builder interface .

Exceptions
Type Condition
ArgumentNullException

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

See Also
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
| Edit this page View Source

ResetTo(GorgonStreamOutCall)

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

Declaration
public GorgonStreamOutCallBuilder ResetTo(GorgonStreamOutCall drawCall = null)
Parameters
Type Name Description
GorgonStreamOutCall drawCall

[Optional] The specified draw call state to copy.

Returns
Type Description
GorgonStreamOutCallBuilder

The fluent builder interface.

See Also
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
| Edit this page View Source

SamplerState(GorgonSamplerState, int)

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

Declaration
public GorgonStreamOutCallBuilder 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
GorgonStreamOutCallBuilder

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
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
| Edit this page View Source

SamplerState(GorgonSamplerStateBuilder, int)

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

Declaration
public GorgonStreamOutCallBuilder 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
GorgonStreamOutCallBuilder

The fluent interface for this builder.

See Also
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
| Edit this page View Source

SamplerStates(IReadOnlyList<GorgonSamplerState>, int)

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

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

The samplers to assign.

int index

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

Returns
Type Description
GorgonStreamOutCallBuilder

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
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
| Edit this page View Source

ShaderResource(GorgonShaderResourceView, int)

Function to assign a single pixel shader resource view to the draw call.

Declaration
public GorgonStreamOutCallBuilder 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
GorgonStreamOutCallBuilder

The fluent builder interface.

Exceptions
Type Condition
ArgumentNullException

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

See Also
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
| Edit this page View Source

ShaderResources(IReadOnlyList<GorgonShaderResourceView>, int)

Function to assign the list of pixel shader resource views to the draw call.

Declaration
public GorgonStreamOutCallBuilder 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
GorgonStreamOutCallBuilder

The fluent builder interface .

Exceptions
Type Condition
ArgumentNullException

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

See Also
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
| Edit this page View Source

VertexBuffer(GorgonInputLayout, in GorgonVertexBufferBinding)

Function to set a vertex buffer binding for the draw call in slot 0.

Declaration
public GorgonStreamOutCallBuilder VertexBuffer(GorgonInputLayout layout, in GorgonVertexBufferBinding binding)
Parameters
Type Name Description
GorgonInputLayout layout

The input layout to use.

GorgonVertexBufferBinding binding

The vertex buffer binding to set.

Returns
Type Description
GorgonStreamOutCallBuilder

The fluent builder interface.

Exceptions
Type Condition
ArgumentNullException

Thrown when the layout parameter is null.

See Also
GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding

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

GorgonGraphics
GorgonPipelineState
GorgonStreamOutCall
GorgonVertexBuffer
VertexBufferBinding
  • 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