gimage

package
v0.0.0-...-5d01ccc Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flush

func Flush(device *wgpu.Device) (err error)

Flush ensures that all pending texture uploads are completed by submitting an empty command buffer and polling the device queue. This is necessary after uploading textures to ensure they are available for rendering, especially when uploads are done in chunks.

func Release

func Release()

Release releases all cached images and samplers, freeing their GPU resources and clearing the caches to prevent reuse. This should be called when the application is shutting down or when the GPU device is being reset to avoid resource leaks.

Types

type Image

type Image struct {
	Name, Path    string
	Width, Height int
	Format        gputypes.TextureFormat
	Texture       *wgpu.Texture
	View          *wgpu.TextureView
	Sampler       *wgpu.Sampler
}

func FromGoImage

func FromGoImage(device *wgpu.Device, name string, stdImg image.Image) (img *Image, err error)

FromGoImage creates a new Image from a standard Go image.Image. The device is passed explicitly so this package does not need package-level initialization.

func LoadImage

func LoadImage(device *wgpu.Device, filePath string) (img *Image, err error)

LoadImage loads an image from filePath and caches it by normalized file name. The device is passed explicitly so this package does not need package-level initialization.

func (*Image) Release

func (i *Image) Release()

Release frees the GPU resources associated with the image and clears its fields to prevent reuse.

Jump to

Keyboard shortcuts

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