summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D11
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-10-07 15:52:04 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-10-07 15:52:04 +0000
commit3dbdeba5e6263018b426ac437db8eb70cc46c88c (patch)
tree9c4950bbcc06afebc64588fc6e2ad3ebccb162d4 /Graphics/GraphicsEngineD3D11
parentReworked D3D11 swap chain to properly return current RTV and DSV through GetC... (diff)
downloadDiligentCore-3dbdeba5e6263018b426ac437db8eb70cc46c88c.tar.gz
DiligentCore-3dbdeba5e6263018b426ac437db8eb70cc46c88c.zip
Added debug names for D3D11 command lists, shaders, samplers, depth-stencil, rasterizer, and blend states
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
-rw-r--r--Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp5
-rw-r--r--Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp31
-rw-r--r--Graphics/GraphicsEngineD3D11/src/SamplerD3D11Impl.cpp5
-rw-r--r--Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp6
4 files changed, 45 insertions, 2 deletions
diff --git a/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp
index 06e476c1..bff165fa 100644
--- a/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp
@@ -36,6 +36,11 @@ CommandListD3D11Impl :: CommandListD3D11Impl(IReferenceCounters* pRefCounters
TCommandListBase(pRefCounters, pDevice),
m_pd3d11CommandList(pd3d11CommandList)
{
+ if (*m_Desc.Name != 0)
+ {
+ auto hr = m_pd3d11CommandList->SetPrivateData(WKPDID_D3DDebugObjectName, static_cast<UINT>(strlen(m_Desc.Name)), m_Desc.Name);
+ DEV_CHECK_ERR(SUCCEEDED(hr), "Failed to set command list name");
+ }
}
CommandListD3D11Impl :: ~CommandListD3D11Impl()
diff --git a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp
index a76e4fcf..ec672ca8 100644
--- a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp
@@ -96,8 +96,7 @@ PipelineStateD3D11Impl::PipelineStateD3D11Impl(IReferenceCounters* pRefCoun
CHECK_D3D_RESULT_THROW( pDeviceD3D11->CreateDepthStencilState( &D3D11DSSDesc, &m_pd3d11DepthStencilState ),
"Failed to create D3D11 depth stencil state" );
-
- // Create input layout
+ // Create input layout
if( m_LayoutElements.size() > 0 )
{
std::vector<D3D11_INPUT_ELEMENT_DESC, STDAllocatorRawMem<D3D11_INPUT_ELEMENT_DESC> > d311InputElements(STD_ALLOCATOR_RAW_MEM(D3D11_INPUT_ELEMENT_DESC, GetRawAllocator(), "Allocator for vector<D3D11_INPUT_ELEMENT_DESC>") );
@@ -110,6 +109,34 @@ PipelineStateD3D11Impl::PipelineStateD3D11Impl(IReferenceCounters* pRefCoun
CHECK_D3D_RESULT_THROW( pDeviceD3D11->CreateInputLayout(d311InputElements.data(), static_cast<UINT>(d311InputElements.size()), pVSByteCode->GetBufferPointer(), pVSByteCode->GetBufferSize(), &m_pd3d11InputLayout ),
"Failed to create the Direct3D11 input layout");
}
+
+ if (*m_Desc.Name != 0)
+ {
+ {
+ String BSName = String(m_Desc.Name) + " - Blend State";
+ auto hr = m_pd3d11BlendState->SetPrivateData(WKPDID_D3DDebugObjectName, static_cast<UINT>(BSName.length()), BSName.c_str());
+ DEV_CHECK_ERR(SUCCEEDED(hr), "Failed to set blend state name");
+ }
+
+ {
+ String DSSName = String(m_Desc.Name) + " - Depth-Stencil State";
+ auto hr = m_pd3d11DepthStencilState->SetPrivateData(WKPDID_D3DDebugObjectName, static_cast<UINT>(DSSName.length()), DSSName.c_str());
+ DEV_CHECK_ERR(SUCCEEDED(hr), "Failed to set depth-stencil state name");
+ }
+
+ {
+ String RSName = String(m_Desc.Name) + " - Raterizer State";
+ auto hr = m_pd3d11RasterizerState->SetPrivateData(WKPDID_D3DDebugObjectName, static_cast<UINT>(RSName.length()), RSName.c_str());
+ DEV_CHECK_ERR(SUCCEEDED(hr), "Failed to set rasterizer state name");
+ }
+
+ if (m_pd3d11InputLayout)
+ {
+ String LayoutName = String(m_Desc.Name) + " - Input Layout";
+ auto hr = m_pd3d11InputLayout->SetPrivateData(WKPDID_D3DDebugObjectName, static_cast<UINT>(LayoutName.length()), LayoutName.c_str());
+ DEV_CHECK_ERR(SUCCEEDED(hr), "Failed to set input layout state name");
+ }
+ }
}
if(PipelineDesc.SRBAllocationGranularity > 1)
diff --git a/Graphics/GraphicsEngineD3D11/src/SamplerD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/SamplerD3D11Impl.cpp
index a2777163..73a6785e 100644
--- a/Graphics/GraphicsEngineD3D11/src/SamplerD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/SamplerD3D11Impl.cpp
@@ -50,6 +50,11 @@ SamplerD3D11Impl::SamplerD3D11Impl(IReferenceCounters* pRefCounters,
};
CHECK_D3D_RESULT_THROW( pd3d11Device->CreateSamplerState(&D3D11SamplerDesc, &m_pd3dSampler),
"Failed to create the Direct3D11 sampler");
+ if (*m_Desc.Name != 0)
+ {
+ auto hr = m_pd3dSampler->SetPrivateData(WKPDID_D3DDebugObjectName, static_cast<UINT>(strlen(m_Desc.Name)), m_Desc.Name);
+ DEV_CHECK_ERR(SUCCEEDED(hr), "Failed to set sampler name");
+ }
}
SamplerD3D11Impl::~SamplerD3D11Impl()
diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp
index 9da40de3..ebdf0d23 100644
--- a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp
@@ -69,6 +69,12 @@ ShaderD3D11Impl::ShaderD3D11Impl(IReferenceCounters* pRefCounters,
if(!m_pShader)
LOG_ERROR_AND_THROW("Failed to create the shader from the byte code");
+ if (*m_Desc.Name != 0)
+ {
+ auto hr = m_pShader->SetPrivateData(WKPDID_D3DDebugObjectName, static_cast<UINT>(strlen(m_Desc.Name)), m_Desc.Name);
+ DEV_CHECK_ERR(SUCCEEDED(hr), "Failed to set shader name");
+ }
+
// Load shader resources
auto &Allocator = GetRawAllocator();
auto *pRawMem = ALLOCATE(Allocator, "Allocator for ShaderResources", sizeof(ShaderResourcesD3D11));