gum-monogame-rendering

Diagnose and fix Gum's MonoGame rendering pipeline batching, clipping, and render-target issues.

614|78|Updated Mar 11, 2015
One-click install
npx skills add https://github.com/vchelaru/Gum --skill gum-monogame-rendering
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gum-monogame-rendering
Source: https://github.com/vchelaru/Gum/tree/main/.claude/skills/gum-monogame-rendering
Command: npx skills add https://github.com/vchelaru/Gum --skill gum-monogame-rendering

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Debugging Gum's MonoGame rendering pipeline is hard because draw-order bugs, stale scissor state, and render-target artifacts span two independent GPU batchers (SpriteBatch and Apos.Shapes ShapeBatch) with subtle cross-cycle state. This Skill documents the internal contracts of Renderer, SpriteBatchStack, GumBatch, and BatchOrchestrator so you can diagnose and fix rendering bugs correctly.

Core Features & Use Cases

  • Batch transition semantics: Explains BatchKey transitions, why empty BatchKey means no flush, and how SpriteBatch and ShapeBatch interleave to determine on-screen paint order.
  • Clipping and scissor rules: Documents why ShapeBatch.Begin must receive a scissor-enabled RasterizerState and why mid-walk clip changes must flush the open custom batch.
  • Render-target pipeline: Covers the two-phase PreRender walk, cross-layer RenderTargetTextureSource binding, premultiplied vs straight alpha bake behavior, and post-process effect blitting contracts.
  • Use Case: When text labels bleed outside a ScrollViewer's clip region or shapes render in the wrong order across GumBatch Begin/End cycles, use this Skill to trace the exact state-management rule being violated.

Quick Start

Ask the AI to diagnose why shapes inside a clipped Gum container render outside the clip region using the gum-monogame-rendering skill.

Frequently Asked Questions about gum-monogame-rendering

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why do Gum shapes render in the wrong draw order in MonoGame?

Gum uses two independent batchers, SpriteBatch and Apos.Shapes ShapeBatch, and paint order follows each batch's End call order, not queue order. Every BatchKey transition must End the previous batch; stale cross-cycle state in BatchOrchestrator is the most common cause.

How do I fix shapes not clipping inside a Gum ScrollViewer?

ShapeBatch ignores GraphicsDevice.ScissorRectangle unless its Begin call receives a RasterizerState with ScissorTestEnable=true. Also, mid-walk clip changes must flush the open ShapeBatch before restarting SpriteBatch, or queued shapes use stale scissor state.

Does Gum's MonoGame renderer support render targets with post-process shaders?

Yes, via RenderableBase.RenderTargetEffect, applied when the cached texture blits back to screen. Only self-contained, parameterless, single-pass effects work; Gum sets no custom effect parameters and cannot chain passes.

Why do Gum render targets look too dark in FRB but fine standalone?

FRB runs premultiplied alpha while the Gum tool defaults to straight alpha. The render-target bake substitutes a premultiply blend state for unconfigured children, which double-darkens already-premultiplied content unless AdjustBlendStateForRenderTargetBake skips it under AlphaBlend.

Can I draw render targets through GumBatch's immediate-mode path?

No. The GumBatch Begin/Draw/End path starts SpriteBatch immediately and runs only the phase-1 PreRender hooks, so nested render targets inside a GumBatch.Draw tree are intentionally unsupported. Use the layered Renderer.RenderLayer path instead.