mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[d3d11] Implement D3D11UserDefinedAnnotation
Reviewed-by: Oleg Kuznetsov <okouznetsov@nvidia.com>
This commit is contained in:
parent
5ce5999232
commit
fb0b11903b
@ -1,9 +1,12 @@
|
|||||||
#include "d3d11_annotation.h"
|
#include "d3d11_annotation.h"
|
||||||
|
#include "d3d11_context.h"
|
||||||
|
#include "d3d11_device.h"
|
||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
D3D11UserDefinedAnnotation::D3D11UserDefinedAnnotation(ID3D11DeviceContext* ctx)
|
D3D11UserDefinedAnnotation::D3D11UserDefinedAnnotation(D3D11DeviceContext* ctx)
|
||||||
: m_container(ctx) { }
|
: m_container(ctx),
|
||||||
|
m_eventDepth(0) { }
|
||||||
|
|
||||||
|
|
||||||
D3D11UserDefinedAnnotation::~D3D11UserDefinedAnnotation() {
|
D3D11UserDefinedAnnotation::~D3D11UserDefinedAnnotation() {
|
||||||
@ -30,26 +33,60 @@ namespace dxvk {
|
|||||||
|
|
||||||
INT STDMETHODCALLTYPE D3D11UserDefinedAnnotation::BeginEvent(
|
INT STDMETHODCALLTYPE D3D11UserDefinedAnnotation::BeginEvent(
|
||||||
LPCWSTR Name) {
|
LPCWSTR Name) {
|
||||||
// Currently not implemented
|
if (!m_container->IsAnnotationEnabled())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
m_container->EmitCs([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;
|
||||||
|
|
||||||
|
ctx->beginDebugLabel(&label);
|
||||||
|
});
|
||||||
|
|
||||||
|
return m_eventDepth++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
INT STDMETHODCALLTYPE D3D11UserDefinedAnnotation::EndEvent() {
|
INT STDMETHODCALLTYPE D3D11UserDefinedAnnotation::EndEvent() {
|
||||||
// Currently not implemented
|
if (!m_container->IsAnnotationEnabled())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
m_container->EmitCs([](DxvkContext *ctx) {
|
||||||
|
ctx->endDebugLabel();
|
||||||
|
});
|
||||||
|
|
||||||
|
return m_eventDepth--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void STDMETHODCALLTYPE D3D11UserDefinedAnnotation::SetMarker(
|
void STDMETHODCALLTYPE D3D11UserDefinedAnnotation::SetMarker(
|
||||||
LPCWSTR Name) {
|
LPCWSTR Name) {
|
||||||
// Currently not implemented
|
if (!m_container->IsAnnotationEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_container->EmitCs([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;
|
||||||
|
|
||||||
|
ctx->insertDebugLabel(&label);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL STDMETHODCALLTYPE D3D11UserDefinedAnnotation::GetStatus() {
|
BOOL STDMETHODCALLTYPE D3D11UserDefinedAnnotation::GetStatus() {
|
||||||
// Currently not implemented
|
return m_container->IsAnnotationEnabled();
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,13 @@
|
|||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
|
class D3D11DeviceContext;
|
||||||
|
|
||||||
class D3D11UserDefinedAnnotation : ID3DUserDefinedAnnotation {
|
class D3D11UserDefinedAnnotation : ID3DUserDefinedAnnotation {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
D3D11UserDefinedAnnotation(ID3D11DeviceContext* ctx);
|
D3D11UserDefinedAnnotation(D3D11DeviceContext* ctx);
|
||||||
~D3D11UserDefinedAnnotation();
|
~D3D11UserDefinedAnnotation();
|
||||||
|
|
||||||
ULONG STDMETHODCALLTYPE AddRef();
|
ULONG STDMETHODCALLTYPE AddRef();
|
||||||
@ -31,8 +33,10 @@ namespace dxvk {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ID3D11DeviceContext* m_container;
|
D3D11DeviceContext* m_container;
|
||||||
|
|
||||||
|
// Stack depth for non-finalized BeginEvent calls
|
||||||
|
int32_t m_eventDepth;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3064,8 +3064,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
BOOL STDMETHODCALLTYPE D3D11DeviceContext::IsAnnotationEnabled() {
|
BOOL STDMETHODCALLTYPE D3D11DeviceContext::IsAnnotationEnabled() {
|
||||||
// Not implemented in the backend
|
return m_device->instance()->extensions().extDebugUtils;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
class D3D11DeviceContext : public D3D11DeviceChild<ID3D11DeviceContext4> {
|
class D3D11DeviceContext : public D3D11DeviceChild<ID3D11DeviceContext4> {
|
||||||
friend class D3D11DeviceContextExt;
|
friend class D3D11DeviceContextExt;
|
||||||
|
// Needed in order to call EmitCs for pushing markers
|
||||||
|
friend class D3D11UserDefinedAnnotation;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
D3D11DeviceContext(
|
D3D11DeviceContext(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user