Replies: 2 comments
-
Related: UI ExtensibilityThe same extensibility principles should apply to gogpu/ui when we design it: Widget System// Users should be able to create custom widgets
type Widget interface {
Layout(constraints Constraints) Size
Paint(dc *gg.Context)
HandleEvent(event Event) bool
}
// Register custom widgets
ui.RegisterWidget("my-chart", NewChartWidget)Theme System// Pluggable themes
type Theme interface {
Colors() ColorPalette
Typography() Typography
Spacing() Spacing
PaintButton(dc *gg.Context, state ButtonState)
PaintInput(dc *gg.Context, state InputState)
// ...
}
// Users can create and register custom themes
ui.RegisterTheme("corporate", NewCorporateTheme)
ui.SetTheme("corporate")Layout Engines// Custom layout algorithms
type LayoutEngine interface {
Layout(children []Widget, constraints Constraints) []Rect
}
// Built-in: Flexbox, Grid, Stack
// User can add: Masonry, Constraint-based, etc.
ui.RegisterLayout("masonry", NewMasonryLayout)Potential ArchitectureThis ties back to the backend question: if we have a unified Thoughts? |
Beta Was this translation helpful? Give feedback.
-
✅ RFC Implemented: gpucontext v0.2.0 → v0.3.0This RFC has been implemented as gogpu/gpucontext — a shared infrastructure package for the gogpu ecosystem. What was delivered
Released versions
Architecture Decision: gputypes + gpucontext (2026-01-28)Final Architecture
Why Two Packages?
Principle: Separation of data types from behavioral interfaces. Why gpucontext imports gputypes?Interfaces need types in method signatures: type DeviceProvider interface {
SurfaceFormat() gputypes.TextureFormat // ← uses gputypes
}Without import: Each project defines incompatible types → type conversion everywhere. New Interfaces in gpucontext v0.3.0For gg ↔ gogpu integration:
Full rationale: Closing this RFC as implemented. Future enhancements tracked in respective repos. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Context
Currently, gogpu and gg have separate backend systems. While this works internally, it creates a barrier for third-party backend developers.
The Extensibility Problem
Imagine a user wants to create:
Current situation:
With a common library:
Proposal: gogpu/gpubackend
Third-Party Usage Example
Then users can:
Architecture with ui
Questions
Is third-party extensibility a priority? Do we expect users to write custom backends?
What should the common interface look like?
How does ui fit in?
Build tags convention?
//go:build !nobackend_webgl- opt-out//go:build backend_webgl- opt-inLooking for Feedback
Beta Was this translation helpful? Give feedback.
All reactions