renderpool

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package renderpool recycles render-target allocations. Ebitengine owns atlas placement; the pool only lends exclusive, zero-origin views of live images.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesForSize

func BytesForSize(width, height int, unmanaged bool) int64

BytesForSize estimates the allocation area, including Ebitengine's border for managed images, or standalone power-of-two rounding for unmanaged ones. Shared atlas packing gaps are additional.

Types

type Pool

type Pool struct {
	MaxFreeBytes int64
	// Optional hooks preserve the caller's allocation diagnostics.
	NewImage   func(width, height int, unmanaged bool) *ebiten.Image
	Deallocate func(*ebiten.Image)
	// contains filtered or unexported fields
}

Pool must not be copied after first use. Callers must return each acquired view with Release and must not retain or draw it after releasing it. Previously submitted draws remain ordered before the next Clear/repaint.

func (*Pool) Acquire

func (p *Pool) Acquire(width, height int, unmanaged bool) *ebiten.Image

func (*Pool) Bytes

func (p *Pool) Bytes(view *ebiten.Image) int64

Bytes returns the area of the allocation backing an acquired view.

func (*Pool) Clear

func (p *Pool) Clear()

Clear releases the idle reserve. Active views remain valid.

func (*Pool) Release

func (p *Pool) Release(view *ebiten.Image) bool

Release returns false for images not owned by this pool. It retains a bounded reserve for reuse; excess idle images are explicitly deallocated.

func (*Pool) Stats

func (p *Pool) Stats() Stats

type Stats

type Stats struct {
	Active, Free           int
	ActiveBytes, FreeBytes int64
	Allocations, Reuses    uint64
}

Jump to

Keyboard shortcuts

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