From 8a51dfd27444abce1becb0b0e22adbc372b2f95f Mon Sep 17 00:00:00 2001 From: Zarigis Date: Wed, 25 Nov 2026 16:57:20 -0800 Subject: [PATCH] Draw the world map's terrain at the window's resolution AppMap draws the map tiles into a fixed 2250x1080 capture (its 1500x720 layout at 1.5x). Its shape is not 16:9, so it was never scaled: at 4K the map was the 1080-line picture stretched 2x, whatever the window size. The capture now has its own scale group (RS_MAP): RS_OUT's vertical scale on both axes, without the HUD handling RS_OUT passes get. At 3840x2160 it is 4500x2160. --- runtime/nvn/vulkan/textures.c | 5 +++++ runtime/nvn/vulkan/vk.h | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/runtime/nvn/vulkan/textures.c b/runtime/nvn/vulkan/textures.c index 38756e040..d86a03dc1 100644 --- a/runtime/nvn/vulkan/textures.c +++ b/runtime/nvn/vulkan/textures.c @@ -192,6 +192,9 @@ static bool format_is_float(VkFormat f) { // (uncompressed: these can hold NaN // 2048 to 8192) they are made at instead of the game's (output_scale.c shadow_map_size). Also // their half-size copy (R16 448x448x3, the max of each 2x2), at the same factor: water and the other // forward-shaded surfaces take their shadows from it (issue #101) +// RS_MAP AppMap's terrain capture (2250x1080: its 1500x720 layout at 1.5x, exec.c map_capture_patch): RS_OUT's +// vertical scale on both axes. At its guest size it held one map texel per 1080p pixel, so at 4K the map +// was the 1080p picture stretched 2x static float g_rs[4][2] = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; static uint32_t g_shadow_size; void renderer_get_scale(float *sx, float *sy) { *sx = g_rs[RS_OUT][0]; *sy = g_rs[RS_OUT][1]; } @@ -203,6 +206,7 @@ void renderer_set_shadow_size(uint32_t n) { // (never past what the GPU can mak } uint64_t renderer_present_count(void); static float rs_want(const TexBackend *b, int axis) { // the scale a texture of b's group is wanted at now + if (b->rs_group == RS_MAP) return g_rs[RS_OUT][1]; if (b->rs_group != RS_SHADOW) return g_rs[b->rs_group][axis]; // (square) bigger than the game's (High and up), or smaller (Potato); 0: the game's own return b->guest_w && g_shadow_size && g_shadow_size != b->guest_w ? (float)g_shadow_size / (float)b->guest_w : 1.0f; @@ -250,6 +254,7 @@ static uint8_t tex_scale_group(const NvnTexture *t) { return RS_SHADOW; if (!vk_shadow_direct() && vk_is_shadow_copy(t)) return RS_SHADOW; // (the copy's readers use the cascades instead) if ((t->target != 1 && t->target != 4) || t->samples > 1 || !(t->flags & 9) || t->width < 32 || t->height < 16) return RS_NONE; + if (t->target == 1 && t->width == 2250 && t->height == 1080) return RS_MAP; // (and its depth target, if any) float a = (float)t->width / (float)t->height; if (a < 1.74f || a > 1.81f) return RS_NONE; if (t->flags & 1) return RS_OUT; // NVN_TEXTURE_FLAGS_DISPLAY: the images the game presents diff --git a/runtime/nvn/vulkan/vk.h b/runtime/nvn/vulkan/vk.h index ffdd32840..1351c79c8 100644 --- a/runtime/nvn/vulkan/vk.h +++ b/runtime/nvn/vulkan/vk.h @@ -105,8 +105,9 @@ VkDescriptorSet vk_alloc_set(VkDescriptorSetLayout layout); // ---- textures (textures.c) // Render-target scale groups (textures.c tex_scale_group): none, the 3D scene's (internal resolution), the final -// image's (the window's resolution), shadow maps (Video > Shadow resolution) -enum { RS_NONE = 0, RS_SCENE = 1, RS_OUT = 2, RS_SHADOW = 3 }; +// image's (the window's resolution), shadow maps (Video > Shadow resolution), the map's terrain capture (the window's +// height, without the HUD handling RS_OUT passes get) +enum { RS_NONE = 0, RS_SCENE = 1, RS_OUT = 2, RS_SHADOW = 3, RS_MAP = 4 }; // A texture's claim on the write watch (textures.c, SAVAGEWIND_VK_CPU_OPTS bit 32): token 0: none typedef struct TexWW {