diff --git a/Common/GPU/Vulkan/VulkanDebug.cpp b/Common/GPU/Vulkan/VulkanDebug.cpp index 08a34b51ec..86b4e6c7cd 100644 --- a/Common/GPU/Vulkan/VulkanDebug.cpp +++ b/Common/GPU/Vulkan/VulkanDebug.cpp @@ -96,6 +96,10 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanDebugUtilsCallback( // Clear value but no LOAD_OP_CLEAR. Not worth fixing right now. return false; + case 1544472022: + // MSAA depth resolve write-after-write?? + return false; + default: break; } diff --git a/Common/GPU/Vulkan/VulkanDescSet.h b/Common/GPU/Vulkan/VulkanDescSet.h index 9133f99f94..bf62bec4fa 100644 --- a/Common/GPU/Vulkan/VulkanDescSet.h +++ b/Common/GPU/Vulkan/VulkanDescSet.h @@ -35,6 +35,10 @@ public: return !descPool_; } + void SetTag(const char *tag) { + tag_ = tag; + } + private: VkResult Recreate(bool grow); diff --git a/Common/GPU/Vulkan/VulkanRenderManager.cpp b/Common/GPU/Vulkan/VulkanRenderManager.cpp index ff79212835..7039cea0cc 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.cpp +++ b/Common/GPU/Vulkan/VulkanRenderManager.cpp @@ -1575,7 +1575,7 @@ void VulkanRenderManager::ResetStats() { VKRPipelineLayout *VulkanRenderManager::CreatePipelineLayout(BindingType *bindingTypes, size_t bindingTypesCount, bool geoShadersEnabled, const char *tag) { VKRPipelineLayout *layout = new VKRPipelineLayout(); - layout->tag = tag; + layout->SetTag(tag); layout->bindingTypesCount = (uint32_t)bindingTypesCount; _dbg_assert_(bindingTypesCount <= ARRAY_SIZE(layout->bindingTypes)); diff --git a/Common/GPU/Vulkan/VulkanRenderManager.h b/Common/GPU/Vulkan/VulkanRenderManager.h index 650eb60af1..01a8fed7fe 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.h +++ b/Common/GPU/Vulkan/VulkanRenderManager.h @@ -192,9 +192,10 @@ struct PackedDescriptor { }; // Note that we only support a single descriptor set due to compatibility with some ancient devices. -// We should probably eventually give that up. +// We should probably eventually give that up eventually. struct VKRPipelineLayout { ~VKRPipelineLayout(); + enum { MAX_DESC_SET_BINDINGS = 10 }; BindingType bindingTypes[MAX_DESC_SET_BINDINGS]; @@ -205,7 +206,8 @@ struct VKRPipelineLayout { const char *tag = nullptr; struct FrameData { - FrameData() : pool("GameDescPool", true) {} + FrameData() : pool("N/A", true) {} + VulkanDescSetPool pool; FastVec descData_; FastVec descSets_; @@ -217,6 +219,12 @@ struct VKRPipelineLayout { FrameData frameData[VulkanContext::MAX_INFLIGHT_FRAMES]; void FlushDescSets(VulkanContext *vulkan, int frame, QueueProfileContext *profile); + void SetTag(const char *tag) { + this->tag = tag; + for (int i = 0; i < ARRAY_SIZE(frameData); i++) { + frameData[i].pool.SetTag(tag); + } + } }; class VulkanRenderManager { diff --git a/Common/GPU/Vulkan/thin3d_vulkan.cpp b/Common/GPU/Vulkan/thin3d_vulkan.cpp index c03e3b6854..2283a79895 100644 --- a/Common/GPU/Vulkan/thin3d_vulkan.cpp +++ b/Common/GPU/Vulkan/thin3d_vulkan.cpp @@ -381,6 +381,9 @@ public: ~VKContext(); void DebugAnnotate(const char *annotation) override; + void Wait() override { + vkDeviceWaitIdle(vulkan_->GetDevice()); + } const DeviceCaps &GetDeviceCaps() const override { return caps_; diff --git a/Common/GPU/thin3d.h b/Common/GPU/thin3d.h index 43504bcccc..95af546665 100644 --- a/Common/GPU/thin3d.h +++ b/Common/GPU/thin3d.h @@ -693,6 +693,8 @@ public: Bugs GetBugs() const { return bugs_; } + virtual void Wait() {} + virtual const DeviceCaps &GetDeviceCaps() const = 0; virtual uint32_t GetDataFormatSupport(DataFormat fmt) const = 0; virtual std::vector GetFeatureList() const { return std::vector(); } diff --git a/GPU/Vulkan/TextureCacheVulkan.cpp b/GPU/Vulkan/TextureCacheVulkan.cpp index 6f4b0b0842..5325c1e18a 100644 --- a/GPU/Vulkan/TextureCacheVulkan.cpp +++ b/GPU/Vulkan/TextureCacheVulkan.cpp @@ -229,6 +229,7 @@ void TextureCacheVulkan::DeviceLost() { nextTexture_ = nullptr; draw_ = nullptr; + Unbind(); } void TextureCacheVulkan::DeviceRestore(Draw::DrawContext *draw) { @@ -372,8 +373,7 @@ void TextureCacheVulkan::UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutB void TextureCacheVulkan::BindTexture(TexCacheEntry *entry) { if (!entry || !entry->vkTex) { - imageView_ = VK_NULL_HANDLE; - curSampler_ = VK_NULL_HANDLE; + Unbind(); return; } diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 44fdc88f38..91c6ead193 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -227,21 +227,25 @@ u64 GameInfo::GetInstallDataSizeInBytes() { } bool GameInfo::LoadFromPath(const Path &gamePath) { - std::lock_guard guard(lock); - // No need to rebuild if we already have it loaded. - if (filePath_ != gamePath) { - { - std::lock_guard guard(loaderLock); - fileLoader.reset(ConstructFileLoader(gamePath)); - if (!fileLoader) - return false; + { + std::lock_guard guard(lock); + // No need to rebuild if we already have it loaded. + if (filePath_ == gamePath) { + return true; } - filePath_ = gamePath; - - // This is a fallback title, while we're loading / if unable to load. - title = filePath_.GetFilename(); } + { + std::lock_guard guard(loaderLock); + fileLoader.reset(ConstructFileLoader(gamePath)); + if (!fileLoader) + return false; + } + + std::lock_guard guard(lock); + filePath_ = gamePath; + // This is a fallback title, while we're loading / if unable to load. + title = filePath_.GetFilename(); return true; } @@ -476,20 +480,26 @@ public: if (info_->wantFlags & GAMEINFO_WANTBG) { if (pbp.GetSubFileSize(PBP_PIC0_PNG) > 0) { + std::string data; + pbp.GetSubFileAsString(PBP_PIC0_PNG, &data); std::lock_guard lock(info_->lock); - pbp.GetSubFileAsString(PBP_PIC0_PNG, &info_->pic0.data); + info_->pic0.data = std::move(data); info_->pic0.dataLoaded = true; } if (pbp.GetSubFileSize(PBP_PIC1_PNG) > 0) { + std::string data; + pbp.GetSubFileAsString(PBP_PIC1_PNG, &data); std::lock_guard lock(info_->lock); - pbp.GetSubFileAsString(PBP_PIC1_PNG, &info_->pic1.data); + info_->pic1.data = std::move(data); info_->pic1.dataLoaded = true; } } if (info_->wantFlags & GAMEINFO_WANTSND) { if (pbp.GetSubFileSize(PBP_SND0_AT3) > 0) { + std::string data; + pbp.GetSubFileAsString(PBP_SND0_AT3, &data); std::lock_guard lock(info_->lock); - pbp.GetSubFileAsString(PBP_SND0_AT3, &info_->sndFileData); + info_->sndFileData = std::move(data); info_->sndDataLoaded = true; } } @@ -628,16 +638,17 @@ handleELF: // Alright, let's fetch the PARAM.SFO. std::string paramSFOcontents; if (ReadFileToString(&umd, "/PSP_GAME/PARAM.SFO", ¶mSFOcontents, nullptr)) { - std::lock_guard lock(info_->lock); - info_->paramSFO.ReadSFO((const u8 *)paramSFOcontents.data(), paramSFOcontents.size()); - info_->ParseParamSFO(); - + { + std::lock_guard lock(info_->lock); + info_->paramSFO.ReadSFO((const u8 *)paramSFOcontents.data(), paramSFOcontents.size()); + info_->ParseParamSFO(); + } if (info_->wantFlags & GAMEINFO_WANTBG) { - info_->pic0.dataLoaded = ReadFileToString(&umd, "/PSP_GAME/PIC0.PNG", &info_->pic0.data, nullptr); - info_->pic1.dataLoaded = ReadFileToString(&umd, "/PSP_GAME/PIC1.PNG", &info_->pic1.data, nullptr); + info_->pic0.dataLoaded = ReadFileToString(&umd, "/PSP_GAME/PIC0.PNG", &info_->pic0.data, &info_->lock); + info_->pic1.dataLoaded = ReadFileToString(&umd, "/PSP_GAME/PIC1.PNG", &info_->pic1.data, &info_->lock); } if (info_->wantFlags & GAMEINFO_WANTSND) { - info_->sndDataLoaded = ReadFileToString(&umd, "/PSP_GAME/SND0.AT3", &info_->sndFileData, nullptr); + info_->sndDataLoaded = ReadFileToString(&umd, "/PSP_GAME/SND0.AT3", &info_->sndFileData, &info_->lock); } }