summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJean-Michaƫl Celerier <jean-michael.celerier@kdab.com>2020-06-08 08:44:43 +0200
committerPaul Lemire <paul.lemire@kdab.com>2020-07-07 17:58:00 +0200
commit858e0ce0ef39e3094e09c19fa27a896be4abfe74 (patch)
tree3479dbbe4d7c18d45bdb4510d90eba0fd8f18882 /src
parentcbe4f6720b965b88bdc5b9e47c76d40215ed7e24 (diff)
rhi: cleanup code which was only relevant for opengl renderer
Change-Id: Idabb992272886d2f358a9aa4ea5374dc309f98ab Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp87
-rw-r--r--src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h10
-rw-r--r--src/plugins/renderers/rhi/renderer/renderer_p.h2
3 files changed, 5 insertions, 94 deletions
diff --git a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp
index 07170c4fb..a75334d84 100644
--- a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp
+++ b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp
@@ -502,7 +502,6 @@ SubmissionContext::SubmissionContext()
: m_ownCurrent(true),
m_id(nextFreeContextId()),
m_surface(nullptr),
- m_activeShader(nullptr),
m_renderTargetFormat(QAbstractTexture::NoFormat),
m_material(nullptr),
m_renderer(nullptr),
@@ -635,56 +634,20 @@ bool SubmissionContext::beginDrawing(QSurface *surface)
m_surface = surface;
- // TO DO: Find a way to make to pause work if the window is not exposed
- // if (m_surface && m_surface->surfaceClass() == QSurface::Window) {
- // qDebug() << Q_FUNC_INFO << 1;
- // if (!static_cast<QWindow *>(m_surface)->isExposed())
- // return false;
- // qDebug() << Q_FUNC_INFO << 2;
- // }
-
- // Makes the surface current on the OpenGLContext
- // and sets the right glHelper
- // m_ownCurrent = !(m_gl->surface() == m_surface);
- // if (m_ownCurrent && !makeCurrent(m_surface))
- // return false;
-
// TODO: cache surface format somewhere rather than doing this every time render surface changes
resolveRenderTargetFormat();
-#if defined(QT3D_RENDER_ASPECT_RHI_DEBUG)
- GLint err = m_gl->functions()->glGetError();
- if (err != 0) {
- qCWarning(Backend) << Q_FUNC_INFO << "glGetError:" << err;
- }
-#endif
-
Q_ASSERT(isInitialized());
- // need to reset these values every frame, may get overwritten elsewhere
- RHI_UNIMPLEMENTED;
-
- if (m_activeShader) {
- m_activeShader = nullptr;
- }
-
// Check if we have a swapchain for the Window, if not create one
SwapChainInfo *swapChainInfo = swapChainForSurface(surface);
QRhiSwapChain *swapChain = swapChainInfo->swapChain;
- // TO DO: Check if that's required all the time
- {
- // Rebuild RenderPassDescriptor
- // TODO -> this is not necessary, swapChain->buildOrResize already does it
- // swapChainInfo->renderBuffer->setPixelSize(surface->size());
- // swapChainInfo->renderBuffer->build();
-
- // Resize swapchain if needed
- if (m_surface->size() != swapChain->currentPixelSize()) {
- bool couldRebuild = swapChain->createOrResize();
- if (!couldRebuild)
- return false;
- }
+ // Resize swapchain if needed
+ if (m_surface->size() != swapChain->currentPixelSize()) {
+ bool couldRebuild = swapChain->createOrResize();
+ if (!couldRebuild)
+ return false;
}
m_currentSwapChain = swapChain;
@@ -700,16 +663,6 @@ void SubmissionContext::endDrawing(bool swapBuffers)
{
Q_UNUSED(swapBuffers);
m_rhi->endFrame(m_currentSwapChain, {});
-
- RHI_UNIMPLEMENTED;
- //* if (swapBuffers)
- //* m_gl->swapBuffers(m_surface);
- //* if (m_ownCurrent)
- //* m_gl->doneCurrent();
- // m_textureContext.endDrawing();
- //* static int i = 0;
- //* if (i++ == 10)
- //* std::exit(0);
}
QImage SubmissionContext::readFramebuffer(const QRect &rect)
@@ -899,27 +852,6 @@ void SubmissionContext::releaseResources()
//* }
}
-// Called only from RenderThread
-bool SubmissionContext::activateShader(RHIShader *shader)
-{
- Q_UNUSED(shader);
- RHI_UNIMPLEMENTED;
- //* if (shader->shaderProgram() != m_activeShader) {
- //* // Ensure material uniforms are re-applied
- //* m_material = nullptr;
- //*
- //* m_activeShader = shader->shaderProgram();
- //* if (Q_LIKELY(m_activeShader != nullptr)) {
- //* m_activeShader->bind();
- //* } else {
- //* m_glHelper->useProgram(0);
- //* qWarning() << "No shader program found";
- //* return false;
- //* }
- //* }
- return true;
-}
-
void SubmissionContext::bindFrameBufferAttachmentHelper(GLuint fboId,
const AttachmentPack &attachments)
{
@@ -983,15 +915,6 @@ void SubmissionContext::activateDrawBuffers(const AttachmentPack &attachments)
//* }
}
-void SubmissionContext::setActiveMaterial(Material *rmat)
-{
- if (m_material == rmat)
- return;
-
- // m_textureContext.deactivateTexturesWithScope(TextureSubmissionContext::TextureScopeMaterial);
- m_material = rmat;
-}
-
void SubmissionContext::applyState(const StateVariant &stateVariant,
QRhiGraphicsPipeline *graphicsPipeline)
{
diff --git a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h
index 15ea30635..1daa971fd 100644
--- a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h
+++ b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h
@@ -143,10 +143,6 @@ public:
RHIShaderManager *rhiShaderManager);
- // Shaders
- bool activateShader(RHIShader *shader);
- RHIShader *activeShader() const { return m_activeShader; }
-
// FBO
QImage readFramebuffer(const QRect &rect);
void blitFramebuffer(Qt3DCore::QNodeId outputRenderTargetId,
@@ -195,10 +191,6 @@ public:
QSurfaceFormat format() const noexcept;
private:
- // Material
- Material *activeMaterial() const { return m_material; }
- void setActiveMaterial(Material *rmat);
-
// FBO
void bindFrameBufferAttachmentHelper(GLuint fboId, const AttachmentPack &attachments);
void activateDrawBuffers(const AttachmentPack &attachments);
@@ -217,8 +209,6 @@ private:
QSurface *m_surface;
QSize m_surfaceSize;
- RHIShader *m_activeShader;
-
QHash<Qt3DCore::QNodeId, HRHIBuffer> m_renderBufferHash;
QHash<Qt3DCore::QNodeId, GLuint> m_renderTargets;
QHash<GLuint, QSize> m_renderTargetsSize;
diff --git a/src/plugins/renderers/rhi/renderer/renderer_p.h b/src/plugins/renderers/rhi/renderer/renderer_p.h
index 1f2ffb938..4e1780f56 100644
--- a/src/plugins/renderers/rhi/renderer/renderer_p.h
+++ b/src/plugins/renderers/rhi/renderer/renderer_p.h
@@ -404,8 +404,6 @@ private:
QScreen *m_screen = nullptr;
QSharedPointer<ResourceAccessor> m_scene2DResourceAccessor;
- QOffscreenSurface *m_fallbackSurface {};
-
bool m_hasSwapChain = false;
int m_jobsInLastFrame = 0;