-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdoc.go
More file actions
77 lines (77 loc) · 2.03 KB
/
Copy pathdoc.go
File metadata and controls
77 lines (77 loc) · 2.03 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Package gogpu provides a simple, cross-platform GPU graphics API for Go.
//
// GoGPU is designed to make GPU programming accessible while maintaining
// the flexibility for advanced use cases. It wraps WebGPU (via wgpu-gpu)
// and provides a clean, Go-idiomatic API.
//
// # Quick Start
//
// The simplest gogpu program creates a window and clears it with a color:
//
// package main
//
// import (
// "log"
// "github.com/gogpu/gogpu"
// )
//
// func main() {
// app := gogpu.NewApp(gogpu.DefaultConfig())
//
// app.OnDraw(func(dc *gogpu.Context) {
// dc.Clear(0.2, 0.3, 0.4, 1.0)
// })
//
// if err := app.Run(); err != nil {
// log.Fatal(err)
// }
// }
//
// # Architecture
//
// GoGPU uses a layered architecture:
//
// - App: Application lifecycle, window management, event dispatch
// - Context: Drawing API available during OnDraw callback
// - Renderer: Internal WebGPU pipeline management
// - Platform: OS-specific windowing (internal)
//
// # Configuration
//
// Use Config to customize your application:
//
// config := gogpu.DefaultConfig().
// WithTitle("My App").
// WithSize(1280, 720)
//
// # Callbacks
//
// GoGPU uses callbacks for the render loop:
//
// - OnDraw(func(*Context)): Called each frame for rendering
// - OnUpdate(func(float64)): Called each frame with delta time for logic
// - OnResize(func(int, int)): Called when window is resized
//
// # Advanced Usage
//
// For advanced rendering, access the underlying WebGPU objects:
//
// app.OnDraw(func(dc *gogpu.Context) {
// device := dc.Device() // *wgpu.Device
// queue := dc.Queue() // *wgpu.Queue
// view := dc.TextureView() // Current render target
// // Create custom pipelines, shaders, etc.
// })
//
// # Platform Support
//
// - Windows: Full support (Win32)
// - macOS: Planned (Cocoa)
// - Linux: Planned (X11/Wayland)
//
// # Dependencies
//
// GoGPU depends on:
// - github.com/go-webgpu/webgpu - Pure Go WebGPU bindings
// - github.com/go-webgpu/goffi - Pure Go FFI (no CGO)
package gogpu