mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +00:00
GPU/SW: Fix 576-line scanout of PAL games
This commit is contained in:
parent
904680f0df
commit
43bb69fb6b
|
@ -46,11 +46,7 @@ protected:
|
||||||
UNIFORM_BUFFER_SIZE = 512 * 1024,
|
UNIFORM_BUFFER_SIZE = 512 * 1024,
|
||||||
MAX_BATCH_VERTEX_COUNTER_IDS = 65536 - 2,
|
MAX_BATCH_VERTEX_COUNTER_IDS = 65536 - 2,
|
||||||
MAX_VERTICES_FOR_RECTANGLE = 6 * (((MAX_PRIMITIVE_WIDTH + (TEXTURE_PAGE_WIDTH - 1)) / TEXTURE_PAGE_WIDTH) + 1u) *
|
MAX_VERTICES_FOR_RECTANGLE = 6 * (((MAX_PRIMITIVE_WIDTH + (TEXTURE_PAGE_WIDTH - 1)) / TEXTURE_PAGE_WIDTH) + 1u) *
|
||||||
(((MAX_PRIMITIVE_HEIGHT + (TEXTURE_PAGE_HEIGHT - 1)) / TEXTURE_PAGE_HEIGHT) + 1u),
|
(((MAX_PRIMITIVE_HEIGHT + (TEXTURE_PAGE_HEIGHT - 1)) / TEXTURE_PAGE_HEIGHT) + 1u)
|
||||||
|
|
||||||
// In interlaced modes, we can exceed the 512 height of VRAM, up to 576 in PAL games.
|
|
||||||
BASE_DISPLAY_TEXTURE_WIDTH = 720,
|
|
||||||
BASE_DISPLAY_TEXTURE_HEIGHT = 576,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BatchVertex
|
struct BatchVertex
|
||||||
|
|
|
@ -256,8 +256,8 @@ bool GPU_HW_D3D11::CreateFramebuffer()
|
||||||
D3D11_BIND_DEPTH_STENCIL) ||
|
D3D11_BIND_DEPTH_STENCIL) ||
|
||||||
!m_vram_read_texture.Create(m_device.Get(), texture_width, texture_height, 1, 1, texture_format,
|
!m_vram_read_texture.Create(m_device.Get(), texture_width, texture_height, 1, 1, texture_format,
|
||||||
D3D11_BIND_SHADER_RESOURCE) ||
|
D3D11_BIND_SHADER_RESOURCE) ||
|
||||||
!m_display_texture.Create(m_device.Get(), BASE_DISPLAY_TEXTURE_WIDTH * m_resolution_scale,
|
!m_display_texture.Create(m_device.Get(), GPU_MAX_DISPLAY_WIDTH * m_resolution_scale,
|
||||||
BASE_DISPLAY_TEXTURE_HEIGHT * m_resolution_scale, 1, 1, texture_format,
|
GPU_MAX_DISPLAY_HEIGHT * m_resolution_scale, 1, 1, texture_format,
|
||||||
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET) ||
|
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET) ||
|
||||||
!m_vram_encoding_texture.Create(m_device.Get(), VRAM_WIDTH, VRAM_HEIGHT, 1, 1, texture_format,
|
!m_vram_encoding_texture.Create(m_device.Get(), VRAM_WIDTH, VRAM_HEIGHT, 1, 1, texture_format,
|
||||||
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET) ||
|
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET) ||
|
||||||
|
|
|
@ -399,8 +399,8 @@ bool GPU_HW_OpenGL::CreateFramebuffer()
|
||||||
!m_vram_encoding_texture.Create(VRAM_WIDTH, VRAM_HEIGHT, 1, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, nullptr,
|
!m_vram_encoding_texture.Create(VRAM_WIDTH, VRAM_HEIGHT, 1, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, nullptr,
|
||||||
false) ||
|
false) ||
|
||||||
!m_vram_encoding_texture.CreateFramebuffer() ||
|
!m_vram_encoding_texture.CreateFramebuffer() ||
|
||||||
!m_display_texture.Create(BASE_DISPLAY_TEXTURE_WIDTH * m_resolution_scale,
|
!m_display_texture.Create(GPU_MAX_DISPLAY_WIDTH * m_resolution_scale,
|
||||||
BASE_DISPLAY_TEXTURE_HEIGHT * m_resolution_scale, 1, GL_RGBA8, GL_RGBA,
|
GPU_MAX_DISPLAY_HEIGHT * m_resolution_scale, 1, GL_RGBA8, GL_RGBA,
|
||||||
GL_UNSIGNED_BYTE, nullptr, false) ||
|
GL_UNSIGNED_BYTE, nullptr, false) ||
|
||||||
!m_display_texture.CreateFramebuffer())
|
!m_display_texture.CreateFramebuffer())
|
||||||
{
|
{
|
||||||
|
|
|
@ -519,8 +519,8 @@ bool GPU_HW_Vulkan::CreateFramebuffer()
|
||||||
!m_vram_read_texture.Create(texture_width, texture_height, 1, 1, texture_format, VK_SAMPLE_COUNT_1_BIT,
|
!m_vram_read_texture.Create(texture_width, texture_height, 1, 1, texture_format, VK_SAMPLE_COUNT_1_BIT,
|
||||||
VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_TILING_OPTIMAL,
|
VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_TILING_OPTIMAL,
|
||||||
VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT) ||
|
VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT) ||
|
||||||
!m_display_texture.Create(BASE_DISPLAY_TEXTURE_WIDTH * m_resolution_scale,
|
!m_display_texture.Create(GPU_MAX_DISPLAY_WIDTH * m_resolution_scale,
|
||||||
BASE_DISPLAY_TEXTURE_HEIGHT * m_resolution_scale, 1, 1, texture_format,
|
GPU_MAX_DISPLAY_HEIGHT * m_resolution_scale, 1, 1, texture_format,
|
||||||
VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_TILING_OPTIMAL,
|
VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_TILING_OPTIMAL,
|
||||||
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT |
|
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT |
|
||||||
VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT) ||
|
VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT) ||
|
||||||
|
|
|
@ -255,7 +255,7 @@ void GPU_SW::CopyOut15Bit(u32 src_x, u32 src_y, u32 width, u32 height, u32 field
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dst_stride = VRAM_WIDTH * sizeof(OutputPixelType);
|
dst_stride = GPU_MAX_DISPLAY_WIDTH * sizeof(OutputPixelType);
|
||||||
dst_ptr = m_display_texture_buffer.data() + (field != 0 ? dst_stride : 0);
|
dst_ptr = m_display_texture_buffer.data() + (field != 0 ? dst_stride : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ protected:
|
||||||
void FillBackendCommandParameters(GPUBackendCommand* cmd);
|
void FillBackendCommandParameters(GPUBackendCommand* cmd);
|
||||||
void FillDrawCommand(GPUBackendDrawCommand* cmd, GPURenderCommand rc);
|
void FillDrawCommand(GPUBackendDrawCommand* cmd, GPURenderCommand rc);
|
||||||
|
|
||||||
HeapArray<u8, VRAM_WIDTH * VRAM_HEIGHT * sizeof(u32)> m_display_texture_buffer;
|
HeapArray<u8, GPU_MAX_DISPLAY_WIDTH * GPU_MAX_DISPLAY_HEIGHT * sizeof(u32)> m_display_texture_buffer;
|
||||||
HostDisplayPixelFormat m_16bit_display_format = HostDisplayPixelFormat::RGB565;
|
HostDisplayPixelFormat m_16bit_display_format = HostDisplayPixelFormat::RGB565;
|
||||||
HostDisplayPixelFormat m_24bit_display_format = HostDisplayPixelFormat::RGBA8;
|
HostDisplayPixelFormat m_24bit_display_format = HostDisplayPixelFormat::RGBA8;
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,11 @@ enum : u32
|
||||||
TEXTURE_PAGE_HEIGHT = 256,
|
TEXTURE_PAGE_HEIGHT = 256,
|
||||||
MAX_PRIMITIVE_WIDTH = 1024,
|
MAX_PRIMITIVE_WIDTH = 1024,
|
||||||
MAX_PRIMITIVE_HEIGHT = 512,
|
MAX_PRIMITIVE_HEIGHT = 512,
|
||||||
|
|
||||||
|
// In interlaced modes, we can exceed the 512 height of VRAM, up to 576 in PAL games.
|
||||||
|
GPU_MAX_DISPLAY_WIDTH = 720,
|
||||||
|
GPU_MAX_DISPLAY_HEIGHT = 576,
|
||||||
|
|
||||||
DITHER_MATRIX_SIZE = 4
|
DITHER_MATRIX_SIZE = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue