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

@@ -47,3 +47,7 @@ uint32_t *mesh_emu_compute(const uint32_t *w, size_t n, MeshEmuInfo *info, size_
// A task or mesh module's output primitive: 3 triangles, 2 lines, 1 points, 0 not a mesh module.
int mesh_emu_prim(const uint32_t *w, size_t n);
// fsw: the fragment shader's SPIR-V; its input variables are matched one for one (Location, Component, type, Flat),
// else (NULL, or a declaration the parser does not take) one vector per location of need.
uint32_t *mesh_emu_vs(const MeshEmuInfo *m, uint32_t need, const uint8_t types[32], const uint8_t comps[32],
const uint32_t *fsw, size_t fsn, size_t *out_n);