Repository navigation
Conversation
Source: NotRexed/Hookshot#1132 Original proposal by: wrocketdev Original head: e2ec9b84d0b176603a896652d955e2f4412aef01 Verified source tree: f243a07 Reconstructed import commit, not a claim of original authorship. Source head author: wrocket <wrocket@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Longshot is preserving this upstream proposal for review. This draft is not an adopted or functionally verified fix.
Source: NotRexed/Hookshot#1132
Original contributor: wrocketdev.
Original head:
e2ec9b84d0b176603a896652d955e2f4412aef01.Exact source tree:
f243a070d13d7bf178c6e1a822589e92ce939752.Import parent:
d224dc0680ad418b1ab111555c7d19cc483dcfdc(common ancestor with the migration base).The source-tree checksum matches exactly. Original commits after the common ancestor are represented by one reconstructed import commit; source links and authorship are recorded. This snapshot can contain prerequisites beyond our migration base. Review its complete diff and overlapping proposals before merging.
Validation here: copying fidelity only. Platform builds, gameplay, functional behavior and the upstream author's claims have not been independently verified. Keep draft until reviewed, rebased and tested.
Original proposal
Draft, not tried in game. It is opt-in (
RX_VK_MEMORY_PRIORITY=1), so nothing changes unless a player turns it on.I am looking for players on 6-8 GB cards (NotRexed/Hookshot#993, NotRexed/Hookshot#995) to try it before it goes further.
Problem
On 8 GB cards the process sits at the driver's VRAM limit in Hyrule Field, Castle Town and Kakariko (NotRexed/Hookshot#993, NotRexed/Hookshot#995):
the logs show
VRAM: ... used of ... allowedover the allowance. The driver then pages VRAM to system memory, andnothing tells it which allocations matter: a terrain array of an area left behind and the textures the scene draws
are the same to it.
Change
Everything below is behind
RX_VK_MEMORY_PRIORITY=1. Unset, the device is created with the same extensions asbefore, and the renderer behaves as it does now.
vk_main.cpp: asks forVK_EXT_memory_priorityand, with it,VK_EXT_pageable_device_local_memory, each onlywith its feature. One log line says which:
vk: memory priorities: on, pageable device-local memory ...,on, without pageable device-local memory ...,not supported, oroff (RX_VK_MEMORY_PRIORITY=1: on).vk_vma.cpp:VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT. EveryVmaAllocationCreateInfoand both imagepools'
VmaPoolCreateInfo(the textures' and, since vk: render targets' images in VMA blocks of their own; dead targets swept every 10 presents (follow-up to #1416) NotRexed/Hookshot#1436, the render targets') now setpriority = 0.5. With that flag on, VMA passes the create-info's value asgiven, and a create-info left at
{}is 0, the lowest: without this, every dedicated allocation and both imagepools would be the first paged out. (The field is ignored while the flag is off.)
set_allocation_priority()changes a dedicated allocation's priority, never a shared block's.
vk_texture.cpp:texture_priorities(), every 60 presents when the pageable extension is on. A texture unused forRX_VK_PRIORITY_IDLEpresents (600, about 10 s) drops to 0.1, and goes back to 0.5 once used. Only memory atexture owns changes: dedicated allocations (the big ones, past the 128 MB image blocks) and sparse chunks.
Textures inside pool blocks keep the block's 0.5. Every 600 presents it logs
vk: memory priority: N textures (X MB) at the idle priority.memory_priority.h: the rule and the switches, tested without a GPU bytests/test_memory_priority.py. The testalso fails if a VMA create-info is added later without a priority.
gpu/vk/VULKAN.md.Testing
tests/test_memory_priority.py(C++ rule test plus source checks). The three changed renderer filespass a syntax-only compile against the pinned Vulkan-Headers v1.4.345 and VMA v3.3.0.
How to try it: add
RX_VK_MEMORY_PRIORITY=1tohookshot_env.txt, play the same route with and without it (forexample Kokiri Forest → Hyrule Field → Kakariko → Castle Town market and back), and compare the fps, the worst freezes,
and these lines of
hookshot_log.txt:vk: memory priorities:,vk: memory priority:andVRAM: ... used of ... allowed.Windows already pages video memory on its own, so the gain there may be small. It is aimed at the stalls when VRAM is
full, not at the garbled textures of NotRexed/Hookshot#993.
Not in this PR
one line (
pi.priorityintarget_images_pool()); left at 0.5 here to keep this PR to the mechanism.Related: NotRexed/Hookshot#993, NotRexed/Hookshot#995.
Written with AI assistance (Claude Opus 5.5); the commit carries the
Assisted-by:andCo-Authored-By:trailers.🤖 Generated with Claude Code