This document describes the current render and video presentation strategy.
The renderer should provide a stable playback surface for libmpv while keeping protocol and player state independent from graphics implementation details.
The preferred release path is:
libmpv
-> deko3d render API
-> Switch framebuffer
-> player overlay
OpenGL remains a fallback path for development and minimal compatibility.
The deko3d/libmpv render API path is the preferred path when the installed media toolchain provides:
mpv/render_dk3d.hlibmpv.alinked withdeko3dlibuamFFmpegwith Switchnvtegrahardware decode support
This path is used for release builds when NXCAST_REQUIRE_DEKO3D=1 succeeds.
The OpenGL path is a fallback when deko3d is unavailable.
It is useful for:
- Keeping the project buildable with a wider devkitPro setup.
- Debugging protocol and player logic without the full media stack.
- Avoiding accidental hard dependency on one render backend during development.
It is not the default release target.
Software rendering is a last-resort path. It is not expected to provide production playback quality.
Owns:
mpv_handlempv_render_context- Render API attachment
- Render frame calls
- Backend event pumping
Owns:
- Foreground video page lifecycle.
- Graphics device and swapchain lifecycle.
- Frame acquisition and presentation.
- Overlay composition order.
Owns:
- Overlay state.
- Timeline drawing.
- Control drawing.
- Input-to-command mapping.
The intended frame order is:
acquire frame
-> render mpv video
-> render player overlay
-> present frame
The optional NXCAST_USE_IMGUI_UI=1 path renders the Dear ImGui + deko3d player overlay after the mpv video frame and before present. If ImGui initialization fails, rendering falls back to the legacy C overlay. Only one system should acquire and present per frame.
The backend should create and initialize mpv first, then attach the render context after the graphics context is ready.
This avoids loading media before render context creation and matches the practical behavior expected by libmpv.
deko3d is not hardware decode by itself. Hardware decode depends on the installed FFmpeg/mpv package exposing nvtegra support.
Current runtime preference:
- Use explicit
hwdec=nvtegrawhen detected. - Fall back to
hwdec=yes. - Keep playback functional even if hardware decode is unavailable.
Render shutdown should release resources in this order:
- Stop player commands and event pumping.
- Detach/free
mpv_render_context. - Terminate/destroy
mpv_handle. - Release overlay and frontend resources.
- Release graphics/platform resources.
This avoids freeing graphics or platform state while libmpv may still reference render resources.
- Keep
deko3dstable as the release path. - Keep OpenGL as a clear fallback, not a competing product target.
- Avoid render-thread blocking from input handling.
- Keep UI drawing independent from protocol and backend internals.