From 24dd49e05ded2171241e22fe460cb3c26a3ee3b2 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Mon, 25 Jan 2021 18:48:55 +1000 Subject: [PATCH] GPU: Fix runahead with MSAA enabled in D3D11/Vulkan --- src/core/gpu_hw_d3d11.cpp | 6 ++---- src/core/system.cpp | 2 +- src/frontend-common/vulkan_host_display.cpp | 5 +++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/core/gpu_hw_d3d11.cpp b/src/core/gpu_hw_d3d11.cpp index 312a6035c..283e59301 100644 --- a/src/core/gpu_hw_d3d11.cpp +++ b/src/core/gpu_hw_d3d11.cpp @@ -95,8 +95,6 @@ bool GPU_HW_D3D11::DoState(StateWrapper& sw, HostDisplayTexture** host_texture, { if (host_texture) { - const CD3D11_BOX src_box(0, 0, 0, static_cast(m_vram_texture.GetWidth()), - static_cast(m_vram_texture.GetHeight()), 1); ComPtr resource; HostDisplayTexture* tex = *host_texture; @@ -109,7 +107,7 @@ bool GPU_HW_D3D11::DoState(StateWrapper& sw, HostDisplayTexture** host_texture, } static_cast(tex->GetHandle())->GetResource(resource.GetAddressOf()); - m_context->CopySubresourceRegion(m_vram_texture.GetD3DTexture(), 0, 0, 0, 0, resource.Get(), 0, &src_box); + m_context->CopySubresourceRegion(m_vram_texture.GetD3DTexture(), 0, 0, 0, 0, resource.Get(), 0, nullptr); } else { @@ -128,7 +126,7 @@ bool GPU_HW_D3D11::DoState(StateWrapper& sw, HostDisplayTexture** host_texture, } static_cast(tex->GetHandle())->GetResource(resource.GetAddressOf()); - m_context->CopySubresourceRegion(resource.Get(), 0, 0, 0, 0, m_vram_texture.GetD3DTexture(), 0, &src_box); + m_context->CopySubresourceRegion(resource.Get(), 0, 0, 0, 0, m_vram_texture.GetD3DTexture(), 0, nullptr); } } diff --git a/src/core/system.cpp b/src/core/system.cpp index ceabf4c0f..6e797218c 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -1973,7 +1973,7 @@ void CalculateRewindMemoryUsage(u32 num_saves, u64* ram_usage, u64* vram_usage) { *ram_usage = MAX_SAVE_STATE_SIZE * static_cast(num_saves); *vram_usage = (VRAM_WIDTH * VRAM_HEIGHT * 4) * static_cast(std::max(g_settings.gpu_resolution_scale, 1u)) * - static_cast(num_saves); + static_cast(g_settings.gpu_multisamples) * static_cast(num_saves); } void ClearMemorySaveStates() diff --git a/src/frontend-common/vulkan_host_display.cpp b/src/frontend-common/vulkan_host_display.cpp index 938254b5e..18e32523b 100644 --- a/src/frontend-common/vulkan_host_display.cpp +++ b/src/frontend-common/vulkan_host_display.cpp @@ -168,8 +168,9 @@ std::unique_ptr VulkanHostDisplay::CreateTexture(u32 width, VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT; Vulkan::Texture texture; - if (!texture.Create(width, height, levels, layers, vk_format, VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_VIEW_TYPE_2D, - VK_IMAGE_TILING_OPTIMAL, usage)) + if (!texture.Create(width, height, levels, layers, vk_format, static_cast(samples), + (layers > 1) ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_TILING_OPTIMAL, + usage)) { return {}; }