gpu/gpu.go

Functions

Functions

func SetDeviceProvider

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.

func SetDeviceProvider(provider gpucontext.DeviceProvider) error {
	return gg.SetAcceleratorDeviceProvider(provider)
}