From c73fad6772a186edbf5097e902569e703684ac00 Mon Sep 17 00:00:00 2001 From: Paris Oplopoios Date: Fri, 27 Sep 2024 01:56:59 +0300 Subject: [PATCH 1/4] Error reporting on failed memory allocation (#1091) * Error reporting on failed memory allocation * Formatting --- src/core/address_space.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/address_space.cpp b/src/core/address_space.cpp index 3950bd5fe57..48748e4c34c 100644 --- a/src/core/address_space.cpp +++ b/src/core/address_space.cpp @@ -72,7 +72,8 @@ struct AddressSpace::Impl { } reduction += ReductionOnFail; } - ASSERT_MSG(virtual_base, "Unable to reserve virtual address space!"); + ASSERT_MSG(virtual_base, "Unable to reserve virtual address space: {}", + Common::GetLastErrorMsg()); // Take the reduction off of the system managed area, and leave the others unchanged. system_managed_base = virtual_base; From 50fc5e339d64b3cef901bd8052c55cedf7e58d83 Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Thu, 26 Sep 2024 15:57:22 -0700 Subject: [PATCH 2/4] liverpool_to_vk: Add MRT feature flags to supported number formats. (#1087) --- src/video_core/renderer_vulkan/liverpool_to_vk.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video_core/renderer_vulkan/liverpool_to_vk.cpp b/src/video_core/renderer_vulkan/liverpool_to_vk.cpp index cc6302c8f78..cd527c621fc 100644 --- a/src/video_core/renderer_vulkan/liverpool_to_vk.cpp +++ b/src/video_core/renderer_vulkan/liverpool_to_vk.cpp @@ -381,12 +381,13 @@ static constexpr vk::FormatFeatureFlags2 GetNumberFormatFeatureFlags( case AmdGpu::NumberFormat::Uint: case AmdGpu::NumberFormat::Sint: case AmdGpu::NumberFormat::Float: - return BufferRead | BufferWrite | ImageRead | ImageWrite; + return BufferRead | BufferWrite | ImageRead | ImageWrite | Mrt; case AmdGpu::NumberFormat::Uscaled: case AmdGpu::NumberFormat::Sscaled: case AmdGpu::NumberFormat::SnormNz: return BufferRead | ImageRead; case AmdGpu::NumberFormat::Srgb: + return ImageRead | Mrt; case AmdGpu::NumberFormat::Ubnorm: case AmdGpu::NumberFormat::UbnromNz: case AmdGpu::NumberFormat::Ubint: From cf342e7a4b69baa0e74016a147a9acb950789b0d Mon Sep 17 00:00:00 2001 From: IndecisiveTurtle <47210458+raphaelthegreat@users.noreply.github.com> Date: Fri, 27 Sep 2024 02:56:27 +0300 Subject: [PATCH 3/4] hotfix: descriptor set lifetime fix --- src/video_core/texture_cache/tile_manager.cpp | 8 +++++--- src/video_core/texture_cache/tile_manager.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/video_core/texture_cache/tile_manager.cpp b/src/video_core/texture_cache/tile_manager.cpp index 6624cee7fae..46f9be2748f 100644 --- a/src/video_core/texture_cache/tile_manager.cpp +++ b/src/video_core/texture_cache/tile_manager.cpp @@ -295,10 +295,12 @@ TileManager::TileManager(const Vulkan::Instance& instance, Vulkan::Scheduler& sc .bindingCount = static_cast(bindings.size()), .pBindings = bindings.data(), }; - auto [desc_layout_result, desc_layout] = + auto desc_layout_result = instance.GetDevice().createDescriptorSetLayoutUnique(desc_layout_ci); - ASSERT_MSG(desc_layout_result == vk::Result::eSuccess, - "Failed to create descriptor set layout: {}", vk::to_string(desc_layout_result)); + ASSERT_MSG(desc_layout_result.result == vk::Result::eSuccess, + "Failed to create descriptor set layout: {}", + vk::to_string(desc_layout_result.result)); + desc_layout = std::move(desc_layout_result.value); const vk::PushConstantRange push_constants = { .stageFlags = vk::ShaderStageFlagBits::eCompute, diff --git a/src/video_core/texture_cache/tile_manager.h b/src/video_core/texture_cache/tile_manager.h index d0e5eb0f37f..ed7e32c44a4 100644 --- a/src/video_core/texture_cache/tile_manager.h +++ b/src/video_core/texture_cache/tile_manager.h @@ -51,6 +51,7 @@ class TileManager { private: const Vulkan::Instance& instance; Vulkan::Scheduler& scheduler; + vk::UniqueDescriptorSetLayout desc_layout; std::array detilers; }; From ebebafed6437c9af72f80feebb92737681b84162 Mon Sep 17 00:00:00 2001 From: IndecisiveTurtle <47210458+raphaelthegreat@users.noreply.github.com> Date: Fri, 27 Sep 2024 03:21:08 +0300 Subject: [PATCH 4/4] hotfix2: Actually fix errors Ahhhh --- src/video_core/texture_cache/tile_manager.cpp | 65 +++++++++---------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/src/video_core/texture_cache/tile_manager.cpp b/src/video_core/texture_cache/tile_manager.cpp index 46f9be2748f..c4f24420dac 100644 --- a/src/video_core/texture_cache/tile_manager.cpp +++ b/src/video_core/texture_cache/tile_manager.cpp @@ -259,6 +259,38 @@ TileManager::TileManager(const Vulkan::Instance& instance, Vulkan::Scheduler& sc HostShaders::DETILE_M32X4_COMP, }; + boost::container::static_vector bindings{ + { + .binding = 0, + .descriptorType = vk::DescriptorType::eStorageBuffer, + .descriptorCount = 1, + .stageFlags = vk::ShaderStageFlagBits::eCompute, + }, + { + .binding = 1, + .descriptorType = vk::DescriptorType::eStorageBuffer, + .descriptorCount = 1, + .stageFlags = vk::ShaderStageFlagBits::eCompute, + }, + }; + + const vk::DescriptorSetLayoutCreateInfo desc_layout_ci = { + .flags = vk::DescriptorSetLayoutCreateFlagBits::ePushDescriptorKHR, + .bindingCount = static_cast(bindings.size()), + .pBindings = bindings.data(), + }; + auto desc_layout_result = instance.GetDevice().createDescriptorSetLayoutUnique(desc_layout_ci); + ASSERT_MSG(desc_layout_result.result == vk::Result::eSuccess, + "Failed to create descriptor set layout: {}", + vk::to_string(desc_layout_result.result)); + desc_layout = std::move(desc_layout_result.value); + + const vk::PushConstantRange push_constants = { + .stageFlags = vk::ShaderStageFlagBits::eCompute, + .offset = 0, + .size = sizeof(DetilerParams), + }; + for (int pl_id = 0; pl_id < DetilerType::Max; ++pl_id) { auto& ctx = detilers[pl_id]; @@ -275,39 +307,6 @@ TileManager::TileManager(const Vulkan::Instance& instance, Vulkan::Scheduler& sc .pName = "main", }; - boost::container::static_vector bindings{ - { - .binding = 0, - .descriptorType = vk::DescriptorType::eStorageBuffer, - .descriptorCount = 1, - .stageFlags = vk::ShaderStageFlagBits::eCompute, - }, - { - .binding = 1, - .descriptorType = vk::DescriptorType::eStorageBuffer, - .descriptorCount = 1, - .stageFlags = vk::ShaderStageFlagBits::eCompute, - }, - }; - - const vk::DescriptorSetLayoutCreateInfo desc_layout_ci = { - .flags = vk::DescriptorSetLayoutCreateFlagBits::ePushDescriptorKHR, - .bindingCount = static_cast(bindings.size()), - .pBindings = bindings.data(), - }; - auto desc_layout_result = - instance.GetDevice().createDescriptorSetLayoutUnique(desc_layout_ci); - ASSERT_MSG(desc_layout_result.result == vk::Result::eSuccess, - "Failed to create descriptor set layout: {}", - vk::to_string(desc_layout_result.result)); - desc_layout = std::move(desc_layout_result.value); - - const vk::PushConstantRange push_constants = { - .stageFlags = vk::ShaderStageFlagBits::eCompute, - .offset = 0, - .size = sizeof(DetilerParams), - }; - const vk::DescriptorSetLayout set_layout = *desc_layout; const vk::PipelineLayoutCreateInfo layout_info = { .setLayoutCount = 1U,