gpu

package
v0.37.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 3 Imported by: 4

Documentation

Overview

Package gpu registers the GPU accelerator and coverage filler for hardware-accelerated rendering.

Import this package to enable both GPU-based shape rendering (SDF for circles, rounded rectangles) and adaptive tile-based rasterization for complex paths. The GPU accelerator uses wgpu/hal compute shaders for parallel evaluation.

If GPU initialization fails (no Vulkan/Metal/DX12 available), the registration is silently skipped and rendering falls back to CPU.

For tile-based rasterization only (no GPU shapes), use:

import _ "github.com/gogpu/gg/raster"

Usage:

import _ "github.com/gogpu/gg/gpu" // enable GPU acceleration + tile rasterization

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDeviceProvider

func SetDeviceProvider(provider gpucontext.DeviceProvider) error

SetDeviceProvider configures the GPU accelerator to use a shared GPU device from an external provider (e.g., gogpu). This avoids creating a separate GPU instance and enables efficient device sharing.

The provider should be a gpucontext.DeviceProvider. The accelerator type-asserts provider.Device() to *wgpu.Device for HAL access.

Call this before drawing operations, typically from ggcanvas.New() or manually after registering the accelerator.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL