mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-08-25 15:46:45 +00:00
Mutex the access to commandPoolToQueueFamilyMap
This commit is contained in:
+1
-1
@@ -315,7 +315,7 @@ class Config
|
||||
L"idtechlauncher.exe|cefviewwing.exe|ace-setup64.exe|ace-service64.exe|qtwebengineprocess.exe|"
|
||||
L"platformprocess.exe|bugsplathd64.exe|bssndrpt64.exe|pspcsdkappmgr.exe|pspcsdkcore.exe|pspcsdkstttts.exe|"
|
||||
L"pspcsdktelemetry.exe|pspcsdkui.exe|pspcsdkupdatechecker.exe|pspcsdkvoicechat.exe|pspcsdkwebview.exe|windhawk."
|
||||
L"exe|vscodium.exe|crash_reporter.exe|steamerrorreporter64.exe"
|
||||
L"exe|vscodium.exe|crash_reporter.exe|steamerrorreporter64.exe|crashreportclient.exe"
|
||||
};
|
||||
|
||||
// Hotfixes
|
||||
|
||||
@@ -25,6 +25,7 @@ static PFN_vkAllocateCommandBuffers o_vkAllocateCommandBuffers = nullptr;
|
||||
static PFN_vkDestroyCommandPool o_vkDestroyCommandPool = nullptr;
|
||||
static PFN_vkCreateCommandPool o_vkCreateCommandPool = nullptr;
|
||||
|
||||
static std::mutex mutexCommandPoolToQueueFamilyMap;
|
||||
static std::unordered_map<VkCommandPool, uint32_t> commandPoolToQueueFamilyMap;
|
||||
|
||||
// #define LOG_ALL_RECORDS
|
||||
@@ -6048,7 +6049,10 @@ VkResult Vulkan_wDx12::hk_vkCreateCommandPool(VkDevice device, const VkCommandPo
|
||||
|
||||
if (result == VK_SUCCESS && pCommandPool && *pCommandPool != VK_NULL_HANDLE && pCreateInfo)
|
||||
{
|
||||
commandPoolToQueueFamilyMap[*pCommandPool] = pCreateInfo->queueFamilyIndex;
|
||||
{
|
||||
std::scoped_lock lock(mutexCommandPoolToQueueFamilyMap);
|
||||
commandPoolToQueueFamilyMap[*pCommandPool] = pCreateInfo->queueFamilyIndex;
|
||||
}
|
||||
|
||||
LOG_DEBUG("Command pool {:X} created for queue family {}", (size_t) *pCommandPool,
|
||||
pCreateInfo->queueFamilyIndex);
|
||||
@@ -7195,8 +7199,13 @@ VkResult Vulkan_wDx12::hk_vkAllocateCommandBuffers(VkDevice device, const VkComm
|
||||
|
||||
if (result == VK_SUCCESS && pAllocateInfo != nullptr && pCommandBuffers != nullptr)
|
||||
{
|
||||
auto it = commandPoolToQueueFamilyMap.find(pAllocateInfo->commandPool);
|
||||
uint32_t queueFamily = (it != commandPoolToQueueFamilyMap.end()) ? it->second : 0;
|
||||
uint32_t queueFamily = 0;
|
||||
|
||||
{
|
||||
std::scoped_lock lock(mutexCommandPoolToQueueFamilyMap);
|
||||
auto it = commandPoolToQueueFamilyMap.find(pAllocateInfo->commandPool);
|
||||
queueFamily = (it != commandPoolToQueueFamilyMap.end()) ? it->second : 0;
|
||||
}
|
||||
|
||||
// Notify state tracker about new command buffers
|
||||
cmdBufferStateTracker.OnAllocateCommandBuffers(pAllocateInfo->commandPool, pAllocateInfo->commandBufferCount,
|
||||
|
||||
Reference in New Issue
Block a user