cache directwrite

This commit is contained in:
Jorijn van der Graaf 2026-06-16 20:10:23 +02:00
commit ab222ffa1f
3 changed files with 32 additions and 5 deletions

View file

@ -232,8 +232,22 @@ export namespace Crafter {
// small-window budget would consult VK_EXT_memory_budget for the
// window's *remaining* space rather than its total size; that needs the
// extension enabled and is a follow-up.
//
// Everything except the final size comparison depends only on
// memoryProperties, so it is derived once by CacheUploadStrategy (called
// at device creation) into the directWrite* members below; this leaves
// the per-allocation call a single bounds check.
static bool PreferDirectDeviceWrite(VkDeviceSize size);
// Size-independent half of PreferDirectDeviceWrite, cached from
// memoryProperties. directWriteBudget is the largest buffer that may be
// written directly: 0 when no resizable BAR exists (always stage),
// VkDeviceSize max for ReBAR/UMA (always map), or the small-window
// per-buffer cap otherwise. Recompute via CacheUploadStrategy whenever
// memoryProperties changes (device creation does this once).
inline static VkDeviceSize directWriteBudget = 0;
static void CacheUploadStrategy();
// ─── Wayland key repeat ────────────────────────────────────────
// TickKeyRepeats fires onRawKeyDown / onRawKeyHold / onTextInput on
// the focused window for whichever key is currently repeating.