Skip to content

Make nested rendering surfaces (AutoRenderingSurface) composite again - #1

Merged
slapin merged 1 commit into
slapin:v0-tomluchowski-14.xfrom
Upabjojr:fix-nested-rendering-surfaces
Aug 14, 2026
Merged

Make nested rendering surfaces (AutoRenderingSurface) composite again#1
slapin merged 1 commit into
slapin:v0-tomluchowski-14.xfrom
Upabjojr:fix-nested-rendering-surfaces

Conversation

@Upabjojr

Copy link
Copy Markdown

Fixes the silent-nothing rendering of widgets with AutoRenderingSurface=True that I described in the comment on this PR's discussion (tomluchowski#1).

Root cause — a C++ hidden-virtual, introduced by the draw-mode merge: RenderingWindow::draw(uint32 drawModeMask) and GUIContext::draw(uint32) took the new mask parameter, but the base RenderingSurface::draw() / drawContent() stayed argless. Different signature = the derived functions hide the base virtuals instead of overriding them. So Window::render's ctx.surface->draw() dispatched to plain RenderingSurface::draw(), which renders the widget's queues into the texture target and stops — the code that queues the composite quad back onto the parent surface only exists in RenderingWindow::draw(drawModeMask), which nothing ever reached. Content went into the texture; the texture never came back out. No error anywhere, because every function that ran, ran successfully.

The doc comment on RenderingSurface::draw already describes the mask parameter ("will be checked against the supplied mask") — the merge kept the docs and dropped the signature.

Fix — give the base virtuals the drawModeMask parameter (defaulted to DrawModeMaskAll, so existing callers like System::renderAllGUIContexts are unaffected), making the derived functions real overrides, and pass the mask through at the two call sites (Window::render, GUIContext::draw). This also reconnects GUIContext::drawContent — which draws the mouse cursor and was severed the same way — to virtual dispatch.

Verified built from source against Ogre 14.6 (2ebfcfd) and run under OpenDungeonsPlus: a slider with AutoRenderingSurface=True (the repro from the original report) goes from rendering nothing to rendering track-and-thumb normally, and the stock surfaceless path renders identically to before. With this fix, FrameWindow's stock default of AutoRenderingSurface=True should also be safe again.

🤖 Generated with Claude Code

Widgets with AutoRenderingSurface=True rendered nothing: their content
was drawn into the texture target, but the quad that composites that
texture back onto the parent surface never reached a render queue.

The draw-mode merge gave RenderingWindow::draw and GUIContext::draw a
drawModeMask parameter but left the base virtuals argless, so the
derived functions hid RenderingSurface::draw()/drawContent() instead of
overriding them. Window::render's 'ctx.surface->draw()' therefore
dispatched to the base implementation, which renders the queues into
the texture and stops — the composite-quad logic only exists in
RenderingWindow::draw(drawModeMask). The doc comment on
RenderingSurface::draw already described the mask parameter the
signature was missing.

Give the base virtuals the drawModeMask parameter (defaulted to
DrawModeMaskAll, so external callers are unaffected), which turns the
derived functions into real overrides, and pass the mask through at the
call sites. This also reconnects GUIContext::drawContent — the mouse
cursor drawing — to virtual dispatch, which had been severed the same
way.

Verified against Ogre 14.6 with OpenDungeonsPlus: a slider with
AutoRenderingSurface=True went from rendering nothing to rendering
normally, and the stock (surfaceless) path is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants