From 4e07302cbfc1e29c011a68a407dfed78963dbf7d Mon Sep 17 00:00:00 2001 From: Jeff Date: Wed, 27 Nov 2024 22:59:33 -0800 Subject: [PATCH] [d3d9] Fix race condition in PIX events --- src/d3d9/d3d9_annotation.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/d3d9/d3d9_annotation.cpp b/src/d3d9/d3d9_annotation.cpp index 8949d1e3b..09b3ef18a 100644 --- a/src/d3d9/d3d9_annotation.cpp +++ b/src/d3d9/d3d9_annotation.cpp @@ -127,6 +127,7 @@ namespace dxvk { INT STDMETHODCALLTYPE D3D9UserDefinedAnnotation::BeginEvent( D3DCOLOR Color, LPCWSTR Name) { + D3D9DeviceLock lock = m_container->LockDevice(); m_container->EmitCs([color = Color, labelName = dxvk::str::fromws(Name)](DxvkContext *ctx) { VkDebugUtilsLabelEXT label; label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; @@ -143,6 +144,7 @@ namespace dxvk { INT STDMETHODCALLTYPE D3D9UserDefinedAnnotation::EndEvent() { + D3D9DeviceLock lock = m_container->LockDevice(); m_container->EmitCs([](DxvkContext *ctx) { ctx->endDebugLabel(); }); @@ -155,6 +157,7 @@ namespace dxvk { void STDMETHODCALLTYPE D3D9UserDefinedAnnotation::SetMarker( D3DCOLOR Color, LPCWSTR Name) { + D3D9DeviceLock lock = m_container->LockDevice(); m_container->EmitCs([color = Color, labelName = dxvk::str::fromws(Name)](DxvkContext *ctx) { VkDebugUtilsLabelEXT label; label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;