Mesh emulation: the vertex shader declares the fragment shader's inputs one for one.

The generated vertex shader wrote one vector per location. A fragment shader that packs two inputs into one location
(Component decorations: a vec2 at component 0 and another at component 2) then had nothing matching its second input,
whose value is undefined: wrong colours on the emulated foliage. The vertex shader now declares an output for every
input variable of the fragment shader, with its Location, Component, type and Flat, filled from those components of
the mesh stage's vector at that location (zero where the mesh stage writes none).

(cherry picked from commit c38eb31889314ebfb164ff9dffad5796eba46ed4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Tobim6
2026-11-12 16:22:08 +01:00
parent 8b78e64539
commit 1768d5f607
3 changed files with 75 additions and 0 deletions

View File

@@ -3257,6 +3257,9 @@ static VkPipeline create_graphics(const VkPipeState *s, const GKey *k, const Lay
cp[i] = need >> i & 1 && !fin[i].packed && fin[i].comps ? (uint8_t)fin[i].comps : 4;
}
size_t vn = 0;
uint64_t fsw = 0;
const uint32_t *fcode0 = s->fs ? gfx_shader_spirv(s->fs, &fsw) : NULL;
vpatched = mesh_emu_vs(&me->mi, need, ty, cp, fcode0, (size_t)fsw, &vn);
if (!vpatched) return VK_NULL_HANDLE;
vcode = vpatched, vw = vn;
mesh = 0; // a vertex pipeline from here on