diff options
author | Mike Krus <mike.krus@kdab.com> | 2019-03-14 11:19:31 +0000 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2019-03-14 17:23:14 +0000 |
commit | a7e8df28c7f667a8f1e23ff865268e7f06d43328 (patch) | |
tree | 399423291b466e3a101bd27d853a0d230ead0678 | |
parent | 31aa763b0d1f4ec2439c6dc33b4a63b88c16369e (diff) | |
download | qt3d-a7e8df28c7f667a8f1e23ff865268e7f06d43328.tar.gz |
Fix member overloads
m_currentVAO and m_glHelper were hiding members in parent class.
Removed overloads and cleaned up initialization.
Change-Id: I174dffc63c812e0b4241018c86e560de48a31a0b
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
4 files changed, 10 insertions, 26 deletions
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp b/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp index 59b5701f8..2b8076336 100644 --- a/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp +++ b/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp @@ -130,6 +130,7 @@ GraphicsContext::GraphicsContext() , m_glHelper(nullptr) , m_shaderCache(nullptr) , m_debugLogger(nullptr) + , m_currentVAO(nullptr) { } @@ -199,15 +200,20 @@ bool GraphicsContext::makeCurrent(QSurface *surface) return false; } + initializeHelpers(surface); + + return true; +} + +void GraphicsContext::initializeHelpers(QSurface *surface) +{ // Set the correct GL Helper depending on the surface // If no helper exists, create one - m_glHelper = m_glHelpers.value(surface); if (!m_glHelper) { m_glHelper = resolveHighestOpenGLFunctions(); m_glHelpers.insert(surface, m_glHelper); } - return true; } void GraphicsContext::doneCurrent() diff --git a/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h b/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h index 7bc79996c..73d1f316c 100644 --- a/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h +++ b/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h @@ -177,6 +177,7 @@ public: bool supportsVAO() const { return m_supportsVAO; } void initialize(); + void initializeHelpers(QSurface *surface); GraphicsHelperInterface *resolveHighestOpenGLFunctions(); bool m_initialized; diff --git a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp index dc1e85b8e..60fa9ed83 100644 --- a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp +++ b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp @@ -394,7 +394,6 @@ SubmissionContext::SubmissionContext() , m_stateSet(nullptr) , m_renderer(nullptr) , m_uboTempArray(QByteArray(1024, 0)) - , m_currentVAO(nullptr) { static_contexts[m_id] = this; } @@ -462,10 +461,6 @@ bool SubmissionContext::beginDrawing(QSurface *surface) // TODO: cache surface format somewhere rather than doing this every time render surface changes resolveRenderTargetFormat(); - // Sets or Create the correct m_glHelper - // for the current surface - activateGLHelper(); - #if defined(QT3D_RENDER_ASPECT_OPENGL_DEBUG) GLint err = m_gl->functions()->glGetError(); if (err != 0) { @@ -475,13 +470,13 @@ bool SubmissionContext::beginDrawing(QSurface *surface) if (!isInitialized()) initialize(); + initializeHelpers(m_surface); // need to reset these values every frame, may get overwritten elsewhere m_gl->functions()->glClearColor(m_currClearColorValue.redF(), m_currClearColorValue.greenF(), m_currClearColorValue.blueF(), m_currClearColorValue.alphaF()); m_gl->functions()->glClearDepthf(m_currClearDepthValue); m_gl->functions()->glClearStencil(m_currClearStencilValue); - if (m_activeShader) { m_activeShader = nullptr; m_activeShaderDNA = 0; @@ -815,20 +810,6 @@ void SubmissionContext::setOpenGLContext(QOpenGLContext* ctx) m_gl = ctx; } -void SubmissionContext::activateGLHelper() -{ - // Sets the correct GL Helper depending on the surface - // If no helper exists, create one - m_glHelper = m_glHelpers.value(m_surface); - if (!m_glHelper) { - m_glHelper = resolveHighestOpenGLFunctions(); - m_glHelpers.insert(m_surface, m_glHelper); - // Note: OpenGLContext is current at this point - m_gl->functions()->glDisable(GL_DITHER); - } -} - - // Called only from RenderThread bool SubmissionContext::activateShader(ProgramDNA shaderDNA) { diff --git a/src/render/renderers/opengl/graphicshelpers/submissioncontext_p.h b/src/render/renderers/opengl/graphicshelpers/submissioncontext_p.h index d502a8b27..52c6034d7 100644 --- a/src/render/renderers/opengl/graphicshelpers/submissioncontext_p.h +++ b/src/render/renderers/opengl/graphicshelpers/submissioncontext_p.h @@ -101,7 +101,6 @@ public: bool beginDrawing(QSurface *surface); void endDrawing(bool swapBuffers); - void activateGLHelper(); void releaseOpenGL(); void setOpenGLContext(QOpenGLContext* ctx); @@ -198,8 +197,6 @@ private: QHash<GLuint, QSize> m_renderTargetsSize; QAbstractTexture::TextureFormat m_renderTargetFormat; - QHash<QSurface *, GraphicsHelperInterface*> m_glHelpers; - // active textures, indexed by texture unit struct ActiveTexture { GLTexture *texture = nullptr; @@ -226,7 +223,6 @@ private: // Attributes friend class OpenGLVertexArrayObject; - OpenGLVertexArrayObject *m_currentVAO; struct VAOVertexAttribute { |