diff --git a/core/cfg/option.cpp b/core/cfg/option.cpp index ce5479e41..e0dfc8195 100644 --- a/core/cfg/option.cpp +++ b/core/cfg/option.cpp @@ -64,7 +64,6 @@ Option Widescreen("rend.WideScreen"); Option SuperWidescreen("rend.SuperWideScreen"); Option ShowFPS("rend.ShowFPS"); Option RenderToTextureBuffer("rend.RenderToTextureBuffer"); -Option RenderToTextureUpscale("rend.RenderToTextureUpscale", 1); Option TranslucentPolygonDepthMask("rend.TranslucentPolygonDepthMask"); Option ModifierVolumes("rend.ModifierVolumes", true); Option TextureUpscale("rend.TextureUpscale", 1); diff --git a/core/cfg/option.h b/core/cfg/option.h index 576db2814..411c864e5 100644 --- a/core/cfg/option.h +++ b/core/cfg/option.h @@ -354,7 +354,6 @@ extern Option Widescreen; extern Option SuperWidescreen; extern Option ShowFPS; extern Option RenderToTextureBuffer; -extern Option RenderToTextureUpscale; extern Option TranslucentPolygonDepthMask; extern Option ModifierVolumes; constexpr ConstOption Clipping; diff --git a/core/rend/gl4/gles.cpp b/core/rend/gl4/gles.cpp index 2695fc737..26f239d1c 100644 --- a/core/rend/gl4/gles.cpp +++ b/core/rend/gl4/gles.cpp @@ -652,7 +652,7 @@ static bool RenderFrame(int width, int height) int rendering_height; if (is_rtt) { - int scaling = config::RenderToTextureBuffer ? 1 : config::RenderToTextureUpscale; + float scaling = config::RenderToTextureBuffer ? 1.f : config::RenderResolution / 480.f; rendering_width = matrices.GetDreamcastViewport().x * scaling; rendering_height = matrices.GetDreamcastViewport().y * scaling; } @@ -790,12 +790,13 @@ static bool RenderFrame(int width, int height) fHeight = pvrrc.fb_Y_CLIP.max - pvrrc.fb_Y_CLIP.min + 1; min_x = pvrrc.fb_X_CLIP.min; min_y = pvrrc.fb_Y_CLIP.min; - if (config::RenderToTextureUpscale > 1 && !config::RenderToTextureBuffer) + if (config::RenderResolution > 480 && !config::RenderToTextureBuffer) { - min_x *= config::RenderToTextureUpscale; - min_y *= config::RenderToTextureUpscale; - fWidth *= config::RenderToTextureUpscale; - fHeight *= config::RenderToTextureUpscale; + float scale = config::RenderResolution / 480.f; + min_x *= scale; + min_y *= scale; + fWidth *= scale; + fHeight *= scale; } } gl4ShaderUniforms.base_clipping.enabled = true; diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index 062f17bba..f846ac863 100644 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -1183,12 +1183,13 @@ bool RenderFrame(int width, int height) fHeight = pvrrc.fb_Y_CLIP.max - pvrrc.fb_Y_CLIP.min + 1; min_x = pvrrc.fb_X_CLIP.min; min_y = pvrrc.fb_Y_CLIP.min; - if (config::RenderToTextureUpscale > 1 && !config::RenderToTextureBuffer) + if (config::RenderResolution > 480 && !config::RenderToTextureBuffer) { - min_x *= config::RenderToTextureUpscale; - min_y *= config::RenderToTextureUpscale; - fWidth *= config::RenderToTextureUpscale; - fHeight *= config::RenderToTextureUpscale; + float scale = config::RenderResolution / 480.f; + min_x *= scale; + min_y *= scale; + fWidth *= scale; + fHeight *= scale; } } ShaderUniforms.base_clipping.enabled = true; diff --git a/core/rend/gles/gltex.cpp b/core/rend/gles/gltex.cpp index 1a04890f9..c6b3beaf3 100644 --- a/core/rend/gles/gltex.cpp +++ b/core/rend/gles/gltex.cpp @@ -172,11 +172,6 @@ GLuint BindRTT(bool withDepthBuffer) readAsyncPixelBuffer(gl.rtt.texAddress); gl.rtt.texAddress = texAddress; - if (!config::RenderToTextureBuffer) - { - fbw *= config::RenderToTextureUpscale; - fbh *= config::RenderToTextureUpscale; - } // Find the smallest power of two texture that fits the viewport u32 fbh2 = 2; while (fbh2 < fbh) @@ -184,6 +179,13 @@ GLuint BindRTT(bool withDepthBuffer) u32 fbw2 = 2; while (fbw2 < fbw) fbw2 *= 2; + if (!config::RenderToTextureBuffer) + { + fbw *= config::RenderResolution / 480.f; + fbh *= config::RenderResolution / 480.f; + fbw2 *= config::RenderResolution / 480.f; + fbh2 *= config::RenderResolution / 480.f; + } if (gl.gl_major >= 3 && config::RenderToTextureBuffer) { diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index cf04f4d08..94840d21e 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -1382,8 +1382,6 @@ static void gui_display_settings() { OptionCheckbox("Copy to VRAM", config::RenderToTextureBuffer, "Copy rendered-to textures back to VRAM. Slower but accurate"); - OptionSlider("Render to Texture Upscaling", config::RenderToTextureUpscale, 1, 8, - "Upscale rendered-to textures. Should be the same as the screen or window upscale ratio, or lower for slow platforms"); } if (ImGui::CollapsingHeader("Texture Upscaling", ImGuiTreeNodeFlags_DefaultOpen)) { diff --git a/core/rend/tileclip.h b/core/rend/tileclip.h index 8b9cf96a6..0ff14f4ad 100644 --- a/core/rend/tileclip.h +++ b/core/rend/tileclip.h @@ -71,10 +71,11 @@ static inline TileClipping GetTileClip(u32 val, const glm::mat4& viewport, int * } else if (!config::RenderToTextureBuffer) { - csx *= config::RenderToTextureUpscale; - csy *= config::RenderToTextureUpscale; - cex *= config::RenderToTextureUpscale; - cey *= config::RenderToTextureUpscale; + float scale = config::RenderResolution / 480.f; + csx *= scale; + csy *= scale; + cex *= scale; + cey *= scale; } clip_rect[0] = std::max(0, (int)lroundf(csx)); clip_rect[1] = std::max(0, (int)lroundf(std::min(csy, cey))); diff --git a/core/rend/vulkan/drawer.cpp b/core/rend/vulkan/drawer.cpp index defe67367..722f1b4b7 100644 --- a/core/rend/vulkan/drawer.cpp +++ b/core/rend/vulkan/drawer.cpp @@ -390,17 +390,19 @@ vk::CommandBuffer TextureDrawer::BeginRenderPass() textureAddr = FB_W_SOF1 & VRAM_MASK; u32 origWidth = pvrrc.fb_X_CLIP.max + 1; u32 origHeight = pvrrc.fb_Y_CLIP.max + 1; - u32 upscale = 1; - if (!config::RenderToTextureBuffer) - upscale = config::RenderToTextureUpscale; - u32 upscaledWidth = origWidth * upscale; - u32 upscaledHeight = origHeight * upscale; u32 heightPow2 = 8; - while (heightPow2 < upscaledHeight) + while (heightPow2 < origHeight) heightPow2 *= 2; u32 widthPow2 = 8; - while (widthPow2 < upscaledWidth) + while (widthPow2 < origHeight) widthPow2 *= 2; + float upscale = 1.f; + if (!config::RenderToTextureBuffer) + upscale = config::RenderResolution / 480.f; + u32 upscaledWidth = origWidth * upscale; + u32 upscaledHeight = origHeight * upscale; + widthPow2 *= upscale; + heightPow2 *= upscale; rttPipelineManager->CheckSettingsChange(); VulkanContext *context = GetContext(); diff --git a/core/rend/vulkan/oit/oit_drawer.cpp b/core/rend/vulkan/oit/oit_drawer.cpp index 53cdc6172..7d87f1477 100644 --- a/core/rend/vulkan/oit/oit_drawer.cpp +++ b/core/rend/vulkan/oit/oit_drawer.cpp @@ -495,17 +495,19 @@ vk::CommandBuffer OITTextureDrawer::NewFrame() textureAddr = FB_W_SOF1 & VRAM_MASK; u32 origWidth = pvrrc.fb_X_CLIP.max + 1; u32 origHeight = pvrrc.fb_Y_CLIP.max + 1; - u32 upscale = 1; + float upscale = 1.f; if (!config::RenderToTextureBuffer) - upscale = config::RenderToTextureUpscale; - u32 upscaledWidth = origWidth * upscale; - u32 upscaledHeight = origHeight * upscale; + upscale = config::RenderResolution / 480.f; u32 heightPow2 = 8; - while (heightPow2 < upscaledHeight) + while (heightPow2 < origHeight) heightPow2 *= 2; u32 widthPow2 = 8; - while (widthPow2 < upscaledWidth) + while (widthPow2 < origWidth) widthPow2 *= 2; + u32 upscaledWidth = origWidth * upscale; + u32 upscaledHeight = origHeight * upscale; + widthPow2 *= upscale; + heightPow2 *= upscale; rttPipelineManager->CheckSettingsChange(); VulkanContext *context = GetContext();