From 9d981ec1a88476a06d37efed24fa60800fc872a3 Mon Sep 17 00:00:00 2001 From: Robin Kertels Date: Wed, 3 Aug 2022 19:16:30 +0200 Subject: [PATCH] [dxvk] Introduce DxvkMarker Co-authored-by: Philip Rebohle --- src/dxvk/dxvk_context.h | 10 ++++++++++ src/dxvk/dxvk_device.h | 3 ++- src/dxvk/dxvk_marker.h | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/dxvk/dxvk_marker.h diff --git a/src/dxvk/dxvk_context.h b/src/dxvk/dxvk_context.h index 67bb8d0d..3d5c5c43 100644 --- a/src/dxvk/dxvk_context.h +++ b/src/dxvk/dxvk_context.h @@ -8,6 +8,7 @@ #include "dxvk_objects.h" #include "dxvk_resource.h" #include "dxvk_util.h" +#include "dxvk_marker.h" namespace dxvk { @@ -1252,6 +1253,15 @@ namespace dxvk { */ void insertDebugLabel(VkDebugUtilsLabelEXT *label); + /** + * \brief Inserts a marker object + * \param [in] marker The marker + */ + template + void insertMarker(const Rc>& marker) { + m_cmd->trackResource(marker); + } + /** * \brief Increments a given stat counter * diff --git a/src/dxvk/dxvk_device.h b/src/dxvk/dxvk_device.h index cbc04041..f4785010 100644 --- a/src/dxvk/dxvk_device.h +++ b/src/dxvk/dxvk_device.h @@ -22,6 +22,7 @@ #include "dxvk_shader.h" #include "dxvk_stats.h" #include "dxvk_unbound.h" +#include "dxvk_marker.h" #include "../vulkan/vulkan_presenter.h" @@ -348,7 +349,7 @@ namespace dxvk { */ Rc createSampler( const DxvkSamplerCreateInfo& createInfo); - + /** * \brief Retrieves stat counters * diff --git a/src/dxvk/dxvk_marker.h b/src/dxvk/dxvk_marker.h new file mode 100644 index 00000000..3e6f686b --- /dev/null +++ b/src/dxvk/dxvk_marker.h @@ -0,0 +1,35 @@ +#pragma once + +#include "dxvk_resource.h" + +namespace dxvk { + + /** + * \brief Marker + * + * Arbitrary marker that can be used to track whether + * the GPU has finished processing certain commands, + * and stores some data. + */ + template + class DxvkMarker : public DxvkResource { + + public: + + DxvkMarker(T&& payload) + : m_payload(std::move(payload)) { } + + DxvkMarker(const T& payload) + : m_payload(payload) { } + + const T& payload() const { + return m_payload; + } + + private: + + T m_payload; + + }; + +}