gpu

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

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

Import this package to enable GPU-based rendering. The GPU accelerator uses wgpu/hal compute shaders for parallel evaluation, providing hardware-accelerated anti-aliased rendering for shapes like circles and rounded rectangles.

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

Usage:

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDeviceProvider

func SetDeviceProvider(provider any) 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 that also implements gpucontext.HalProvider for direct 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