From a70b171aa86f69a8435f79c1c6deb189c5b90232 Mon Sep 17 00:00:00 2001 From: Valiantsin Dzerakh Date: Sat, 24 Oct 2026 13:53:38 +0300 Subject: [PATCH] Read a vertex attribute without a format as (0, 0, 0, 1), as Maxwell's fixed attribute does The zero binding used four-component formats, so shader inputs the game left unset read w = 0. TOTK's foliage shaders scale wind sway by 1 - colour.w; the Brightbloom stem and leaves have no vertex colour and swayed fully, while the bulb (which has one) stayed put and floated beside the cup. One-component R32 formats expand to (0, 0, 0, 1), matching deko3d's IsFixed 1x32 float for unused attributes. Co-Authored-By: Claude Opus 5.5 --- runtime/vk_pipeline.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runtime/vk_pipeline.c b/runtime/vk_pipeline.c index abdb29db..3e73ec2e 100644 --- a/runtime/vk_pipeline.c +++ b/runtime/vk_pipeline.c @@ -533,9 +533,12 @@ typedef struct { VkVertexInputBindingDescription2EXT b[17]; } VtxInput; +// An attribute the game left without a format is a fixed one on Maxwell, a single 32-bit component of 0 (deko3d +// gpu_3d_vbo.cpp binds unused attributes as IsFixed 1x32 float): it reads (0, 0, 0, 1), as Vulkan expands a +// one-component format. TOTK's foliage shaders scale wind sway by 1 - colour.w; shapes without a vertex colour +// (Brightbloom stem and leaves) must not sway, or they bend away from the parts that have one (the bulb). static VkFormat zero_format(int type) { - return type == GFX_TYPE_UINT ? VK_FORMAT_R32G32B32A32_UINT : type == GFX_TYPE_SINT ? VK_FORMAT_R32G32B32A32_SINT - : VK_FORMAT_R32G32B32A32_SFLOAT; + return type == GFX_TYPE_UINT ? VK_FORMAT_R32_UINT : type == GFX_TYPE_SINT ? VK_FORMAT_R32_SINT : VK_FORMAT_R32_SFLOAT; } // Attributes for the Locations the vertex shader reads; one without a usable NVN attribute reads VK_PIPE_ZERO_BINDING.