Enhance main loop#2049
Closed
dimensionscape wants to merge 38 commits into8.4.0-devfrom
Closed
Conversation
gcc 15 changes the default standard from gnu17 to gnu23, but HashLink mysql won't build with gnu23. I confirmed that clang also supports gnu17 (and it is the documented default).
Replace SDL_GL_CreateContext with SDL_GL_GetCurrentContext in SDLWindow.cpp to use a single shared GL context instead of creating one per window. Keep SDL_GL_MakeCurrent call and add comments explaining the choice and a TODO to revisit context-per-window if windows are ever given independent render loops.
This reverts commit c94d7d2.
The quotes used previously prevented ~ from being expanded by the shell, which broke the path on some platforms. This allows the cache to function properly and should speed up build times.
…py/paste into community.openfl.org Discourse seems to preserve most Markdown, but I guess it prefers - over * for list items
Add calibrated sleep logic and fractional-frame stepping to improve timing accuracy and avoid overshooting frame deadlines. Introduces calibration for SDL_Delay(1) (s_minSleepCostMs / s_delay1CostMs) and helper functions (CalibrateMinSleep/CalibrateDelay1, SleepMinStep/SleepShortest) to decide whether to sleep 1ms or yield (SDL_Delay(0)). Adds NextFrameStep with fractional accumulation to advance nextUpdate using integer+fractional frame periods, and replaces unconditional SDL_Delay(1) with conditional calibrated delay/yield in the main loop. These changes reduce jitter and drift caused by coarse sleep quantization.
…quested Some native targets will update the clipboard text automatically, including macOS, but not iOS or tvOS.
It seems that the automatic updating is desktop only, and mobile needs the manual update when trying to read the clipboard.
…h different bytesPerElement Also, fix missing range error on set() when passing a view that is too long for the remaining space after the offset
Replace strict LIME_GLES3_API preprocessor checks with a condition that also allows desktop GL (!LIME_GLES) and add runtime null checks for GL function pointers before invoking them. Updates glFramebufferTextureLayer, glTexImage3D, glTexStorage3D and glTexSubImage3D (and their HL bindings) to avoid calling missing symbols on platforms where those APIs aren't available.
Replace strict LIME_GLES3_API compile-time guards with checks that allow desktop GL (or GLES3) and verify function pointer availability before calling. Adds nullptr checks around calls like glBlitFramebuffer, glClearBuffer* variants, glCopyTexSubImage3D, glDrawBuffers and glReadBuffer (including HL_* wrappers) to avoid invoking missing entry points. Also scopes the draw_buffers allocation/loop inside the availability guard. This makes the OpenGL bindings safer across platforms and when certain GL functions are not present. We should probably come up with a more idomatic solution here but this is a good temporary workaround. These functions are available on desktop gl, not just gles3.
Replace narrow LIME_GLES3_API-only #ifdefs with a desktop-aware condition (#if defined(LIME_GLES3_API) || !defined(LIME_GLES)) and add runtime function-pointer null checks before calling GL functions. A TODO comment was added to remind maintainers to audit GLES3-only wrappers and introduce a proper desktop-GL capability macro later. Multiple wrappers were updated (samplers, vertex arrays, buffer copy, instanced draws, framebuffer invalidation, sampler params, tex storage, renderbuffer multisample, is* queries, vertex attrib divisor, etc.) to avoid calling NULL proc pointers on desktop GL while preserving behavior for pure GLES builds.
…> to force NPM build for a project. Do not force 'dist' directory (use <assets /> tags to populate the appropriate dist/ or public/ folder)
…='npm' /> to force NPM build for a project. Do not force 'dist' directory (use <assets /> tags to populate the appropriate dist/ or public/ folder)" This reverts commit 175bf95.
Introduce configurable main-loop and VSync support across layers and refactor SDL application event/timing logic. - API: Add SetMainLoop and SetVSyncMode to Application and GetVSyncInterval/GetRefreshRate to Window. - ExternalInterface: Expose lime_application_set_main_loop and lime_application_set_vsync_mode (including HL variants). - SDL backend: Large refactor of SDLApplication to support requested main-loop settings (profile, frameRate, timePrecision, busyWait, uncapMode, vsync), display refresh detection, sleep calibration, high-resolution timing, scheduler unthrottling, busy-wait modes, and improved frame dispatching. Adds modal event watch for native modal loops (Windows) and reorganizes event handling into many Process* helper methods. - Window flags: Add several new WINDOW_FLAG_* values (SKIP_TASKBAR, UTILITY, POPUP_MENU, TOOLTIP). - Haxe: Add enums/files for BusyWaitMode, FrameOptions, FrameProfile, TimePrecision, UncapMode, VSyncMode and related updates across backends and app/window Haxe classes. - Tests: Add FrameTimingTest for runtime testing. These changes enable finer control over application's main loop behavior and VSync handling, and improve cross-platform event/timing robustness.
This reverts commit 9a49cc8.
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.
No description provided.