Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/doitsujin/dxvk.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Ashton <joshua@froggi.es>2021-04-30 12:32:10 +0300
committerJoshua Ashton <joshua@froggi.es>2021-04-30 12:34:04 +0300
commit2892916f68ae111aaef0a6e7a4caf485a7431e62 (patch)
treeba080b682b46cb59e207d9989e2a59dcace6b35f
parent0bcb1ea7ff128681d583f43970f4dfd4aa1c42f9 (diff)
[d3d11] Register annotation interfaces with D3D9global-annotations
Some apps try use the D3DPERF_ functions for debug markers/annotations. This utilizes the DXVK_RegisterAnnotation hidden functions to share the interfaces.
-rw-r--r--src/d3d11/d3d11_annotation.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/d3d11/d3d11_annotation.cpp b/src/d3d11/d3d11_annotation.cpp
index ddb4cfaf..24740815 100644
--- a/src/d3d11/d3d11_annotation.cpp
+++ b/src/d3d11/d3d11_annotation.cpp
@@ -6,13 +6,41 @@
namespace dxvk {
+ template <bool Register>
+ static void RegisterUserDefinedAnnotation(IDXVKUserDefinedAnnotation* annotation) {
+ using RegistrationFunctionType = void(__stdcall *)(IDXVKUserDefinedAnnotation*);
+ static const int16_t RegisterOrdinal = 28257;
+ static const int16_t UnregisterOrdinal = 28258;
+
+ HMODULE d3d9Module = ::LoadLibraryA("d3d9.dll");
+ if (!d3d9Module) {
+ Logger::info("Unable to find d3d9, some annotations may be missed.");
+ return;
+ }
+
+ const int16_t ordinal = Register ? UnregisterOrdinal : RegisterOrdinal;
+ auto registrationFunction = reinterpret_cast<RegistrationFunctionType>(::GetProcAddress(d3d9Module,
+ reinterpret_cast<const char*>(static_cast<uintptr_t>(ordinal))));
+
+ if (!registrationFunction) {
+ Logger::info("Unable to find DXVK_RegisterAnnotation, some annotations may be missed.");
+ return;
+ }
+
+ registrationFunction(annotation);
+ }
+
D3D11UserDefinedAnnotation::D3D11UserDefinedAnnotation(D3D11DeviceContext* ctx)
: m_container(ctx),
- m_eventDepth(0) { }
+ m_eventDepth(0) {
+ if (m_container->IsAnnotationEnabled())
+ RegisterUserDefinedAnnotation<true>(this);
+ }
D3D11UserDefinedAnnotation::~D3D11UserDefinedAnnotation() {
-
+ if (m_container->IsAnnotationEnabled())
+ RegisterUserDefinedAnnotation<false>(this);
}