diff --git a/src/core/gpu_hw.h b/src/core/gpu_hw.h index 06c52b76e..096a200b2 100644 --- a/src/core/gpu_hw.h +++ b/src/core/gpu_hw.h @@ -46,11 +46,7 @@ protected: UNIFORM_BUFFER_SIZE = 512 * 1024, MAX_BATCH_VERTEX_COUNTER_IDS = 65536 - 2, 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), - - // 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, + (((MAX_PRIMITIVE_HEIGHT + (TEXTURE_PAGE_HEIGHT - 1)) / TEXTURE_PAGE_HEIGHT) + 1u) }; struct BatchVertex diff --git a/src/core/gpu_hw_d3d11.cpp b/src/core/gpu_hw_d3d11.cpp index 9d10982b4..c8a46fa1f 100644 --- a/src/core/gpu_hw_d3d11.cpp +++ b/src/core/gpu_hw_d3d11.cpp @@ -256,8 +256,8 @@ bool GPU_HW_D3D11::CreateFramebuffer() D3D11_BIND_DEPTH_STENCIL) || !m_vram_read_texture.Create(m_device.Get(), texture_width, texture_height, 1, 1, texture_format, D3D11_BIND_SHADER_RESOURCE) || - !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, + !m_display_texture.Create(m_device.Get(), GPU_MAX_DISPLAY_WIDTH * m_resolution_scale, + GPU_MAX_DISPLAY_HEIGHT * m_resolution_scale, 1, 1, texture_format, D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET) || !m_vram_encoding_texture.Create(m_device.Get(), VRAM_WIDTH, VRAM_HEIGHT, 1, 1, texture_format, D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET) || diff --git a/src/core/gpu_hw_opengl.cpp b/src/core/gpu_hw_opengl.cpp index 5f1327aa2..32f7ac393 100644 --- a/src/core/gpu_hw_opengl.cpp +++ b/src/core/gpu_hw_opengl.cpp @@ -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, false) || !m_vram_encoding_texture.CreateFramebuffer() || - !m_display_texture.Create(BASE_DISPLAY_TEXTURE_WIDTH * m_resolution_scale, - BASE_DISPLAY_TEXTURE_HEIGHT * m_resolution_scale, 1, GL_RGBA8, GL_RGBA, + !m_display_texture.Create(GPU_MAX_DISPLAY_WIDTH * m_resolution_scale, + GPU_MAX_DISPLAY_HEIGHT * m_resolution_scale, 1, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, nullptr, false) || !m_display_texture.CreateFramebuffer()) { diff --git a/src/core/gpu_hw_vulkan.cpp b/src/core/gpu_hw_vulkan.cpp index 8265fce66..e22e86e69 100644 --- a/src/core/gpu_hw_vulkan.cpp +++ b/src/core/gpu_hw_vulkan.cpp @@ -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, VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT) || - !m_display_texture.Create(BASE_DISPLAY_TEXTURE_WIDTH * m_resolution_scale, - BASE_DISPLAY_TEXTURE_HEIGHT * m_resolution_scale, 1, 1, texture_format, + !m_display_texture.Create(GPU_MAX_DISPLAY_WIDTH * m_resolution_scale, + 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_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT) || diff --git a/src/core/gpu_sw.cpp b/src/core/gpu_sw.cpp index 20cd5301b..bb72ce213 100644 --- a/src/core/gpu_sw.cpp +++ b/src/core/gpu_sw.cpp @@ -255,7 +255,7 @@ void GPU_SW::CopyOut15Bit(u32 src_x, u32 src_y, u32 width, u32 height, u32 field } 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); } diff --git a/src/core/gpu_sw.h b/src/core/gpu_sw.h index 16b0be885..1d14fb3e0 100644 --- a/src/core/gpu_sw.h +++ b/src/core/gpu_sw.h @@ -47,7 +47,7 @@ protected: void FillBackendCommandParameters(GPUBackendCommand* cmd); void FillDrawCommand(GPUBackendDrawCommand* cmd, GPURenderCommand rc); - HeapArray m_display_texture_buffer; + HeapArray m_display_texture_buffer; HostDisplayPixelFormat m_16bit_display_format = HostDisplayPixelFormat::RGB565; HostDisplayPixelFormat m_24bit_display_format = HostDisplayPixelFormat::RGBA8; diff --git a/src/core/gpu_types.h b/src/core/gpu_types.h index 9a7a6f074..c9ed3b0ca 100644 --- a/src/core/gpu_types.h +++ b/src/core/gpu_types.h @@ -15,6 +15,11 @@ enum : u32 TEXTURE_PAGE_HEIGHT = 256, MAX_PRIMITIVE_WIDTH = 1024, 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 };