diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2016-07-01 11:58:08 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2016-07-01 11:37:06 +0000 |
commit | 7ab621d9a5393be5996654cd67c85b76fc3f5b2b (patch) | |
tree | 1d12854b56efc04f501432cfdedd3f4d8efc8e38 /src/plugins | |
parent | 4c3a3dbee9701a62eec8455713451ac1afaeda10 (diff) |
D3D12: Move the info prints to categorized logging
Print info messages on startup only when QSG_INFO / qt.scenegraph.general
are set, similarly to what happens with OpenGL.
Change-Id: I11c0329462bb6f66968246c4412fff940797671b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp index e1b076c39a..fefd23ddc1 100644 --- a/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp +++ b/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp @@ -42,6 +42,7 @@ #include "cs_mipmapgen.hlslh" #include <QString> #include <QColor> +#include <QLoggingCategory> #include <qmath.h> #include <qalgorithms.h> @@ -70,6 +71,10 @@ QT_BEGIN_NAMESPACE DECLARE_DEBUG_VAR(render) +// Except for system info on startup. +Q_LOGGING_CATEGORY(QSG_LOG_INFO, "qt.scenegraph.general") + + static const int DEFAULT_SWAP_CHAIN_BUFFER_COUNT = 3; static const int DEFAULT_FRAME_IN_FLIGHT_COUNT = 2; static const int DEFAULT_WAITABLE_SWAP_CHAIN_MAX_LATENCY = 0; @@ -184,7 +189,7 @@ static void getHardwareAdapter(IDXGIFactory1 *factory, IDXGIAdapter1 **outAdapte DXGI_ADAPTER_DESC1 desc; adapter->GetDesc1(&desc); const QString name = QString::fromUtf16((char16_t *) desc.Description); - qDebug("Adapter %d: '%s' (flags 0x%x)", adapterIndex, qPrintable(name), desc.Flags); + qCDebug(QSG_LOG_INFO, "Adapter %d: '%s' (flags 0x%x)", adapterIndex, qPrintable(name), desc.Flags); } if (qEnvironmentVariableIsSet("QT_D3D_ADAPTER_INDEX")) { @@ -193,7 +198,7 @@ static void getHardwareAdapter(IDXGIFactory1 *factory, IDXGIAdapter1 **outAdapte && SUCCEEDED(D3D12CreateDevice(adapter.Get(), fl, _uuidof(ID3D12Device), nullptr))) { adapter->GetDesc1(&desc); const QString name = QString::fromUtf16((char16_t *) desc.Description); - qDebug("Using requested adapter '%s'", qPrintable(name)); + qCDebug(QSG_LOG_INFO, "Using requested adapter '%s'", qPrintable(name)); *outAdapter = adapter.Detach(); return; } @@ -206,7 +211,7 @@ static void getHardwareAdapter(IDXGIFactory1 *factory, IDXGIAdapter1 **outAdapte if (SUCCEEDED(D3D12CreateDevice(adapter.Get(), fl, _uuidof(ID3D12Device), nullptr))) { const QString name = QString::fromUtf16((char16_t *) desc.Description); - qDebug("Using adapter '%s'", qPrintable(name)); + qCDebug(QSG_LOG_INFO, "Using adapter '%s'", qPrintable(name)); break; } } @@ -270,7 +275,7 @@ void QSGD3D12DeviceManager::ensureCreated() } if (warp) { - qDebug("Using WARP"); + qCDebug(QSG_LOG_INFO, "Using WARP"); m_factory->EnumWarpAdapter(IID_PPV_ARGS(&adapter)); HRESULT hr = D3D12CreateDevice(adapter.Get(), D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_device)); if (FAILED(hr)) { @@ -283,14 +288,14 @@ void QSGD3D12DeviceManager::ensureCreated() if (SUCCEEDED(adapter.As(&adapter3))) { DXGI_QUERY_VIDEO_MEMORY_INFO vidMemInfo; if (SUCCEEDED(adapter3->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &vidMemInfo))) { - qDebug("Video memory info: LOCAL: Budget %llu KB CurrentUsage %llu KB AvailableForReservation %llu KB CurrentReservation %llu KB", - vidMemInfo.Budget / 1024, vidMemInfo.CurrentUsage / 1024, - vidMemInfo.AvailableForReservation / 1024, vidMemInfo.CurrentReservation / 1024); + qCDebug(QSG_LOG_INFO, "Video memory info: LOCAL: Budget %llu KB CurrentUsage %llu KB AvailableForReservation %llu KB CurrentReservation %llu KB", + vidMemInfo.Budget / 1024, vidMemInfo.CurrentUsage / 1024, + vidMemInfo.AvailableForReservation / 1024, vidMemInfo.CurrentReservation / 1024); } if (SUCCEEDED(adapter3->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL, &vidMemInfo))) { - qDebug("Video memory info: NON-LOCAL: Budget %llu KB CurrentUsage %llu KB AvailableForReservation %llu KB CurrentReservation %llu KB", - vidMemInfo.Budget / 1024, vidMemInfo.CurrentUsage / 1024, - vidMemInfo.AvailableForReservation / 1024, vidMemInfo.CurrentReservation / 1024); + qCDebug(QSG_LOG_INFO, "Video memory info: NON-LOCAL: Budget %llu KB CurrentUsage %llu KB AvailableForReservation %llu KB CurrentReservation %llu KB", + vidMemInfo.Budget / 1024, vidMemInfo.CurrentUsage / 1024, + vidMemInfo.AvailableForReservation / 1024, vidMemInfo.CurrentReservation / 1024); } } } @@ -700,13 +705,16 @@ void QSGD3D12EnginePrivate::initialize(WId w, const QSize &size, float dpr, int else waitableSwapChainMaxLatency = qBound(0, qEnvironmentVariableIntValue(latReqEnvVar), 16); - qDebug("d3d12 engine init. swap chain buffer count %d, max frames prepared without blocking %d", - swapChainBufferCount, frameInFlightCount); + if (qEnvironmentVariableIsSet("QSG_INFO")) + const_cast<QLoggingCategory &>(QSG_LOG_INFO()).setEnabled(QtDebugMsg, true); + + qCDebug(QSG_LOG_INFO, "d3d12 engine init. swap chain buffer count %d, max frames prepared without blocking %d", + swapChainBufferCount, frameInFlightCount); if (waitableSwapChainMaxLatency) - qDebug("Swap chain frame latency waitable object enabled. Frame latency is %d", waitableSwapChainMaxLatency); + qCDebug(QSG_LOG_INFO, "Swap chain frame latency waitable object enabled. Frame latency is %d", waitableSwapChainMaxLatency); if (qEnvironmentVariableIntValue("QT_D3D_DEBUG") != 0) { - qDebug("Enabling debug layer"); + qCDebug(QSG_LOG_INFO, "Enabling debug layer"); ComPtr<ID3D12Debug> debugController; if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&debugController)))) debugController->EnableDebugLayer(); |