GPU/OpenGL: Fix non-interleaved interlaced display

This commit is contained in:
Connor McLaughlin 2020-05-26 13:44:05 +10:00
parent e368dbbadc
commit cb66889856
2 changed files with 5 additions and 4 deletions

View file

@ -612,9 +612,10 @@ void GPU_HW_OpenGL::UpdateDisplay()
m_display_texture.BindFramebuffer(GL_DRAW_FRAMEBUFFER);
m_vram_texture.Bind();
const u32 flipped_vram_offset_y = VRAM_HEIGHT - vram_offset_y - display_height;
const u8 interleaved_shift = BoolToUInt8(!m_GPUSTAT.vertical_resolution);
const u32 flipped_vram_offset_y = VRAM_HEIGHT - vram_offset_y - (display_height >> interleaved_shift);
const u32 scaled_flipped_vram_offset_y =
m_vram_texture.GetHeight() - scaled_vram_offset_y - scaled_display_height;
m_vram_texture.GetHeight() - scaled_vram_offset_y - (scaled_display_height >> interleaved_shift);
const u32 reinterpret_field_offset = GetInterlacedDisplayLineOffset();
const u32 reinterpret_start_x = m_crtc_state.regs.X * m_resolution_scale;
const u32 reinterpret_crop_left = (m_crtc_state.display_vram_left - m_crtc_state.regs.X) * m_resolution_scale;
@ -623,7 +624,7 @@ void GPU_HW_OpenGL::UpdateDisplay()
UploadUniformBuffer(uniforms, sizeof(uniforms));
m_batch_ubo_dirty = true;
glViewport(0, reinterpret_field_offset, scaled_display_width, scaled_display_height);
glViewport(0, 0, scaled_display_width, scaled_display_height);
glBindVertexArray(m_attributeless_vao_id);
glDrawArrays(GL_TRIANGLES, 0, 3);

View file

@ -1026,7 +1026,7 @@ std::string GPU_HW_ShaderGen::GenerateDisplayFragmentShader(bool depth_24bit, GP
uint2 icoords = uint2(v_pos.xy);
#if INTERLACED
if (((icoords.y / RESOLUTION_SCALE) & 1u) != u_field_offset)
if (((fixYCoord(icoords.y) / RESOLUTION_SCALE) & 1u) != u_field_offset)
discard;
#if !INTERLEAVED