From 45e5f53c981c1b02639c435d3519f5d2dda037ec Mon Sep 17 00:00:00 2001 From: Matthew Stanley <1379tech@gmail.com> Date: Tue, 25 Aug 2026 19:11:48 -0700 Subject: [PATCH] Force nearest presentation filtering --- runner/src/frontend.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/runner/src/frontend.cpp b/runner/src/frontend.cpp index 4e36085..ef45583 100644 --- a/runner/src/frontend.cpp +++ b/runner/src/frontend.cpp @@ -869,6 +869,13 @@ bool create_presentation(const NdsFrontendOptions& options, destroy_presentation(presentation); return false; } + if (SDL_SetTextureScaleMode(presentation.textures[screen], + SDL_ScaleModeNearest) != 0) { + std::fprintf(stderr, "[sdl] texture scale mode failed: %s\n", + SDL_GetError()); + destroy_presentation(presentation); + return false; + } if (presentation.sample_scale > 1) { presentation.sample_targets[screen] = SDL_CreateTexture( presentation.renderers[screen], SDL_PIXELFORMAT_ARGB8888, @@ -883,6 +890,15 @@ bool create_presentation(const NdsFrontendOptions& options, destroy_presentation(presentation); return false; } + if (SDL_SetTextureScaleMode(presentation.sample_targets[screen], + SDL_ScaleModeNearest) != 0) { + std::fprintf( + stderr, + "[sdl] supersample target scale mode failed: %s\n", + SDL_GetError()); + destroy_presentation(presentation); + return false; + } } presentation.window_ids[screen] = SDL_GetWindowID(presentation.windows[screen]); @@ -1039,9 +1055,11 @@ int nds_run_interactive_frontend(const NdsFrontendOptions& options) { std::fprintf(stderr, "[sdl] thread priority unchanged: %s\n", SDL_GetError()); - SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, - (options.supersampling > 1 || options.antialiasing > 0) - ? "1" : "0"); + if (!SDL_SetHintWithPriority(SDL_HINT_RENDER_SCALE_QUALITY, "0", + SDL_HINT_OVERRIDE)) { + std::fprintf(stderr, + "[sdl] render scale quality hint was not applied\n"); + } FrontendPresentation presentation{}; if (!create_presentation(options, presentation)) { SDL_Quit();