aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp5
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp2
-rw-r--r--src/quick/scenegraph/qsgcontext_p.h2
-rw-r--r--src/quick/scenegraph/qsgdefaultcontext.cpp27
-rw-r--r--src/quick/scenegraph/qsgdefaultrendercontext.cpp61
-rw-r--r--src/quick/scenegraph/qsgdefaultrendercontext_p.h27
-rw-r--r--src/quick/scenegraph/util/qsgdefaultpainternode.cpp3
7 files changed, 9 insertions, 118 deletions
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index e2d36b6ec0..f3d2d242d2 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -4375,8 +4375,9 @@ void QQuickContext2D::init(QQuickCanvasItem *canvasItem, const QVariantMap &args
m_texture->moveToThread(renderThread);
#if QT_CONFIG(opengl)
if (m_renderTarget == QQuickCanvasItem::FramebufferObject && renderThread != sceneGraphThread) {
- auto openglRenderContext = static_cast<const QSGDefaultRenderContext *>(QQuickWindowPrivate::get(window)->context);
- QOpenGLContext *cc = openglRenderContext->openglContext();
+ //auto openglRenderContext = static_cast<const QSGDefaultRenderContext *>(QQuickWindowPrivate::get(window)->context);
+ // ### glpurge
+ QOpenGLContext *cc = nullptr; // openglRenderContext->openglContext();
m_surface.reset(new QOffscreenSurface);
m_surface->setFormat(window->format());
m_surface->create();
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index 6536739a31..216b90598b 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -1036,7 +1036,7 @@ void Renderer::invalidateAndRecycleBatch(Batch *b)
void Renderer::map(Buffer *buffer, int byteSize, bool isIndexBuf)
{
- if (!m_context->hasBrokenIndexBufferObjects() && m_visualizer->mode() == Visualizer::VisualizeNothing) {
+ if (m_visualizer->mode() == Visualizer::VisualizeNothing) {
// Common case, use a shared memory pool for uploading vertex data to avoid
// excessive reevaluation
QDataBuffer<char> &pool = m_context->separateIndexBuffer() && isIndexBuf
diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h
index 934753598b..7140432c30 100644
--- a/src/quick/scenegraph/qsgcontext_p.h
+++ b/src/quick/scenegraph/qsgcontext_p.h
@@ -204,8 +204,6 @@ public:
virtual QSGRenderer *createRenderer(RenderMode renderMode = RenderMode2D) = 0;
virtual QSGTexture *compressedTextureForFactory(const QSGCompressedTextureFactory *) const;
- virtual void setAttachToGraphicsContext(bool attach) { Q_UNUSED(attach); }
-
virtual int maxTextureSize() const = 0;
void registerFontengineForCleanup(QFontEngine *engine);
diff --git a/src/quick/scenegraph/qsgdefaultcontext.cpp b/src/quick/scenegraph/qsgdefaultcontext.cpp
index 8318d96eac..bb998df912 100644
--- a/src/quick/scenegraph/qsgdefaultcontext.cpp
+++ b/src/quick/scenegraph/qsgdefaultcontext.cpp
@@ -154,28 +154,6 @@ void QSGDefaultContext::renderContextInitialized(QSGRenderContext *renderContext
#endif
}
- static bool dumped = false;
- if (!dumped && QSG_LOG_INFO().isDebugEnabled() && !rc->rhi()) {
- dumped = true;
- QSurfaceFormat format = rc->openglContext()->format();
- QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
- qCDebug(QSG_LOG_INFO, "R/G/B/A Buffers: %d %d %d %d", format.redBufferSize(),
- format.greenBufferSize(), format.blueBufferSize(), format.alphaBufferSize());
- qCDebug(QSG_LOG_INFO, "Depth Buffer: %d", format.depthBufferSize());
- qCDebug(QSG_LOG_INFO, "Stencil Buffer: %d", format.stencilBufferSize());
- qCDebug(QSG_LOG_INFO, "Samples: %d", format.samples());
- qCDebug(QSG_LOG_INFO, "GL_VENDOR: %s", (const char*)funcs->glGetString(GL_VENDOR));
- qCDebug(QSG_LOG_INFO, "GL_RENDERER: %s",
- (const char*)funcs->glGetString(GL_RENDERER));
- qCDebug(QSG_LOG_INFO, "GL_VERSION: %s", (const char*)funcs->glGetString(GL_VERSION));
- QByteArrayList exts = rc->openglContext()->extensions().values();
- std::sort(exts.begin(), exts.end());
- qCDebug(QSG_LOG_INFO, "GL_EXTENSIONS: %s", exts.join(' ').constData());
- qCDebug(QSG_LOG_INFO, "Max Texture Size: %d", rc->maxTextureSize());
- qCDebug(QSG_LOG_INFO, "Debug context: %s",
- format.testOption(QSurfaceFormat::DebugContext) ? "true" : "false");
- }
-
m_mutex.unlock();
}
@@ -320,11 +298,6 @@ void *QSGDefaultContext::getResource(QQuickWindow *window, Resource resource) co
QSGRhiSupport *rhiSupport = QSGRhiSupport::instance();
switch (resource) {
- case OpenGLContextResource:
- if (rhiSupport->graphicsApi() == OpenGL)
- return rc->openglContext();
- else
- return const_cast<void *>(rhiSupport->rifResource(resource, rc, window));
#if QT_CONFIG(vulkan)
case VulkanInstanceResource:
return window->vulkanInstance();
diff --git a/src/quick/scenegraph/qsgdefaultrendercontext.cpp b/src/quick/scenegraph/qsgdefaultrendercontext.cpp
index e3071c78cc..d939f64590 100644
--- a/src/quick/scenegraph/qsgdefaultrendercontext.cpp
+++ b/src/quick/scenegraph/qsgdefaultrendercontext.cpp
@@ -40,7 +40,6 @@
#include "qsgdefaultrendercontext_p.h"
#include <QtGui/QGuiApplication>
-#include <QOpenGLFramebufferObject>
#include <QtQuick/private/qsgbatchrenderer_p.h>
#include <QtQuick/private/qsgrenderer_p.h>
@@ -52,17 +51,11 @@
QT_BEGIN_NAMESPACE
-#define QSG_RENDERCONTEXT_PROPERTY "_q_sgrendercontext"
-
QSGDefaultRenderContext::QSGDefaultRenderContext(QSGContext *context)
: QSGRenderContext(context)
, m_rhi(nullptr)
- , m_gl(nullptr)
- , m_depthStencilManager(nullptr)
, m_maxTextureSize(0)
- , m_brokenIBOs(false)
, m_serializedRender(false)
- , m_attachToGLContext(true)
, m_rhiAtlasManager(nullptr)
, m_currentFrameCommandBuffer(nullptr)
, m_currentFrameRenderPass(nullptr)
@@ -99,7 +92,7 @@ void QSGDefaultRenderContext::initialize(const QSGRenderContext::InitParams *par
void QSGDefaultRenderContext::invalidate()
{
- if (!m_gl && !m_rhi)
+ if (!m_rhi)
return;
qDeleteAll(m_texturesToDelete);
@@ -137,22 +130,16 @@ void QSGDefaultRenderContext::invalidate()
// sequence. (see qsgdefaultglyphnode_p.cpp's init())
for (QSet<QFontEngine *>::const_iterator it = m_fontEnginesToClean.constBegin(),
end = m_fontEnginesToClean.constEnd(); it != end; ++it) {
- (*it)->clearGlyphCache(m_gl ? (void *) m_gl : (void *) m_rhi);
+ (*it)->clearGlyphCache(m_rhi);
if (!(*it)->ref.deref())
delete *it;
}
m_fontEnginesToClean.clear();
- delete m_depthStencilManager;
- m_depthStencilManager = nullptr;
qDeleteAll(m_glyphCaches);
m_glyphCaches.clear();
- if (m_gl && m_gl->property(QSG_RENDERCONTEXT_PROPERTY) == QVariant::fromValue(this))
- m_gl->setProperty(QSG_RENDERCONTEXT_PROPERTY, QVariant());
-
- m_gl = nullptr;
m_rhi = nullptr;
if (m_sg)
@@ -224,39 +211,6 @@ void QSGDefaultRenderContext::endNextRhiFrame(QSGRenderer *renderer)
m_currentFrameRenderPass = nullptr;
}
-/*!
- Returns a shared pointer to a depth stencil buffer that can be used with \a fbo.
-*/
-QSharedPointer<QSGDepthStencilBuffer> QSGDefaultRenderContext::depthStencilBufferForFbo(QOpenGLFramebufferObject *fbo)
-{
- if (!m_gl)
- return QSharedPointer<QSGDepthStencilBuffer>();
- QSGDepthStencilBufferManager *manager = depthStencilBufferManager();
- QSGDepthStencilBuffer::Format format;
- format.size = fbo->size();
- format.samples = fbo->format().samples();
- format.attachments = QSGDepthStencilBuffer::DepthAttachment | QSGDepthStencilBuffer::StencilAttachment;
- QSharedPointer<QSGDepthStencilBuffer> buffer = manager->bufferForFormat(format);
- if (buffer.isNull()) {
- buffer = QSharedPointer<QSGDepthStencilBuffer>(new QSGDefaultDepthStencilBuffer(m_gl, format));
- manager->insertBuffer(buffer);
- }
- return buffer;
-}
-
-/*!
- Returns a pointer to the context's depth/stencil buffer manager. This is useful for custom
- implementations of \l depthStencilBufferForFbo().
-*/
-QSGDepthStencilBufferManager *QSGDefaultRenderContext::depthStencilBufferManager()
-{
- if (!m_gl)
- return nullptr;
- if (!m_depthStencilManager)
- m_depthStencilManager = new QSGDepthStencilBufferManager(m_gl);
- return m_depthStencilManager;
-}
-
QSGTexture *QSGDefaultRenderContext::createTexture(const QImage &image, uint flags) const
{
bool atlas = flags & CreateTexture_Atlas;
@@ -321,17 +275,6 @@ void QSGDefaultRenderContext::initializeRhiShader(QSGMaterialShader *shader, QSh
QSGMaterialShaderPrivate::get(shader)->prepare(shaderVariant);
}
-void QSGDefaultRenderContext::setAttachToGraphicsContext(bool attach)
-{
- Q_ASSERT(!isValid());
- m_attachToGLContext = attach;
-}
-
-QSGDefaultRenderContext *QSGDefaultRenderContext::from(QOpenGLContext *context)
-{
- return qobject_cast<QSGDefaultRenderContext *>(context->property(QSG_RENDERCONTEXT_PROPERTY).value<QObject *>());
-}
-
bool QSGDefaultRenderContext::separateIndexBuffer() const
{
return m_separateIndexBuffer;
diff --git a/src/quick/scenegraph/qsgdefaultrendercontext_p.h b/src/quick/scenegraph/qsgdefaultrendercontext_p.h
index ac55fe4b6e..d92d83eb6b 100644
--- a/src/quick/scenegraph/qsgdefaultrendercontext_p.h
+++ b/src/quick/scenegraph/qsgdefaultrendercontext_p.h
@@ -54,26 +54,14 @@
#include <QtQuick/private/qsgcontext_p.h>
#include <QtGui/private/qshader_p.h>
-#if QT_CONFIG(opengl)
-#include <QtQuick/private/qsgdepthstencilbuffer_p.h>
-#endif
-
QT_BEGIN_NAMESPACE
class QRhi;
class QRhiCommandBuffer;
class QRhiRenderPassDescriptor;
-class QOpenGLContext;
class QSGMaterialShader;
-class QOpenGLFramebufferObject;
-class QSGDepthStencilBufferManager;
-class QSGDepthStencilBuffer;
class QSurface;
-namespace QSGOpenGLAtlasTexture {
- class Manager;
-}
-
namespace QSGRhiAtlasTexture {
class Manager;
}
@@ -85,8 +73,7 @@ public:
QSGDefaultRenderContext(QSGContext *context);
QRhi *rhi() const override { return m_rhi; }
- QOpenGLContext *openglContext() const { return m_gl; }
- bool isValid() const override { return m_gl || m_rhi; }
+ bool isValid() const override { return m_rhi != nullptr; }
static const int INIT_PARAMS_MAGIC = 0x50E;
struct InitParams : public QSGRenderContext::InitParams {
@@ -121,20 +108,12 @@ public:
QSGDistanceFieldGlyphCache *distanceFieldGlyphCache(const QRawFont &font) override;
- virtual QSharedPointer<QSGDepthStencilBuffer> depthStencilBufferForFbo(QOpenGLFramebufferObject *fbo);
- QSGDepthStencilBufferManager *depthStencilBufferManager();
-
QSGTexture *createTexture(const QImage &image, uint flags) const override;
QSGRenderer *createRenderer(RenderMode renderMode = RenderMode2D) override;
QSGTexture *compressedTextureForFactory(const QSGCompressedTextureFactory *factory) const override;
virtual void initializeRhiShader(QSGMaterialShader *shader, QShader::Variant shaderVariant);
- void setAttachToGraphicsContext(bool attach) override;
-
- static QSGDefaultRenderContext *from(QOpenGLContext *context);
-
- bool hasBrokenIndexBufferObjects() const { return m_brokenIBOs; }
int maxTextureSize() const override { return m_maxTextureSize; }
bool separateIndexBuffer() const;
@@ -165,12 +144,8 @@ protected:
InitParams m_initParams;
QRhi *m_rhi;
- QOpenGLContext *m_gl;
- QSGDepthStencilBufferManager *m_depthStencilManager;
int m_maxTextureSize;
- bool m_brokenIBOs;
bool m_serializedRender;
- bool m_attachToGLContext;
QSGRhiAtlasTexture::Manager *m_rhiAtlasManager;
QRhiCommandBuffer *m_currentFrameCommandBuffer;
QRhiRenderPassDescriptor *m_currentFrameRenderPass;
diff --git a/src/quick/scenegraph/util/qsgdefaultpainternode.cpp b/src/quick/scenegraph/util/qsgdefaultpainternode.cpp
index e704624a96..f0bcc82993 100644
--- a/src/quick/scenegraph/util/qsgdefaultpainternode.cpp
+++ b/src/quick/scenegraph/util/qsgdefaultpainternode.cpp
@@ -268,7 +268,8 @@ void QSGDefaultPainterNode::updateRenderTarget()
m_actualRenderTarget == QQuickPaintedItem::InvertedYFramebufferObject)
{
Q_ASSERT(!m_context->rhi());
- const QOpenGLContext *ctx = m_context->openglContext();
+ // ### glpurge
+ const QOpenGLContext *ctx = nullptr; // m_context->openglContext();
if (m_fbo && !m_dirtyGeometry && (!ctx->format().samples() || !m_multisamplingSupported))
return;