rend: get rid of RenderToTextureUpscale option. Use RenderResolution

This commit is contained in:
Flyinghead 2021-05-10 20:07:23 +02:00
parent a4019dd205
commit fb38b224f4
9 changed files with 42 additions and 37 deletions

View File

@ -64,7 +64,6 @@ Option<bool> Widescreen("rend.WideScreen");
Option<bool> SuperWidescreen("rend.SuperWideScreen");
Option<bool> ShowFPS("rend.ShowFPS");
Option<bool> RenderToTextureBuffer("rend.RenderToTextureBuffer");
Option<int> RenderToTextureUpscale("rend.RenderToTextureUpscale", 1);
Option<bool> TranslucentPolygonDepthMask("rend.TranslucentPolygonDepthMask");
Option<bool> ModifierVolumes("rend.ModifierVolumes", true);
Option<int> TextureUpscale("rend.TextureUpscale", 1);

View File

@ -354,7 +354,6 @@ extern Option<bool> Widescreen;
extern Option<bool> SuperWidescreen;
extern Option<bool> ShowFPS;
extern Option<bool> RenderToTextureBuffer;
extern Option<int> RenderToTextureUpscale;
extern Option<bool> TranslucentPolygonDepthMask;
extern Option<bool> ModifierVolumes;
constexpr ConstOption<bool, true> Clipping;

View File

@ -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;

View File

@ -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;

View File

@ -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)
{

View File

@ -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))
{

View File

@ -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)));

View File

@ -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();

View File

@ -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();