[Spike] libretro RETRO_ENVIRONMENT_SET_HW_RENDER bridge for OpenGL/Vulkan cores
Author: github-actions[bot]Created Mar 7, 2026Updated Mar 27, 2026
Labelsaudio
Overview
Several native libretro cores request hardware-accelerated rendering via RETRO_ENVIRONMENT_SET_HW_RENDER — the standard libretro mechanism for cores that need OpenGL, OpenGL ES, or Vulkan contexts. The current PVLibRetroCoreBridge does not handle this environment callback in a way that provides a working render context, which means these cores load and run but produce no video output.
Affected Cores
- Flycast (Dreamcast) — builds, audio plays, no video (#2369)
- BeetlePSX (PSX with hardware upscaling) — builds with Vulkan/GL, no video (#2368)
- Play! (PS2) — listed in PR #2373 as "compiling broke"
- Potentially others: FreeIntv, any future hardware-accelerated libretro core
How retro_hw_render_callback works
When a libretro core wants hardware rendering, it calls:
retro_hw_render_callback hw_render = {
.context_type = RETRO_HW_CONTEXT_OPENGLES3, // or OPENGL, VULKAN
.context_reset = my_context_reset,
.get_current_framebuffer = my_get_framebuffer,
.get_proc_address = my_get_proc_address,
.depth = true,
.stencil = false,
.bottom_left_origin = true,
};
environ_cb(RETRO_ENVIRONMENT_SET_HW_RENDER, &hw_render);The host (Provenance) must then:
- Create an OpenGL ES or Vulkan context
- Call
hw_render.context_reset()once the context is ready - Make the context current before each
retro_run() - Implement
get_current_framebufferto return an FBO that Provenance then blits to the Metal layer - Implement
get_proc_addressto return OpenGL function pointers
What needs to be built
For OpenGL ES path:
- Create an
EAGLContext(orCAEAGLLayerbacked context) in the bridge - Wire
get_proc_addresstodlsym(RTLD_DEFAULT, symbol) - Create an FBO for the core to render into
- After
retro_run(), blit the FBO contents to the Metal texture used byPVMetalViewController
For Vulkan path:
- Provide MoltenVK context via
VkInstance/VkDevice - Wire to
CAMetalLayer(thesurface_handlethat DuckStation also needs) - Use
VK_MVK_moltenvkextension for iOS integration
Reference implementations
- DuckStation's
PVDuckStationCoreBridge.mmalready has partial Vulkan/MoltenVK setup — worth studying - RetroArch's iOS video drivers show how to connect GL/Vulkan to UIKit views
- OpenEmu's
OEGameHelperLayerfor the GL path
Current state of RetroArch-wrapped cores
a20b7c788 enabled 3D GLES cores in the RetroArch wrapper. This means Flycast and BeetlePSX already work via the RetroArch path. The native libretro bridge is a separate (harder) effort but would allow:
- Running without the full RetroArch binary overhead
- Better integration with Provenance's native UI
- Use in "Provenance Lite" builds
Success criteria
- Flycast renders video in native libretro mode
- BeetlePSX renders video in native libretro mode
- Both work on physical device (not just simulator)
Related
- #2369 Flycast
- #2368 BeetlePSX
- #2373 Original PR
- #2482 Core Updates epic
Source: Provenance-Emu/Provenance