mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-15 16:29:16 +01:00
[d3d11] Support debug names for buffers and textures
Co-authored-by: Aaron Leiby <aleiby@gmail.com>
This commit is contained in:
parent
4970dc3358
commit
8c3d7a1979
@ -1,5 +1,6 @@
|
|||||||
#include "d3d11_buffer.h"
|
#include "d3d11_buffer.h"
|
||||||
#include "d3d11_context.h"
|
#include "d3d11_context.h"
|
||||||
|
#include "d3d11_context_imm.h"
|
||||||
#include "d3d11_device.h"
|
#include "d3d11_device.h"
|
||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
@ -211,6 +212,18 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void D3D11Buffer::SetDebugName(const char* pName) {
|
||||||
|
if (m_buffer) {
|
||||||
|
m_parent->GetContext()->InjectCs([
|
||||||
|
cBuffer = m_buffer,
|
||||||
|
cName = std::string(pName ? pName : "")
|
||||||
|
] (DxvkContext* ctx) {
|
||||||
|
ctx->setDebugName(cBuffer, cName.c_str());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
HRESULT D3D11Buffer::NormalizeBufferProperties(D3D11_BUFFER_DESC* pDesc) {
|
HRESULT D3D11Buffer::NormalizeBufferProperties(D3D11_BUFFER_DESC* pDesc) {
|
||||||
// Zero-sized buffers are illegal
|
// Zero-sized buffers are illegal
|
||||||
if (!pDesc->ByteWidth && !(pDesc->MiscFlags & D3D11_RESOURCE_MISC_TILE_POOL))
|
if (!pDesc->ByteWidth && !(pDesc->MiscFlags & D3D11_RESOURCE_MISC_TILE_POOL))
|
||||||
|
@ -61,6 +61,8 @@ namespace dxvk {
|
|||||||
void STDMETHODCALLTYPE GetDesc(
|
void STDMETHODCALLTYPE GetDesc(
|
||||||
D3D11_BUFFER_DESC *pDesc) final;
|
D3D11_BUFFER_DESC *pDesc) final;
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE SetDebugName(const char* pName) final;
|
||||||
|
|
||||||
bool CheckViewCompatibility(
|
bool CheckViewCompatibility(
|
||||||
UINT BindFlags,
|
UINT BindFlags,
|
||||||
DXGI_FORMAT Format) const;
|
DXGI_FORMAT Format) const;
|
||||||
|
@ -20,8 +20,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE GetPrivateData(
|
HRESULT STDMETHODCALLTYPE GetPrivateData(
|
||||||
REFGUID guid,
|
REFGUID guid,
|
||||||
UINT *pDataSize,
|
UINT* pDataSize,
|
||||||
void *pData) final {
|
void* pData) final {
|
||||||
return m_privateData.getData(
|
return m_privateData.getData(
|
||||||
guid, pDataSize, pData);
|
guid, pDataSize, pData);
|
||||||
}
|
}
|
||||||
@ -29,14 +29,18 @@ namespace dxvk {
|
|||||||
HRESULT STDMETHODCALLTYPE SetPrivateData(
|
HRESULT STDMETHODCALLTYPE SetPrivateData(
|
||||||
REFGUID guid,
|
REFGUID guid,
|
||||||
UINT DataSize,
|
UINT DataSize,
|
||||||
const void *pData) final {
|
const void* pData) final {
|
||||||
|
// WKPDID_D3DDebugObjectName, can't use directly due to MSVC link errors
|
||||||
|
if (guid == GUID{0x429b8c22,0x9188,0x4b0c,0x87,0x42,0xac,0xb0,0xbf,0x85,0xc2,0x00})
|
||||||
|
SetDebugName(static_cast<const char*>(pData));
|
||||||
|
|
||||||
return m_privateData.setData(
|
return m_privateData.setData(
|
||||||
guid, DataSize, pData);
|
guid, DataSize, pData);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
|
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
|
||||||
REFGUID guid,
|
REFGUID guid,
|
||||||
const IUnknown *pUnknown) final {
|
const IUnknown* pUnknown) final {
|
||||||
return m_privateData.setInterface(
|
return m_privateData.setInterface(
|
||||||
guid, pUnknown);
|
guid, pUnknown);
|
||||||
}
|
}
|
||||||
@ -46,6 +50,10 @@ namespace dxvk {
|
|||||||
*ppDevice = ref(GetParentInterface());
|
*ppDevice = ref(GetParentInterface());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void STDMETHODCALLTYPE SetDebugName(const char* pName) {
|
||||||
|
// No-op by default
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
ID3D11Device* GetParentInterface() const {
|
ID3D11Device* GetParentInterface() const {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "d3d11_device.h"
|
#include "d3d11_device.h"
|
||||||
|
#include "d3d11_context_imm.h"
|
||||||
#include "d3d11_gdi.h"
|
#include "d3d11_gdi.h"
|
||||||
#include "d3d11_texture.h"
|
#include "d3d11_texture.h"
|
||||||
|
|
||||||
@ -374,6 +375,29 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void D3D11CommonTexture::SetDebugName(const char* pName) {
|
||||||
|
if (m_image) {
|
||||||
|
m_device->GetContext()->InjectCs([
|
||||||
|
cImage = m_image,
|
||||||
|
cName = std::string(pName ? pName : "")
|
||||||
|
] (DxvkContext* ctx) {
|
||||||
|
ctx->setDebugName(cImage, cName.c_str());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_STAGING) {
|
||||||
|
for (uint32_t i = 0; i < m_buffers.size(); i++) {
|
||||||
|
m_device->GetContext()->InjectCs([
|
||||||
|
cBuffer = m_buffers[i].buffer,
|
||||||
|
cName = std::string(pName ? pName : "")
|
||||||
|
] (DxvkContext* ctx) {
|
||||||
|
ctx->setDebugName(cBuffer, cName.c_str());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
HRESULT D3D11CommonTexture::NormalizeTextureProperties(D3D11_COMMON_TEXTURE_DESC* pDesc) {
|
HRESULT D3D11CommonTexture::NormalizeTextureProperties(D3D11_COMMON_TEXTURE_DESC* pDesc) {
|
||||||
if (pDesc->Width == 0 || pDesc->Height == 0 || pDesc->Depth == 0 || pDesc->ArraySize == 0)
|
if (pDesc->Width == 0 || pDesc->Height == 0 || pDesc->Depth == 0 || pDesc->ArraySize == 0)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
@ -1196,6 +1220,11 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE D3D11Texture1D::SetDebugName(const char* pName) {
|
||||||
|
m_texture.SetDebugName(pName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// D 3 D 1 1 T E X T U R E 2 D
|
// D 3 D 1 1 T E X T U R E 2 D
|
||||||
D3D11Texture2D::D3D11Texture2D(
|
D3D11Texture2D::D3D11Texture2D(
|
||||||
@ -1377,6 +1406,11 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE D3D11Texture2D::SetDebugName(const char* pName) {
|
||||||
|
m_texture.SetDebugName(pName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// D 3 D 1 1 T E X T U R E 3 D
|
// D 3 D 1 1 T E X T U R E 3 D
|
||||||
D3D11Texture3D::D3D11Texture3D(
|
D3D11Texture3D::D3D11Texture3D(
|
||||||
@ -1488,6 +1522,11 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE D3D11Texture3D::SetDebugName(const char* pName) {
|
||||||
|
m_texture.SetDebugName(pName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
D3D11CommonTexture* GetCommonTexture(ID3D11Resource* pResource) {
|
D3D11CommonTexture* GetCommonTexture(ID3D11Resource* pResource) {
|
||||||
D3D11_RESOURCE_DIMENSION dimension = D3D11_RESOURCE_DIMENSION_UNKNOWN;
|
D3D11_RESOURCE_DIMENSION dimension = D3D11_RESOURCE_DIMENSION_UNKNOWN;
|
||||||
pResource->GetType(&dimension);
|
pResource->GetType(&dimension);
|
||||||
|
@ -525,6 +525,14 @@ namespace dxvk {
|
|||||||
return m_11on12;
|
return m_11on12;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Sets debug name for texture
|
||||||
|
*
|
||||||
|
* Passes the given name to the backing image or buffer.
|
||||||
|
* \param [in] name Debug name
|
||||||
|
*/
|
||||||
|
void SetDebugName(const char* pName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Normalizes and validates texture description
|
* \brief Normalizes and validates texture description
|
||||||
*
|
*
|
||||||
@ -759,6 +767,8 @@ namespace dxvk {
|
|||||||
void STDMETHODCALLTYPE GetDesc(
|
void STDMETHODCALLTYPE GetDesc(
|
||||||
D3D11_TEXTURE1D_DESC *pDesc) final;
|
D3D11_TEXTURE1D_DESC *pDesc) final;
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE SetDebugName(const char* pName) final;
|
||||||
|
|
||||||
D3D11CommonTexture* GetCommonTexture() {
|
D3D11CommonTexture* GetCommonTexture() {
|
||||||
return &m_texture;
|
return &m_texture;
|
||||||
}
|
}
|
||||||
@ -825,6 +835,8 @@ namespace dxvk {
|
|||||||
void STDMETHODCALLTYPE GetDesc1(
|
void STDMETHODCALLTYPE GetDesc1(
|
||||||
D3D11_TEXTURE2D_DESC1* pDesc) final;
|
D3D11_TEXTURE2D_DESC1* pDesc) final;
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE SetDebugName(const char* pName) final;
|
||||||
|
|
||||||
D3D11CommonTexture* GetCommonTexture() {
|
D3D11CommonTexture* GetCommonTexture() {
|
||||||
return &m_texture;
|
return &m_texture;
|
||||||
}
|
}
|
||||||
@ -875,6 +887,8 @@ namespace dxvk {
|
|||||||
void STDMETHODCALLTYPE GetDesc1(
|
void STDMETHODCALLTYPE GetDesc1(
|
||||||
D3D11_TEXTURE3D_DESC1* pDesc) final;
|
D3D11_TEXTURE3D_DESC1* pDesc) final;
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE SetDebugName(const char* pName) final;
|
||||||
|
|
||||||
D3D11CommonTexture* GetCommonTexture() {
|
D3D11CommonTexture* GetCommonTexture() {
|
||||||
return &m_texture;
|
return &m_texture;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user