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 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-10-24 13:53:38 +03:00
1 parent 56e242553a
commit a70b171aa8
1 file changed
+5 -2
+5 -2
View File
@@ -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.