[-]
[+]
|
Changed |
_service:tar_git:qtscenegraph-adaptation.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:qtscenegraph-adaptation-droid.spec
^
|
|
[-]
[+]
|
Changed |
_service:tar_git:qtscenegraph-adaptation-0.6.4.tar.bz2/customcontext/context.cpp
^
|
@@ -51,7 +51,6 @@
#include <QtQuick/QSGVertexColorMaterial>
#include <QtQuick/QSGOpaqueTextureMaterial>
#include <QtQuick/QSGTextureMaterial>
-#include <QtQuick/QQuickWindow>
#include <private/qsgdefaultimagenode_p.h>
#include <private/qsgdefaultrectanglenode_p.h>
#include <private/qsgdistancefieldglyphnode_p_p.h>
@@ -69,10 +68,6 @@
#include "renderer/overlaprenderer.h"
#endif
-#ifdef CUSTOMCONTEXT_SIMPLERENDERER
-#include "renderer/simplerenderer.h"
-#endif
-
#ifdef CUSTOMCONTEXT_MACTEXTURE
#include "mactexture.h"
#endif
@@ -286,24 +281,22 @@
}
+#ifdef CUSTOMCONTEXT_HYBRISTEXTURE
void Context::renderContextInitialized(QSGRenderContext *ctx)
{
-#if defined(CUSTOMCONTEXT_HYBRISTEXTURE)
// This check is delayed until there is an EGL display present.
m_hybrisTexture = qEnvironmentVariableIsEmpty("CUSTOMCONTEXT_NO_HYBRISTEXTURE");
if (m_hybrisTexture && strstr(eglQueryString(eglGetCurrentDisplay(), EGL_EXTENSIONS), "EGL_HYBRIS_native_buffer") == 0) {
qDebug() << "EGL_HYBRIS_native_buffer is not available...";
m_hybrisTexture = false;
}
-
#if defined(CUSTOMCONTEXT_DEBUG)
qDebug(" - EGL/Hybris based texture: %s", m_hybrisTexture ? "yes" : "no");
#endif
-#endif // CUSTOMCONTEXT_HYBRISTEXTURE
-
QSGContext::renderContextInitialized(ctx);
}
+#endif
@@ -438,56 +431,7 @@
}
#endif
-#if QT_VERSION >= 0x050600
-QSGTexture *CONTEXT_CLASS::createTexture(const QImage &image, uint flags) const
-{
- if (flags & QQuickWindow::TextureCanUseAtlas) {
-#ifdef CUSTOMCONTEXT_ATLASTEXTURE
- if (m_atlasTexture && atlas) {
- QSGTexture *t = const_cast<Context *>(this)->m_atlasManager.create(image);
- if (t)
- return t;
- }
-#endif
- } else {
-#ifdef CUSTOMCONTEXT_EGLGRALLOCTEXTURE
- if (static_cast<Context *>(sceneGraphContext())->hasEglGrallocTextures()) {
- // Only use gralloc textures for textures created outside the render thread.
- // They can still block for as long as normal texture, so better to not waste
- // the precious resource.
- if (openglContext() != 0 && openglContext()->thread() != QThread::currentThread()) {
- EglGrallocTexture *t = EglGrallocTexture::create(image);
- if (t)
- return t;
- }
- }
-#endif
-#ifdef CUSTOMCONTEXT_HYBRISTEXTURE
- if (static_cast<Context *>(sceneGraphContext())->hasHybrisTextures()) {
-
- // Only use hybris textures for textures created outside the render thread.
- // They can still block for as long as normal texture, so better to not waste
- // the precious resource.
- if (openglContext() != 0 && openglContext()->thread() != QThread::currentThread()) {
- HybrisTexture *t = HybrisTexture::create(image);
- if (t)
- return t;
- }
- }
-#endif
- }
-
-#ifdef CUSTOMCONTEXT_MACTEXTURE
- if (m_macTexture)
- return new MacTexture(image);
-#endif
-
-
- return CONTEXT_CLASS_BASE::createTexture(image, flags);
-}
-
-#else
QSGTexture *CONTEXT_CLASS::createTexture(const QImage &image) const
{
@@ -539,12 +483,8 @@
return CONTEXT_CLASS_BASE::createTextureNoAtlas(image);
}
-
-// Qt 5.2 branch
#endif
-// Qt 5.6 branch
-#endif
QSGRenderer *CONTEXT_CLASS::createRenderer()
@@ -557,9 +497,6 @@
return renderer;
}
#endif
-#ifdef CUSTOMCONTEXT_SIMPLERENDERER
- return new QSGSimpleRenderer::Renderer(this);
-#endif
return CONTEXT_CLASS_BASE::createRenderer();
}
|
[-]
[+]
|
Changed |
_service:tar_git:qtscenegraph-adaptation-0.6.4.tar.bz2/customcontext/context.h
^
|
@@ -75,14 +75,8 @@
void initialize(QOpenGLContext *context);
void invalidate();
void renderNextFrame(QSGRenderer *renderer, GLuint fbo);
-
-#if QT_VERSION < 0x050600
QSGTexture *createTexture(const QImage &image) const;
QSGTexture *createTextureNoAtlas(const QImage &image) const;
-#else
- QSGTexture *createTexture(const QImage &image, uint flags) const;
-#endif
-
QSGRenderer *createRenderer();
#ifdef PROGRAM_BINARY
|
[-]
[+]
|
Changed |
_service:tar_git:qtscenegraph-adaptation-0.6.4.tar.bz2/customcontext/customcontext.pro
^
|
@@ -84,7 +84,7 @@
HEADERS += texture/eglgralloctexture.h
INCLUDEPATH += texture $(ANDROID_SDK_INCLUDE) $(ANDROID_SDK_INCLUDE)/android
- LIBS += -lhardware -lEGL
+ LIBS += -lhardware
} else {
message("eglgralloctexure .........: no")
@@ -96,7 +96,6 @@
SOURCES += texture/hybristexture.cpp
HEADERS += texture/hybristexture.h
INCLUDEPATH += texture
- LIBS += -lEGL
} else {
message("hybristexture ............: no")
@@ -164,14 +163,6 @@
message("overlaprenderer ..........: no")
}
-simplerenderer:{
- message("simplerenderer ...........: yes")
- DEFINES += CUSTOMCONTEXT_SIMPLERENDERER
- SOURCES += renderer/simplerenderer.cpp
- HEADERS += renderer/simplerenderer.h renderer/qsgbasicshadermanager_p.h renderer/qsgbasicclipmanager_p.h
-} else {
- message("simplerenderer ...........: no")
-}
############################################################
@@ -205,7 +196,6 @@
message("programbinary ............: yes")
DEFINES += PROGRAM_BINARY
SOURCES += programbinary.cpp
- LIBS += -lEGL
} else {
message("programbinary ............: no")
}
|
[-]
[+]
|
Changed |
_service:tar_git:qtscenegraph-adaptation-0.6.4.tar.bz2/customcontext/programbinary.cpp
^
|
@@ -75,8 +75,8 @@
typedef void (* _glGetProgramBinary)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
typedef void (* _glProgramBinary)(GLuint program, GLenum binaryFormat, const void *binary, GLint length);
}
-static _glGetProgramBinary glGetProgramBinaryFunc;
-static _glProgramBinary glProgramBinaryFunc;
+static _glGetProgramBinary glGetProgramBinary;
+static _glProgramBinary glProgramBinary;
namespace CustomContext {
@@ -131,19 +131,10 @@
qDebug() << "Customcontext: binary shaders stored in:" << m_location;
#endif
- // Verify OpenGL 3 support exists
- QString version = (const char *)glGetString(GL_VERSION);
- m_hasOpenGLES3 = version.startsWith("OpenGL ES 3");
-
- if (m_hasOpenGLES3) {
- glGetProgramBinaryFunc = (_glGetProgramBinary) eglGetProcAddress("glGetProgramBinary");
- glProgramBinaryFunc = (_glProgramBinary) eglGetProcAddress("glProgramBinary");
- } else {
- glGetProgramBinaryFunc = (_glGetProgramBinary) eglGetProcAddress("glGetProgramBinaryOES");
- glProgramBinaryFunc = (_glProgramBinary) eglGetProcAddress("glProgramBinaryOES");
- }
+ glGetProgramBinary = (_glGetProgramBinary) eglGetProcAddress("glGetProgramBinaryOES");
+ glProgramBinary = (_glProgramBinary) eglGetProcAddress("glProgramBinaryOES");
- Q_ASSERT(glGetProgramBinaryFunc && glProgramBinaryFunc);
+ Q_ASSERT(glGetProgramBinary && glProgramBinary);
}
static ProgramBinaryStore *self() {
@@ -157,7 +148,6 @@
ProgramBinary *lookup(const QByteArray key);
void insert(ProgramBinary *shader);
void purge(const QByteArray &key);
- bool hasOpenGLES3() { return m_hasOpenGLES3; }
void sanityCheck();
@@ -172,8 +162,6 @@
int m_maxShaderCount;
- bool m_hasOpenGLES3;
-
static ProgramBinaryStore *instance;
};
@@ -251,7 +239,7 @@
QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
funcs->glGetProgramiv(id, GL_PROGRAM_BINARY_LENGTH, &length);
b->blob.resize(length);
- glGetProgramBinaryFunc(id, b->blob.size(), &length, &b->format, b->blob.data());
+ glGetProgramBinary(id, b->blob.size(), &length, &b->format, b->blob.data());
b->key = key;
if (length != b->blob.size()) {
#ifdef CUSTOMCONTEXT_DEBUG
@@ -266,9 +254,7 @@
void RenderContext::compile(QSGMaterialShader *shader, QSGMaterial *material, const char *vertex, const char *fragment)
{
- ProgramBinaryStore *store = ProgramBinaryStore::self();
- if (!store->hasOpenGLES3())
- Q_ASSERT(QOpenGLContext::currentContext()->extensions().contains("GL_OES_get_program_binary"));
+ Q_ASSERT(QOpenGLContext::currentContext()->extensions().contains("GL_OES_get_program_binary"));
// We cannot cache shaders which have custom compilation
if (material->flags() & QSGMaterial::CustomCompileStep) {
@@ -276,6 +262,7 @@
return;
}
+ ProgramBinaryStore *store = ProgramBinaryStore::self();
QByteArray key = store->key(shader, vertex, fragment);
ProgramBinary *binary = store->lookup(key);
@@ -294,7 +281,7 @@
if (p->programId() == 0)
p->addShader(0);
// Upload precompiled binary
- glProgramBinaryFunc(p->programId(), binary->format, binary->blob.data(), binary->blob.size());
+ glProgramBinary(p->programId(), binary->format, binary->blob.data(), binary->blob.size());
p->link();
if (!p->isLinked()) {
#ifdef CUSTOMCONTEXT_DEBUG
|
[-]
[+]
|
Changed |
_service:tar_git:qtscenegraph-adaptation-0.6.4.tar.bz2/customcontext/texture/eglgralloctexture.cpp
^
|
@@ -54,13 +54,26 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
-#include "drawhelper.h"
-
// Taken from libhybris
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
+// Taken from qdrawhelper_p.h
+static inline uint PREMUL(uint x) {
+ uint a = x >> 24;
+ uint t = (x & 0xff00ff) * a;
+ t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
+ t &= 0xff00ff;
+
+ x = ((x >> 8) & 0xff) * a;
+ x = (x + ((x >> 8) & 0xff) + 0x80);
+ x &= 0xff00;
+ x |= t | (a << 24);
+ return x;
+}
+static inline int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
+
#ifndef QSG_NO_RENDER_TIMING
static bool qsg_render_timing = !qgetenv("QSG_RENDER_TIMING").isEmpty();
|
[-]
[+]
|
Changed |
_service:tar_git:qtscenegraph-adaptation-0.6.4.tar.bz2/customcontext/texture/hybristexture.cpp
^
|
@@ -42,6 +42,8 @@
#include <QtCore/qdebug.h>
#include <QtCore/QCoreApplication>
+#include <QtGui/private/qdrawhelper_p.h>
+
#include "hybristexture.h"
#include <QtCore/QElapsedTimer>
@@ -51,8 +53,6 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
-#include "drawhelper.h"
-
#ifndef QSG_NO_RENDER_TIMING
static bool qsg_render_timing = !qgetenv("QSG_RENDER_TIMING").isEmpty();
static QElapsedTimer qsg_renderer_timer;
@@ -67,8 +67,6 @@
#define EGL_NATIVE_BUFFER_HYBRIS 0x3140
-static bool customcontext_no_bgra = !qgetenv("QT_OPENGL_NO_BGRA").isEmpty();
-
namespace CustomContext {
extern "C" {
@@ -102,30 +100,16 @@
eglHybrisReleaseNativeBuffer = (_eglHybrisReleaseNativeBuffer) eglGetProcAddress("eglHybrisReleaseNativeBuffer");
}
-NativeBuffer::NativeBuffer(const QImage &image_in)
+NativeBuffer::NativeBuffer(const QImage &image)
{
- const QImage::Format iformat = image_in.format();
- QImage image_swapped;
- bool image_is_rgba = iformat == QImage::Format_RGBA8888_Premultiplied
+ hasAlpha = image.hasAlphaChannel();
+ const QImage::Format iformat = image.format();
+ format = iformat == QImage::Format_RGBA8888_Premultiplied
|| iformat == QImage::Format_RGBX8888
- || iformat == QImage::Format_RGBA8888;
- const QImage &image = (customcontext_no_bgra && !image_is_rgba) ? image_swapped : image_in;
+ || iformat == QImage::Format_RGBA8888
+ ? HYBRIS_PIXEL_FORMAT_RGBA_8888
+ : HYBRIS_PIXEL_FORMAT_BGRA_8888;
int usage = HYBRIS_USAGE_SW_READ_RARELY | HYBRIS_USAGE_SW_WRITE_RARELY | HYBRIS_USAGE_HW_TEXTURE;
-
- if (customcontext_no_bgra && !image_is_rgba) {
- image_swapped = image_in.rgbSwapped();
- }
-
- hasAlpha = image.hasAlphaChannel();
-
- if (!customcontext_no_bgra) {
- format = image_is_rgba
- ? HYBRIS_PIXEL_FORMAT_RGBA_8888
- : HYBRIS_PIXEL_FORMAT_BGRA_8888;
- } else {
- format = HYBRIS_PIXEL_FORMAT_RGBA_8888;
- }
-
width = image.width();
height = image.height();
stride = 0;
@@ -287,10 +271,11 @@
return buffer;
}
-HybrisTexture::HybrisTexture(QSharedPointer<NativeBuffer> buffer)
+HybrisTexture::HybrisTexture(NativeBuffer *buffer)
: m_id(0)
, m_buffer(buffer)
, m_bound(false)
+ , m_ownsBuffer(false)
{
Q_ASSERT(buffer);
#ifdef CUSTOMCONTEXT_DEBUG
@@ -302,6 +287,8 @@
{
if (m_id)
glDeleteTextures(1, &m_id);
+ if (m_ownsBuffer)
+ delete m_buffer;
}
void HybrisTexture::bind()
@@ -357,7 +344,8 @@
NativeBuffer *buffer = NativeBuffer::create(image);
if (!buffer)
return 0;
- HybrisTexture *texture = new HybrisTexture(QSharedPointer<NativeBuffer>(buffer));
+ HybrisTexture *texture = new HybrisTexture(buffer);
+ texture->m_ownsBuffer = true;
return texture;
}
@@ -371,6 +359,7 @@
HybrisTextureFactory::~HybrisTextureFactory()
{
+ delete m_buffer;
}
QSGTexture *HybrisTextureFactory::createTexture(QQuickWindow *) const
|
[-]
[+]
|
Changed |
_service:tar_git:qtscenegraph-adaptation-0.6.4.tar.bz2/customcontext/texture/hybristexture.h
^
|
@@ -44,7 +44,6 @@
#include <QtQuick/QSGTexture>
#include <QtQuick/QQuickTextureFactory>
-#include <QSharedPointer>
#include <QtGui/qopengl.h>
@@ -78,7 +77,7 @@
{
Q_OBJECT
public:
- HybrisTexture(QSharedPointer<NativeBuffer> buffer);
+ HybrisTexture(NativeBuffer *buffer);
~HybrisTexture();
virtual int textureId() const;
@@ -91,8 +90,9 @@
private:
mutable GLuint m_id;
- QSharedPointer<NativeBuffer> m_buffer;
+ NativeBuffer *m_buffer;
bool m_bound;
+ bool m_ownsBuffer;
};
class HybrisTextureFactory : public QQuickTextureFactory
@@ -110,7 +110,7 @@
static HybrisTextureFactory *create(const QImage &image);
private:
- QSharedPointer<NativeBuffer> m_buffer;
+ NativeBuffer *m_buffer;
};
}
|
[-]
[+]
|
Changed |
_service:tar_git:qtscenegraph-adaptation-0.6.4.tar.bz2/scenegraph-playground.pro
^
|
@@ -1,2 +1,3 @@
TEMPLATE=subdirs
SUBDIRS=customcontext
+
|
[-]
[+]
|
Deleted |
_service:tar_git:qtscenegraph-adaptation-0.7.6.tar.bz2/customcontext/renderer/qsgbasicclipmanager_p.h
^
|
@@ -1,233 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Quick Sceneground Playground.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSGBASICCLIPMANAGER_P_H
-#define QSGBASICCLIPMANAGER_P_H
-
-#include <private/qsgcontext_p.h>
-#include <private/qsgshadersourcebuilder_p.h>
-
-#include <QOpenGLShaderProgram>
-
-class QSGBasicClipManager : public QObject
-{
- Q_OBJECT
-public:
- enum ClipTypeBit
- {
- NoClip = 0x00,
- ScissorClip = 0x01,
- StencilClip = 0x02
- };
- Q_DECLARE_FLAGS(ClipType, ClipTypeBit)
-
- QSGBasicClipManager(QSGRenderContext *context)
- : QObject(context)
- , m_program(0)
- , m_currentStencilValue(0)
- , m_clipMatrixId(0)
- , m_clipType(NoClip)
- {
- connect(context, SIGNAL(invalidated()), this, SLOT(invalidate()));
- }
-
- static QSGBasicClipManager *from(QSGRenderContext *context)
- {
- const QString name = QStringLiteral("qsg_basic_clipmanager");
- QSGBasicClipManager *cm = context->findChild<QSGBasicClipManager*>(name);
- if (!cm) {
- cm = new QSGBasicClipManager(context);
- cm->setObjectName(name);
- }
- return cm;
- }
-
- void setDeviceRect(const QRect &deviceRect) { m_deviceRect = deviceRect; }
- void setProjectionMatrix(const QMatrix4x4 &matrix) { m_projectionMatrix = matrix; }
-
- template<typename ClipRenderer, typename ShaderStateTracker>
- void activate(const QSGClipNode *clip, ClipRenderer *clipRenderer, ShaderStateTracker *tracker, QOpenGLFunctions *gl);
-
- void reset(QOpenGLFunctions *gl) {
- if (m_clipType & StencilClip)
- gl->glDisable(GL_STENCIL_TEST);
- if (m_clipType & ScissorClip)
- gl->glDisable(GL_SCISSOR_TEST);
- m_clipType = NoClip;
- m_currentClip = 0;
- }
-
- ClipType clipType() const { return m_clipType; }
- const QSGClipNode *currentClip() const { return m_currentClip; }
-
-public Q_SLOTS:
- void invalidate() {
- delete m_program;
- m_program = 0;
- }
-
-private:
- QOpenGLShaderProgram *m_program;
- QRect m_currentScissorRect;
- int m_currentStencilValue;
- int m_clipMatrixId;
- ClipType m_clipType;
- const QSGClipNode *m_currentClip;
-
- QRect m_deviceRect;
- QMatrix4x4 m_projectionMatrix;
-};
-
-template <typename ClipRenderer, typename ShaderStateTracker>
-void QSGBasicClipManager::activate(const QSGClipNode *clip,
- ClipRenderer *clipRenderer,
- ShaderStateTracker *tracker,
- QOpenGLFunctions *gl)
-{
- if (m_currentClip == clip)
- return;
-
- m_clipType = NoClip;
- m_currentClip = clip;
- if (!clip) {
- gl->glDisable(GL_STENCIL_TEST);
- gl->glDisable(GL_SCISSOR_TEST);
- return;
- }
-
- gl->glDisable(GL_SCISSOR_TEST);
-
- m_currentStencilValue = 0;
- m_currentScissorRect = QRect();
-
- while (clip) {
- QMatrix4x4 m = m_projectionMatrix;
- if (clip->matrix())
- m *= *clip->matrix();
-
- bool isRectangleWithNoPerspective = clip->isRectangular()
- && qFuzzyIsNull(m(3, 0)) && qFuzzyIsNull(m(3, 1));
- bool noRotate = qFuzzyIsNull(m(0, 1)) && qFuzzyIsNull(m(1, 0));
- bool isRotate90 = qFuzzyIsNull(m(0, 0)) && qFuzzyIsNull(m(1, 1));
-
- if (isRectangleWithNoPerspective && (noRotate || isRotate90)) {
- QRectF bbox = clip->clipRect();
- qreal invW = 1 / m(3, 3);
- qreal fx1, fy1, fx2, fy2;
- if (noRotate) {
- fx1 = (bbox.left() * m(0, 0) + m(0, 3)) * invW;
- fy1 = (bbox.bottom() * m(1, 1) + m(1, 3)) * invW;
- fx2 = (bbox.right() * m(0, 0) + m(0, 3)) * invW;
- fy2 = (bbox.top() * m(1, 1) + m(1, 3)) * invW;
- } else {
- Q_ASSERT(isRotate90);
- fx1 = (bbox.bottom() * m(0, 1) + m(0, 3)) * invW;
- fy1 = (bbox.left() * m(1, 0) + m(1, 3)) * invW;
- fx2 = (bbox.top() * m(0, 1) + m(0, 3)) * invW;
- fy2 = (bbox.right() * m(1, 0) + m(1, 3)) * invW;
- }
-
- if (fx1 > fx2)
- qSwap(fx1, fx2);
- if (fy1 > fy2)
- qSwap(fy1, fy2);
-
- GLint ix1 = qRound((fx1 + 1) * m_deviceRect.width() * qreal(0.5));
- GLint iy1 = qRound((fy1 + 1) * m_deviceRect.height() * qreal(0.5));
- GLint ix2 = qRound((fx2 + 1) * m_deviceRect.width() * qreal(0.5));
- GLint iy2 = qRound((fy2 + 1) * m_deviceRect.height() * qreal(0.5));
-
- if (!(m_clipType & ScissorClip)) {
- m_currentScissorRect = QRect(ix1, iy1, ix2 - ix1, iy2 - iy1);
- gl->glEnable(GL_SCISSOR_TEST);
- m_clipType |= ScissorClip;
- } else {
- m_currentScissorRect &= QRect(ix1, iy1, ix2 - ix1, iy2 - iy1);
- }
- gl->glScissor(m_currentScissorRect.x(), m_currentScissorRect.y(),
- m_currentScissorRect.width(), m_currentScissorRect.height());
- } else {
-
- if (!(m_clipType & StencilClip)) {
- tracker->deactivate();
- if (!m_program) {
- m_program = new QOpenGLShaderProgram();
- QSGShaderSourceBuilder::initializeProgramFromFiles(
- m_program,
-#if QT_VERSION >= 0x050600
- QStringLiteral(":/qt-project.org/scenegraph/shaders/stencilclip.vert"),
- QStringLiteral(":/qt-project.org/scenegraph/shaders/stencilclip.frag")
-#else
- QStringLiteral(":/scenegraph/shaders/stencilclip.vert"),
- QStringLiteral(":/scenegraph/shaders/stencilclip.frag")
-#endif
- );
- m_program->bindAttributeLocation("vCoord", 0);
- m_program->link();
- m_clipMatrixId = m_program->uniformLocation("matrix");
- }
-
|
[-]
[+]
|
Deleted |
_service:tar_git:qtscenegraph-adaptation-0.7.6.tar.bz2/customcontext/renderer/qsgbasicshadermanager_p.h
^
|
@@ -1,170 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Quick Sceneground Playground.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSGBASICSHADERMANAGER_P_H
-#define QSGBASICSHADERMANAGER_P_H
-
-#include <qsgmaterial.h>
-
-#include <private/qsgcontext_p.h>
-#include <private/qsgrenderer_p.h>
-
-class QSGBasicShaderManager : public QObject
-{
- Q_OBJECT
-public:
- QSGBasicShaderManager(QSGRenderContext *context)
- : QObject(context)
- , m_context(context)
- , m_currentShader(0)
- , m_currentMaterial(0)
- , m_previousMaterial(0)
- , m_currentAttributeCount(0)
- {
- connect(context, SIGNAL(invalidated()), this, SLOT(invalidate()));
- }
-
- static QSGBasicShaderManager *from(QSGRenderContext *context)
- {
- const QString name = QStringLiteral("qsg_basic_shadermanager");
- QSGBasicShaderManager *sm = context->findChild<QSGBasicShaderManager *>(name);
- if (!sm) {
- sm = new QSGBasicShaderManager(context);
- sm->setObjectName(name);
- }
- return sm;
- }
-
- QSGMaterialShader *prepare(const QSGMaterial *material)
- {
- Q_ASSERT(material);
-
- QSGMaterialType *type = material->type();
- QSGMaterialShader *shader = m_shaders.value(type);
- if (shader)
- return shader;
-
- shader = static_cast<QSGMaterialShader *>(material->createShader());
- m_context->compile(shader, const_cast<QSGMaterial *>(material));
- m_context->initialize(shader);
-
- m_shaders[type] = shader;
-
- return shader;
- }
-
- static int countAttributes(QSGMaterialShader *shader)
- {
- const char * const *names = shader->attributeNames();
- Q_ASSERT(names);
- int count = 0;
- while (names[count])
- ++count;
- return count;
- }
-
- void activate(const QSGMaterial *m, QSGMaterialShader::RenderState::DirtyStates states, QSGRenderer *renderer, QOpenGLFunctions *gl)
- {
- Q_ASSERT(m);
- QSGMaterialShader *shader = prepare(m);
- Q_ASSERT(shader);
-
- m_previousMaterial = m_currentMaterial;
- m_currentMaterial = m;
-
- if (shader != m_currentShader) {
- if (m_currentShader)
- m_currentShader->deactivate();
- m_currentShader = shader;
- m_currentShader->program()->bind();
- m_currentShader->activate();
- m_previousMaterial = 0;
- states |=(QSGMaterialShader::RenderState::DirtyOpacity | QSGMaterialShader::RenderState::DirtyMatrix);
- setEnabledVertexAttribArrays(countAttributes(m_currentShader), gl);
- }
-
- m_currentShader->updateState(renderer->state(states),
- const_cast<QSGMaterial *>(m_currentMaterial),
- const_cast<QSGMaterial *>(m_previousMaterial));
- }
-
- void setEnabledVertexAttribArrays(int howMany, QOpenGLFunctions *gl) {
- for (int i=m_currentAttributeCount; i<howMany; ++i)
- gl->glEnableVertexAttribArray(i);
- for (int i=m_currentAttributeCount-1; i>=howMany; --i)
- gl->glDisableVertexAttribArray(i);
- m_currentAttributeCount = howMany;
- }
-
- void deactivate() {
- if (m_currentShader) {
- m_currentShader->deactivate();
- m_currentShader = 0;
- }
- m_previousMaterial = 0;
- m_currentMaterial = 0;
- }
-
- QSGMaterialShader *currentShader() const { return m_currentShader; }
- int currentAttributeCount() const { return m_currentAttributeCount; }
-
- void endFrame(QOpenGLFunctions *gl) {
- // Reset shader and potential shader state
- if (m_currentShader) {
- m_currentShader->deactivate();
- m_currentShader = 0;
- }
- m_currentMaterial = 0;
- m_previousMaterial = 0;
- // Disable all attribute arrays.
- while (m_currentAttributeCount > 0)
- gl->glDisableVertexAttribArray(--m_currentAttributeCount);
- }
-
-public Q_SLOTS:
- void invalidate() {
- qDeleteAll(m_shaders.values());
- m_shaders.clear();
- }
-
-private:
- QHash<QSGMaterialType *, QSGMaterialShader *> m_shaders;
- QSGRenderContext *m_context;
-
- QSGMaterialShader *m_currentShader;
- const QSGMaterial *m_currentMaterial;
- const QSGMaterial *m_previousMaterial;
- int m_currentAttributeCount;
-};
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:qtscenegraph-adaptation-0.7.6.tar.bz2/customcontext/renderer/simplerenderer.cpp
^
|
@@ -1,556 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Quick Sceneground Playground.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "simplerenderer.h"
-
-#include <private/qsgnodeupdater_p.h>
-
-#include <QtGui/QOpenGLFunctions_1_0>
-#include <QtGui/QOpenGLFunctions_3_2_Core>
-
-namespace QSGSimpleRenderer {
-
-#define QSGNODE_TRAVERSE(NODE) for (QSGNode *child = NODE->firstChild(); child; child = child->nextSibling())
-
-#define DECLARE_DEBUG_VAR(variable) \
- static bool debug_ ## variable() \
- { static bool value = qgetenv("QSG_RENDERER_DEBUG").contains(QT_STRINGIFY(variable)); return value; }
-DECLARE_DEBUG_VAR(build)
-DECLARE_DEBUG_VAR(change)
-DECLARE_DEBUG_VAR(render)
-DECLARE_DEBUG_VAR(nodepthbuffer)
-
-static inline int size_of_type(GLenum type)
-{
- static int sizes[] = {
- sizeof(char),
- sizeof(unsigned char),
- sizeof(short),
- sizeof(unsigned short),
- sizeof(int),
- sizeof(unsigned int),
- sizeof(float),
- 2,
- 3,
- 4,
- sizeof(double)
- };
- Q_ASSERT(type >= GL_BYTE && type <= 0x140A); // the value of GL_DOUBLE
- return sizes[type - GL_BYTE];
-}
-
-
-class DummyUpdater : public QSGNodeUpdater
-{
-public:
- void updateState(QSGNode *) { };
-};
-
-Renderer::Renderer(QSGRenderContext *ctx)
- : QSGRenderer(ctx)
- , m_renderList(16)
- , m_vboData(1024)
- , m_iboData(256)
- , m_vboId(0)
- , m_iboId(0)
- , m_vboSize(0)
- , m_iboSize(0)
- , m_rebuild(true)
-{
- m_shaderManager = QSGBasicShaderManager::from(ctx);
- m_clipManager = QSGBasicClipManager::from(ctx);
- m_useDepthBuffer = QOpenGLContext::currentContext()->format().depthBufferSize() > 0
- && !debug_nodepthbuffer();
-
- setNodeUpdater(new DummyUpdater());
-
- initializeOpenGLFunctions();
- glGenBuffers(1, &m_vboId);
- glGenBuffers(1, &m_iboId);
-}
-
-Renderer::~Renderer()
-{
- glDeleteBuffers(1, &m_vboId);
- glDeleteBuffers(1, &m_iboId);
-}
-
-void Renderer::nodeChanged(QSGNode *node, QSGNode::DirtyState state)
-{
- if (Q_UNLIKELY(debug_change())) {
- QDebug debug = qDebug();
- debug << "dirty:";
- if (state & QSGNode::DirtyGeometry)
- debug << "Geometry";
- if (state & QSGNode::DirtyMaterial)
- debug << "Material";
- if (state & QSGNode::DirtyMatrix)
- debug << "Matrix";
- if (state & QSGNode::DirtyNodeAdded)
- debug << "Added";
- if (state & QSGNode::DirtyNodeRemoved)
- debug << "Removed";
- if (state & QSGNode::DirtyOpacity)
- debug << "Opacity";
- if (state & QSGNode::DirtySubtreeBlocked)
- debug << "SubtreeBlocked";
- if (state & QSGNode::DirtyForceUpdate)
- debug << "ForceUpdate";
-
- // when removed, some parts of the node could already have been destroyed
- // so don't debug it out.
- if (state & QSGNode::DirtyNodeRemoved)
- debug << (void *) node << node->type();
- else
- debug << node;
- }
-
- if (state & (QSGNode::DirtyNodeAdded
- | QSGNode::DirtyNodeRemoved
- | QSGNode::DirtySubtreeBlocked
- | QSGNode::DirtyGeometry
- | QSGNode::DirtyForceUpdate)) {
- m_rebuild = true;
- }
- if (state & QSGNode::DirtyMatrix)
- m_dirtyTransformNodes << node;
- if (state & QSGNode::DirtyOpacity)
- m_dirtyOpacityNodes << node;
- if (state & QSGNode::DirtyMaterial)
- m_dirtyOpaqueElements = true;
-
- QSGRenderer::nodeChanged(node, state);
-}
-
-class BasicGeometryNode_Accessor : public QSGNode
-{
-public:
- QSGGeometry *m_geometry;
-
- int m_reserved_start_index;
- int m_reserved_end_index;
-
- const QMatrix4x4 *m_matrix;
- const QSGClipNode *m_clip_list;
-};
-
-
-void Renderer::buildRenderList(QSGNode *node, QSGClipNode *clip)
-{
- if (node->isSubtreeBlocked())
- return;
-
- if (node->type() == QSGNode::GeometryNodeType || node->type() == QSGNode::ClipNodeType) {
- QSGBasicGeometryNode *gn = static_cast<QSGBasicGeometryNode *>(node);
- QSGGeometry *g = gn->geometry();
-
- Element e;
- e.node = gn;
-
- if (g->vertexCount() > 0) {
- e.vboOffset = m_vboSize;
- int vertexSize = g->sizeOfVertex() * g->vertexCount();
- m_vboSize += vertexSize;
- m_vboData.resize(m_vboSize);
- memcpy(m_vboData.data() + e.vboOffset, g->vertexData(), vertexSize);
- } else {
- e.vboOffset = -1;
- }
-
- if (g->indexCount() > 0) {
- e.iboOffset = m_iboSize;
- int indexSize = g->sizeOfIndex() * g->indexCount();
- m_iboSize += indexSize;
- m_iboData.resize(m_iboSize);
- memcpy(m_iboData.data() + e.iboOffset, g->indexData(), indexSize);
- } else {
- e.iboOffset = -1;
- }
-
|
[-]
[+]
|
Deleted |
_service:tar_git:qtscenegraph-adaptation-0.7.6.tar.bz2/customcontext/renderer/simplerenderer.h
^
|
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Quick Sceneground Playground.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSGSIMPLERENDERER_H
-#define QSGSIMPLERENDERER_H
-
-#include <private/qdatabuffer_p.h>
-
-#include <private/qsgrenderer_p.h>
-#include <private/qsgcontext_p.h>
-
-#include <qbitarray.h>
-
-#include "qsgbasicshadermanager_p.h"
-#include "qsgbasicclipmanager_p.h"
-
-namespace QSGSimpleRenderer
-{
-
-struct Element {
- QSGBasicGeometryNode *node;
- qint32 vboOffset;
- qint32 iboOffset;
-};
-
-class Renderer : public QSGRenderer, public QOpenGLFunctions
-{
-public:
- Renderer(QSGRenderContext *context);
- ~Renderer();
-
- virtual void render();
- virtual void nodeChanged(QSGNode *node, QSGNode::DirtyState state) Q_DECL_OVERRIDE;
-
- void buildRenderList(QSGNode *node, QSGClipNode *clip);
- void updateMatrices(QSGNode *node, QSGTransformNode *xnode);
- void updateOpacities(QSGNode *node, qreal opacity);
- void renderElements();
- void renderElement(int elementIndex);
-
- QDataBuffer<Element> m_renderList;
- QBitArray m_opaqueElements;
- QDataBuffer<char> m_vboData;
- QDataBuffer<char> m_iboData;
-
- QSet<QSGNode *> m_dirtyTransformNodes;
- QSet<QSGNode *> m_dirtyOpacityNodes;
-
- QSGBasicShaderManager *m_shaderManager;
- QSGBasicClipManager *m_clipManager;
-
- GLuint m_vboId;
- GLuint m_iboId;
- int m_vboSize;
- int m_iboSize;
-
- bool m_rebuild;
- bool m_useDepthBuffer;
- bool m_dirtyOpaqueElements;
-};
-
-}
-
-#endif // QSGSIMPLERENDERER_H
|
[-]
[+]
|
Deleted |
_service:tar_git:qtscenegraph-adaptation-0.7.6.tar.bz2/customcontext/texture/drawhelper.h
^
|
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Scenegraph Playground module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DRAWHELPER_H
-#define DRAWHELPER_H
-
-// Taken from qdrawhelper_p.h
-static inline uint PREMUL(uint x) {
- uint a = x >> 24;
- uint t = (x & 0xff00ff) * a;
- t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
- t &= 0xff00ff;
-
- x = ((x >> 8) & 0xff) * a;
- x = (x + ((x >> 8) & 0xff) + 0x80);
- x &= 0xff00;
- x |= t | (a << 24);
- return x;
-}
-static inline int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
-
-#endif
|