Skip to content

Claude/mod vertex buffer mismatch ml8oiq - #90

Merged
jmquigs merged 2 commits into
masterfrom
claude/mod-vertex-buffer-mismatch-ml8oiq
Aug 20, 2026
Merged

Claude/mod vertex buffer mismatch ml8oiq#90
jmquigs merged 2 commits into
masterfrom
claude/mod-vertex-buffer-mismatch-ml8oiq

Conversation

@jmquigs

@jmquigs jmquigs commented Aug 20, 2026

Copy link
Copy Markdown
Owner

No description provided.

claude added 2 commits August 17, 2026 01:44
Authored by Claude (claude-opus-5)

Previously only the UByte4N decl type got stub bytes when a texture
coordinate element had a semantic index > 0; every other type was
skipped with a warning and nothing was written.  If such an element was
the last one in the vertex, the vertex ended up short and writeVertex
failed with "Wrote an insufficient number of bytes for the vertex",
which aborted the whole fill and prevented the mod from loading.  This
was hit by a d3d11 layout with TEXCOORD1 as R32G32_Float (wrote 40 of
48 bytes).

Now a stub of the correct size is written for all texture coordinate
types that are supported at semantic index 0, using a mid-range UV
(0.5,0.5) and zeros for any extra components.  Unknown types are zero
filled using the element size; if even that can't be determined, nothing
is written (the old behavior).  The existing UByte4N stub is unchanged.

The warning is now emitted once per fill from setup rather than from the
per-vertex loop, so the stub bytes can also be precomputed there instead
of being rebuilt for every vertex.

Also factors the format size table out of MeshUtil.getVertSizeFromEls
into getSizeFromFormat/getSizeFromElType so the stub code can use it.
Authored by Claude (claude-opus-5)

The stub-data warning was emitted from the vertex fill, which is skipped
entirely on a VBData disk cache hit.  So it only appeared the first time
a mod was loaded, and after that the fact that part of the vertex data
is fake -- and that rendering may therefore be somewhat off -- was
invisible in the log.

Move the stub construction (makeTexCoordStub, plus a new
buildTexCoordStubs that warns and returns the per-semantic-index map) to
module scope and run it in fillModDataInternalHelper before the cache
check, so the warning is logged on every load regardless of which path
fills the buffer.  The warning now also names the mod and says that
rendering may be incorrect.
@jmquigs
jmquigs merged commit 7ff96c0 into master Aug 20, 2026
1 check passed
@jmquigs
jmquigs deleted the claude/mod-vertex-buffer-mismatch-ml8oiq branch August 20, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants