vkf_cache Module

The cache: what is slow to make again at every launch, kept between runs (src/vsg/vkf_cache.h): fonts converted for labels and HUD text (their glyphs' signed distance fields: seconds each; in its fonts directory) and shaders compiled from GLSL (about 45 ms each; in shaders). Fonts are named for their contents, so copies of one font share an entry, and a font's older entries are removed when it is converted again (after the font or VSG changed); shaders are named for their source and settings.

The directory is VKFRAMES_CACHE_DIR if set, else the user's cache directory (macOS: ~/Library/Caches/vkframes; Linux: $XDG_CACHE_HOME or ~/.cache, then vkframes; Windows: %LOCALAPPDATA%/vkframes/cache), created (with its parents) if it doesn't exist; without one, nothing is cached (all is made at each launch). cache_directory says which; clear_cache deletes the cache's files, made again when next needed.


Uses

  • module~~vkf_cache~~UsesGraph module~vkf_cache vkf_cache iso_c_binding iso_c_binding module~vkf_cache->iso_c_binding module~vkf_layer vkf_layer module~vkf_cache->module~vkf_layer module~vkf_layer->iso_c_binding

Used by

  • module~~vkf_cache~~UsedByGraph module~vkf_cache vkf_cache module~vkframes vkframes module~vkframes->module~vkf_cache

Functions

public function cache_directory() result(dir)

The cache directory, created if it doesn't exist yet (e.g. a VKFRAMES_CACHE_DIR not made yet); '' if there is none or it can't be created: nothing is cached.

Arguments

None

Return Value character(len=:), allocatable

public function clear_cache() result(removed)

Delete the cache's files (converted fonts, compiled shaders; nothing else in the directory) and its fonts and shaders directories if left empty (the cache directory itself is kept): the number of files removed, or -1 if some couldn't be. They are made again when next needed.

Arguments

None

Return Value integer