From 9f3a5b43134976adcf4ddcac75c0a31c295921de Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 19 May 2022 14:06:42 +0200 Subject: [PATCH] dzn: add a debug-flag to wait for the debugger It's geneunely useful to wait for the debugger to attach in some cases. So let's add a debug-flag and staill untik the debugger has attached. Acked-by: Boris Brezillon Acked-by: Jesse Natalie Part-of: --- src/microsoft/vulkan/dzn_device.c | 8 ++++++++ src/microsoft/vulkan/dzn_private.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/microsoft/vulkan/dzn_device.c b/src/microsoft/vulkan/dzn_device.c index 2c34f35fd78..941d0ddb77c 100644 --- a/src/microsoft/vulkan/dzn_device.c +++ b/src/microsoft/vulkan/dzn_device.c @@ -110,6 +110,7 @@ static const struct debug_control dzn_debug_options[] = { { "signature", DZN_DEBUG_SIG }, { "gbv", DZN_DEBUG_GBV }, { "d3d12", DZN_DEBUG_D3D12 }, + { "debugger", DZN_DEBUG_DEBUGGER }, { NULL, 0 } }; @@ -179,6 +180,13 @@ dzn_instance_create(const VkInstanceCreateInfo *pCreateInfo, instance->debug_flags = parse_debug_string(getenv("DZN_DEBUG"), dzn_debug_options); + if (instance->debug_flags & DZN_DEBUG_DEBUGGER) { + /* wait for debugger to attach... */ + while (!IsDebuggerPresent()) { + Sleep(100); + } + } + instance->dxil_validator = dxil_create_validator(NULL); instance->d3d12.serialize_root_sig = d3d12_get_serialize_root_sig(); diff --git a/src/microsoft/vulkan/dzn_private.h b/src/microsoft/vulkan/dzn_private.h index 48bae7a38af..f9142fe389f 100644 --- a/src/microsoft/vulkan/dzn_private.h +++ b/src/microsoft/vulkan/dzn_private.h @@ -920,6 +920,7 @@ enum dzn_debug_flags { DZN_DEBUG_SIG = 1 << 5, DZN_DEBUG_GBV = 1 << 6, DZN_DEBUG_D3D12 = 1 << 7, + DZN_DEBUG_DEBUGGER = 1 << 8, }; struct dzn_instance {