Skip to content

feat: GPU text rendering for RenderDirect #115

@kolkov

Description

@kolkov

Text is not visible when using RenderDirect because it only renders GPU-accelerated shapes. Text is currently CPU-rasterized to an internal pixel buffer, and RenderDirect (zero-copy GPU→surface path) does not upload that buffer.

Current behavior

Method GPU shapes CPU text
RenderDirect
RenderTo

Workaround

Use RenderTo instead of RenderDirect:

canvas.RenderTo(dc.AsTextureDrawer())

Solution

Integrate the existing MSDF text pipeline into the unified GPU render session so DrawString goes through a GPU MSDF batch instead of CPU rasterization.

Completed infrastructure

Task Description Status
TASK-050 Phase 1 Text pipeline: shaper, bidi, layout, cache ✅ Done
TASK-050b Glyph-as-path conversion ✅ Done
TASK-050c Glyph cache ✅ Done
TASK-050f MSDF generator (Pure Go) ✅ Done
TASK-050g MSDF atlas packer ✅ Done
TASK-050h MSDF WGSL shader (msdf_text.wgsl) ✅ Done
TASK-050i Emoji support ✅ Done
TASK-050j Subpixel positioning ✅ Done

Existing code:

  • internal/gpu/text_pipeline.goTextPipeline struct (stub RenderText)
  • internal/gpu/shaders/msdf_text.wgsl — WGSL shader with fill, outline, shadow modes
  • Spec: msdfgen-go-spec.md — standalone Pure Go MSDF library design

Remaining work

Wire DrawStringTextPipeline.RenderText within the GPU render session:

  1. Upload MSDF atlas to GPU texture
  2. Glyph layout → vertex buffer (quad per glyph)
  3. Integrate text batch into unified render pass
  4. Zero readbacks, resolution-independent

Related

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions