From fee08cf63d85d0b1788e0bd2509d2397265c365c Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 2 Aug 2017 21:23:31 +1000 Subject: [PATCH] Vulkan: Use optimal tiling for dummy texture Fixes a crash on some NVIDIA drivers. Apparently calling vkCmdClearColorImage on an image with linear tiling causes the GPU/driver to lock up. --- Source/Core/VideoBackends/Vulkan/ObjectCache.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp b/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp index 9eb7c0efd9..6c932c350d 100644 --- a/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp +++ b/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp @@ -61,15 +61,15 @@ bool ObjectCache::Initialize() return false; m_dummy_texture = Texture2D::Create(1, 1, 1, 1, VK_FORMAT_R8G8B8A8_UNORM, VK_SAMPLE_COUNT_1_BIT, - VK_IMAGE_VIEW_TYPE_2D_ARRAY, VK_IMAGE_TILING_LINEAR, + VK_IMAGE_VIEW_TYPE_2D_ARRAY, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT); m_dummy_texture->TransitionToLayout(g_command_buffer_mgr->GetCurrentInitCommandBuffer(), VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); VkClearColorValue clear_color = {}; VkImageSubresourceRange clear_range = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; vkCmdClearColorImage(g_command_buffer_mgr->GetCurrentInitCommandBuffer(), - m_dummy_texture->GetImage(), VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - &clear_color, 1, &clear_range); + m_dummy_texture->GetImage(), m_dummy_texture->GetLayout(), &clear_color, 1, + &clear_range); m_dummy_texture->TransitionToLayout(g_command_buffer_mgr->GetCurrentInitCommandBuffer(), VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);