aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/compressedtexture
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-06-04 21:32:01 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-06-08 09:55:53 +0200
commit3f5e21a0cc9f41f1747e5c431695e7798ee489db (patch)
treeccd9f02554d16f68fb66a8f2dd59368dd1a43c30 /src/quick/scenegraph/compressedtexture
parentc8dd51333f14941d9a5c2d3798768df342aa48d4 (diff)
Remove OpenGL dependency from QSGTexture
The QSGTexture API is now clean, the OpenGL-specific functions are removed. Docs are to be updated in a separate patch. QSGPlainTexture, and a number of texture related places have to follow suit. The OpenGL atlas texture implementation is now removed. Task-number: QTBUG-84717 Task-number: QTBUG-84623 Change-Id: I1aab3b8b9145bb74ad39ef836ce540fc851292c5 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/scenegraph/compressedtexture')
-rw-r--r--src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp77
-rw-r--r--src/quick/scenegraph/compressedtexture/qsgcompressedtexture_p.h3
2 files changed, 0 insertions, 80 deletions
diff --git a/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp b/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp
index c7176875d6..bfb0023527 100644
--- a/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp
+++ b/src/quick/scenegraph/compressedtexture/qsgcompressedtexture.cpp
@@ -39,9 +39,7 @@
#include "qsgcompressedtexture_p.h"
-#include <QOpenGLContext>
#include <QOpenGLTexture>
-#include <QOpenGLFunctions>
#include <QDebug>
#include <QtQuick/private/qquickwindow_p.h>
#include <QtQuick/private/qquickitem_p.h>
@@ -61,41 +59,11 @@ QSGCompressedTexture::QSGCompressedTexture(const QTextureFileData &texData)
QSGCompressedTexture::~QSGCompressedTexture()
{
-#if QT_CONFIG(opengl)
- if (m_textureId) {
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- QOpenGLFunctions *funcs = ctx ? ctx->functions() : nullptr;
- if (!funcs)
- return;
-
- funcs->glDeleteTextures(1, &m_textureId);
- }
-#endif
-
delete m_texture;
}
-int QSGCompressedTexture::textureId() const
-{
-#if QT_CONFIG(opengl)
- if (!m_textureId) {
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- QOpenGLFunctions *funcs = ctx ? ctx->functions() : nullptr;
- if (!funcs)
- return 0;
-
- funcs->glGenTextures(1, &m_textureId);
- }
-#endif
- return m_textureId;
-}
-
qint64 QSGCompressedTexture::comparisonKey() const
{
- // not textureId() as that would create an id when not yet done - that's not wanted here
- if (m_textureId)
- return m_textureId;
-
if (m_texture)
return qint64(m_texture);
@@ -118,51 +86,6 @@ bool QSGCompressedTexture::hasMipmaps() const
return false;
}
-void QSGCompressedTexture::bind()
-{
-#if QT_CONFIG(opengl)
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- QOpenGLFunctions *funcs = ctx ? ctx->functions() : nullptr;
- if (!funcs)
- return;
-
- if (!textureId())
- return;
-
- funcs->glBindTexture(GL_TEXTURE_2D, m_textureId);
-
- if (m_uploaded)
- return;
-
- if (!m_textureData.isValid()) {
- qCDebug(QSG_LOG_TEXTUREIO, "Invalid texture data for %s", m_textureData.logName().constData());
- funcs->glBindTexture(GL_TEXTURE_2D, 0);
- return;
- }
-
- if (Q_UNLIKELY(QSG_LOG_TEXTUREIO().isDebugEnabled())) {
- qCDebug(QSG_LOG_TEXTUREIO) << "Uploading texture" << m_textureData;
- while (funcs->glGetError() != GL_NO_ERROR);
- }
-
- funcs->glCompressedTexImage2D(GL_TEXTURE_2D, 0, m_textureData.glInternalFormat(),
- m_size.width(), m_size.height(), 0, m_textureData.dataLength(),
- m_textureData.data().constData() + m_textureData.dataOffset());
-
- if (Q_UNLIKELY(QSG_LOG_TEXTUREIO().isDebugEnabled())) {
- GLuint error = funcs->glGetError();
- if (error != GL_NO_ERROR) {
- qCDebug(QSG_LOG_TEXTUREIO, "glCompressedTexImage2D failed for %s, error 0x%x", m_textureData.logName().constData(), error);
- }
- }
-
- m_textureData = QTextureFileData(); // Release this memory, not needed anymore
-
- updateBindOptions(true);
- m_uploaded = true;
-#endif // QT_CONFIG(opengl)
-}
-
QSGCompressedTexture::FormatInfo QSGCompressedTexture::formatInfo(quint32 glTextureFormat)
{
switch (glTextureFormat) {
diff --git a/src/quick/scenegraph/compressedtexture/qsgcompressedtexture_p.h b/src/quick/scenegraph/compressedtexture/qsgcompressedtexture_p.h
index 228f8dd7b7..cf62c4f893 100644
--- a/src/quick/scenegraph/compressedtexture/qsgcompressedtexture_p.h
+++ b/src/quick/scenegraph/compressedtexture/qsgcompressedtexture_p.h
@@ -74,8 +74,6 @@ public:
bool hasMipmaps() const override;
qint64 comparisonKey() const override;
- int textureId() const override;
- void bind() override;
QRhiTexture *rhiTexture() const override;
void commitTextureOperations(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates) override;
@@ -92,7 +90,6 @@ public:
protected:
QTextureFileData m_textureData;
QSize m_size;
- mutable uint m_textureId = 0;
QRhiTexture *m_texture = nullptr;
bool m_hasAlpha = false;
bool m_uploaded = false;