shadercache

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0 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 shadercache keeps what the GPU drivers compile for Glutter between runs: the binaries of the OpenGL ES programs and the pipeline cache of Vulkan (SPEC §9.7). It is a directory of files; a file is named by the hash of its key, and is written whole or not at all. A cache that cannot be read or written is reported once and ignored: the drivers compile again, as they did before the cache.

Flutter: no counterpart

Index

Constants

View Source
const EnvVar = "GLUTTER_SHADER_CACHE"

EnvVar is the environment variable that turns the cache off when it is "0".

Flutter: no counterpart

Variables

This section is empty.

Functions

func Dir

func Dir(getenv func(string) string) string

Dir is the directory of the cache: $XDG_CACHE_HOME/glutter/shaders, or ~/.cache/glutter/shaders; empty when the cache is turned off (EnvVar is "0") or the environment names no home (the web).

Flutter: no counterpart

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache is a directory of cached binaries. It is used from the UI thread, as the renderers are.

Flutter: no counterpart

func New

func New(dir string, report func(error)) *Cache

New makes a cache in the directory. The directory is made when the first file is stored. report receives the first error of the cache (a file that cannot be read or written) and none after it; it may be nil.

Flutter: no counterpart

func (*Cache) Dir

func (c *Cache) Dir() string

Dir is the directory of the cache.

Flutter: no counterpart

func (*Cache) Load

func (c *Cache) Load(key string) ([]byte, bool)

Load returns the data stored under the key, or false when there is none (or it cannot be read).

Flutter: no counterpart

func (*Cache) Store

func (c *Cache) Store(key string, data []byte)

Store keeps the data under the key, replacing what was there. The file is written to a temporary file and renamed, so that a reader never sees half of it. A failure is reported once and ignored.

Flutter: no counterpart

Jump to

Keyboard shortcuts

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