summaryrefslogtreecommitdiffstats
path: root/src/plugins/renderers/rhi/renderer/renderer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/renderers/rhi/renderer/renderer.cpp')
-rw-r--r--src/plugins/renderers/rhi/renderer/renderer.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/renderers/rhi/renderer/renderer.cpp b/src/plugins/renderers/rhi/renderer/renderer.cpp
index 47839b5b2..8f4df706d 100644
--- a/src/plugins/renderers/rhi/renderer/renderer.cpp
+++ b/src/plugins/renderers/rhi/renderer/renderer.cpp
@@ -266,7 +266,7 @@ Renderer::Renderer()
JobTypes::DirtyShaderGathering)),
m_ownedContext(false),
m_RHIResourceManagers(nullptr),
- m_commandExecuter(new Qt3DRender::Debug::CommandExecuter(this)),
+ m_commandExecuter(new Qt3DRender::DebugRhi::CommandExecuter(this)),
m_shouldSwapBuffers(true)
{
std::fill_n(m_textureTransform, 4, 0.f);
@@ -2199,8 +2199,10 @@ void Renderer::jobsDone(Qt3DCore::QAspectManager *manager)
// called in main thread once all jobs are done running
// sync captured renders to frontend
+ QMutexLocker lock(&m_pendingRenderCaptureSendRequestsMutex);
const std::vector<Qt3DCore::QNodeId> pendingCaptureIds =
Qt3DCore::moveAndClear(m_pendingRenderCaptureSendRequests);
+ lock.unlock();
for (const Qt3DCore::QNodeId &id : qAsConst(pendingCaptureIds)) {
auto *backend = static_cast<Qt3DRender::Render::RenderCapture *>(
m_nodesManager->frameGraphManager()->lookupNode(id));
@@ -2774,20 +2776,21 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo)
QRect rect(QPoint(0, 0), size);
if (!request.rect.isEmpty())
rect = rect.intersected(request.rect);
- QImage image;
if (!rect.isEmpty()) {
// Bind fbo as read framebuffer
QRhiReadbackResult *readBackResult = new QRhiReadbackResult;
readBackResult->completed = [this, readBackResult, renderCaptureId, request] () {
const QImage::Format fmt = QImage::Format_RGBA8888_Premultiplied; // fits QRhiTexture::RGBA8
const uchar *p = reinterpret_cast<const uchar *>(readBackResult->data.constData());
- const QImage image(p, readBackResult->pixelSize.width(), readBackResult->pixelSize.height(), fmt);
+ const QImage image(p, readBackResult->pixelSize.width(), readBackResult->pixelSize.height(), fmt, [] (void *ptr) {
+ delete static_cast<QRhiReadbackResult *>(ptr);
+ }, readBackResult);
Render::RenderCapture *renderCapture = static_cast<Render::RenderCapture*>(m_nodesManager->frameGraphManager()->lookupNode(renderCaptureId));
renderCapture->addRenderCapture(request.captureId, image);
+ QMutexLocker lock(&m_pendingRenderCaptureSendRequestsMutex);
if (!Qt3DCore::contains(m_pendingRenderCaptureSendRequests, renderCaptureId))
m_pendingRenderCaptureSendRequests.push_back(renderCaptureId);
- delete readBackResult;
};
QRhiReadbackDescription readbackDesc;