Gorgon
Show / Hide Table of Contents

Class GorgonGraphics

The primary object for the Gorgon Graphics system.

Inheritance
object
GorgonGraphics
Implements
IGorgonNativeResource
IDisposable
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 GorgonGraphics : IGorgonNativeResource, IDisposable
Remarks

This is used to initialize the functionality available for rendering hardware accelerated graphics for applications. It is also used in the initialization of other objects used to create graphics.

Typically, a graphics object is assigned to a single IGorgonVideoAdapterInfo to provide access to the functionality of that video adapter. If the system has more than once video adapter installed then access to subsequent devices can be given by creating a new instance of this object with the appropriate IGorgonVideoAdapterInfo.

tip

To determine what devices are attached to the system, use a EnumerateAdapters(bool, IGorgonLog) method to retreive a list of applicable video adapters. This will contain a list of IGorgonVideoAdapterInfo objects suitable for construction of the graphics object.

When creating a graphics object, the user can choose which feature set they will support for a given IGorgonVideoAdapterInfo so that older devices may be used. The actual feature set support is provided by the FeatureSet on the IGorgonVideoAdapterInfo interface.

This object is quite simple in its functionality. It provides some state assignment, and a means to submit a draw call so that graphics information can be rendered.

Rendering

Through the use of draw call types, this object will send data in a stateless fashion. This differs from Direct 3D and other traditional APIs where states are set until they're changed (stateful). The approach provided by this object avoids a common problem called state-leakage where a state may have been set prior to drawing, but was forgotten about. This can lead to artifacts or can disable rendering entirely and consequently can be quite difficult to track.

When a draw call is sent, it carries all of the required state information (with the exception of resource types). This ensures that if a draw call doesn't need a state at a specific time, it will be reset to a sensible default (as defined by the developer).

When drawing, Gorgon will determine the minimum required state to send with the final draw call, ensuring no redundant states are set. This type of rendering provides a performance gain since it will only set the absolute minimum unique state it needs when the draw call is actually sent to the GPU. This means the user can set the state for a draw call as much as they want without that state being sent to the GPU.

Debugging Support

Applications can enable Direct 3D debugging by setting to the IsDebugEnabled property to true. This will allow developers to examine underlying failures when rendering using Direct 3D. Gorgon also provides memory tracking for any underlying Direct 3D objects when the IsObjectTrackingEnabled is set to true. This is useful if a Dispose() call was forgotten by the developer.

However, it is not enough to just set these flags to true to enable debugging. Users must also use the DirectX control panel (Debug -> Graphics -> DirectX Control Panel) provided by Visual Studio in order to turn on debugging. Finally, the user must then turn on Native debugging in the Project properties of their application (under the Debug tab) so that any debug output can be seen in the Output window while running the application.

If using a DEBUG compiled version of Gorgon (recommended for development), then the IsDebugEnabled property will automatically be set to true.

Constructors

| Edit this page View Source

GorgonGraphics(IGorgonVideoAdapterInfo, FeatureSet?, IGorgonLog)

Initializes a new instance of the GorgonGraphics class.

Declaration
public GorgonGraphics(IGorgonVideoAdapterInfo videoAdapterInfo, FeatureSet? featureSet = null, IGorgonLog log = null)
Parameters
Type Name Description
IGorgonVideoAdapterInfo videoAdapterInfo

A IGorgonVideoAdapterInfo to specify the video adapter to use for this instance.

FeatureSet? featureSet

[Optional] The requested feature set for the video adapter used with this object.

IGorgonLog log

[Optional] The log to use for debugging.

Remarks

When the videoAdapterInfo is set to null, Gorgon will use the first video adapter with feature level specified by featureSet will be used. If the feature level requested is higher than what any device in the system can support, then the first device with the highest feature level will be used.

When specifying a feature set, the device with the closest matching feature set will be used. If the videoAdapterInfo is specified, then that device will be used at the requested featureSet. If the requested featureSet is higher than what the videoAdapterInfo will support, then Gorgon will use the highest feature of the specified videoAdapterInfo.

If Gorgon is compiled in DEBUG mode, and videoAdapterInfo is null, then it will attempt to find the most appropriate hardware video adapter, and failing that, will fall back to a software device.

important

The Gorgon Graphics library only works on Windows 10 v1703 Build 15603 (Creators Update) or better. No lesser operating system version is supported.

Examples

The following examples show the various ways the object can be configured:

// Create using a specific video adapter and use the highest feature set supported by that device:
// Get a list of available video adapters.
IReadOnlyList<IGorgonVideoAdapterInfo> videoAdapters = GorgonGraphics.EnumerateAdapters(false, log);

// In real code, you should always check for more than 0 devices in the resulting list. GorgonGraphics graphics = new GorgonGraphics(videoAdapters[0]);

// Create using the requested feature set and the first adapter that supports the nearest feature set requested: // If the device does not support 12.1, then the device with the nearest feature set (e.g. 12.0) will be used instead. IReadOnlyList<IGorgonVideoAdapterInfo> videoAdapters = GorgonGraphics.EnumerateAdapters(false, log);

// In real code, you should always check for more than 0 devices in the resulting list. GorgonGraphics graphics = new GorgonGraphics(videoAdapters[0], FeatureSet.Level_12_1);

Exceptions
Type Condition
GorgonException

Thrown when the featureSet is unsupported.

See Also
IGorgonVideoAdapterInfo

Fields

| Edit this page View Source

BlitterShaderIncludeFileName

The name of the shader file data used for include files that wish to use the include shader.

Declaration
public const string BlitterShaderIncludeFileName = "__Gorgon_TextureBlitter_Shader__"
Field Value
Type Description
string
See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall

Properties

| Edit this page View Source

DepthStencilView

Property to return the current depth/stencil view.

Declaration
public GorgonDepthStencil2DView DepthStencilView { get; }
Property Value
Type Description
GorgonDepthStencil2DView
See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

FeatureSet

Property to return the actual supported FeatureSet for this graphics instance.

Declaration
public FeatureSet FeatureSet { get; }
Property Value
Type Description
FeatureSet
Remarks

A user may request a lower FeatureSet than what is supported by the device to allow the application to run on older video adapters that lack support for newer functionality. This requested feature set will be returned by this property if supported by the device.

If the user does not request a feature set, or has specified one higher than what the video adapter supports, then the highest feature set supported by the video adapter (indicated by the FeatureSet property in the IGorgonVideoAdapterInfo class) will be returned.

See Also
FeatureSet
| Edit this page View Source

FormatSupport

Property to return the support available to each format.

Declaration
public IReadOnlyDictionary<BufferFormat, IGorgonFormatSupportInfo> FormatSupport { get; }
Property Value
Type Description
IReadOnlyDictionary<BufferFormat, IGorgonFormatSupportInfo>
Remarks

This will return the options available to a BufferFormat.

The format support and compute shader/uav support value returned will be a bit mask of values from the BufferFormatSupport and the ComputeShaderFormatSupport enumeration respectively.

See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

IsDebugEnabled

Property to set or return whether debug output is enabled for the underlying graphics API.

Declaration
public static bool IsDebugEnabled { get; set; }
Property Value
Type Description
bool
Remarks

This will enable debug output for the underlying graphics API that Gorgon uses to render (Direct 3D 11 at this time). When this is enabled, all functionality will have debugging information that will output to the debug output console (Output window in Visual Studio) if the Debug -> Enable Native Debugging is turned on in the application project settings and the DirectX control panel is set up to debug the application under Direct 3D 10/11(/12 for Windows 10) application list.

When Gorgon is compiled in DEBUG mode, this flag defaults to true, otherwise it defaults to false.

important

This flag must be set prior to creating any GorgonGraphics object, or else the flag will not take effect.

The D3D11 SDK Layers DLL must be installed in order for this flag to work. If it is not, then the application may crash.

See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

IsObjectTrackingEnabled

Property to set or return whether object tracking is disabled.

Declaration
public static bool IsObjectTrackingEnabled { get; set; }
Property Value
Type Description
bool
Remarks

This will enable SharpDX's object tracking to ensure references are destroyed upon application exit.

The default value for DEBUG mode is true, and for RELEASE it is set to false. Disabling object tracking will give a slight performance increase.

important

This flag must be set prior to creating any GorgonGraphics object, or else the flag will not take effect.

See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

Log

Property to return the logging interface used to write out debug messages.

Declaration
public IGorgonLog Log { get; }
Property Value
Type Description
IGorgonLog
See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

RenderTargets

Property to return the currently assigned render targets.

Declaration
public IReadOnlyList<GorgonRenderTargetView> RenderTargets { get; }
Property Value
Type Description
IReadOnlyList<GorgonRenderTargetView>
See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

Statistics

Property to return the statistics generated while rendering.

Declaration
public ref readonly GorgonGraphicsStatistics Statistics { get; }
Property Value
Type Description
GorgonGraphicsStatistics
See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

TemporaryTargets

Property to return a factory for creating/retrieving render targets for temporary use.

Declaration
public IGorgonRenderTargetFactory TemporaryTargets { get; }
Property Value
Type Description
IGorgonRenderTargetFactory
Remarks

During the lifecycle of an application, many render targets may be required. In most instances, creating a render target for a scene and disposing of it when done is all that is required. But, when dealing with effects, shaders, etc... render targets may need to be created and released during a frame and doing this several times in a frame can be costly.

This factory allows applications to "rent" a render target and return it when done with only an initial cost when creating a target for the first time. This way, temporary render targets can be reused when needed.

When the factory retrieves a target, it will check its internal pool and see if a render target already exists. If it exists, and is not in use, it will return the existing target. If the target does not exist, or is being used elsewhere, then a new target is created and added to the pool.

Targets retrieved by this factory must be returned when they are no longer needed, otherwise the purpose of the factory is defeated.

warning

This factory is not thread safe.

See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

VideoAdapter

Property to set or return the video adapter to use for this graphics interface.

Declaration
public IGorgonVideoAdapterInfo VideoAdapter { get; }
Property Value
Type Description
IGorgonVideoAdapterInfo
See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

Viewports

Property to return the list of currently assigned viewports.

Declaration
public IReadOnlyList<ViewportF> Viewports { get; }
Property Value
Type Description
IReadOnlyList<ViewportF>
See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall

Methods

| Edit this page View Source

ClearState(bool)

Function to clear the states for the graphics object.

Declaration
public void ClearState(bool flush = false)
Parameters
Type Name Description
bool flush

[Optional] true to flush the queued graphics object commands, false to leave as is.

Remarks

This method will reset all current states to an uninitialized state.

If the flush parameter is set to true, then any commands on the GPU that are pending will be flushed.

warning

This method will cause a significant performance hit if the flush parameter is set to true, so its use is generally discouraged in performance sensitive situations.

See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

ClearStateCache()

Function to clear the cached pipeline states and sampler states

Declaration
public void ClearStateCache()
Remarks

This will destroy any previously cached pipeline states and sampler states.

See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()
See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

EnumerateAdapters(bool, IGorgonLog)

Function to retrieve information about the installed video adapters on the system.

Declaration
public static IReadOnlyList<IGorgonVideoAdapterInfo> EnumerateAdapters(bool includeSoftwareDevice = false, IGorgonLog log = null)
Parameters
Type Name Description
bool includeSoftwareDevice

[Optional] true to retrieve a software rendering device, or false to exclude it.

IGorgonLog log

[Optional] The logging interface used to capture debug messages.

Returns
Type Description
IReadOnlyList<IGorgonVideoAdapterInfo>

A list of installed adapters on the system.

Remarks

Use this to retrieve a list of video adapters available on the system. A video adapter may be a discreet video card, a device on the motherboard, or a software video adapter.

This resulting list will contain IGorgonVideoAdapterInfo objects which can then be passed to a GorgonGraphics instance. This allows applications or users to pick and choose which adapter they wish to use for rendering.

If the user specifies true for the includeSoftwareDevice parameter, then the video adapter supplied will be much slower than an actual hardware video adapter. However, this adapter can be helpful in debugging scenarios where issues with the hardware device driver may be causing incorrect rendering.

See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

Flush()

Function to flush the rendering commands.

Declaration
public void Flush()
See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

ReportLiveObjects()

Function to report internal objects that are still alive to the debug output.

Declaration
public void ReportLiveObjects()
Remarks

This method is used to track any object that is still alive even when they should be deactivated. Typically one would call this at shut down due to resource leaks noted by the debug runtime.

See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

SetDepthStencil(GorgonDepthStencil2DView)

Function to assign a depth/stencil view.

Declaration
public void SetDepthStencil(GorgonDepthStencil2DView depthStencil)
Parameters
Type Name Description
GorgonDepthStencil2DView depthStencil

The depth/stencil to assign.

Remarks

This depth/stencil have the same dimensions, array size, and multisample values as the currently assigned RenderTargets.

warning

When changing a depth/stencil, the state of the GPU is reset and may impact performance. This is done to avoid resource hazards (e.g. depth/stencil is set as a shader resource).

important

For performance reasons, any exceptions thrown from this method will only be thrown when Gorgon is compiled as DEBUG.

See Also
GorgonDepthStencil2DView
GorgonTexture2D
| Edit this page View Source

SetRenderTarget(GorgonRenderTargetView, GorgonDepthStencil2DView)

Function to assign a single render target to the first slot.

Declaration
public void SetRenderTarget(GorgonRenderTargetView renderTarget, GorgonDepthStencil2DView depthStencil = null)
Parameters
Type Name Description
GorgonRenderTargetView renderTarget

The render target view to assign.

GorgonDepthStencil2DView depthStencil

[Optional] The depth/stencil to assign with the render target.

Remarks

This will assign a render target in slot 0 of the RenderTargets list. All other render targets bound in other slots will be unbound. If multiple render targets need to be set, then call the SetRenderTargets(ReadOnlySpan<GorgonRenderTargetView>, GorgonDepthStencil2DView) method.

If the depthStencil parameter is used, then a GorgonDepthStencil2DView is assigned in conjunction with the render target. This depth/stencil have the same dimensions, array size, and multisample values as the render target. When specifying a depth/stencil, the render targets must be a GorgonTexture2D.

When a render target is set, the first viewport in the Viewports list will be reset to the size of the render target. The user is responsible for restoring these to their intended values after assigning the target if a different viewport region is required.

warning

When changing a render target or depth/stencil, the state of the GPU is reset and may impact performance. This is done to avoid resource hazards (e.g. target is set as a shader resource).

important

For performance reasons, any exceptions thrown from this method will only be thrown when Gorgon is compiled as DEBUG.

See Also
GorgonDepthStencil2DView
GorgonTexture2D
| Edit this page View Source

SetRenderTargets(ReadOnlySpan<GorgonRenderTargetView>, GorgonDepthStencil2DView)

Function to assign multiple render targets to the first slot and a custom depth/stencil view.

Declaration
public void SetRenderTargets(ReadOnlySpan<GorgonRenderTargetView> renderTargets, GorgonDepthStencil2DView depthStencil = null)
Parameters
Type Name Description
ReadOnlySpan<GorgonRenderTargetView> renderTargets

The list of render target views to assign.

GorgonDepthStencil2DView depthStencil

The depth/stencil view to assign.

Remarks

This will assign multiple render targets to the corresponding slots in the RenderTargets list.

If the depthStencil parameter is used, then a GorgonDepthStencil2DView is assigned in conjunction with the render target. This depth/stencil have the same dimensions, array size, and multisample values as the render target. When specifying a depth/stencil, the render targets must be a GorgonTexture2D.

If the GorgonRenderTargetViews are attached to resources with multisampling enabled through GorgonMultisampleInfo, then the GorgonMultisampleInfo of the resource attached to the GorgonDepthStencil2DView being assigned must match, or an exception will be thrown.

The format for the renderTargets and depthStencil may differ from the formats of other views passed in.

When a render target is set, the first viewport in the Viewports list will be reset to the size of the render target. The user is responsible for restoring these to their intended values after assigning the target if a different viewport region is required.

warning

When changing a render target or depth/stencil, the state of the GPU is reset and may impact performance. This is done to avoid resource hazards (e.g. target is set as a shader resource).

information

The exceptions raised when validating a view against other views in this list are only thrown when Gorgon is compiled as DEBUG.

See Also
GorgonDepthStencil2DView
GorgonTexture2D
| Edit this page View Source

SetScissorRect(Rectangle)

Function to set a scissor rectangle for defining a clipping area on the current render target.

Declaration
public void SetScissorRect(Rectangle rect)
Parameters
Type Name Description
Rectangle rect

The region, in screen coordinates, to clip.

Remarks

These are used for defining a clipping area on the current render target, pixels rendered outside of the area defined will not appear in the render target.

The rasterizer state does not have ScissorRectsEnabled set to true, this method will have no effect. If a scissor rectangle is assigned while a raster state with ScissorRectsEnabled is set to false, it will remain assigned and will be applied if a raster state with ScissorRectsEnabled is set to true.

See Also
GorgonRasterState
| Edit this page View Source

SetScissorRects(ReadOnlySpan<Rectangle>)

Function to set multple scissor rectangles for defining a clipping area on the current render target.

Declaration
public void SetScissorRects(ReadOnlySpan<Rectangle> rects)
Parameters
Type Name Description
ReadOnlySpan<Rectangle> rects

The regions, in screen coordinates, to clip.

Remarks

These are used for defining clipping areas on the current render target, pixels rendered outside of the areas defined will not appear in the render target.

This Which scissor rectangle to use is determined by the SV_ViewportArrayIndex semantic output by a geometry shader (see shader semantic syntax). If a geometry shader does not make use of the SV_ViewportArrayIndex semantic then the first scissor rectangle in the array will be used.

The rasterizer state does not have ScissorRectsEnabled set to true, this method will have no effect. If a scissor rectangle is assigned while a raster state with ScissorRectsEnabled is set to false, it will remain assigned and will be applied if a raster state with ScissorRectsEnabled is set to true.

See Also
GorgonRasterState
| Edit this page View Source

SetViewport(ViewportF)

Function to set a viewport to define the area to render on the RenderTargets.

Declaration
public void SetViewport(ViewportF viewport)
Parameters
Type Name Description
ViewportF viewport

The viewport to assign.

Remarks

This will define the area to render into on the current RenderTargets. This method will set the first viewport at index 0 only, any other viewports assigned will be unassigned.

See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

SetViewports(ReadOnlySpan<ViewportF>)

Function to set multiple viewports to define the area to render on the RenderTargets.

Declaration
public void SetViewports(ReadOnlySpan<ViewportF> viewports)
Parameters
Type Name Description
ReadOnlySpan<ViewportF> viewports

The viewports to assign.

Remarks

This will define the area to render into on the current RenderTargets. This method will set the first viewport at index 0 only, any other viewports assigned will be unassigned.

See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

Submit(GorgonDrawCall, in GorgonColor?, int, int)

Function to submit a basic draw call to the GPU.

Declaration
public void Submit(GorgonDrawCall drawCall, in GorgonColor? blendFactor = null, int blendSampleMask = -2147483648, int stencilReference = 0)
Parameters
Type Name Description
GorgonDrawCall drawCall

The draw call to execute.

GorgonColor? blendFactor

[Optional] The factor used to modulate the pixel shader, render target or both.

int blendSampleMask

[Optional] The mask used to define which samples get updated in the active render targets.

int stencilReference

[Optional] The stencil reference value used when performing a stencil test.

Exceptions
Type Condition
ArgumentNullException

Thrown when the drawCall parameter is null.

See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

Submit(GorgonDrawIndexCall, in GorgonColor?, int, int)

Function to submit a draw call with indices to the GPU.

Declaration
public void Submit(GorgonDrawIndexCall drawIndexCall, in GorgonColor? blendFactor = null, int blendSampleMask = -2147483648, int stencilReference = 0)
Parameters
Type Name Description
GorgonDrawIndexCall drawIndexCall

The draw call to execute.

GorgonColor? blendFactor

[Optional] The factor used to modulate the pixel shader, render target or both.

int blendSampleMask

[Optional] The mask used to define which samples get updated in the active render targets.

int stencilReference

[Optional] The stencil reference value used when performing a stencil test.

Exceptions
Type Condition
ArgumentNullException

Thrown when the drawIndexCall parameter is null.

See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

SubmitIndirect(GorgonDrawCallCommon, GorgonBuffer, int)

Function to submit a GorgonDrawCallCommon to the GPU using a GorgonBuffer to pass in variable sized arguments.

Declaration
public void SubmitIndirect(GorgonDrawCallCommon drawCall, GorgonBuffer indirectArgs, int argumentOffset = 0)
Parameters
Type Name Description
GorgonDrawCallCommon drawCall

The draw call to submit.

GorgonBuffer indirectArgs

The buffer containing the draw call arguments to pass.

int argumentOffset

[Optional] The offset, in bytes, within the buffer to start reading the arguments from.

Remarks

This allows submitting a GorgonDrawCallCommon with variable arguments without having to perform a read back of that data from the GPU and therefore avoid a stall.

Like the SubmitStreamOut(GorgonStreamOutCall, in GorgonColor?, int, int) method, this is useful when a shader generates an arbitrary amount of data within a buffer. Retrieving the size, or the data itself from the buffer will cause a stall when swtiching back to the CPU. So, to counter this, this method will pass the buffer with the arguments for the draw call straight through without having to get the CPU to read the data back, thus avoiding the stall.

important

For performance reasons, any exceptions thrown from this method will only be thrown when Gorgon is compiled as DEBUG.

Exceptions
Type Condition
ArgumentNullException

Thrown when the drawCall, or the indirectArgs parameter is null.

ArgumentOutOfRangeException

Thrown when the argumentOffset parameter is less than 0.

GorgonException

Thrown if the indirectArgs was not created with the IndirectArgs flag set to true.

See Also
GorgonDrawCallCommon
| Edit this page View Source

SubmitInstance(GorgonDrawCall, int, int, in GorgonColor?, int, int)

Function to submit a basic, instanced, draw call to the GPU.

Declaration
public void SubmitInstance(GorgonDrawCall drawCall, int instanceCount, int startInstanceIndex = 0, in GorgonColor? blendFactor = null, int blendSampleMask = -2147483648, int stencilReference = 0)
Parameters
Type Name Description
GorgonDrawCall drawCall

The draw call to execute.

int instanceCount

The number of instances to draw.

int startInstanceIndex

[Optional] The starting index within the instance buffer.

GorgonColor? blendFactor

[Optional] The factor used to modulate the pixel shader, render target or both.

int blendSampleMask

[Optional] The mask used to define which samples get updated in the active render targets.

int stencilReference

[Optional] The stencil reference value used when performing a stencil test.

Exceptions
Type Condition
ArgumentNullException

Thrown when the drawCall parameter is null.

See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

SubmitInstance(GorgonDrawIndexCall, int, int, in GorgonColor?, int, int)

Function to submit a draw call with indices to the GPU.

Declaration
public void SubmitInstance(GorgonDrawIndexCall drawIndexCall, int instanceCount, int startInstanceLocation = 0, in GorgonColor? blendFactor = null, int blendSampleMask = -2147483648, int stencilReference = 0)
Parameters
Type Name Description
GorgonDrawIndexCall drawIndexCall

The draw call to execute.

int instanceCount

The number of instances to draw.

int startInstanceLocation

[Optional] The starting instance in the instance buffer.

GorgonColor? blendFactor

[Optional] The factor used to modulate the pixel shader, render target or both.

int blendSampleMask

[Optional] The mask used to define which samples get updated in the active render targets.

int stencilReference

[Optional] The stencil reference value used when performing a stencil test.

Exceptions
Type Condition
ArgumentNullException

Thrown when the drawIndexCall parameter is null.

See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

SubmitStreamOut(GorgonStreamOutCall, in GorgonColor?, int, int)

Function to submit a GorgonDrawCallCommon to the GPU.

Declaration
public void SubmitStreamOut(GorgonStreamOutCall drawCall, in GorgonColor? blendFactor = null, int blendSampleMask = -2147483648, int stencilReference = 0)
Parameters
Type Name Description
GorgonStreamOutCall drawCall

The draw call to submit.

GorgonColor? blendFactor

[Optional] The factor used to modulate the pixel shader, render target or both.

int blendSampleMask

[Optional] The mask used to define which samples get updated in the active render targets.

int stencilReference

[Optional] The stencil reference value used when performing a stencil test.

Remarks

This method sends a series of state changes and resource bindings to the GPU. However, unlike the Submit(GorgonDrawIndexCall, in GorgonColor?, int, int) command, this command uses pre-processed data from the vertex and stream out stages. This means that the GorgonVertexBuffer attached to the draw call must have been assigned to the previous StreamOutBufferBindings and had data deposited into it from the stream out stage. After that, it should be be assigned to a GorgonStreamOutCall passed to this method.

To render data with this method, the GorgonVertexBufferBinding being rendered must have been be created with the StreamOut flag set.

important

For performance reasons, any exceptions thrown from this method will only be thrown when Gorgon is compiled as DEBUG.

Exceptions
Type Condition
ArgumentNullException

Thrown when the drawCall parameter is null.

See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall

Events

| Edit this page View Source

DepthStencilChanged

Event triggered when the depth/stencil buffer has been changed.

Declaration
public event EventHandler DepthStencilChanged
Event Type
Type Description
EventHandler
See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

DepthStencilChanging

Event triggered before a depth/stencil buffer is changed.

Declaration
public event CancelEventHandler DepthStencilChanging
Event Type
Type Description
CancelEventHandler
See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

RenderTargetChanged

Event triggered when the render target has been changed.

Declaration
public event EventHandler RenderTargetChanged
Event Type
Type Description
EventHandler
See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

RenderTargetChanging

Event triggered before a render target is changed.

Declaration
public event CancelEventHandler RenderTargetChanging
Event Type
Type Description
CancelEventHandler
See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

ViewportChanged

Event triggered when a viewport is changed.

Declaration
public event EventHandler ViewportChanged
Event Type
Type Description
EventHandler
See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
| Edit this page View Source

ViewportChanging

Event triggered before a viewport is changed.

Declaration
public event CancelEventHandler ViewportChanging
Event Type
Type Description
CancelEventHandler
See Also
IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall

Implements

IGorgonNativeResource
IDisposable

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonResourceLocator.LocateResourcesByName<T>(GorgonGraphics, string, LocateFilterType, StringComparison)
GorgonResourceLocator.LocateResourcesByType<T>(GorgonGraphics)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)

See Also

IGorgonVideoAdapterInfo
GorgonDrawCall
GorgonDrawIndexCall
  • 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