mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-05 01:24:14 +01:00
[d3d9] Implement D3D9UserDefinedAnnotation
This commit is contained in:
parent
47b1ab52ce
commit
787a979514
@ -92,4 +92,83 @@ namespace dxvk {
|
||||
return m_shouldAnnotate ? 1 : 0;
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
// D3D9UserDefinedAnnotation
|
||||
////////////////////////////
|
||||
|
||||
D3D9UserDefinedAnnotation::D3D9UserDefinedAnnotation(D3D9DeviceEx* device)
|
||||
: m_container(device) {
|
||||
D3D9GlobalAnnotationList::Instance().RegisterAnnotator(this);
|
||||
}
|
||||
|
||||
|
||||
D3D9UserDefinedAnnotation::~D3D9UserDefinedAnnotation() {
|
||||
D3D9GlobalAnnotationList::Instance().UnregisterAnnotator(this);
|
||||
}
|
||||
|
||||
|
||||
ULONG STDMETHODCALLTYPE D3D9UserDefinedAnnotation::AddRef() {
|
||||
return m_container->AddRef();
|
||||
}
|
||||
|
||||
|
||||
ULONG STDMETHODCALLTYPE D3D9UserDefinedAnnotation::Release() {
|
||||
return m_container->Release();
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D9UserDefinedAnnotation::QueryInterface(
|
||||
REFIID riid,
|
||||
void** ppvObject) {
|
||||
return m_container->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
|
||||
INT STDMETHODCALLTYPE D3D9UserDefinedAnnotation::BeginEvent(
|
||||
D3DCOLOR Color,
|
||||
LPCWSTR Name) {
|
||||
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();
|
||||
DecodeD3DCOLOR(color, label.color);
|
||||
|
||||
ctx->beginDebugLabel(&label);
|
||||
});
|
||||
|
||||
// Handled by the global list.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
INT STDMETHODCALLTYPE D3D9UserDefinedAnnotation::EndEvent() {
|
||||
m_container->EmitCs([](DxvkContext *ctx) {
|
||||
ctx->endDebugLabel();
|
||||
});
|
||||
|
||||
// Handled by the global list.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D9UserDefinedAnnotation::SetMarker(
|
||||
D3DCOLOR Color,
|
||||
LPCWSTR Name) {
|
||||
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();
|
||||
DecodeD3DCOLOR(color, label.color);
|
||||
|
||||
ctx->insertDebugLabel(&label);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
BOOL STDMETHODCALLTYPE D3D9UserDefinedAnnotation::GetStatus() {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -52,4 +52,37 @@ namespace dxvk {
|
||||
|
||||
};
|
||||
|
||||
class D3D9UserDefinedAnnotation final : public IDXVKUserDefinedAnnotation {
|
||||
|
||||
public:
|
||||
|
||||
D3D9UserDefinedAnnotation(D3D9DeviceEx* device);
|
||||
~D3D9UserDefinedAnnotation();
|
||||
|
||||
ULONG STDMETHODCALLTYPE AddRef();
|
||||
|
||||
ULONG STDMETHODCALLTYPE Release();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
REFIID riid,
|
||||
void** ppvObject);
|
||||
|
||||
INT STDMETHODCALLTYPE BeginEvent(
|
||||
D3DCOLOR Color,
|
||||
LPCWSTR Name);
|
||||
|
||||
INT STDMETHODCALLTYPE EndEvent();
|
||||
|
||||
void STDMETHODCALLTYPE SetMarker(
|
||||
D3DCOLOR Color,
|
||||
LPCWSTR Name);
|
||||
|
||||
BOOL STDMETHODCALLTYPE GetStatus();
|
||||
|
||||
private:
|
||||
|
||||
D3D9DeviceEx* m_container;
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -59,6 +59,9 @@ namespace dxvk {
|
||||
if (canSWVP)
|
||||
Logger::info("D3D9DeviceEx: Using extended constant set for software vertex processing.");
|
||||
|
||||
if (m_dxvkDevice->instance()->extensions().extDebugUtils)
|
||||
m_annotation = new D3D9UserDefinedAnnotation(this);
|
||||
|
||||
m_initializer = new D3D9Initializer(m_dxvkDevice);
|
||||
m_converter = new D3D9FormatHelper(m_dxvkDevice);
|
||||
|
||||
@ -145,6 +148,9 @@ namespace dxvk {
|
||||
Flush();
|
||||
SynchronizeCsThread(DxvkCsThread::SynchronizeAll);
|
||||
|
||||
if (m_annotation)
|
||||
delete m_annotation;
|
||||
|
||||
delete m_initializer;
|
||||
delete m_converter;
|
||||
|
||||
|
@ -41,6 +41,7 @@ namespace dxvk {
|
||||
class D3D9Query;
|
||||
class D3D9StateBlock;
|
||||
class D3D9FormatHelper;
|
||||
class D3D9UserDefinedAnnotation;
|
||||
|
||||
enum class D3D9DeviceFlag : uint32_t {
|
||||
DirtyFramebuffer,
|
||||
@ -98,6 +99,7 @@ namespace dxvk {
|
||||
constexpr static uint32_t NullStreamIdx = caps::MaxStreams;
|
||||
|
||||
friend class D3D9SwapChainEx;
|
||||
friend class D3D9UserDefinedAnnotation;
|
||||
public:
|
||||
|
||||
D3D9DeviceEx(
|
||||
@ -1254,6 +1256,8 @@ namespace dxvk {
|
||||
D3D9ConstantLayout m_psLayout;
|
||||
D3D9ConstantSets m_consts[DxsoProgramTypes::Count];
|
||||
|
||||
D3D9UserDefinedAnnotation* m_annotation = nullptr;
|
||||
|
||||
D3D9ViewportInfo m_viewportInfo;
|
||||
|
||||
DxvkCsChunkPool m_csChunkPool;
|
||||
|
Loading…
Reference in New Issue
Block a user