[-]
[+]
|
Changed |
_service:tar_git:qtscenegraph-adaptation-0.6.6.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.6.tar.bz2/customcontext/texture/hybristexture.cpp
^
|
@@ -67,7 +67,6 @@
#define EGL_NATIVE_BUFFER_HYBRIS 0x3140
-static bool customcontext_no_bgra = !qgetenv("QT_OPENGL_NO_BGRA").isEmpty();
namespace CustomContext {
@@ -102,30 +101,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;
|