From 5b38a36d0a067e52a1867985cad36a4e67b46f72 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 14 Dec 2018 10:15:10 +0000 Subject: [PATCH] Don't count references from shaders that fail to create on FL10_0 * The MSAA <-> Array copy shaders require FL11_0, so don't try to create them on FL10_0 and don't count their internal references. --- renderdoc/driver/d3d11/d3d11_debug.cpp | 55 ++++++++++++++++-------- renderdoc/driver/d3d11/d3d11_manager.cpp | 2 +- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/renderdoc/driver/d3d11/d3d11_debug.cpp b/renderdoc/driver/d3d11/d3d11_debug.cpp index ceebe4930..02398c51c 100644 --- a/renderdoc/driver/d3d11/d3d11_debug.cpp +++ b/renderdoc/driver/d3d11/d3d11_debug.cpp @@ -137,24 +137,43 @@ void D3D11DebugManager::InitCommonResources() std::string multisamplehlsl = GetEmbeddedResource(multisample_hlsl); - CopyMSToArrayPS = - shaderCache->MakePShader(multisamplehlsl.c_str(), "RENDERDOC_CopyMSToArray", "ps_5_0"); - m_pDevice->InternalRef(); - CopyArrayToMSPS = - shaderCache->MakePShader(multisamplehlsl.c_str(), "RENDERDOC_CopyArrayToMS", "ps_5_0"); - m_pDevice->InternalRef(); - FloatCopyMSToArrayPS = - shaderCache->MakePShader(multisamplehlsl.c_str(), "RENDERDOC_FloatCopyMSToArray", "ps_5_0"); - m_pDevice->InternalRef(); - FloatCopyArrayToMSPS = - shaderCache->MakePShader(multisamplehlsl.c_str(), "RENDERDOC_FloatCopyArrayToMS", "ps_5_0"); - m_pDevice->InternalRef(); - DepthCopyMSToArrayPS = - shaderCache->MakePShader(multisamplehlsl.c_str(), "RENDERDOC_DepthCopyMSToArray", "ps_5_0"); - m_pDevice->InternalRef(); - DepthCopyArrayToMSPS = - shaderCache->MakePShader(multisamplehlsl.c_str(), "RENDERDOC_DepthCopyArrayToMS", "ps_5_0"); - m_pDevice->InternalRef(); + if(m_pDevice->GetFeatureLevel() >= D3D_FEATURE_LEVEL_11_0) + { + CopyMSToArrayPS = + shaderCache->MakePShader(multisamplehlsl.c_str(), "RENDERDOC_CopyMSToArray", "ps_4_0"); + if(CopyMSToArrayPS) + m_pDevice->InternalRef(); + CopyArrayToMSPS = + shaderCache->MakePShader(multisamplehlsl.c_str(), "RENDERDOC_CopyArrayToMS", "ps_4_0"); + if(CopyArrayToMSPS) + m_pDevice->InternalRef(); + FloatCopyMSToArrayPS = + shaderCache->MakePShader(multisamplehlsl.c_str(), "RENDERDOC_FloatCopyMSToArray", "ps_4_0"); + if(FloatCopyMSToArrayPS) + m_pDevice->InternalRef(); + FloatCopyArrayToMSPS = + shaderCache->MakePShader(multisamplehlsl.c_str(), "RENDERDOC_FloatCopyArrayToMS", "ps_4_0"); + if(FloatCopyArrayToMSPS) + m_pDevice->InternalRef(); + DepthCopyMSToArrayPS = + shaderCache->MakePShader(multisamplehlsl.c_str(), "RENDERDOC_DepthCopyMSToArray", "ps_4_0"); + if(DepthCopyMSToArrayPS) + m_pDevice->InternalRef(); + DepthCopyArrayToMSPS = + shaderCache->MakePShader(multisamplehlsl.c_str(), "RENDERDOC_DepthCopyArrayToMS", "ps_4_0"); + if(DepthCopyArrayToMSPS) + m_pDevice->InternalRef(); + } + else + { + RDCWARN("Device feature level below 11_0, MSAA <-> Array copies will not be supported."); + CopyMSToArrayPS = NULL; + CopyArrayToMSPS = NULL; + FloatCopyMSToArrayPS = NULL; + FloatCopyArrayToMSPS = NULL; + DepthCopyMSToArrayPS = NULL; + DepthCopyArrayToMSPS = NULL; + } // mark created resources as internal during capture so they aren't included in capture files. rm->SetInternalResource(CopyMSToArrayPS); diff --git a/renderdoc/driver/d3d11/d3d11_manager.cpp b/renderdoc/driver/d3d11/d3d11_manager.cpp index 9dc044884..c05a4d965 100644 --- a/renderdoc/driver/d3d11/d3d11_manager.cpp +++ b/renderdoc/driver/d3d11/d3d11_manager.cpp @@ -51,7 +51,7 @@ ID3D11DeviceChild *D3D11ResourceManager::UnwrapResource(ID3D11DeviceChild *res) void D3D11ResourceManager::SetInternalResource(ID3D11DeviceChild *res) { - if(!RenderDoc::Inst().IsReplayApp()) + if(res && !RenderDoc::Inst().IsReplayApp()) { D3D11ResourceRecord *record = GetResourceRecord(GetIDForResource(res)); if(record)