mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Move DX12 debug layer flag out of common code
Change-Id: I5c0a80c772b470be7970abe428cfd2f7a7ea17dd
This commit is contained in:
@@ -227,8 +227,6 @@ RenderDoc::RenderDoc()
|
||||
|
||||
m_TargetControlThreadShutdown = false;
|
||||
m_ControlClientThreadShutdown = false;
|
||||
|
||||
m_DX12DebugLayerEnabled = false;
|
||||
}
|
||||
|
||||
void RenderDoc::Initialise()
|
||||
|
||||
@@ -538,11 +538,6 @@ public:
|
||||
|
||||
string GetOverlayText(RDCDriver driver, uint32_t frameNumber, int flags);
|
||||
|
||||
void SetDX12DebugLayerEnabled(const bool &enableDX12DebugLayer)
|
||||
{
|
||||
m_DX12DebugLayerEnabled = enableDX12DebugLayer;
|
||||
}
|
||||
bool IsDX12DebugLayerEnabled() const { return m_DX12DebugLayerEnabled; }
|
||||
private:
|
||||
RenderDoc();
|
||||
~RenderDoc();
|
||||
@@ -658,8 +653,6 @@ private:
|
||||
static void TargetControlClientThread(uint32_t version, Network::Socket *client);
|
||||
|
||||
ICrashHandler *m_ExHandler;
|
||||
|
||||
bool m_DX12DebugLayerEnabled;
|
||||
};
|
||||
|
||||
struct DriverRegistration
|
||||
|
||||
@@ -131,8 +131,12 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12DebugDevice::QueryInterface(REFIID riid,
|
||||
return m_pDebug->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
WrappedID3D12Device::WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitParams *params)
|
||||
: m_RefCounter(realDevice, false), m_SoftRefCounter(NULL, false), m_pDevice(realDevice)
|
||||
WrappedID3D12Device::WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitParams *params,
|
||||
bool enabledDebugLayer)
|
||||
: m_RefCounter(realDevice, false),
|
||||
m_SoftRefCounter(NULL, false),
|
||||
m_pDevice(realDevice),
|
||||
m_debugLayerEnabled(enabledDebugLayer)
|
||||
{
|
||||
if(RenderDoc::Inst().GetCrashHandler())
|
||||
RenderDoc::Inst().GetCrashHandler()->RegisterMemoryRegion(this, sizeof(WrappedID3D12Device));
|
||||
|
||||
@@ -366,11 +366,14 @@ private:
|
||||
bool Serialise_CaptureScope(SerialiserType &ser);
|
||||
void EndCaptureFrame(ID3D12Resource *presentImage);
|
||||
|
||||
bool m_debugLayerEnabled;
|
||||
|
||||
public:
|
||||
static const int AllocPoolCount = 4;
|
||||
ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D12Device, AllocPoolCount);
|
||||
|
||||
WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitParams *params);
|
||||
WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitParams *params, bool enabledDebugLayer);
|
||||
bool IsDebugLayerEnabled() const { return m_debugLayerEnabled; }
|
||||
virtual ~WrappedID3D12Device();
|
||||
|
||||
UINT GetUnwrappedDescriptorIncrement(D3D12_DESCRIPTOR_HEAP_TYPE type)
|
||||
|
||||
@@ -211,7 +211,7 @@ private:
|
||||
if(SUCCEEDED(hr) && debug)
|
||||
{
|
||||
debug->EnableDebugLayer();
|
||||
RenderDoc::Inst().SetDX12DebugLayerEnabled(true);
|
||||
|
||||
RDCDEBUG("Enabling debug layer");
|
||||
|
||||
// enable this to get GPU-based validation, where available, whenever we enable API validation
|
||||
@@ -285,7 +285,7 @@ private:
|
||||
dev = (ID3D12Device *)dev1;
|
||||
}
|
||||
|
||||
WrappedID3D12Device *wrap = new WrappedID3D12Device(dev, ¶ms);
|
||||
WrappedID3D12Device *wrap = new WrappedID3D12Device(dev, ¶ms, EnableDebugLayer);
|
||||
|
||||
RDCDEBUG("created wrapped device.");
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ void D3D12Replay::CreateResources()
|
||||
if(m_Vendor == GPUVendor::AMD)
|
||||
{
|
||||
RDCLOG("AMD GPU detected - trying to initialise AMD counters");
|
||||
counters = new AMDCounters();
|
||||
counters = new AMDCounters(m_pDevice->IsDebugLayerEnabled());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3520,7 +3520,7 @@ static DriverRegistration D3D12DriverRegistration(RDCDriver::D3D12, &D3D12_Creat
|
||||
|
||||
void D3D12_ProcessStructured(RDCFile *rdc, SDFile &output)
|
||||
{
|
||||
WrappedID3D12Device device(NULL, NULL);
|
||||
WrappedID3D12Device device(NULL, NULL, false);
|
||||
|
||||
int sectionIdx = rdc->SectionIndex(SectionType::FrameCapture);
|
||||
|
||||
|
||||
@@ -58,7 +58,11 @@ static void GPA_LoggingCallback(GPA_Logging_Type messageType, const char *pMessa
|
||||
#define GPA_WARNING(text, status) \
|
||||
RDCWARN(text ". %s", m_pGPUPerfAPI->GPA_GetStatusAsStr((GPA_Status)status));
|
||||
|
||||
AMDCounters::AMDCounters() : m_pGPUPerfAPI(NULL), m_gpaSessionCounter(0u), m_passCounter(-1)
|
||||
AMDCounters::AMDCounters(bool dx12DebugLayerEnabled)
|
||||
: m_pGPUPerfAPI(NULL),
|
||||
m_gpaSessionCounter(0u),
|
||||
m_passCounter(-1),
|
||||
m_dx12DebugLayerEnabled(dx12DebugLayerEnabled)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -112,7 +116,7 @@ bool AMDCounters::Init(ApiType apiType, void *pContext)
|
||||
|
||||
bool disableCounters = false;
|
||||
|
||||
if(apiType == ApiType::Dx12 && RenderDoc::Inst().IsDX12DebugLayerEnabled())
|
||||
if(apiType == ApiType::Dx12 && m_dx12DebugLayerEnabled)
|
||||
{
|
||||
// Disable counters in DX12 Debug configuration
|
||||
void *versionFunc = Process::GetFunctionAddress(module, "GPA_GetVersion");
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
Vk = 3
|
||||
};
|
||||
|
||||
AMDCounters();
|
||||
AMDCounters(bool dx12DebugLayerEnabled = false);
|
||||
~AMDCounters();
|
||||
|
||||
bool Init(ApiType apiType, void *pContext);
|
||||
@@ -102,6 +102,7 @@ private:
|
||||
ApiType m_apiType;
|
||||
uint32_t m_gpaSessionCounter;
|
||||
int m_passCounter;
|
||||
bool m_dx12DebugLayerEnabled;
|
||||
|
||||
void InitializeCmdInfo();
|
||||
void DeInitializeCmdInfo();
|
||||
|
||||
Reference in New Issue
Block a user