From 5d54d79865c28d55c14654b88487edd97b1b82b1 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Fri, 30 Apr 2021 09:04:30 +0100 Subject: [PATCH] [d3d11] Use IDXVKUserDefinedAnnotation --- src/d3d11/d3d11_annotation.cpp | 22 ++++++++-------------- src/d3d11/d3d11_annotation.h | 5 ++++- src/d3d11/d3d11_context.cpp | 3 ++- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/d3d11/d3d11_annotation.cpp b/src/d3d11/d3d11_annotation.cpp index 72d6134e..97d29a10 100644 --- a/src/d3d11/d3d11_annotation.cpp +++ b/src/d3d11/d3d11_annotation.cpp @@ -2,6 +2,8 @@ #include "d3d11_context.h" #include "d3d11_device.h" +#include "../util/util_misc.h" + namespace dxvk { D3D11UserDefinedAnnotation::D3D11UserDefinedAnnotation(D3D11DeviceContext* ctx) @@ -32,21 +34,17 @@ namespace dxvk { INT STDMETHODCALLTYPE D3D11UserDefinedAnnotation::BeginEvent( + D3DCOLOR Color, LPCWSTR Name) { if (!m_container->IsAnnotationEnabled()) return -1; - D3D10DeviceLock lock = m_container->LockContext(); - - m_container->EmitCs([labelName = dxvk::str::fromws(Name)](DxvkContext *ctx) { + m_container->EmitCs([color = Color, labelName = dxvk::str::fromws(Name)](DxvkContext *ctx) { VkDebugUtilsLabelEXT label; label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; label.pNext = nullptr; label.pLabelName = labelName.c_str(); - label.color[0] = 1.0f; - label.color[1] = 1.0f; - label.color[2] = 1.0f; - label.color[3] = 1.0f; + DecodeD3DCOLOR(color, label.color); ctx->beginDebugLabel(&label); }); @@ -70,21 +68,17 @@ namespace dxvk { void STDMETHODCALLTYPE D3D11UserDefinedAnnotation::SetMarker( + D3DCOLOR Color, LPCWSTR Name) { if (!m_container->IsAnnotationEnabled()) return; - D3D10DeviceLock lock = m_container->LockContext(); - - m_container->EmitCs([labelName = dxvk::str::fromws(Name)](DxvkContext *ctx) { + m_container->EmitCs([color = Color, labelName = dxvk::str::fromws(Name)](DxvkContext *ctx) { VkDebugUtilsLabelEXT label; label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; label.pNext = nullptr; label.pLabelName = labelName.c_str(); - label.color[0] = 1.0f; - label.color[1] = 1.0f; - label.color[2] = 1.0f; - label.color[3] = 1.0f; + DecodeD3DCOLOR(color, label.color); ctx->insertDebugLabel(&label); }); diff --git a/src/d3d11/d3d11_annotation.h b/src/d3d11/d3d11_annotation.h index 4e847ced..702abe40 100644 --- a/src/d3d11/d3d11_annotation.h +++ b/src/d3d11/d3d11_annotation.h @@ -1,12 +1,13 @@ #pragma once #include "d3d11_include.h" +#include "../dxvk/dxvk_annotation.h" namespace dxvk { class D3D11DeviceContext; - class D3D11UserDefinedAnnotation final : public ID3DUserDefinedAnnotation { + class D3D11UserDefinedAnnotation final : public IDXVKUserDefinedAnnotation { public: @@ -22,11 +23,13 @@ namespace dxvk { void** ppvObject); INT STDMETHODCALLTYPE BeginEvent( + D3DCOLOR Color, LPCWSTR Name); INT STDMETHODCALLTYPE EndEvent(); void STDMETHODCALLTYPE SetMarker( + D3DCOLOR Color, LPCWSTR Name); BOOL STDMETHODCALLTYPE GetStatus(); diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 0d530abb..b9b91efb 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -55,7 +55,8 @@ namespace dxvk { return S_OK; } - if (riid == __uuidof(ID3DUserDefinedAnnotation)) { + if (riid == __uuidof(ID3DUserDefinedAnnotation) + || riid == __uuidof(IDXVKUserDefinedAnnotation)) { *ppvObject = ref(&m_annotation); return S_OK; }