Implements the RmlUi render interface on top of CoreGraphics, modelled on RmlUi's GL3 reference renderer.
RmlUi renders into its own offscreen targets in the StaticUI subgraph, outside of any frame script pass, so the renderer can switch targets for layers and filters. Every target shares one stencil buffer, which holds the clip masks. The result is composited onto the color buffer in the StaticUI To Backbuffer subgraph (Present).
The targets are unorm RGBA8 and all blending happens with premultiplied alpha in sRGB space, which is what RmlUi's reference renderers do. Present converts to linear for the sRGB color buffer.
Supported: geometry, textures, scissor, transforms, clip masks, layers, filters (opacity, blur, drop-shadow, color matrices, mask-image), gradient shaders and render-to-texture (box-shadow).
- Copyright
- (C) 2026 Individual contributors, see AUTHORS file
Inherits Rml::RenderInterface.
|
| | RmlUiRenderInterface () |
| | constructor
|
| | ~RmlUiRenderInterface () override |
| | destructor
|
| void | Setup () |
| | setup GPU resources
|
| void | Discard () |
| | discard GPU resources
|
| void | CreatePresentPipeline (const CoreGraphics::RenderPassId pass) |
| | (re)create the present pipeline for the frame script pass the UI is composited in
|
| void | BeginFrame (const CoreGraphics::CmdBufferId frameCmdBuf, const Math::rectangle< int > &viewport, const IndexT frameBufferIndex) |
| | start rendering a frame into the UI targets, called outside of any pass
|
| void | EndFrame () |
| | finish rendering the frame, leaves the UI readable
|
| void | Present (const CoreGraphics::CmdBufferId cmdBuf, const Math::rectangle< int > &viewport) |
| | composite the UI onto the current pass, called inside the frame script pass
|
| Rml::CompiledGeometryHandle | CompileGeometry (Rml::Span< const Rml::Vertex > vertices, Rml::Span< const int > indices) override |
| | Rml::RenderInterface.
|
| void | RenderGeometry (Rml::CompiledGeometryHandle geometry, Rml::Vector2f translation, Rml::TextureHandle texture) override |
| void | ReleaseGeometry (Rml::CompiledGeometryHandle geometry) override |
| Rml::TextureHandle | LoadTexture (Rml::Vector2i &textureDimensions, const Rml::String &source) override |
| | Sources containing a URN of type tex (folder:file:tex) go through the resource server, anything else is read as an image file (png, tga, jpg...).
|
| Rml::TextureHandle | GenerateTexture (Rml::Span< const Rml::byte > source, Rml::Vector2i sourceDimensions) override |
| | RmlUi hands over premultiplied RGBA8 (font atlases, gradients...), which is what the renderer works with.
|
| void | ReleaseTexture (Rml::TextureHandle texture) override |
| void | EnableScissorRegion (bool enable) override |
| void | SetScissorRegion (Rml::Rectanglei region) override |
| void | EnableClipMask (bool enable) override |
| void | RenderToClipMask (Rml::ClipMaskOperation operation, Rml::CompiledGeometryHandle geometry, Rml::Vector2f translation) override |
| | Same scheme as RmlUi's GL3 renderer: Set clears the stencil and writes 1, SetInverse clears to 1 and writes 0, Intersect increments.
|
| void | SetTransform (const Rml::Matrix4f *transform) override |
| | RmlUi matrices are column major with translation in elements 12-14, which is the memory layout of Math::mat4.
|
| Rml::LayerHandle | PushLayer () override |
| void | CompositeLayers (Rml::LayerHandle source, Rml::LayerHandle destination, Rml::BlendMode blendMode, Rml::Span< const Rml::CompiledFilterHandle > filters) override |
| void | PopLayer () override |
| Rml::TextureHandle | SaveLayerAsTexture () override |
| | Copies the scissor region of the top layer into a new texture, used by RmlUi for box-shadow.
|
| Rml::CompiledFilterHandle | SaveLayerAsMaskImage () override |
| Rml::CompiledFilterHandle | CompileFilter (const Rml::String &name, const Rml::Dictionary ¶meters) override |
| | Filter parameters as in RmlUi's GL3 renderer.
|
| void | ReleaseFilter (Rml::CompiledFilterHandle filter) override |
| Rml::CompiledShaderHandle | CompileShader (const Rml::String &name, const Rml::Dictionary ¶meters) override |
| | Linear, radial and conic gradients (repeating or not).
|
| void | RenderShader (Rml::CompiledShaderHandle shader, Rml::CompiledGeometryHandle geometry, Rml::Vector2f translation, Rml::TextureHandle texture) override |
| void | ReleaseShader (Rml::CompiledShaderHandle shader) override |
|
| void | CreateTarget (RenderTarget &target, const char *name) |
| | create a render target of the current size, with the shared stencil attached
|
| void | DestroyTarget (RenderTarget &target) |
| | destroy a render target
|
| void | DestroyTargets () |
| | destroy all size dependent resources
|
| void | Transition (RenderTarget &target, CoreGraphics::PipelineStage stage) |
| | move a target to a stage, ends the active pass if a barrier is needed
|
| void | BindTarget (RenderTarget &target, bool clear) |
| | make the target the active render target, clearing it if asked
|
| void | EndActivePass () |
| | end the active pass, if any
|
| void | EnsureTopLayer () |
| | bind the top layer if no other target is active
|
| void | CopyTarget (RenderTarget &from, RenderTarget &to) |
| | copy a whole target to another
|
| void | ApplyScissor () |
| | apply the scissor to the active pass
|
| uint | AllocDraw (const Rmlui::RmlUiDraw &draw) |
| | write per-draw data, returns its index
|
| void | Draw (const Rml::Vertex *vertices, SizeT numVertices, const int *indices, SizeT numIndices, Rml::Vector2f translation, const DrawParams ¶ms) |
| | stream geometry and draw it into the active target
|
| void | DrawFullscreen (const DrawParams ¶ms, Rml::Vector2f uvOffset=Rml::Vector2f(0.0f), Rml::Vector2f uvScale=Rml::Vector2f(1.0f)) |
| | draw a quad covering the target, sampling the given uv range
|
| void | SetStencil (uint reference) |
| | set the stencil reference for the next draws
|
| void | RenderBlur (float sigma, RenderTarget &sourceDestination, RenderTarget &temp, const Rml::Rectanglei window) |
| | gaussian blur, sourceDestination keeps the result
|
| Rml::Rectanglei | GetScissorOrTarget () const |
| | the active scissor, or the whole target
|
| void | EnsureCapacity (SizeT numVertices, SizeT numIndices) |
| | grow the current frame buffers to hold at least this many vertices and indices
|