fix(fast3d): upload RAW block-load textures by per-line stride, not block size#1136
Open
bassdr wants to merge 1 commit into
Open
fix(fast3d): upload RAW block-load textures by per-line stride, not block size#1136bassdr wants to merge 1 commit into
bassdr wants to merge 1 commit into
Conversation
…lock size Kenix3#1118 changed ImportTextureRaw's fallback to describe the upload buffer using loaded_texture.line_size_bytes. For a block-loaded texture that value spans the whole image (a LoadBlock is a single contiguous "line"), so width = line_size_bytes/4 became the entire image and height collapsed to 1 -- e.g. a 768x256 HD button replacement uploaded as 188416x1, corrupting any alt-asset/HD texture loaded via LoadBlock (button prompts, C-button symbols). resultNewLineSize (tile line_size * h_byte_scale) is the true per-row stride for both block and tile loads. Use it for the upload dimensions; the OOB clamp added by Kenix3#1118 is preserved. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
bassdr
added a commit
to bassdr/Shipwright
that referenced
this pull request
Jun 24, 2026
Bumps libultraship to bassdr/main-bassdr including the ImportTextureRaw fix (Kenix3/libultraship#1136) for alt-asset/HD textures loaded via LoadBlock rendering as garbage (button prompts, C-button symbols). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
bassdr
added a commit
to bassdr/Shipwright
that referenced
this pull request
Jun 27, 2026
Bumps libultraship to bassdr/main-bassdr including the ImportTextureRaw fix (Kenix3/libultraship#1136) for alt-asset/HD textures loaded via LoadBlock rendering as garbage (button prompts, C-button symbols). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Alt-asset / HD texture-pack textures that are loaded via
LoadBlock(button prompts, C-button symbols, etc.) render as garbage stripes or a solid block. Vanilla is unaffected; it only appears with a replacement pack enabled.Root cause
Regression from #1118. It rewrote
ImportTextureRaw's fallback upload to describe the buffer withloaded_texture.line_size_bytes:For a block-loaded texture,
line_size_bytesspans the entire image (aLoadBlockis one contiguous "line"), so this collapses the upload to anN x 1strip. Instrumented, a 768x256 RGBA32 button replacement (gCBtnSymbolsTex):The fast path is skipped because the block load reports a non-integer original height (
736 bytes / 48-byte line = 15.33 -> 15), soresultNewHeight (240) != resource height (256). Before #1118 the fallback usedresultNewLineSize / 4 = 768(correct width).Fix
Describe the buffer by the per-line HD stride
resultNewLineSize(tile line_size x h_byte_scale) -- the true per-row stride for both block and tile loads -- and derive height from the loaded bytes. The OOB clamp added by #1118 is preserved.Scope and testing
Fixes any alt-asset/HD replacement loaded via
LoadBlock. Tested with an Xbox/N64 button texture pack: the in-game equip prompt and C-button symbols now render correctly. Fast-path textures (the vast majority of HD textures) are untouched since they never reach this fallback.Same root PR (#1118) as #1135.