mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 14:25:37 +00:00
GPU: Make display texture 720x576 instead of 1024x512
Some PAL games render in the full permissable 576 height, not 512.
This commit is contained in:
parent
d1a5b89f0a
commit
23e102b90a
|
@ -46,7 +46,11 @@ 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,7 +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(), texture_width, texture_height, 1, 1, texture_format,
|
!m_display_texture.Create(m_device.Get(), BASE_DISPLAY_TEXTURE_WIDTH * m_resolution_scale,
|
||||||
|
BASE_DISPLAY_TEXTURE_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) ||
|
||||||
|
@ -905,6 +906,9 @@ void GPU_HW_D3D11::UpdateDisplay()
|
||||||
ID3D11PixelShader* display_pixel_shader =
|
ID3D11PixelShader* display_pixel_shader =
|
||||||
m_display_pixel_shaders[BoolToUInt8(m_GPUSTAT.display_area_color_depth_24)][static_cast<u8>(interlaced)].Get();
|
m_display_pixel_shaders[BoolToUInt8(m_GPUSTAT.display_area_color_depth_24)][static_cast<u8>(interlaced)].Get();
|
||||||
|
|
||||||
|
Assert(scaled_display_width <= m_display_texture.GetWidth() &&
|
||||||
|
scaled_display_height <= m_display_texture.GetHeight());
|
||||||
|
|
||||||
SetViewportAndScissor(0, 0, scaled_display_width, scaled_display_height);
|
SetViewportAndScissor(0, 0, scaled_display_width, scaled_display_height);
|
||||||
DrawUtilityShader(display_pixel_shader, uniforms, sizeof(uniforms));
|
DrawUtilityShader(display_pixel_shader, uniforms, sizeof(uniforms));
|
||||||
|
|
||||||
|
|
|
@ -399,8 +399,9 @@ 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(texture_width, texture_height, 1, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, nullptr,
|
!m_display_texture.Create(BASE_DISPLAY_TEXTURE_WIDTH * m_resolution_scale,
|
||||||
false) ||
|
BASE_DISPLAY_TEXTURE_HEIGHT * m_resolution_scale, 1, GL_RGBA8, GL_RGBA,
|
||||||
|
GL_UNSIGNED_BYTE, nullptr, false) ||
|
||||||
!m_display_texture.CreateFramebuffer())
|
!m_display_texture.CreateFramebuffer())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -926,6 +927,9 @@ void GPU_HW_OpenGL::UpdateDisplay()
|
||||||
UploadUniformBuffer(uniforms, sizeof(uniforms));
|
UploadUniformBuffer(uniforms, sizeof(uniforms));
|
||||||
m_batch_ubo_dirty = true;
|
m_batch_ubo_dirty = true;
|
||||||
|
|
||||||
|
Assert(scaled_display_width <= m_display_texture.GetWidth() &&
|
||||||
|
scaled_display_height <= m_display_texture.GetHeight());
|
||||||
|
|
||||||
glViewport(0, 0, scaled_display_width, scaled_display_height);
|
glViewport(0, 0, scaled_display_width, scaled_display_height);
|
||||||
glBindVertexArray(m_attributeless_vao_id);
|
glBindVertexArray(m_attributeless_vao_id);
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||||
|
|
|
@ -519,8 +519,9 @@ 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(texture_width, texture_height, 1, 1, texture_format, VK_SAMPLE_COUNT_1_BIT,
|
!m_display_texture.Create(BASE_DISPLAY_TEXTURE_WIDTH * m_resolution_scale,
|
||||||
VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_TILING_OPTIMAL,
|
BASE_DISPLAY_TEXTURE_HEIGHT * m_resolution_scale, 1, 1, texture_format,
|
||||||
|
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) ||
|
||||||
!m_vram_readback_texture.Create(VRAM_WIDTH, VRAM_HEIGHT, 1, 1, texture_format, VK_SAMPLE_COUNT_1_BIT,
|
!m_vram_readback_texture.Create(VRAM_WIDTH, VRAM_HEIGHT, 1, 1, texture_format, VK_SAMPLE_COUNT_1_BIT,
|
||||||
|
@ -1357,6 +1358,9 @@ void GPU_HW_Vulkan::UpdateDisplay()
|
||||||
m_display_texture.TransitionToLayout(cmdbuf, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
|
m_display_texture.TransitionToLayout(cmdbuf, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
|
||||||
m_vram_texture.TransitionToLayout(cmdbuf, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
m_vram_texture.TransitionToLayout(cmdbuf, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
||||||
|
|
||||||
|
Assert(scaled_display_width <= m_display_texture.GetWidth() &&
|
||||||
|
scaled_display_height <= m_display_texture.GetHeight());
|
||||||
|
|
||||||
BeginRenderPass(m_display_render_pass, m_display_framebuffer, 0, 0, scaled_display_width, scaled_display_height);
|
BeginRenderPass(m_display_render_pass, m_display_framebuffer, 0, 0, scaled_display_width, scaled_display_height);
|
||||||
|
|
||||||
vkCmdBindPipeline(
|
vkCmdBindPipeline(
|
||||||
|
|
Loading…
Reference in a new issue