-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoc.go
More file actions
48 lines (48 loc) · 2.07 KB
/
doc.go
File metadata and controls
48 lines (48 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Package gpucontext provides shared GPU infrastructure for the gogpu ecosystem.
//
// This package defines interfaces and utilities used across multiple gogpu
// projects to enable GPU resource sharing without circular dependencies:
//
// - DeviceProvider: Interface for providing GPU device and queue
// - EventSource: Interface for window/input events (keyboard, mouse)
// - PointerEventSource: Interface for unified pointer events (W3C Level 3, mouse+touch+pen)
// - WindowProvider: Interface for window geometry, DPI, and redraw requests
// - PlatformProvider: Interface for clipboard, cursor, dark mode, accessibility
// - ScrollEventSource: Interface for detailed scroll events
// - WindowChrome: Interface for custom window chrome (frameless windows)
// - Texture: Minimal interface for GPU textures
// - TextureDrawer: Interface for drawing textures (2D rendering)
// - TextureCreator: Interface for creating textures from pixel data
//
// # Consumers
//
// - gogpu/gogpu: Implements DeviceProvider via App/Renderer
// - gogpu/gg: Uses DeviceProvider for GPU-accelerated 2D rendering
// - born-ml/born: Implements and uses for GPU compute
//
// # Design Principles
//
// This package follows the wgpu ecosystem pattern where shared types
// are separated from implementation (cf. wgpu-types in Rust).
//
// The key insight is that GPU context (device + queue + related state)
// is a universal concept across Vulkan, CUDA, OpenGL, and WebGPU.
// By defining a minimal interface here, different packages can share
// GPU resources without depending on each other.
//
// # Example Usage
//
// // In gogpu/gogpu - implements DeviceProvider
// func (app *App) Device() gpucontext.Device { return app.renderer.device }
// func (app *App) Queue() gpucontext.Queue { return app.renderer.queue }
//
// // In gogpu/gg - uses DeviceProvider
// func NewGPUCanvas(provider gpucontext.DeviceProvider) *Canvas {
// return &Canvas{
// device: provider.Device(),
// queue: provider.Queue(),
// }
// }
//
// Reference: https://github.com/gogpu/gpucontext
package gpucontext