From 5487f8b9a022cff5ce5dc1e6452d2ad499476e57 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 6 Nov 2024 12:02:24 +0100 Subject: [PATCH] [dxvk] Add convenience methods to check for debug utils support --- src/d3d11/d3d11_annotation.cpp | 2 +- src/d3d9/d3d9_device.cpp | 2 +- src/dxvk/dxvk_device.h | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/d3d11/d3d11_annotation.cpp b/src/d3d11/d3d11_annotation.cpp index b7c1fdf77..4e02c5990 100644 --- a/src/d3d11/d3d11_annotation.cpp +++ b/src/d3d11/d3d11_annotation.cpp @@ -38,7 +38,7 @@ namespace dxvk { ContextType* container, const Rc& dxvkDevice) : m_container(container), m_eventDepth(0), - m_annotationsEnabled(dxvkDevice->instance()->extensions().extDebugUtils) { + m_annotationsEnabled(dxvkDevice->isDebugEnabled()) { if (!IsDeferred && m_annotationsEnabled) RegisterUserDefinedAnnotation(this); } diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 56150dc8c..ace712f8e 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -70,7 +70,7 @@ namespace dxvk { if (canSWVP) Logger::info("D3D9DeviceEx: Using extended constant set for software vertex processing."); - if (m_dxvkDevice->instance()->extensions().extDebugUtils) + if (m_dxvkDevice->isDebugEnabled()) m_annotation = new D3D9UserDefinedAnnotation(this); m_initializer = new D3D9Initializer(this); diff --git a/src/dxvk/dxvk_device.h b/src/dxvk/dxvk_device.h index a3a2b2b29..219655fa9 100644 --- a/src/dxvk/dxvk_device.h +++ b/src/dxvk/dxvk_device.h @@ -92,6 +92,14 @@ namespace dxvk { return m_vkd; } + /** + * \brief Vulkan instance functions + * \returns Vulkan instance functions + */ + Rc vki() const { + return m_instance->vki(); + } + /** * \brief Logical device handle * \returns The device handle @@ -100,6 +108,14 @@ namespace dxvk { return m_vkd->device(); } + /** + * \brief Checks whether debug functionality is enabled + * \returns \c true if debug utils are enabled + */ + bool isDebugEnabled() const { + return bool(m_instance->extensions().extDebugUtils); + } + /** * \brief Device options * \returns Device options