TEST: GPU: Include padded/DAC-inactive area in postfx final_rect

This commit is contained in:
Stenzek 2024-08-01 22:01:42 +10:00
parent f1f57d88ce
commit f79863d0c9
No known key found for this signature in database
2 changed files with 20 additions and 12 deletions

View File

@ -1942,12 +1942,13 @@ bool GPU::PresentDisplay()
{
FlushRender();
GSVector4i padded_draw_rect;
const GSVector4i draw_rect = CalculateDrawRect(g_gpu_device->GetWindowWidth(), g_gpu_device->GetWindowHeight(),
!g_settings.debugging.show_vram, true);
return RenderDisplay(nullptr, draw_rect, !g_settings.debugging.show_vram);
!g_settings.debugging.show_vram, true, &padded_draw_rect);
return RenderDisplay(nullptr, draw_rect, padded_draw_rect, !g_settings.debugging.show_vram);
}
bool GPU::RenderDisplay(GPUTexture* target, const GSVector4i draw_rect, bool postfx)
bool GPU::RenderDisplay(GPUTexture* target, const GSVector4i draw_rect, const GSVector4i padded_draw_rect, bool postfx)
{
GL_SCOPE_FMT("RenderDisplay: {}", draw_rect);
@ -2106,7 +2107,7 @@ bool GPU::RenderDisplay(GPUTexture* target, const GSVector4i draw_rect, bool pos
const s32 orig_height = static_cast<s32>(std::ceil(static_cast<float>(m_crtc_state.display_height) * upscale_y));
return PostProcessing::DisplayChain.Apply(PostProcessing::DisplayChain.GetInputTexture(), nullptr, target,
real_draw_rect, orig_width, orig_height, m_crtc_state.display_width,
padded_draw_rect, orig_width, orig_height, m_crtc_state.display_width,
m_crtc_state.display_height);
}
else
@ -2340,8 +2341,8 @@ bool GPU::ApplyChromaSmoothing()
return true;
}
GSVector4i GPU::CalculateDrawRect(s32 window_width, s32 window_height, bool apply_rotation,
bool apply_aspect_ratio) const
GSVector4i GPU::CalculateDrawRect(s32 window_width, s32 window_height, bool apply_rotation, bool apply_aspect_ratio,
GSVector4i* padded_rect) const
{
const bool integer_scale = (g_settings.display_scaling == DisplayScalingMode::NearestInteger ||
g_settings.display_scaling == DisplayScalingMode::BilinearInteger);
@ -2451,6 +2452,13 @@ GSVector4i GPU::CalculateDrawRect(s32 window_width, s32 window_height, bool appl
const s32 top = static_cast<s32>(active_top * scale + top_padding);
const s32 right = left + static_cast<s32>(active_width * scale);
const s32 bottom = top + static_cast<s32>(active_height * scale);
if (padded_rect)
{
*padded_rect = GSVector4i(
GSVector4(left_padding, top_padding, left_padding + display_width * scale, top_padding + display_height * scale));
}
return GSVector4i(left, top, right, bottom);
}
@ -2637,7 +2645,7 @@ bool GPU::RenderScreenshotToBuffer(u32 width, u32 height, const GSVector4i draw_
g_gpu_device->ClearRenderTarget(render_texture.get(), 0);
// TODO: this should use copy shader instead.
RenderDisplay(render_texture.get(), draw_rect, postfx);
RenderDisplay(render_texture.get(), draw_rect, draw_rect, postfx);
const u32 stride = Common::AlignUpPow2(GPUTexture::GetPixelSize(hdformat) * width, sizeof(u32));
out_pixels->resize((height * stride) / sizeof(u32));

View File

@ -4,8 +4,8 @@
#pragma once
#include "gpu_types.h"
#include "timers.h"
#include "types.h"
#include "timing_event.h"
#include "types.h"
#include "util/gpu_texture.h"
@ -207,7 +207,8 @@ public:
virtual void FlushRender() = 0;
/// Helper function for computing the draw rectangle in a larger window.
GSVector4i CalculateDrawRect(s32 window_width, s32 window_height, bool apply_rotation, bool apply_aspect_ratio) const;
GSVector4i CalculateDrawRect(s32 window_width, s32 window_height, bool apply_rotation, bool apply_aspect_ratio,
GSVector4i* padded_rect = nullptr) const;
/// Helper function to save current display texture to PNG.
bool WriteDisplayTextureToFile(std::string filename, bool compress_on_thread = false);
@ -343,8 +344,7 @@ protected:
AddCommandTicks(pixels);
}
ALWAYS_INLINE_RELEASE void AddDrawRectangleTicks(const GSVector4i clamped_rect, bool textured,
bool semitransparent)
ALWAYS_INLINE_RELEASE void AddDrawRectangleTicks(const GSVector4i clamped_rect, bool textured, bool semitransparent)
{
u32 drawn_width = clamped_rect.width();
u32 drawn_height = clamped_rect.height();
@ -591,7 +591,7 @@ protected:
void SetDisplayTexture(GPUTexture* texture, GPUTexture* depth_texture, s32 view_x, s32 view_y, s32 view_width,
s32 view_height);
bool RenderDisplay(GPUTexture* target, const GSVector4i draw_rect, bool postfx);
bool RenderDisplay(GPUTexture* target, const GSVector4i draw_rect, const GSVector4i padded_draw_rect, bool postfx);
bool Deinterlace(u32 field, u32 line_skip);
bool DeinterlaceExtractField(u32 dst_bufidx, GPUTexture* src, u32 x, u32 y, u32 width, u32 height, u32 line_skip);