Table of Contents

Class GpuRenderStateCreateInfo

Namespace
Sdl3Sharp.Video.Rendering
Assembly
Sdl3Sharp.dll

Represents the information needed to create a GpuRenderState

public sealed class GpuRenderStateCreateInfo : IDisposable
Inheritance
GpuRenderStateCreateInfo
Implements
Inherited Members

Remarks

This type can be used to share the same creation parameters across multiple GpuRenderState instances, or if you want to prepare the creation parameters in advance and move the heavy lifting away from the constructor call. Alternatively, you can use the TryCreateGpuRenderState(Renderer<Gpu>, GpuShader, out GpuRenderState, ReadOnlySpan<GpuTextureSamplerBinding>, ReadOnlySpan<GpuTexture>, ReadOnlySpan<GpuBuffer>, Properties) method to create a GpuRenderState without needing to create a separate GpuRenderStateCreateInfo instance.

Properties

FragmentShader

Gets or sets the fragment shader to use when the render state created from this GpuRenderStateCreateInfo is active

public required GpuShader FragmentShader { get; set; }

Property Value

GpuShader

The fragment shader to use when the render state created from this GpuRenderStateCreateInfo is active

Exceptions

ArgumentNullException

When setting this property to null

Properties

Gets or sets optional properties for extensions

public Properties? Properties { get; set; }

Property Value

Properties

The properties used for extensions, or null if no extensions are needed

SamplerBindings

Gets or sets the additional fragment samplers to bind when the render state created from this GpuRenderStateCreateInfo is active

public IEnumerable<GpuTextureSamplerBinding>? SamplerBindings { get; set; }

Property Value

IEnumerable<GpuTextureSamplerBinding>

The additional fragment samplers to bind when the render state created from this GpuRenderStateCreateInfo is active

StorageBuffers

Gets or sets the storage buffers to bind when the render state created from this GpuRenderStateCreateInfo is active

public IEnumerable<GpuBuffer>? StorageBuffers { get; set; }

Property Value

IEnumerable<GpuBuffer>

The storage buffers to bind when the render state created from this GpuRenderStateCreateInfo is active

StorageTextures

Gets or sets the storage textures to bind when the render state created from this GpuRenderStateCreateInfo is active

public IEnumerable<GpuTexture>? StorageTextures { get; set; }

Property Value

IEnumerable<GpuTexture>

The storage textures to bind when the render state created from this GpuRenderStateCreateInfo is active

Methods

Dispose()

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

public void Dispose()

~GpuRenderStateCreateInfo()

protected ~GpuRenderStateCreateInfo()

TryPrepare()

Tries to prepare this GpuRenderStateCreateInfo and caches its internal representation

public bool TryPrepare()

Returns

bool

true, if this GpuRenderStateCreateInfo is ready to be used for creating a GpuRenderState; otherwise, false

Remarks

This method prepares this GpuRenderStateCreateInfo's internal representation, caching it for future use. That means calling this method multiple times without modifying any of the properties is essentially a no-op after the first call.

Calling this method is not strictly necessary, as the TryCreateGpuRenderState(Renderer<Gpu>, GpuRenderStateCreateInfo, out GpuRenderState) method would prepare the GpuRenderStateCreateInfo itself, if necessary. But it could be useful to call this method in advance to have a more deterministic point where the preparation happens, and to move away the heavy lifting from the constructor call.

This method will return false if any of the required properties is not set to a valid value (e.g. FragmentShader is null), or if it fails to allocate or reallocate the native memory needed for the sampler bindings, storage textures, or storage buffers.