Repository navigation
Fix in-game visual corruption and 640x480 resolution on iPhone - #20
Merged
Merged
Conversation
…n web WebGL can't map GPU buffers. Emscripten's emulation hands back fresh, uninitialized malloc memory on every map and uploads all of it on unmap, which broke three paths in the browser: - Lightmap pages are dynamic textures that stream through a mapped pixel buffer. Every re-lock of a page re-uploaded the whole page from garbage, wiping the surfaces written earlier: the world rendered blown-out white with cyan/green noise. On web, dynamic textures now keep a persistent CPU backing store (zero-initialized) and upload only the locked region. - Static vertex/index buffer locks got uninitialized memory, so any bytes the engine didn't rewrite became garbage. On web the locked range is staged in CPU memory holding the buffer's current contents (read back with glGetBufferSubData when needed) and uploaded on unlock. - Static prop color meshes shared one pooled vertex buffer that is locked for N vertices and then written past that range. Pooling is off on web, so every prop gets its own color mesh (green/cyan garbage on props). Also: - DXT decoding for tiny mips (2x2, 1x1) used the real width as the row stride and mistook 2x2 DXT5 for uncompressed data; decode into whole blocks and upload with the padded row length. - The requested -w/-h was clamped to a fixed 640x480 "display mode" in the browser, so the game still ran stretched 4:3. Keep the requested size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qy5DKdwTqGQqScWvJyNcft
This branch was successfully deployed
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.
What was wrong
In-game, the world rendered blown-out white with cyan/green noise, and props had garbage green/blue colors. WebGL can't map GPU buffers. Emscripten's emulation returns fresh, uninitialized memory on every map and uploads all of it on unmap, which broke three engine paths:
glGetBufferSubDataonly when D3D semantics require it) and uploaded on unlock.Also fixed
-w/-hwas clamped to a fixed 640×480 "display mode" in the browser, so the game still rendered stretched 4:3. The requested size is now kept.Verification
em++ -fsyntax-only(Emscripten 4.0.9) on every touched file passes. I confirmed the check catches errors by injecting a deliberate typo.🤖 Generated with Claude Code
https://claude.ai/code/session_01Qy5DKdwTqGQqScWvJyNcft
Generated by Claude Code