From f98c9b408466f68f46627f9ca8c28d55049ff7e4 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 25 Apr 2020 14:37:56 +1000 Subject: [PATCH] GPU/HW: Fix display being cut off when cropping+upscaling --- src/core/gpu_hw_d3d11.cpp | 3 ++- src/core/gpu_hw_opengl.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/gpu_hw_d3d11.cpp b/src/core/gpu_hw_d3d11.cpp index 7e9bcbe21..3315b8c0a 100644 --- a/src/core/gpu_hw_d3d11.cpp +++ b/src/core/gpu_hw_d3d11.cpp @@ -570,7 +570,8 @@ void GPU_HW_D3D11::UpdateDisplay() const u32 reinterpret_field_offset = GetInterlacedField(); const u32 reinterpret_start_x = m_crtc_state.regs.X * m_resolution_scale; - const u32 reinterpret_width = scaled_display_width + (m_crtc_state.display_vram_left - m_crtc_state.regs.X); + const u32 reinterpret_width = + scaled_display_width + ((m_crtc_state.display_vram_left - m_crtc_state.regs.X) * m_resolution_scale); const u32 uniforms[4] = {reinterpret_start_x, scaled_vram_offset_y, reinterpret_field_offset}; ID3D11PixelShader* display_pixel_shader = m_display_pixel_shaders[BoolToUInt8(m_GPUSTAT.display_area_color_depth_24)][BoolToUInt8(interlaced)].Get(); diff --git a/src/core/gpu_hw_opengl.cpp b/src/core/gpu_hw_opengl.cpp index e5bc6c60e..dc7ba8c1f 100644 --- a/src/core/gpu_hw_opengl.cpp +++ b/src/core/gpu_hw_opengl.cpp @@ -571,7 +571,8 @@ void GPU_HW_OpenGL::UpdateDisplay() m_vram_texture.GetHeight() - scaled_vram_offset_y - scaled_display_height; const u32 reinterpret_field_offset = GetInterlacedField(); const u32 reinterpret_start_x = m_crtc_state.regs.X * m_resolution_scale; - const u32 reinterpret_width = scaled_display_width + (m_crtc_state.display_vram_left - m_crtc_state.regs.X); + const u32 reinterpret_width = + scaled_display_width + ((m_crtc_state.display_vram_left - m_crtc_state.regs.X) * m_resolution_scale); const u32 uniforms[4] = {reinterpret_start_x, scaled_flipped_vram_offset_y, reinterpret_field_offset}; UploadUniformBuffer(uniforms, sizeof(uniforms)); m_batch_ubo_dirty = true;