PlatformAPI reference
Class SdlRendererDevice
Namespace: MicroEngine.Sdl
Assembly: MicroEngine.Sdl.dll
Guide: The graphics device
The tier-0 graphics device on SDL_Renderer, with SDL’s default render driver unless
Api names one (“direct3d11”, “direct3d12”, “opengl”, “vulkan”, “metal”, “gpu”,
“software”…). Buffers are device-owned CPU memory submitted through SDL_RenderGeometryRaw (the
Vertex2D layout is passed with strides, without conversion); the built-in pipeline is an SDL blend mode;
samplers are SDL scale and address modes applied per draw; command lists execute inside
Submit into SDL’s own queue, which SDL flushes at readback and present. Declared
features: render targets, repeat addressing and, where the driver composes every blend factor, custom blend states.
SDL’s software driver is a diagnostic device: its triangle coverage differs from the contract’s pixel-centre
rule along rotated edges, and it does not claim conformance.
public sealed class SdlRendererDevice : GraphicsDeviceBase, IGraphicsDevice, IDisposableInheritance
object ← GraphicsDeviceBase ← SdlRendererDevice
Implements
Inherited Members
GraphicsDeviceBase.CreateTexture(in TextureDescription, ReadOnlySpan<byte>), GraphicsDeviceBase.CreateRenderTarget(in RenderTargetDescription), GraphicsDeviceBase.GetSampler(in SamplerDescription), GraphicsDeviceBase.CreateBuffer(in BufferDescription), GraphicsDeviceBase.CreateShader(in ShaderDescription), GraphicsDeviceBase.CreatePipeline(PipelineDescription), GraphicsDeviceBase.GetBuiltInPipeline(BuiltInPipeline, BlendState, TextureFormat, TextureFormat?), GraphicsDeviceBase.BeginCommands(), GraphicsDeviceBase.Submit(CommandList), GraphicsDeviceBase.ReadPixels(RenderTarget, RectI), GraphicsDeviceBase.TryAcquireSurfaceTarget(out RenderTarget?), GraphicsDeviceBase.Present(), GraphicsDeviceBase.Dispose(), GraphicsDeviceBase.TryGetResource<T>(Handle<GraphicsResource>, out T?), GraphicsDeviceBase.Capabilities, GraphicsDeviceBase.IsDisposed, GraphicsDeviceBase.Counters, GraphicsDeviceBase.PendingReleases, GraphicsDeviceBase.DeviceLost, object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
SdlRendererDevice(ISurface, GraphicsDeviceOptions)
Creates the device and its SDL renderer for an SDL window surface.
public SdlRendererDevice(ISurface surface, GraphicsDeviceOptions options)Parameters
surface ISurface
A surface whose NativeWindow is an SDL_Window*.
options GraphicsDeviceOptions
The present mode and, optionally, the render driver to ask SDL for.
Exceptions
SDL could not create the renderer (the message names SDL’s error).
The present mode is not VSync or Immediate.
Fields
BackendName
The backend name.
public const string BackendName = "sdl-renderer"Field Value
Properties
Capabilities
Declared capabilities.
public override GraphicsCapabilities Capabilities { get; }Property Value
Renderer
The SDL renderer the device draws with (owned by the device; destroyed with it).
public SDL_Renderer* Renderer { get; }Property Value
SDL_Renderer*
Methods
CreateBufferCore(in BufferDescription)
Backend: create a validated buffer.
protected override GpuBuffer CreateBufferCore(in BufferDescription description)Parameters
description BufferDescription
Returns
CreateBuiltInPipelineCore(BuiltInPipeline, BlendState, TextureFormat, TextureFormat?)
Backend: create a built-in pipeline variant (core caches it).
protected override Pipeline CreateBuiltInPipelineCore(BuiltInPipeline kind, BlendState blend, TextureFormat colorFormat, TextureFormat? depthFormat)Parameters
kind BuiltInPipeline
blend BlendState
colorFormat TextureFormat
depthFormat TextureFormat?
Returns
CreatePipelineCore(PipelineDescription)
Backend: create a validated custom pipeline (tier 0 is never called: core refuses first).
protected override Pipeline CreatePipelineCore(PipelineDescription description)Parameters
description PipelineDescription
Returns
CreateRenderTargetCore(in RenderTargetDescription)
Backend: create a validated render target.
protected override RenderTarget CreateRenderTargetCore(in RenderTargetDescription description)Parameters
description RenderTargetDescription
Returns
CreateSamplerCore(in SamplerDescription)
Backend: create a validated sampler (core caches it).
protected override Sampler CreateSamplerCore(in SamplerDescription description)Parameters
description SamplerDescription
Returns
CreateShaderCore(in ShaderDescription)
Backend: create a validated shader (tier 0 is never called: core refuses first).
protected override Shader CreateShaderCore(in ShaderDescription description)Parameters
description ShaderDescription
Returns
CreateTextureCore(in TextureDescription, ReadOnlySpan<byte>)
Backend: create a validated texture.
protected override Texture CreateTextureCore(in TextureDescription description, ReadOnlySpan<byte> initialData)Parameters
description TextureDescription
initialData ReadOnlySpan<byte>
Returns
DisposeCore(IReadOnlyList<Pipeline>, IReadOnlyList<Sampler>)
Backend: release everything, the device-owned built-ins and samplers included.
protected override void DisposeCore(IReadOnlyList<Pipeline> builtIns, IReadOnlyList<Sampler> samplers)Parameters
builtIns IReadOnlyList<Pipeline>
samplers IReadOnlyList<Sampler>
PresentCore(RenderTarget)
Backend: present and expire the surface target.
protected override void PresentCore(RenderTarget surfaceTarget)Parameters
surfaceTarget RenderTarget
ReadPixelsCore(RenderTarget, RectI)
Backend: start a validated readback.
protected override ReadbackRequest ReadPixelsCore(RenderTarget target, RectI region)Parameters
target RenderTarget
region RectI
Returns
SubmitCore(CommandList)
Backend: execute a validated, sealed list after everything submitted before it.
protected override void SubmitCore(CommandList commands)Parameters
commands CommandList
TryAcquireSurfaceTargetCore()
Backend: acquire this frame’s surface target or return null.
protected override RenderTarget? TryAcquireSurfaceTargetCore()