Table of Contents

Class RenderContext

Namespace
Xui.GPU.Software
Assembly
Xui.Runtime.Software.dll

Orchestrates the software rendering pipeline.

public class RenderContext
Inheritance
RenderContext
Inherited Members

Remarks

RenderContext manages the rendering state and executes vertex and fragment shaders to produce pixels in a framebuffer.

Constructors

RenderContext(Framebuffer)

Creates a new render context with the specified framebuffer.

public RenderContext(Framebuffer framebuffer)

Parameters

framebuffer Framebuffer

The framebuffer to render into.

Properties

BlendEnabled

Gets or sets whether blending is enabled.

public bool BlendEnabled { get; set; }

Property Value

bool

CullMode

Gets or sets the triangle cull mode (default is Back).

public CullMode CullMode { get; set; }

Property Value

CullMode

DepthTestEnabled

Gets or sets whether depth testing is enabled.

public bool DepthTestEnabled { get; set; }

Property Value

bool

Framebuffer

Gets the framebuffer associated with this render context.

public Framebuffer Framebuffer { get; }

Property Value

Framebuffer

Topology

Gets or sets the primitive topology.

public PrimitiveTopology Topology { get; set; }

Property Value

PrimitiveTopology

Viewport

Gets or sets the viewport for coordinate transformation.

public Viewport Viewport { get; set; }

Property Value

Viewport

Methods

ClearColor(Color4)

Clears the framebuffer color to the specified value.

public void ClearColor(Color4 color)

Parameters

color Color4

Color to clear to.

ClearDepth(float)

Clears the framebuffer depth to the specified value.

public void ClearDepth(float depth = 1)

Parameters

depth float

Depth value to clear to (default 1.0).

Draw<TVertex, TVarying, TBindings>(VertexSource<TVertex>, IVertexShader<TVertex, TVarying, TBindings>, IFragmentShader<TVarying, FragmentOutput, TBindings>, TBindings)

Renders vertices through the specified vertex and fragment shaders.

public void Draw<TVertex, TVarying, TBindings>(VertexSource<TVertex> vertices, IVertexShader<TVertex, TVarying, TBindings> vertexShader, IFragmentShader<TVarying, FragmentOutput, TBindings> fragmentShader, TBindings bindings) where TVertex : unmanaged where TVarying : unmanaged where TBindings : unmanaged

Parameters

vertices VertexSource<TVertex>

Source of vertex data.

vertexShader IVertexShader<TVertex, TVarying, TBindings>

Vertex shader implementation.

fragmentShader IFragmentShader<TVarying, FragmentOutput, TBindings>

Fragment shader implementation.

bindings TBindings

Shader bindings (uniforms, textures, etc.).

Type Parameters

TVertex

The vertex input type.

TVarying

The varying data type (vertex output / fragment input).

TBindings

The shader bindings type.