mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 15:45:42 +00:00
GPU/OpenGL: Use CopyImageSubData for VRAM copies
Not correct with regard to the mask bit handling, but better than blitting.
This commit is contained in:
parent
22e8b6b0a7
commit
771a151567
|
@ -712,12 +712,25 @@ void GPU_HW_OpenGL::CopyVRAM(u32 src_x, u32 src_y, u32 dst_x, u32 dst_y, u32 wid
|
||||||
src_y = m_vram_texture->GetHeight() - src_y - height;
|
src_y = m_vram_texture->GetHeight() - src_y - height;
|
||||||
dst_y = m_vram_texture->GetHeight() - dst_y - height;
|
dst_y = m_vram_texture->GetHeight() - dst_y - height;
|
||||||
|
|
||||||
|
if (GLAD_GL_VERSION_4_3)
|
||||||
|
{
|
||||||
|
glCopyImageSubData(m_vram_texture->GetGLId(), GL_TEXTURE_2D, 0, src_x, src_y, 0, m_vram_texture->GetGLId(),
|
||||||
|
GL_TEXTURE_2D, 0, dst_x, dst_y, 0, width, height, 1);
|
||||||
|
}
|
||||||
|
else if (GLAD_GL_EXT_copy_image)
|
||||||
|
{
|
||||||
|
glCopyImageSubDataEXT(m_vram_texture->GetGLId(), GL_TEXTURE_2D, 0, src_x, src_y, 0, m_vram_texture->GetGLId(),
|
||||||
|
GL_TEXTURE_2D, 0, dst_x, dst_y, 0, width, height, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
m_vram_texture->BindFramebuffer(GL_READ_FRAMEBUFFER);
|
m_vram_texture->BindFramebuffer(GL_READ_FRAMEBUFFER);
|
||||||
glBlitFramebuffer(src_x, src_y, src_x + width, src_y + height, dst_x, dst_y, dst_x + width, dst_y + height,
|
glBlitFramebuffer(src_x, src_y, src_x + width, src_y + height, dst_x, dst_y, dst_x + width, dst_y + height,
|
||||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GPU_HW_OpenGL::UpdateVRAMReadTexture()
|
void GPU_HW_OpenGL::UpdateVRAMReadTexture()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue