From dce2f844c0267507b93bb5b58aa01f9fe81d5613 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 11 Jun 2018 14:29:47 +0200 Subject: [PATCH] [d3d11] Add ID3DUserDefinedAnnotation stub We can implement this properly in the future using VK_EXT_debug_utils. --- src/d3d11/d3d11_annotation.cpp | 55 ++++++++++++++++++++++++++++++++++ src/d3d11/d3d11_annotation.h | 38 +++++++++++++++++++++++ src/d3d11/d3d11_context.cpp | 13 ++++---- src/d3d11/d3d11_context.h | 4 ++- src/d3d11/meson.build | 1 + 5 files changed, 105 insertions(+), 6 deletions(-) create mode 100644 src/d3d11/d3d11_annotation.cpp create mode 100644 src/d3d11/d3d11_annotation.h diff --git a/src/d3d11/d3d11_annotation.cpp b/src/d3d11/d3d11_annotation.cpp new file mode 100644 index 00000000..d582efdf --- /dev/null +++ b/src/d3d11/d3d11_annotation.cpp @@ -0,0 +1,55 @@ +#include "d3d11_annotation.h" + +namespace dxvk { + + D3D11UserDefinedAnnotation::D3D11UserDefinedAnnotation(ID3D11DeviceContext* ctx) + : m_container(ctx) { } + + + D3D11UserDefinedAnnotation::~D3D11UserDefinedAnnotation() { + + } + + + ULONG STDMETHODCALLTYPE D3D11UserDefinedAnnotation::AddRef() { + return m_container->AddRef(); + } + + + ULONG STDMETHODCALLTYPE D3D11UserDefinedAnnotation::Release() { + return m_container->Release(); + } + + + HRESULT STDMETHODCALLTYPE D3D11UserDefinedAnnotation::QueryInterface( + REFIID riid, + void** ppvObject) { + return m_container->QueryInterface(riid, ppvObject); + } + + + INT STDMETHODCALLTYPE D3D11UserDefinedAnnotation::BeginEvent( + LPCWSTR Name) { + // Currently not implemented + return -1; + } + + + INT STDMETHODCALLTYPE D3D11UserDefinedAnnotation::EndEvent() { + // Currently not implemented + return -1; + } + + + void STDMETHODCALLTYPE D3D11UserDefinedAnnotation::SetMarker( + LPCWSTR Name) { + // Currently not implemented + } + + + BOOL STDMETHODCALLTYPE D3D11UserDefinedAnnotation::GetStatus() { + // Currently not implemented + return FALSE; + } + +} \ No newline at end of file diff --git a/src/d3d11/d3d11_annotation.h b/src/d3d11/d3d11_annotation.h new file mode 100644 index 00000000..41b174ad --- /dev/null +++ b/src/d3d11/d3d11_annotation.h @@ -0,0 +1,38 @@ +#pragma once + +#include "d3d11_include.h" + +namespace dxvk { + + class D3D11UserDefinedAnnotation : ID3DUserDefinedAnnotation { + + public: + + D3D11UserDefinedAnnotation(ID3D11DeviceContext* ctx); + ~D3D11UserDefinedAnnotation(); + + ULONG STDMETHODCALLTYPE AddRef(); + + ULONG STDMETHODCALLTYPE Release(); + + HRESULT STDMETHODCALLTYPE QueryInterface( + REFIID riid, + void** ppvObject); + + INT STDMETHODCALLTYPE BeginEvent( + LPCWSTR Name); + + INT STDMETHODCALLTYPE EndEvent(); + + void STDMETHODCALLTYPE SetMarker( + LPCWSTR Name); + + BOOL STDMETHODCALLTYPE GetStatus(); + + private: + + ID3D11DeviceContext* m_container; + + }; + +} \ No newline at end of file diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index ed7eef02..bc9fb54a 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -12,9 +12,10 @@ namespace dxvk { D3D11DeviceContext::D3D11DeviceContext( D3D11Device* pParent, const Rc& Device) - : m_parent (pParent), - m_device (Device), - m_csChunk (new DxvkCsChunk()) { + : m_parent (pParent), + m_annotation(this), + m_device (Device), + m_csChunk (new DxvkCsChunk()) { // Create default state objects. We won't ever return them // to the application, but we'll use them to apply state. Com defaultBlendState; @@ -50,8 +51,10 @@ namespace dxvk { return S_OK; } - if (riid == __uuidof(ID3DUserDefinedAnnotation)) - return E_NOINTERFACE; + if (riid == __uuidof(ID3DUserDefinedAnnotation)) { + *ppvObject = ref(&m_annotation); + return S_OK; + } Logger::warn("D3D11DeviceContext::QueryInterface: Unknown interface query"); Logger::warn(str::format(riid)); diff --git a/src/d3d11/d3d11_context.h b/src/d3d11/d3d11_context.h index b22063fd..1d073095 100644 --- a/src/d3d11/d3d11_context.h +++ b/src/d3d11/d3d11_context.h @@ -4,6 +4,7 @@ #include "../dxvk/dxvk_cs.h" #include "../dxvk/dxvk_device.h" +#include "d3d11_annotation.h" #include "d3d11_context_state.h" #include "d3d11_device_child.h" @@ -637,7 +638,8 @@ namespace dxvk { protected: - D3D11Device* const m_parent; + D3D11Device* const m_parent; + D3D11UserDefinedAnnotation m_annotation; Rc m_device; Rc m_csChunk; diff --git a/src/d3d11/meson.build b/src/d3d11/meson.build index a0cf8e3a..802afd03 100644 --- a/src/d3d11/meson.build +++ b/src/d3d11/meson.build @@ -1,4 +1,5 @@ d3d11_src = [ + 'd3d11_annotation.cpp', 'd3d11_blend.cpp', 'd3d11_buffer.cpp', 'd3d11_class_linkage.cpp',