Documentation
¶
Overview ¶
Package webgpu owns the framework's wgpu-native instance, adapter and device. It is the only new GPU API boundary: platform renderers select and size a target, while application graphics use WebGPU resources.
Index ¶
- func RuntimePath() (string, bool)
- type GPU
- type Renderer
- func (r *Renderer) FinishFrame()
- func (r *Renderer) Release()
- func (r *Renderer) Render(s *scene.Scene, encoder *wgpu.CommandEncoder, view *wgpu.TextureView) error
- func (r *Renderer) RenderTarget(s *scene.Scene, encoder *wgpu.CommandEncoder, target *wgpu.Texture, ...) error
- func (r *Renderer) RenderTargetPart(s *scene.Scene, encoder *wgpu.CommandEncoder, target *wgpu.Texture, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RuntimePath ¶
RuntimePath returns the wgpu-native library the process will load, if one can be located. WGPU_NATIVE_PATH wins, then lib/ next to the executable or in an ancestor of the working directory, then the platform loader's search path.
Types ¶
type GPU ¶
type GPU struct {
// contains filtered or unexported fields
}
GPU owns a wgpu-native instance, its preferred hardware adapter, the logical device and the device's default queue.
func Open ¶
Open initializes wgpu-native and requests a high-performance adapter. The first call also locates a development lib/wgpu-native library when WGPU_NATIVE_PATH is unset.
func (*GPU) AdapterInfo ¶
func (g *GPU) AdapterInfo() wgpu.AdapterInfoGo
AdapterInfo returns the selected adapter's descriptive information.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer draws WebGPU scenes. Shared pipeline resources are reused across the root frame and every nested native UI canvas; each target owns the instance buffer and atlas bindings its scene draws with.
func NewRenderer ¶
func NewRenderer(g *GPU, format wgpu.TextureFormat) (*Renderer, error)
NewRenderer creates a scene renderer for targets of format.
func (*Renderer) FinishFrame ¶
func (r *Renderer) FinishFrame()
FinishFrame releases transient effect resources after the command buffer that reads them has been submitted.
func (*Renderer) Release ¶
func (r *Renderer) Release()
Release frees the renderer's WebGPU resources.
func (*Renderer) Render ¶
func (r *Renderer) Render(s *scene.Scene, encoder *wgpu.CommandEncoder, view *wgpu.TextureView) error
Render encodes s into view. Clear is the scene background.
func (*Renderer) RenderTarget ¶
func (r *Renderer) RenderTarget(s *scene.Scene, encoder *wgpu.CommandEncoder, target *wgpu.Texture, view *wgpu.TextureView) error
RenderTarget encodes s into target and view. A backdrop-reading effect needs the target handle so it can be copied into the backdrop grab.
func (*Renderer) RenderTargetPart ¶
func (r *Renderer) RenderTargetPart(s *scene.Scene, encoder *wgpu.CommandEncoder, target *wgpu.Texture, view *wgpu.TextureView, part *gpu.Part) error
RenderTargetPart draws only batches meeting part into an existing target. The caller must have filled the target's untouched pixels with the same scene; part is normally the result of gpu.Part.Set.