Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jp7677/dxvk-nvapi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrochaudhari <rochaudhari@nvidia.com>2021-09-21 12:34:05 +0300
committerJens Peters <jp7677@gmail.com>2021-09-21 14:57:03 +0300
commit7a7ca69b0fb09999d1d2e4253930cb3d7e69b3ec (patch)
tree2ba2c9d1f7a311449356601c25cd35fffa317b68
parent08a9a8c611b2ed8dccd396690795362a313fbe5f (diff)
nvapi-d3d12: add locks for handling caching maps
Signed-off-by: Roshan Chaudhari <rochaudhari@nvidia.com>
-rw-r--r--src/d3d12/nvapi_d3d12_device.cpp1
-rw-r--r--src/d3d12/nvapi_d3d12_device.h1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/d3d12/nvapi_d3d12_device.cpp b/src/d3d12/nvapi_d3d12_device.cpp
index 795cccf..3801864 100644
--- a/src/d3d12/nvapi_d3d12_device.cpp
+++ b/src/d3d12/nvapi_d3d12_device.cpp
@@ -59,6 +59,7 @@ namespace dxvk {
// We are going to have single map for storing devices with extensions D3D12_VK_NVX_BINARY_IMPORT & D3D12_VK_NVX_IMAGE_VIEW_HANDLE.
// These are specific to NVIDIA and both of these extensions goes together.
Com<ID3D12DeviceExt> NvapiD3d12Device::GetCubinDevice(ID3D12Device* device) {
+ std::scoped_lock lock(m_CubinDeviceMutex);
auto it = m_cubinDeviceMap.find(device);
if(it != m_cubinDeviceMap.end())
return it->second;
diff --git a/src/d3d12/nvapi_d3d12_device.h b/src/d3d12/nvapi_d3d12_device.h
index 4095817..d4524cd 100644
--- a/src/d3d12/nvapi_d3d12_device.h
+++ b/src/d3d12/nvapi_d3d12_device.h
@@ -22,6 +22,7 @@ namespace dxvk {
inline static std::unordered_map<ID3D12GraphicsCommandList*, ID3D12GraphicsCommandListExt*> m_CommandListMap;
inline static std::mutex m_CommandListMutex;
+ inline static std::mutex m_CubinDeviceMutex;
[[nodiscard]] static Com<ID3D12DeviceExt> GetCubinDevice(ID3D12Device* device);
[[nodiscard]] static Com<ID3D12DeviceExt> GetDeviceExt(ID3D12Device* device, D3D12_VK_EXTENSION extension);