System_AudioPushSamples() runs on the emu thread when one is active
(GL/GLCore backends) and appends to / reallocs output_audio_buffer,
while retro_run() on the libretro thread reads .data/.size and resets
.size in upload_output_audio_buffer(), unsynchronized. A realloc on
the emu thread can free the pointer while audio_batch_cb() reads it.
Guard the four access sites with a mutex (<mutex> was already included
in this file, unused). The lock is held across audio_batch_cb() — no
second buffer; worst case the emu thread briefly backpressures while
the frontend syncs audio. Behavior is otherwise unchanged.
LibretroGLCoreContext is the backend for RETRO_HW_CONTEXT_OPENGL_CORE,
so the frontend hands us a desktop GL Core profile context. But
CreateDrawContext() never told GLFeatures about it — useCoreContext
stayed at its default false and gl_extensions.IsCoreContext stayed
false, so the macOS Core-profile workaround at GLFeatures.cpp:532
(which force-enables ARB_framebuffer_object because Apple's Core
driver doesn't list it as an extension) never fired.
Every glBindFramebuffer(GL_FRAMEBUFFER, g_defaultFBO) in
GLQueueRunner::fbo_unbind then fell through both branches and silently
no-op'd, so the BackBuffer present pass rendered into nothing and
GL_INVALID_OPERATION accumulated. End result: black screen on macOS,
audio and game logic still working.
One-line fix: call SetGLCoreContext(true) before CheckGLExtensions().
Adds a new GLProfiler class for GPU-side timestamp profiling, similar to
VulkanProfiler. Uses GL_EXT_disjoint_timer_query (GLES) or GL_ARB_timer_query
(desktop GL).
Features:
- Scoped Begin()/End() profiling with printf-style naming
- Automatic GPU disjoint detection (frequency changes invalidate results)
- Millisecond timing output via INFO_LOG
- Pre-allocated query pool (1024 queries max per frame)
- Nested scope support with indented output
Signed-off-by: Chris Healy <cphealy@gmail.com>
extend max pdp block size, due to user report of the following in
dissidia:
07:53:752 MatchingEven I[SCENET]: HLE\sceNetAdhocMatching.cpp:1188 EventLoop[1]: Matching Event [1=HELLO][00:02:02:02:02:02] OptSize=4696
gcc9 and the version of msvc19 that the libretro builders use don't
have _mm_storeu_si32. Using _m_cvtsi128_si32 followed by memcpy is
picked up by compilers that support _mm_storeu_si32 as being the same
and they generate the same assembly, so this is no harm to them.