macOS: allocate chunk VBOs, ASCII date string, focus dialog field - #4
Merged
Merged
Conversation
…log field The world-creation crash on real Mavericks hardware was actually two distinct bugs stacked on top of each other: 1. LevelRenderer's VBO allocation was gated on OPENGL_ES, but Chunk uses VBOs whenever USE_VBO is defined (set in gles.h for iOS GLES 1.1 AND macOS desktop GL 2.1). On the macOS path chunkBuffers was never allocated, so chunk->vboBuffers held uninitialised heap; the moment any chunk had geometry to flush, Tesselator::end(true, vboBuffers[l]) dereferenced garbage and the renderer crashed inside Chunk::rebuild(). Switch all four guards in LevelRenderer.cpp from OPENGL_ES to USE_VBO so the buffer allocation, the sky VBO upload, and the destructor match what the renderer actually does. 2. getDateString used the system locale (NSDateFormatterMediumStyle). On a Russian-locale Mavericks install that produces Cyrillic; the engine's Font.cpp is a 256-slot bitmap indexed by raw byte value, so non-ASCII rendered as tile glyphs (the 'strange symbol' the user reported on the world-list screen). Pin en_US_POSIX + a fixed yyyy-MM-dd HH:mm format so the date is always ASCII. Also push first-responder into the world-name text field once the NSAlert sheet is laid out so users don't have to mouse-click the field before typing -- 'world naming doesn't work' on Mavericks turned out to be that the focus ring isn't visible until the field is active. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.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.
Fixes the SIGSEGV at
Chunk::rebuild() + 672on real Mavericks hardware (see issue #2 follow-up).Root cause
LevelRenderers VBO allocation was gated onOPENGL_ES, butChunk::rebuild()uses VBOs wheneverUSE_VBOis defined (whichgles.hdoes for both iOS GLES 1.1 AND macOS desktop GL 2.1). The macOS path therefore created chunks withvboBuffers = &chunkBuffers[id]wherechunkBufferswas an uninitialisedGLuint*member ofLevelRenderer. The moment any chunk had geometry to flush,Tesselator::end(true, vboBuffers[l])dereferenced the garbage pointer and crashed insideChunk::rebuild(). The previous r3 defensive check was only inside the inner tile loop -- the new crash was in the post-loopt.end()call which readsvboBuffers[l].Changes
LevelRenderer.cpp-- switch all 4#ifdef OPENGL_ESguards to#ifdef USE_VBO(constructor, destructor, sky draw,onGraphicsReset). The iOS build behaviour is unchanged becauseOPENGL_ES => USE_VBOingles.h. macOS now actually allocates the chunk VBO array.AppPlatform_macOS.mm--getDateString-- pinen_US_POSIXlocale andyyyy-MM-dd HH:mmformat. The enginesFont.cppis a 256-slot bitmap indexed by raw byte value, so the previous medium-style localized date produced Cyrillic on a Russian-locale system which Font rendered as garbage (the "strange symbol" on the world-list screen).AppPlatform_macOS.mm--showDialog-- push first-responder into the world-name field once the NSAlert sheet is laid out so users do not have to click the field before typing.Verification
Cross-built with OSXCross + MacOSX10.9.sdk. Binary is
Mach-O 64-bit x86_64,LC_VERSION_MIN_MACOSX = 10.9.