diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-12-17 17:04:38 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-01-04 13:00:40 +0100 |
commit | 23f8d6c57f8d599b8b9542586801964d10cf8fba (patch) | |
tree | 3c0fe3e7b3cb808afcd828687e3613c57b3b9a41 /src/gui/rhi/qrhigles2.cpp | |
parent | dcc2704d17bda08e6dc7783559ccbfd864dd4339 (diff) | |
download | qtbase-23f8d6c57f8d599b8b9542586801964d10cf8fba.tar.gz |
rhi: Drop the profiler for now
The system we inherited from the original Qt 5.14 introduction of QRhi
is a text stream based solution where resource creation and frame
timings are sent in a comma-separated format to a QIODevice.
This, while useful to get insights about the number of resources at a
given time, is not actively helpful. The frameworks built on top (Qt
Quick, Qt Quick 3D) are expected to provide solutions for logging
timings in a different way (e.g. via the QML Profiler). Similarly,
tracking active resources and generating statistics from that is
better handled on a higher level.
The unique bits, such as the Vulkan memory allocator statistics and
the GPU frame timestamps, are converted into APIs in QRhi. This way a
user of QRhi can query it at any time and do whatever it sees fit with
the data.
When it comes to the GPU timestamps, that has a somewhat limited value
due to the heavy asynchronousness, hence the callback based
API. Nonetheless, this is still useful since it is the only means of
reporting some frame timing data (an approx. elapsed milliseconds for
a frame) from the GPU side.
Change-Id: I67cd58b81aaa7e343c11731f9aa5b4804c2a1823
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhigles2.cpp')
-rw-r--r-- | src/gui/rhi/qrhigles2.cpp | 47 |
1 files changed, 5 insertions, 42 deletions
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 90ade77dcc..2f41279e4f 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -1189,9 +1189,9 @@ QRhiDriverInfo QRhiGles2::driverInfo() const return driverInfoStruct; } -void QRhiGles2::sendVMemStatsToProfiler() +QRhiMemAllocStats QRhiGles2::graphicsMemoryAllocationStatistics() { - // nothing to do here + return {}; } bool QRhiGles2::makeThreadLocalNativeContextCurrent() @@ -1774,9 +1774,6 @@ QRhi::FrameOpResult QRhiGles2::beginFrame(QRhiSwapChain *swapChain, QRhi::BeginF currentSwapChain = swapChainD; - QRhiProfilerPrivate *rhiP = profilerPrivateOrNull(); - QRHI_PROF_F(beginSwapChainFrame(swapChain)); - executeDeferredReleases(); swapChainD->cb.resetState(); @@ -1797,10 +1794,6 @@ QRhi::FrameOpResult QRhiGles2::endFrame(QRhiSwapChain *swapChain, QRhi::EndFrame executeCommandBuffer(&swapChainD->cb); - QRhiProfilerPrivate *rhiP = profilerPrivateOrNull(); - // this must be done before the swap - QRHI_PROF_F(endSwapChainFrame(swapChain, swapChainD->frameCount + 1)); - if (swapChainD->surface && !flags.testFlag(QRhi::SkipPresent)) { ctx->swapBuffers(swapChainD->surface); needsMakeCurrentDueToSwap = true; @@ -4430,8 +4423,6 @@ void QGles2Buffer::destroy() QRHI_RES_RHI(QRhiGles2); if (rhiD) { rhiD->releaseQueue.append(e); - QRHI_PROF; - QRHI_PROF_F(releaseBuffer(this)); rhiD->unregisterResource(this); } } @@ -4442,7 +4433,6 @@ bool QGles2Buffer::create() destroy(); QRHI_RES_RHI(QRhiGles2); - QRHI_PROF; nonZeroSize = m_size <= 0 ? 256 : m_size; @@ -4452,7 +4442,6 @@ bool QGles2Buffer::create() return false; } data.resize(nonZeroSize); - QRHI_PROF_F(newBuffer(this, uint(nonZeroSize), 0, 1)); return true; } @@ -4471,7 +4460,6 @@ bool QGles2Buffer::create() usageState.access = AccessNone; - QRHI_PROF_F(newBuffer(this, uint(nonZeroSize), 1, 0)); rhiD->registerResource(this); return true; } @@ -4543,8 +4531,6 @@ void QGles2RenderBuffer::destroy() if (rhiD) { if (owns) rhiD->releaseQueue.append(e); - QRHI_PROF; - QRHI_PROF_F(releaseRenderBuffer(this)); rhiD->unregisterResource(this); } } @@ -4555,14 +4541,11 @@ bool QGles2RenderBuffer::create() destroy(); QRHI_RES_RHI(QRhiGles2); - QRHI_PROF; samples = rhiD->effectiveSampleCount(m_sampleCount); if (m_flags.testFlag(UsedWithSwapChainOnly)) { - if (m_type == DepthStencil) { - QRHI_PROF_F(newRenderBuffer(this, false, true, samples)); + if (m_type == DepthStencil) return true; - } qWarning("RenderBuffer: UsedWithSwapChainOnly is meaningless in combination with Color"); } @@ -4602,7 +4585,6 @@ bool QGles2RenderBuffer::create() rhiD->f->glRenderbufferStorage(GL_RENDERBUFFER, stencilStorage, size.width(), size.height()); } - QRHI_PROF_F(newRenderBuffer(this, false, false, samples)); break; case QRhiRenderBuffer::Color: { @@ -4623,7 +4605,6 @@ bool QGles2RenderBuffer::create() rhiD->f->glRenderbufferStorage(GL_RENDERBUFFER, internalFormat, size.width(), size.height()); } - QRHI_PROF_F(newRenderBuffer(this, false, false, samples)); } break; default: @@ -4656,9 +4637,6 @@ bool QGles2RenderBuffer::createFrom(NativeRenderBuffer src) renderbuffer = src.object; - QRHI_PROF; - QRHI_PROF_F(newRenderBuffer(this, false, false, samples)); - owns = false; generation += 1; rhiD->registerResource(this); @@ -4702,8 +4680,6 @@ void QGles2Texture::destroy() if (rhiD) { if (owns) rhiD->releaseQueue.append(e); - QRHI_PROF; - QRHI_PROF_F(releaseTexture(this)); rhiD->unregisterResource(this); } } @@ -4850,9 +4826,6 @@ bool QGles2Texture::create() specified = false; } - QRHI_PROF; - QRHI_PROF_F(newTexture(this, true, mipLevelCount, isCube ? 6 : 1, 1)); - owns = true; generation += 1; @@ -4873,13 +4846,10 @@ bool QGles2Texture::createFrom(QRhiTexture::NativeTexture src) specified = true; zeroInitialized = true; - QRHI_RES_RHI(QRhiGles2); - QRHI_PROF; - QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, 1)); - owns = false; generation += 1; + QRHI_RES_RHI(QRhiGles2); rhiD->registerResource(this); return true; } @@ -5447,11 +5417,8 @@ QGles2SwapChain::~QGles2SwapChain() void QGles2SwapChain::destroy() { QRHI_RES_RHI(QRhiGles2); - if (rhiD) { - QRHI_PROF; - QRHI_PROF_F(releaseSwapChain(this)); + if (rhiD) rhiD->unregisterResource(this); - } } QRhiCommandBuffer *QGles2SwapChain::currentFrameCommandBuffer() @@ -5508,10 +5475,6 @@ bool QGles2SwapChain::createOrResize() frameCount = 0; - QRHI_PROF; - // make something up - QRHI_PROF_F(resizeSwapChain(this, 2, m_sampleCount > 1 ? 2 : 0, m_sampleCount)); - // The only reason to register this fairly fake gl swapchain // object with no native resources underneath is to be able to // implement a safe destroy(). |