GraphicsContext

Description

abstract class Tinman.Engine.Rendering.GraphicsContext

Derived from

Disposable abstract
IGraphicsContext

Extended by

DirectX11Context sealed
DirectX12Context sealed
DirectX9Context
GLContext abstract

Abstract base class for IGraphicsContext implementations.

These protected fields must be initialized by subclasses in the constructor:

Usually, subclasses will issue render command using a native API, which will be processed by the GPU asynchronously. The following method calls are recommended as implicit events at which to flush the render command buffer:

  • IGraphicsFence.Set:
    The CPU intends to wait for the buffered commands at some later point in time by calling IGraphicsFence.Wait, so the GPU should start working on those as soon as possible.

  • IBeginEnd.End of IGraphicsContext: The CPU will not issue any more render commands and may eventually call ISwapChain.Present at some later point in time. The GPU should process the buffered render commands as quickly as possible.

Public / Constants

Swap​Chain​Format


The render target format flags that are used for swap chains.

Public / Methods

Check​Debug​Enable​Log​Output


[Pure]
public static method CheckDebugEnableLogOutput → ()

returns → bool

true if debug log-output shall be enabled,
false if not.

Checks if debug log-output shall be enabled, according to DebugEnableLogOutput.

Decode​Scanline


public static method DecodeScanline → (6)

pixels in : ColorBuffer

[not-null]
The output pixel buffer.

data in : IntPtr

Pointer to the scanline data to decode.

pitch in : int32

[>0]
The scanline pitch of data in, in bytes.

format in : int32

The data in format:
0 : A8
1 : A8 B8 G8 R8
2 : A8 R8 G8 B8
3 : R8
4 : R32F
5 : R32F G32F
6 : R32F G32F B32F A32F
7 : R16
8 : R16 G16 B16 A16
9 : R16F
10 : R16F G16F
11 : R16F G16F B16F A16F

srgb in : bool

Treat data in values as sRGB compressed?

alpha in : bool

Decode alpha channel?

Decodes a scanline of pixels.

Public / Attributes

Debug​Enable​Log​Output


[DebugHelper] [ShutdownClear]
public static attribute DebugEnableLogOutput → (int32)

Enable additional debug-level log output?

This switch must be set before TinmanModule.Initialize is called:
< 0 : disable debug-level log output
= 0 : use LowLevel.IsDebug to toggle debug-level log output
> 0 : enable debug-level log output
Defaults to 0.

Protected / Constructors

Graphics​Context


protected constructor GraphicsContext → (1)

name in : string

[not-empty]
The graphics context name (see IGraphicsContext.Name).

Creates a new instance of GraphicsContext.

The constructor of a concrete IGraphicsContext implementation must call IGraphicsContext.RegisterRenderEffectFactory once, in order to provide the factory for the built-in render effects.

Protected / Methods

Assert​Begun


protected method AssertBegun → (1)

source in : string

The error source tag.

Asserts that IBeginEnd.Begin has been called.

Do​Set​Clip


protected abstract method DoSetClip → (1)

value in : Box2I

The clip rectangle.

Sets the clip rectangle.

Do​Set​Viewport


protected abstract method DoSetViewport → (1)

value in : Box2I

The viewport rectangle.

Sets the viewport rectangle.

Do​Validate​Render​Target​Format


protected abstract method DoValidateRenderTargetFormat → (1)

format in : RenderTargetFormat

The render target format.

returns → bool

The validation result.

Validates the given render target format.

Instance​Range


protected static method InstanceRange → (4)

buffer in : IGeometryBuffer

The geometry buffer or null.

first in : int32

The first instance to draw.

count in : int32

The number of instances to draw or -1 to draw all remaining instances in buffer in.

zeroIfNonInstanced in : bool

Return RangeI.Zero for non-instanced geometry? Otherwise, a range containing 0 is returned.

returns → RangeI

The resulting instance range.

Computes the instance range for the given geometry buffer.

Protected / Attributes

current​Render​Targets


protected attribute currentRenderTargets → (RenderTargets)

The current set of render targets that has been specified via IGraphicsContext.SetRenderTarget.

render​Target​Count


protected attribute renderTargetCount → (int32)

The maximum number of simultaneous render targets, in the range [1..8].

This field must be initialized by subclasses during construction.

Logging

Logger


public static readonly attribute Logger → (ILogger)

The logger object of this class.