GPU: Fix handling of interlaced non-480-line mode
This commit is contained in:
parent
7152d54104
commit
53881219ce
|
@ -432,6 +432,7 @@ void GPU_HW_D3D11::BlitTexture(ID3D11RenderTargetView* dst, u32 dst_x, u32 dst_y
|
||||||
static_cast<float>(src_height) / static_cast<float>(src_texture_height)};
|
static_cast<float>(src_height) / static_cast<float>(src_texture_height)};
|
||||||
|
|
||||||
m_context->OMSetRenderTargets(1, &dst, nullptr);
|
m_context->OMSetRenderTargets(1, &dst, nullptr);
|
||||||
|
m_context->PSSetShaderResources(0, 1, &src);
|
||||||
SetViewport(dst_x, dst_y, dst_width, dst_height);
|
SetViewport(dst_x, dst_y, dst_width, dst_height);
|
||||||
SetScissor(dst_x, dst_y, dst_width, dst_height);
|
SetScissor(dst_x, dst_y, dst_width, dst_height);
|
||||||
DrawUtilityShader(m_copy_pixel_shader.Get(), uniforms, sizeof(uniforms));
|
DrawUtilityShader(m_copy_pixel_shader.Get(), uniforms, sizeof(uniforms));
|
||||||
|
@ -535,8 +536,7 @@ void GPU_HW_D3D11::UpdateDisplay()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const u32 field_offset = BoolToUInt8(m_GPUSTAT.vertical_interlace && !m_GPUSTAT.drawing_even_line);
|
const u32 field_offset = BoolToUInt8(m_GPUSTAT.vertical_interlace && m_GPUSTAT.interlaced_field);
|
||||||
const u32 scaled_field_offset = field_offset * m_resolution_scale;
|
|
||||||
|
|
||||||
ID3D11PixelShader* display_pixel_shader =
|
ID3D11PixelShader* display_pixel_shader =
|
||||||
m_display_pixel_shaders[BoolToUInt8(m_GPUSTAT.display_area_color_depth_24)]
|
m_display_pixel_shaders[BoolToUInt8(m_GPUSTAT.display_area_color_depth_24)]
|
||||||
|
@ -556,7 +556,7 @@ void GPU_HW_D3D11::UpdateDisplay()
|
||||||
m_context->PSSetShaderResources(0, 1, m_vram_downsample_texture.GetD3DSRVArray());
|
m_context->PSSetShaderResources(0, 1, m_vram_downsample_texture.GetD3DSRVArray());
|
||||||
|
|
||||||
const u32 uniforms[4] = {vram_offset_x, vram_offset_y, field_offset};
|
const u32 uniforms[4] = {vram_offset_x, vram_offset_y, field_offset};
|
||||||
SetViewportAndScissor(0, scaled_field_offset, display_width, display_height);
|
SetViewportAndScissor(0, field_offset, display_width, display_height);
|
||||||
DrawUtilityShader(display_pixel_shader, uniforms, sizeof(uniforms));
|
DrawUtilityShader(display_pixel_shader, uniforms, sizeof(uniforms));
|
||||||
UploadUniformBlock(uniforms, sizeof(uniforms));
|
UploadUniformBlock(uniforms, sizeof(uniforms));
|
||||||
|
|
||||||
|
@ -569,8 +569,8 @@ void GPU_HW_D3D11::UpdateDisplay()
|
||||||
m_context->OMSetRenderTargets(1, m_display_texture.GetD3DRTVArray(), nullptr);
|
m_context->OMSetRenderTargets(1, m_display_texture.GetD3DRTVArray(), nullptr);
|
||||||
m_context->PSSetShaderResources(0, 1, m_vram_texture.GetD3DSRVArray());
|
m_context->PSSetShaderResources(0, 1, m_vram_texture.GetD3DSRVArray());
|
||||||
|
|
||||||
const u32 uniforms[4] = {scaled_vram_offset_x, scaled_vram_offset_y, scaled_field_offset};
|
const u32 uniforms[4] = {scaled_vram_offset_x, scaled_vram_offset_y, field_offset};
|
||||||
SetViewportAndScissor(0, scaled_field_offset, scaled_display_width, scaled_display_height);
|
SetViewportAndScissor(0, field_offset, scaled_display_width, scaled_display_height);
|
||||||
DrawUtilityShader(display_pixel_shader, uniforms, sizeof(uniforms));
|
DrawUtilityShader(display_pixel_shader, uniforms, sizeof(uniforms));
|
||||||
UploadUniformBlock(uniforms, sizeof(uniforms));
|
UploadUniformBlock(uniforms, sizeof(uniforms));
|
||||||
|
|
||||||
|
|
|
@ -448,8 +448,7 @@ void GPU_HW_OpenGL::UpdateDisplay()
|
||||||
const u32 flipped_vram_offset_y = VRAM_HEIGHT - vram_offset_y - display_height;
|
const u32 flipped_vram_offset_y = VRAM_HEIGHT - vram_offset_y - display_height;
|
||||||
const u32 scaled_flipped_vram_offset_y =
|
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;
|
||||||
const u32 field_offset = BoolToUInt8(m_GPUSTAT.vertical_interlace && !m_GPUSTAT.drawing_even_line);
|
const u32 field_offset = BoolToUInt8(m_GPUSTAT.vertical_interlace && m_GPUSTAT.interlaced_field);
|
||||||
const u32 scaled_field_offset = field_offset * m_resolution_scale;
|
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
@ -491,9 +490,9 @@ void GPU_HW_OpenGL::UpdateDisplay()
|
||||||
m_display_texture->BindFramebuffer(GL_DRAW_FRAMEBUFFER);
|
m_display_texture->BindFramebuffer(GL_DRAW_FRAMEBUFFER);
|
||||||
m_vram_texture->Bind();
|
m_vram_texture->Bind();
|
||||||
|
|
||||||
glViewport(0, scaled_field_offset, scaled_display_width, scaled_display_height);
|
glViewport(0, field_offset, scaled_display_width, scaled_display_height);
|
||||||
|
|
||||||
const u32 uniforms[4] = {scaled_vram_offset_x, scaled_flipped_vram_offset_y, scaled_field_offset};
|
const u32 uniforms[4] = {scaled_vram_offset_x, scaled_flipped_vram_offset_y, field_offset};
|
||||||
UploadUniformBlock(uniforms, sizeof(uniforms));
|
UploadUniformBlock(uniforms, sizeof(uniforms));
|
||||||
m_batch_ubo_dirty = true;
|
m_batch_ubo_dirty = true;
|
||||||
|
|
||||||
|
|
|
@ -649,7 +649,7 @@ std::string GPU_HW_ShaderGen::GenerateDisplayFragmentShader(bool depth_24bit, bo
|
||||||
int2 icoords = int2(v_pos.xy);
|
int2 icoords = int2(v_pos.xy);
|
||||||
|
|
||||||
#if INTERLACED
|
#if INTERLACED
|
||||||
if ((((icoords.y - u_base_coords.z) / RESOLUTION_SCALE) & 1) != 0)
|
if (((icoords.y - u_base_coords.z) & 1) != 0)
|
||||||
discard;
|
discard;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue