From fe1040fb818aee2d0d2a543f63b51ed3db6e4a50 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sun, 11 Jan 2015 01:51:43 +0000 Subject: [PATCH] Tweak utility debugmessage adding function --- renderdoc/driver/d3d11/d3d11_device.cpp | 21 +++++++++------- renderdoc/driver/d3d11/d3d11_device.h | 4 ++-- renderdoc/driver/d3d11/shaders/dxbc_debug.cpp | 24 +++++++++---------- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/renderdoc/driver/d3d11/d3d11_device.cpp b/renderdoc/driver/d3d11/d3d11_device.cpp index 9124b17fd..ec11b42e8 100644 --- a/renderdoc/driver/d3d11/d3d11_device.cpp +++ b/renderdoc/driver/d3d11/d3d11_device.cpp @@ -661,16 +661,19 @@ void WrappedID3D11Device::LazyInit() } } -void WrappedID3D11Device::AddDebugMessage(DebugMessageCategory c, DebugMessageSeverity sv, std::string d) +void WrappedID3D11Device::AddDebugMessage(DebugMessageCategory c, DebugMessageSeverity sv, DebugMessageSource src, std::string d) { - DebugMessage msg; - msg.eventID = m_pImmediateContext->GetEventID(); - msg.messageID = 0; - msg.source = eDbgSource_RuntimeWarning; - msg.category = c; - msg.severity = sv; - msg.description = d; - m_DebugMessages.push_back(msg); + if(m_State == READING || src == eDbgSource_RuntimeWarning) + { + DebugMessage msg; + msg.eventID = m_pImmediateContext->GetEventID(); + msg.messageID = 0; + msg.source = src; + msg.category = c; + msg.severity = sv; + msg.description = d; + m_DebugMessages.push_back(msg); + } } vector WrappedID3D11Device::GetDebugMessages() diff --git a/renderdoc/driver/d3d11/d3d11_device.h b/renderdoc/driver/d3d11/d3d11_device.h index f98287267..e32d2cb41 100644 --- a/renderdoc/driver/d3d11/d3d11_device.h +++ b/renderdoc/driver/d3d11/d3d11_device.h @@ -252,8 +252,8 @@ public: const FetchDrawcall *GetDrawcall(uint32_t frameID, uint32_t eventID); vector GetDebugMessages(); - void AddDebugMessage(DebugMessage msg) { m_DebugMessages.push_back(msg); } - void AddDebugMessage(DebugMessageCategory c, DebugMessageSeverity sv, std::string d); + void AddDebugMessage(DebugMessage msg) { if(m_State < WRITING) m_DebugMessages.push_back(msg); } + void AddDebugMessage(DebugMessageCategory c, DebugMessageSeverity sv, DebugMessageSource src, std::string d); const vector &GetLayoutDesc(ID3D11InputLayout *layout) { return m_LayoutDescs[layout]; } ShaderReflection *GetLayoutDXBC(ID3D11InputLayout *layout) { return m_LayoutDXBC[layout]; } diff --git a/renderdoc/driver/d3d11/shaders/dxbc_debug.cpp b/renderdoc/driver/d3d11/shaders/dxbc_debug.cpp index a5c4920ac..ef4513910 100644 --- a/renderdoc/driver/d3d11/shaders/dxbc_debug.cpp +++ b/renderdoc/driver/d3d11/shaders/dxbc_debug.cpp @@ -2191,7 +2191,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const if(load && !srv && (fmt.numComps != 1 || fmt.byteWidth != 4)) { - device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_Medium, + device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\n" \ "UAV loads aren't supported from anything but 32-bit single channel resources", s.nextInstruction-1, op.str)); } @@ -2323,7 +2323,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const { RDCWARN("No targets bound for sampleinfo on rasterizer"); - device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_Medium, + device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nNo targets bound for sampleinfo on rasterizer", s.nextInstruction-1, op.str)); } @@ -2359,7 +2359,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const { RDCWARN("SRV is NULL being queried by sampleinfo"); - device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_Medium, + device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nSRV is NULL being queried by sampleinfo", s.nextInstruction-1, op.str)); } @@ -2391,7 +2391,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const { RDCWARN("Non multisampled resource provided to sample_info"); - device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_Medium, + device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nSRV is NULL being queried by sampleinfo", s.nextInstruction-1, op.str)); } @@ -2421,7 +2421,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const { RDCWARN("Non-multisampled texture being passed to sample_pos"); - device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_Medium, + device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nNon-multisampled texture being passed to sample_pos", s.nextInstruction-1, op.str)); sample_pattern = NULL; @@ -2579,7 +2579,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const { RDCWARN("Unexpected UAV dimension %d passed to bufinfo", uavDesc.ViewDimension); - device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_High, + device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_High, eDbgSource_RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nUAV being queried by bufinfo is not a buffer", s.nextInstruction-1, op.str)); } } @@ -2587,7 +2587,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const { RDCWARN("UAV is NULL being queried by bufinfo"); - device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_Medium, + device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nUAV being queried by bufinfo is NULL", s.nextInstruction-1, op.str)); } @@ -2628,7 +2628,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const { RDCWARN("Unexpected SRV dimension %d passed to bufinfo", srvDesc.ViewDimension); - device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_High, + device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_High, eDbgSource_RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nSRV being queried by bufinfo is not a buffer", s.nextInstruction-1, op.str)); } } @@ -2636,7 +2636,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const { RDCWARN("SRV is NULL being queried by bufinfo"); - device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_Medium, + device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_Medium, eDbgSource_RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nSRV being queried by bufinfo is NULL", s.nextInstruction-1, op.str)); } @@ -3576,7 +3576,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const RDCWARN("NaN or Inf in texlookup"); ddxCalc.value.fv[i] = 0.0f; - device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_High, + device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_High, eDbgSource_RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nNaN or Inf found in texture lookup - using 0.0 instead", s.nextInstruction-1, op.str)); } if(_isnan(ddyCalc.value.fv[i]) || !_finite(ddyCalc.value.fv[i])) @@ -3584,7 +3584,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const RDCWARN("NaN or Inf in texlookup"); ddyCalc.value.fv[i] = 0.0f; - device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_High, + device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_High, eDbgSource_RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nNaN or Inf found in texture lookup - using 0.0 instead", s.nextInstruction-1, op.str)); } if(_isnan(uv.value.fv[i]) || !_finite(uv.value.fv[i])) @@ -3592,7 +3592,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const RDCWARN("NaN or Inf in texlookup"); uv.value.fv[i] = 0.0f; - device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_High, + device->AddDebugMessage(eDbgCategory_Shaders, eDbgSeverity_High, eDbgSource_RuntimeWarning, StringFormat::Fmt("Shader debugging %d: %s\nNaN or Inf found in texture lookup - using 0.0 instead", s.nextInstruction-1, op.str)); } }