1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-04 16:24:29 +01:00

[d3d11] Use IDXVKUserDefinedAnnotation

This commit is contained in:
Joshua Ashton 2021-04-30 09:04:30 +01:00 committed by Philip Rebohle
parent a010397f34
commit 5d54d79865
3 changed files with 14 additions and 16 deletions

View File

@ -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);
});

View File

@ -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();

View File

@ -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;
}