GPU/Vulkan: Fix shader VRAM copies

Fixes battle transitions in Final Fantasy IX.
This commit is contained in:
Connor McLaughlin 2020-06-27 02:23:12 +10:00
parent 58b0e6859a
commit 0b261e836b
3 changed files with 14 additions and 6 deletions

View file

@ -773,6 +773,10 @@ void GPU_HW_D3D11::CopyVRAM(u32 src_x, u32 src_y, u32 dst_x, u32 dst_y, u32 widt
m_context->PSSetShaderResources(0, 1, m_vram_read_texture.GetD3DSRVArray()); m_context->PSSetShaderResources(0, 1, m_vram_read_texture.GetD3DSRVArray());
DrawUtilityShader(m_vram_copy_pixel_shader.Get(), &uniforms, sizeof(uniforms)); DrawUtilityShader(m_vram_copy_pixel_shader.Get(), &uniforms, sizeof(uniforms));
RestoreGraphicsAPIState(); RestoreGraphicsAPIState();
if (m_GPUSTAT.check_mask_before_draw)
m_current_depth++;
return; return;
} }
@ -782,9 +786,6 @@ void GPU_HW_D3D11::CopyVRAM(u32 src_x, u32 src_y, u32 dst_x, u32 dst_y, u32 widt
if (m_vram_dirty_rect.Intersects(Common::Rectangle<u32>::FromExtents(src_x, src_y, width, height))) if (m_vram_dirty_rect.Intersects(Common::Rectangle<u32>::FromExtents(src_x, src_y, width, height)))
UpdateVRAMReadTexture(); UpdateVRAMReadTexture();
if (m_GPUSTAT.IsMaskingEnabled())
Log_WarningPrintf("Masking enabled on VRAM copy - not implemented");
GPU_HW::CopyVRAM(src_x, src_y, dst_x, dst_y, width, height); GPU_HW::CopyVRAM(src_x, src_y, dst_x, dst_y, width, height);
src_x *= m_resolution_scale; src_x *= m_resolution_scale;

View file

@ -895,6 +895,10 @@ void GPU_HW_OpenGL::CopyVRAM(u32 src_x, u32 src_y, u32 dst_x, u32 dst_y, u32 wid
glDrawArrays(GL_TRIANGLES, 0, 3); glDrawArrays(GL_TRIANGLES, 0, 3);
RestoreGraphicsAPIState(); RestoreGraphicsAPIState();
if (m_GPUSTAT.check_mask_before_draw)
m_current_depth++;
return; return;
} }

View file

@ -1156,16 +1156,19 @@ void GPU_HW_Vulkan::CopyVRAM(u32 src_x, u32 src_y, u32 dst_x, u32 dst_y, u32 wid
m_vram_copy_pipelines[BoolToUInt8(m_GPUSTAT.check_mask_before_draw)]); m_vram_copy_pipelines[BoolToUInt8(m_GPUSTAT.check_mask_before_draw)]);
vkCmdBindDescriptorSets(cmdbuf, VK_PIPELINE_BIND_POINT_GRAPHICS, m_single_sampler_pipeline_layout, 0, 1, vkCmdBindDescriptorSets(cmdbuf, VK_PIPELINE_BIND_POINT_GRAPHICS, m_single_sampler_pipeline_layout, 0, 1,
&m_vram_copy_descriptor_set, 0, nullptr); &m_vram_copy_descriptor_set, 0, nullptr);
vkCmdPushConstants(cmdbuf, m_single_sampler_pipeline_layout, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, 0,
sizeof(uniforms), &uniforms);
Vulkan::Util::SetViewportAndScissor(cmdbuf, dst_bounds_scaled.left, dst_bounds_scaled.top, Vulkan::Util::SetViewportAndScissor(cmdbuf, dst_bounds_scaled.left, dst_bounds_scaled.top,
dst_bounds_scaled.GetWidth(), dst_bounds_scaled.GetHeight()); dst_bounds_scaled.GetWidth(), dst_bounds_scaled.GetHeight());
vkCmdDraw(cmdbuf, 3, 1, 0, 0); vkCmdDraw(cmdbuf, 3, 1, 0, 0);
RestoreGraphicsAPIState(); RestoreGraphicsAPIState();
if (m_GPUSTAT.check_mask_before_draw)
m_current_depth++;
return; return;
} }
if (m_GPUSTAT.IsMaskingEnabled())
Log_WarningPrintf("Masking enabled on VRAM copy - not implemented");
GPU_HW::CopyVRAM(src_x, src_y, dst_x, dst_y, width, height); GPU_HW::CopyVRAM(src_x, src_y, dst_x, dst_y, width, height);
src_x *= m_resolution_scale; src_x *= m_resolution_scale;