mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 08:19:56 -04:00
Add the texture_detail setting, which makes large ASTC textures without their largest one or two mip levels on cards with little video memory.
The textures of a loaded area are what fills a 6 GiB card: with the budget taken as 4,730 MiB a walk through Castle Town held 6,907 MiB of device memory, 4,302 MiB of it textures, 201 pools were refused their mirrors and the game ran at 20 fps. With texture_detail = reduced a mipmapped 2D or 2D-array ASTC texture of 256x256 and more that the game's CPU fills is made without its largest level, with low without its two largest when it is 1024x1024 or more. The same walk then held 5,472 MiB (textures 2,357) and 4,987 MiB (textures 1,997), and the ASTC texels decoded fell from 2,589 M to 826 M and 503 M. auto, the default, picks full from 8,192 MiB of device-local budget, low under 6,144 MiB and reduced between. full changes nothing. The image holds the game's levels from the one it starts at (VkTexImage.skip), and the upload with its ASTC regions and BC3 encoding, WriteTexels, the write-back, the views and the sampler LOD clamp of combined bindings count from there. Render targets, storage images, 3D and cube textures, small and unmipped textures and textures the device samples as ASTC itself are left whole, as is a texture made over a live one that holds GPU-written content. A shader that fetches texels by position or uses a texture's size gets the texture whole: gfx_shader.c marks such bindings from the SPIR-V (the layer count of an array, which the translator's layer clamp asks for, does not count), and the replay makes a reduced texture bound there again with every level. Not run on a card with 6 GiB: the figures come from an RTX 5090 with NX2NAVI_VRAM_BUDGET_MB=4730. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
13
runtime/vk.h
13
runtime/vk.h
@@ -474,6 +474,9 @@ typedef struct {
|
||||
uint8_t scale; // 1, or NX2NAVI_SHADOW_SCALE for a shadow map made larger than the game's (vk_texture.c
|
||||
// shadow_scale_of): width and height above are the larger ones, the game's regions
|
||||
// are multiplied by it
|
||||
uint8_t skip; // texture detail (vk_texture.c detail_skip): the game's top mip levels the image was made
|
||||
// without. Image level i holds the game's level i + skip, and width, height and levels
|
||||
// above are the image's, so the game's level skip is their base. 0 everywhere else.
|
||||
uint8_t gone; // destroyed (vk_texture.c destroy_tex, texture lock held): the record stays readable until
|
||||
// the GPU is past the submission being recorded (vk_defer_free), as the replay and DLSS
|
||||
// keep pointers to render targets across a command buffer; no view of it is cached
|
||||
@@ -498,6 +501,16 @@ VkSampler vk_sampler_point_by_id_locked(int id);
|
||||
// The slot's sampler with its compare on, for a depth-compare read (vk_texture.c, at the definition); the slot's own
|
||||
// sampler when it compares already. VK_NULL_HANDLE for an empty slot.
|
||||
VkSampler vk_sampler_compare_by_id_locked(int id);
|
||||
// Texture detail (vk_texture.c): what texture_detail = auto picks on this device, 0 full, 1 reduced, 2 low (the budget is
|
||||
// read at the first call). For the menu's row.
|
||||
int vk_texture_detail_auto(void);
|
||||
// The slot's sampler for a texture made without its top `skip` mip levels (VkTexImage.skip): its LOD clamp counts the
|
||||
// game's levels, so it moves down by skip. The slot's own sampler when its clamp is open or skip is 0.
|
||||
VkSampler vk_sampler_detail_by_id_locked(int id, uint32_t skip);
|
||||
// Slot id resolved to a texture made without its top levels, and a shader binding that reads texels by position or
|
||||
// asks for the size wants it: the texture is made again with every level and stays so (vk_texture.c "texture detail").
|
||||
// Returns what the slot resolves to now, as vk_texture_by_id_locked does.
|
||||
const VkTexImage *vk_texture_exact_by_id_locked(int id, view_t *view, int *has_view);
|
||||
uint32_t vk_texture_slots_gen(void);
|
||||
int vk_texture_slot_count_locked(void);
|
||||
void vk_texture_create_budget_locked(int n); // slot lookups create at most n entries (mapped storage only); -1 any
|
||||
|
||||
Reference in New Issue
Block a user