Commit 48b75d8f authored by Laszlo Agocs's avatar Laszlo Agocs

vk, gl: report tex/rb/sc to prof

parent 922bb6b3
......@@ -1585,6 +1585,9 @@ void QGles2RenderBuffer::release()
QRHI_RES_RHI(QRhiGles2);
rhiD->releaseQueue.append(e);
QRHI_PROF;
QRHI_PROF_F(releaseRenderBuffer(this));
}
bool QGles2RenderBuffer::build()
......@@ -1594,9 +1597,14 @@ bool QGles2RenderBuffer::build()
if (renderbuffer)
release();
QRHI_PROF;
samples = qMax(1, m_sampleCount);
if (m_flags.testFlag(UsedWithSwapChainOnly)) {
if (m_type == DepthStencil)
if (m_type == DepthStencil) {
QRHI_PROF_F(newRenderBuffer(this, false, true, samples));
return true;
}
qWarning("RenderBuffer: UsedWithSwapChainOnly is meaningless in combination with Color");
}
......@@ -1604,8 +1612,6 @@ bool QGles2RenderBuffer::build()
if (!rhiD->ensureContext())
return false;
samples = qMax(1, m_sampleCount);
rhiD->f->glGenRenderbuffers(1, &renderbuffer);
rhiD->f->glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
......@@ -1617,6 +1623,7 @@ bool QGles2RenderBuffer::build()
else
rhiD->f->glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8,
m_pixelSize.width(), m_pixelSize.height());
QRHI_PROF_F(newRenderBuffer(this, false, false, samples));
break;
case QRhiRenderBuffer::Color:
if (rhiD->caps.msaaRenderBuffer)
......@@ -1625,6 +1632,7 @@ bool QGles2RenderBuffer::build()
else
rhiD->f->glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8,
m_pixelSize.width(), m_pixelSize.height());
QRHI_PROF_F(newRenderBuffer(this, false, false, samples));
break;
default:
Q_UNREACHABLE();
......@@ -1663,6 +1671,9 @@ void QGles2Texture::release()
QRHI_RES_RHI(QRhiGles2);
rhiD->releaseQueue.append(e);
}
QRHI_PROF;
QRHI_PROF_F(releaseTexture(this));
}
static inline bool isPowerOfTwo(int x)
......@@ -1750,6 +1761,9 @@ bool QGles2Texture::build()
specified = false;
}
QRHI_PROF;
QRHI_PROF_F(newTexture(this, true, mipLevelCount, isCube ? 6 : 1, 1));
owns = true;
nativeHandlesStruct.texture = texture;
......@@ -1769,6 +1783,9 @@ bool QGles2Texture::buildFrom(const QRhiNativeHandles *src)
texture = h->texture;
specified = true;
QRHI_PROF;
QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, 1));
owns = false;
nativeHandlesStruct.texture = texture;
......@@ -2145,7 +2162,8 @@ QGles2SwapChain::QGles2SwapChain(QRhiImplementation *rhi)
void QGles2SwapChain::release()
{
// nothing to do here
QRHI_PROF;
QRHI_PROF_F(releaseSwapChain(this));
}
QRhiCommandBuffer *QGles2SwapChain::currentFrameCommandBuffer()
......@@ -2180,6 +2198,10 @@ bool QGles2SwapChain::buildOrResize()
rt.d.dpr = m_window->devicePixelRatio();
rt.d.attCount = m_depthStencil ? 2 : 1;
QRHI_PROF;
// make something up
QRHI_PROF_F(resizeSwapChain(this, 2, m_sampleCount > 1 ? 2 : 0, m_sampleCount));
return true;
}
......
......@@ -873,10 +873,10 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
}
ensureBlit();
if (!utexD->d->stagingBuf[currentFrameSlot])
if (!utexD->d->stagingBuf[currentFrameSlot]) {
utexD->d->stagingBuf[currentFrameSlot] = [d->dev newBufferWithLength: stagingSize options: MTLResourceStorageModeShared];
QRHI_PROF_F(newTextureStagingArea(utexD, currentFrameSlot, stagingSize));
QRHI_PROF_F(newTextureStagingArea(utexD, currentFrameSlot, stagingSize));
}
void *mp = [utexD->d->stagingBuf[currentFrameSlot] contents];
qsizetype curOfs = 0;
......
......@@ -2057,6 +2057,7 @@ void QRhiVulkan::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdat
continue;
}
utexD->stagingAllocations[currentFrameSlot] = allocation;
QRHI_PROF_F(newTextureStagingArea(utexD, currentFrameSlot, stagingSize));
}
QVarLengthArray<VkBufferImageCopy, 4> copyInfos;
......@@ -2169,6 +2170,7 @@ void QRhiVulkan::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdat
utexD->stagingBuffers[currentFrameSlot] = VK_NULL_HANDLE;
utexD->stagingAllocations[currentFrameSlot] = nullptr;
releaseQueue.append(e);
QRHI_PROF_F(releaseTextureStagingArea(utexD, currentFrameSlot));
}
finishTransferDest(cb, utexD);
......@@ -3367,6 +3369,9 @@ void QVkRenderBuffer::release()
Q_ASSERT(backingTexture->lastActiveFrameSlot == -1);
backingTexture->release();
}
QRHI_PROF;
QRHI_PROF_F(releaseRenderBuffer(this));
}
bool QVkRenderBuffer::build()
......@@ -3375,6 +3380,7 @@ bool QVkRenderBuffer::build()
release();
QRHI_RES_RHI(QRhiVulkan);
QRHI_PROF;
samples = rhiD->effectiveSampleCount(m_sampleCount);
switch (m_type) {
......@@ -3389,6 +3395,7 @@ bool QVkRenderBuffer::build()
if (!backingTexture->build())
return false;
vkformat = backingTexture->vkformat;
QRHI_PROF_F(newRenderBuffer(this, false, false, samples));
}
break;
case QRhiRenderBuffer::DepthStencil:
......@@ -3405,6 +3412,7 @@ bool QVkRenderBuffer::build()
{
return false;
}
QRHI_PROF_F(newRenderBuffer(this, true, false, samples));
break;
default:
Q_UNREACHABLE();
......@@ -3458,6 +3466,9 @@ void QVkTexture::release()
QRHI_RES_RHI(QRhiVulkan);
rhiD->releaseQueue.append(e);
QRHI_PROF;
QRHI_PROF_F(releaseTexture(this));
}
bool QVkTexture::prepareBuild(QSize *adjustedSize)
......@@ -3587,6 +3598,9 @@ bool QVkTexture::build()
if (!finishBuild())
return false;
QRHI_PROF;
QRHI_PROF_F(newTexture(this, true, mipLevelCount, isCube ? 6 : 1, samples));
owns = true;
layout = VK_IMAGE_LAYOUT_PREINITIALIZED;
return true;
......@@ -3606,6 +3620,9 @@ bool QVkTexture::buildFrom(const QRhiNativeHandles *src)
if (!finishBuild())
return false;
QRHI_PROF;
QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, samples));
owns = false;
layout = h->layout;
return true;
......@@ -4227,6 +4244,9 @@ void QVkSwapChain::release()
QRHI_RES_RHI(QRhiVulkan);
rhiD->swapchains.remove(this);
rhiD->releaseSwapChainResources(this);
QRHI_PROF;
QRHI_PROF_F(releaseSwapChain(this));
}
QRhiCommandBuffer *QVkSwapChain::currentFrameCommandBuffer()
......@@ -4456,6 +4476,9 @@ bool QVkSwapChain::buildOrResize()
}
}
QRHI_PROF;
QRHI_PROF_F(resizeSwapChain(this, QVK_FRAMES_IN_FLIGHT, samples > VK_SAMPLE_COUNT_1_BIT ? QVK_FRAMES_IN_FLIGHT : 0, samples));
wrapWindow = nullptr;
return true;
}
......
prof report api (fed by a cbor stream)
vk, gl: tex and other prof
vk, gl: debug: object names
vk, gl: debug: markers (begin, end, msg)
mtl: max texture size
......@@ -53,6 +52,7 @@ dxc for d3d as an alternative to fxc?
hlsl -> dxc -> spirv -> spirv-cross hmmm...
+++ done
vk, gl: tex and other prof
max texture size stuff
d3d: tex and other prof
plainqwindow examples should be reorganized into one (using examplefw)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment