Rename new QOpenGLContext APIs
isES() becomes isOpenGLES(). The library type enums are changed DesktopGL -> LibGL and GLES2 -> LibGLES. This removes the now unnecessary version number, the confusing "desktop" term and provides better readability. The old function/values are kept until the related qtdeclarative changes are integrated. Task-number: QTBUG-38564 Change-Id: Ibb0a1209985f1ce4bb9451f9b7b093c2b68a6505 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
parent
93c6976a39
commit
f9d323279a
@ -364,7 +364,7 @@ int QOpenGLContextPrivate::maxTextureSize()
|
||||
funcs->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
|
||||
|
||||
#ifndef QT_OPENGL_ES
|
||||
if (!q->isES()) {
|
||||
if (!q->isOpenGLES()) {
|
||||
GLenum proxy = GL_PROXY_TEXTURE_2D;
|
||||
|
||||
GLint size;
|
||||
@ -676,7 +676,7 @@ QOpenGLFunctions *QOpenGLContext::functions() const
|
||||
QAbstractOpenGLFunctions *QOpenGLContext::versionFunctions(const QOpenGLVersionProfile &versionProfile) const
|
||||
{
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
if (isES()) {
|
||||
if (isOpenGLES()) {
|
||||
qWarning("versionFunctions: Not supported on OpenGL ES");
|
||||
return 0;
|
||||
}
|
||||
@ -1036,8 +1036,8 @@ void *QOpenGLContext::openGLModuleHandle()
|
||||
\enum QOpenGLContext::OpenGLModuleType
|
||||
This enum defines the type of the underlying OpenGL implementation.
|
||||
|
||||
\value DesktopGL Desktop OpenGL
|
||||
\value GLES2 OpenGL ES 2.0 or higher
|
||||
\value LibGL OpenGL
|
||||
\value LibGLES OpenGL ES 2.0 or higher
|
||||
|
||||
\since 5.3
|
||||
*/
|
||||
@ -1052,7 +1052,7 @@ void *QOpenGLContext::openGLModuleHandle()
|
||||
\note A desktop OpenGL implementation may be capable of creating
|
||||
ES-compatible contexts too. Therefore in most cases it is more
|
||||
appropriate to check QSurfaceFormat::renderableType() or using the
|
||||
the convenience function isES().
|
||||
the convenience function isOpenGLES().
|
||||
|
||||
\note This function requires that the QGuiApplication instance is already created.
|
||||
|
||||
@ -1064,9 +1064,9 @@ QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType()
|
||||
Q_ASSERT(qGuiApp);
|
||||
return QGuiApplicationPrivate::instance()->platformIntegration()->openGLModuleType();
|
||||
#elif defined(QT_OPENGL_ES_2)
|
||||
return GLES2;
|
||||
return LibGLES;
|
||||
#else
|
||||
return DesktopGL;
|
||||
return LibGL;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1080,7 +1080,7 @@ QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType()
|
||||
|
||||
\since 5.3
|
||||
*/
|
||||
bool QOpenGLContext::isES() const
|
||||
bool QOpenGLContext::isOpenGLES() const
|
||||
{
|
||||
return format().renderableType() == QSurfaceFormat::OpenGLES;
|
||||
}
|
||||
|
@ -195,13 +195,19 @@ public:
|
||||
static void *openGLModuleHandle();
|
||||
|
||||
enum OpenGLModuleType {
|
||||
DesktopGL,
|
||||
GLES2
|
||||
LibGL,
|
||||
LibGLES,
|
||||
|
||||
// ###
|
||||
DesktopGL = LibGL,
|
||||
GLES2 = LibGLES
|
||||
};
|
||||
|
||||
static OpenGLModuleType openGLModuleType();
|
||||
|
||||
bool isES() const;
|
||||
bool isOpenGLES() const;
|
||||
|
||||
bool isES() const { return isOpenGLES(); } // ###
|
||||
|
||||
Q_SIGNALS:
|
||||
void aboutToBeDestroyed();
|
||||
|
@ -491,14 +491,14 @@ void QPlatformIntegration::sync()
|
||||
a desktop OpenGL implementation may be capable of creating OpenGL
|
||||
ES-compatible contexts too.
|
||||
|
||||
\sa QOpenGLContext::openGLModuleType(), QOpenGLContext::isES()
|
||||
\sa QOpenGLContext::openGLModuleType(), QOpenGLContext::isOpenGLES()
|
||||
|
||||
\since 5.3
|
||||
*/
|
||||
QOpenGLContext::OpenGLModuleType QPlatformIntegration::openGLModuleType()
|
||||
{
|
||||
qWarning("This plugin does not support dynamic OpenGL loading!");
|
||||
return QOpenGLContext::DesktopGL;
|
||||
return QOpenGLContext::LibGL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -164,7 +164,7 @@ QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(QOpenGLContext* context)
|
||||
code[NonPremultipliedImageSrcFragmentShader] = qopenglslNonPremultipliedImageSrcFragmentShader;
|
||||
code[CustomImageSrcFragmentShader] = qopenglslCustomSrcFragmentShader; // Calls "customShader", which must be appended
|
||||
code[SolidBrushSrcFragmentShader] = qopenglslSolidBrushSrcFragmentShader;
|
||||
if (context->isES())
|
||||
if (context->isOpenGLES())
|
||||
code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader_ES;
|
||||
else
|
||||
code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader_desktop;
|
||||
|
@ -590,7 +590,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
|
||||
funcs.glBindRenderbuffer(GL_RENDERBUFFER, depth_buffer);
|
||||
Q_ASSERT(funcs.glIsRenderbuffer(depth_buffer));
|
||||
if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) {
|
||||
if (ctx->isES()) {
|
||||
if (ctx->isOpenGLES()) {
|
||||
if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24))
|
||||
funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples,
|
||||
GL_DEPTH_COMPONENT24, size.width(), size.height());
|
||||
@ -602,7 +602,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
|
||||
GL_DEPTH_COMPONENT, size.width(), size.height());
|
||||
}
|
||||
} else {
|
||||
if (ctx->isES()) {
|
||||
if (ctx->isOpenGLES()) {
|
||||
if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24)) {
|
||||
funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24,
|
||||
size.width(), size.height());
|
||||
@ -631,7 +631,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
|
||||
#ifdef QT_OPENGL_ES
|
||||
GLenum storage = GL_STENCIL_INDEX8;
|
||||
#else
|
||||
GLenum storage = ctx->isES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX;
|
||||
GLenum storage = ctx->isOpenGLES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX;
|
||||
#endif
|
||||
|
||||
if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample))
|
||||
@ -773,7 +773,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum tar
|
||||
Q_D(QOpenGLFramebufferObject);
|
||||
d->init(this, size, NoAttachment, target,
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8
|
||||
QOpenGLContext::currentContext()->isOpenGLES() ? GL_RGBA : GL_RGBA8
|
||||
#else
|
||||
GL_RGBA
|
||||
#endif
|
||||
@ -793,7 +793,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, GLenum
|
||||
Q_D(QOpenGLFramebufferObject);
|
||||
d->init(this, QSize(width, height), NoAttachment, target,
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8
|
||||
QOpenGLContext::currentContext()->isOpenGLES() ? GL_RGBA : GL_RGBA8
|
||||
#else
|
||||
GL_RGBA
|
||||
#endif
|
||||
@ -850,7 +850,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, Attach
|
||||
#ifdef QT_OPENGL_ES_2
|
||||
internal_format = GL_RGBA;
|
||||
#else
|
||||
internal_format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8;
|
||||
internal_format = QOpenGLContext::currentContext()->isOpenGLES() ? GL_RGBA : GL_RGBA8;
|
||||
#endif
|
||||
d->init(this, QSize(width, height), attachment, target, internal_format);
|
||||
}
|
||||
@ -877,7 +877,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, Attachment
|
||||
#ifdef QT_OPENGL_ES_2
|
||||
internal_format = GL_RGBA;
|
||||
#else
|
||||
internal_format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8;
|
||||
internal_format = QOpenGLContext::currentContext()->isOpenGLES() ? GL_RGBA : GL_RGBA8;
|
||||
#endif
|
||||
d->init(this, size, attachment, target, internal_format);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
// context, so we need a fallback just to be safe, even though in pratice there
|
||||
// will usually be a context current.
|
||||
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||
const bool isES = ctx ? ctx->isES() : QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL;
|
||||
const bool isES = ctx ? ctx->isOpenGLES() : QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL;
|
||||
internal_format = isES ? GL_RGBA : GL_RGBA8;
|
||||
#else
|
||||
internal_format = GL_RGBA;
|
||||
|
@ -256,7 +256,7 @@ QOpenGLExtensions::QOpenGLExtensions(QOpenGLContext *context)
|
||||
static int qt_gl_resolve_features()
|
||||
{
|
||||
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||
if (ctx->isES()) {
|
||||
if (ctx->isOpenGLES()) {
|
||||
// OpenGL ES 2
|
||||
int features = QOpenGLFunctions::Multitexture |
|
||||
QOpenGLFunctions::Shaders |
|
||||
@ -367,7 +367,7 @@ static int qt_gl_resolve_extensions()
|
||||
if (extensionMatcher.match("GL_ARB_pixel_buffer_object"))
|
||||
extensions |= QOpenGLExtensions::PixelBufferObject;
|
||||
|
||||
if (ctx->isES()) {
|
||||
if (ctx->isOpenGLES()) {
|
||||
if (format.majorVersion() >= 2)
|
||||
extensions |= QOpenGLExtensions::GenerateMipmap;
|
||||
if (extensionMatcher.match("GL_OES_mapbuffer"))
|
||||
@ -2415,7 +2415,7 @@ static void QOPENGLF_APIENTRY qopenglfResolveClearColor(GLclampf red, GLclampf g
|
||||
|
||||
static void QOPENGLF_APIENTRY qopenglfResolveClearDepthf(GLclampf depth)
|
||||
{
|
||||
if (QOpenGLContext::currentContext()->isES()) {
|
||||
if (QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
RESOLVE_FUNC_VOID(0, ClearDepthf)(depth);
|
||||
} else {
|
||||
RESOLVE_FUNC_VOID(0, ClearDepth)((GLdouble) depth);
|
||||
@ -2464,7 +2464,7 @@ static void QOPENGLF_APIENTRY qopenglfResolveDepthMask(GLboolean flag)
|
||||
|
||||
static void QOPENGLF_APIENTRY qopenglfResolveDepthRangef(GLclampf zNear, GLclampf zFar)
|
||||
{
|
||||
if (QOpenGLContext::currentContext()->isES()) {
|
||||
if (QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
RESOLVE_FUNC_VOID(0, DepthRangef)(zNear, zFar);
|
||||
} else {
|
||||
RESOLVE_FUNC_VOID(0, DepthRange)((GLdouble) zNear, (GLdouble) zFar);
|
||||
|
@ -221,7 +221,7 @@ void QOpenGL2PaintEngineExPrivate::updateBrushTexture()
|
||||
currentBrushPixmap = currentBrushPixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio);
|
||||
|
||||
GLuint wrapMode = GL_REPEAT;
|
||||
if (QOpenGLContext::currentContext()->isES()) {
|
||||
if (QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
// OpenGL ES does not support GL_REPEAT wrap modes for NPOT textures. So instead,
|
||||
// we emulate GL_REPEAT by only taking the fractional part of the texture coords
|
||||
// in the qopenglslTextureBrushSrcFragmentShader program.
|
||||
@ -598,7 +598,7 @@ void QOpenGL2PaintEngineExPrivate::resetGLState()
|
||||
setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false);
|
||||
setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, false);
|
||||
setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
// gl_Color, corresponding to vertex attribute 3, may have been changed
|
||||
float color[] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
funcs.glVertexAttrib4fv(3, color);
|
||||
@ -1333,7 +1333,7 @@ void QOpenGL2PaintEngineEx::renderHintsChanged()
|
||||
state()->renderHintsChanged = true;
|
||||
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
Q_D(QOpenGL2PaintEngineEx);
|
||||
if ((state()->renderHints & QPainter::Antialiasing)
|
||||
|| (state()->renderHints & QPainter::HighQualityAntialiasing))
|
||||
@ -2011,7 +2011,7 @@ bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev)
|
||||
d->glyphCacheFormat = QFontEngine::Format_A8;
|
||||
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
d->funcs.glDisable(GL_MULTISAMPLE);
|
||||
d->glyphCacheFormat = QFontEngine::Format_A32;
|
||||
d->multisamplingAlwaysEnabled = false;
|
||||
|
@ -176,7 +176,7 @@ public:
|
||||
#endif
|
||||
{
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
if (!ctx->isES()) {
|
||||
if (!ctx->isOpenGLES()) {
|
||||
QSurfaceFormat f = ctx->format();
|
||||
|
||||
// Geometry shaders require OpenGL >= 3.2
|
||||
@ -445,7 +445,7 @@ bool QOpenGLShader::compileSourceCode(const char *source)
|
||||
|
||||
#ifdef QOpenGL_REDEFINE_HIGHP
|
||||
if (d->shaderType == Fragment && !ctx_d->workaround_missingPrecisionQualifiers
|
||||
&& QOpenGLContext::currentContext()->isES()) {
|
||||
&& QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
src.append(redefineHighp);
|
||||
srclen.append(GLint(sizeof(redefineHighp) - 1));
|
||||
}
|
||||
@ -674,7 +674,7 @@ bool QOpenGLShaderProgram::init()
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
// Resolve OpenGL 4 functions for tessellation shader support
|
||||
QSurfaceFormat format = context->format();
|
||||
if (!context->isES()
|
||||
if (!context->isOpenGLES()
|
||||
&& format.version() >= qMakePair<int, int>(4, 0)) {
|
||||
d->tessellationFuncs = context->versionFunctions<QOpenGLFunctions_4_0_Core>();
|
||||
d->tessellationFuncs->initializeOpenGLFunctions();
|
||||
@ -3280,7 +3280,7 @@ bool QOpenGLShader::hasOpenGLShaders(ShaderType type, QOpenGLContext *context)
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
// Geometry shaders require OpenGL 3.2 or newer
|
||||
QSurfaceFormat format = context->format();
|
||||
return (!context->isES())
|
||||
return (!context->isOpenGLES())
|
||||
&& (format.version() >= qMakePair<int, int>(3, 2));
|
||||
#else
|
||||
// No geometry shader support in OpenGL ES2
|
||||
@ -3288,7 +3288,7 @@ bool QOpenGLShader::hasOpenGLShaders(ShaderType type, QOpenGLContext *context)
|
||||
#endif
|
||||
} else if (type == TessellationControl || type == TessellationEvaluation) {
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
return (!context->isES())
|
||||
return (!context->isOpenGLES())
|
||||
&& (format.version() >= qMakePair<int, int>(4, 0));
|
||||
#else
|
||||
// No tessellation shader support in OpenGL ES2
|
||||
|
@ -2432,7 +2432,7 @@ bool QOpenGLTexture::hasFeature(Feature feature)
|
||||
bool supported = false;
|
||||
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!ctx->isES()) {
|
||||
if (!ctx->isOpenGLES()) {
|
||||
switch (feature) {
|
||||
case ImmutableMultisampleStorage:
|
||||
case TextureBuffer:
|
||||
@ -2489,7 +2489,7 @@ bool QOpenGLTexture::hasFeature(Feature feature)
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->isES())
|
||||
if (ctx->isOpenGLES())
|
||||
#endif
|
||||
{
|
||||
switch (feature) {
|
||||
@ -2524,7 +2524,7 @@ bool QOpenGLTexture::hasFeature(Feature feature)
|
||||
void QOpenGLTexture::setMipBaseLevel(int baseLevel)
|
||||
{
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
Q_D(QOpenGLTexture);
|
||||
d->create();
|
||||
Q_ASSERT(d->textureId);
|
||||
@ -2561,7 +2561,7 @@ int QOpenGLTexture::mipBaseLevel() const
|
||||
void QOpenGLTexture::setMipMaxLevel(int maxLevel)
|
||||
{
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
Q_D(QOpenGLTexture);
|
||||
d->create();
|
||||
Q_ASSERT(d->textureId);
|
||||
@ -2598,7 +2598,7 @@ int QOpenGLTexture::mipMaxLevel() const
|
||||
void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel)
|
||||
{
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
Q_D(QOpenGLTexture);
|
||||
d->create();
|
||||
Q_ASSERT(d->textureId);
|
||||
@ -2708,7 +2708,7 @@ void QOpenGLTexture::generateMipMaps(int baseLevel, bool resetBaseLevel)
|
||||
void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue value)
|
||||
{
|
||||
#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
Q_D(QOpenGLTexture);
|
||||
d->create();
|
||||
Q_ASSERT(d->texFuncs);
|
||||
@ -2737,7 +2737,7 @@ void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g,
|
||||
SwizzleValue b, SwizzleValue a)
|
||||
{
|
||||
#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
Q_D(QOpenGLTexture);
|
||||
d->create();
|
||||
Q_ASSERT(d->texFuncs);
|
||||
@ -2786,7 +2786,7 @@ QOpenGLTexture::SwizzleValue QOpenGLTexture::swizzleMask(SwizzleComponent compon
|
||||
void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode)
|
||||
{
|
||||
#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
Q_D(QOpenGLTexture);
|
||||
d->create();
|
||||
Q_ASSERT(d->texFuncs);
|
||||
@ -2977,7 +2977,7 @@ QOpenGLTexture::WrapMode QOpenGLTexture::wrapMode(QOpenGLTexture::CoordinateDire
|
||||
void QOpenGLTexture::setBorderColor(QColor color)
|
||||
{
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
Q_D(QOpenGLTexture);
|
||||
d->create();
|
||||
Q_ASSERT(d->texFuncs);
|
||||
@ -3007,7 +3007,7 @@ void QOpenGLTexture::setBorderColor(QColor color)
|
||||
void QOpenGLTexture::setBorderColor(float r, float g, float b, float a)
|
||||
{
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
Q_D(QOpenGLTexture);
|
||||
d->create();
|
||||
Q_ASSERT(d->texFuncs);
|
||||
@ -3040,7 +3040,7 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a)
|
||||
void QOpenGLTexture::setBorderColor(int r, int g, int b, int a)
|
||||
{
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
Q_D(QOpenGLTexture);
|
||||
d->create();
|
||||
Q_ASSERT(d->texFuncs);
|
||||
@ -3075,7 +3075,7 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a)
|
||||
void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a)
|
||||
{
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
Q_D(QOpenGLTexture);
|
||||
d->create();
|
||||
Q_ASSERT(d->texFuncs);
|
||||
@ -3187,7 +3187,7 @@ void QOpenGLTexture::borderColor(unsigned int *border) const
|
||||
void QOpenGLTexture::setMinimumLevelOfDetail(float value)
|
||||
{
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
Q_D(QOpenGLTexture);
|
||||
d->create();
|
||||
Q_ASSERT(d->texFuncs);
|
||||
@ -3224,7 +3224,7 @@ float QOpenGLTexture::minimumLevelOfDetail() const
|
||||
void QOpenGLTexture::setMaximumLevelOfDetail(float value)
|
||||
{
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
Q_D(QOpenGLTexture);
|
||||
d->create();
|
||||
Q_ASSERT(d->texFuncs);
|
||||
@ -3260,7 +3260,7 @@ float QOpenGLTexture::maximumLevelOfDetail() const
|
||||
void QOpenGLTexture::setLevelOfDetailRange(float min, float max)
|
||||
{
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
Q_D(QOpenGLTexture);
|
||||
d->create();
|
||||
Q_ASSERT(d->texFuncs);
|
||||
@ -3302,7 +3302,7 @@ QPair<float, float> QOpenGLTexture::levelOfDetailRange() const
|
||||
void QOpenGLTexture::setLevelofDetailBias(float bias)
|
||||
{
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
Q_D(QOpenGLTexture);
|
||||
d->create();
|
||||
Q_ASSERT(d->texFuncs);
|
||||
|
@ -369,7 +369,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
|
||||
|| mask.format() == QImage::Format_ARGB32_Premultiplied
|
||||
#else
|
||||
|| (mask.format() == QImage::Format_ARGB32_Premultiplied
|
||||
&& ctx->isES())
|
||||
&& ctx->isOpenGLES())
|
||||
#endif
|
||||
) {
|
||||
for (int y = 0; y < maskHeight; ++y) {
|
||||
@ -387,7 +387,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
|
||||
src[x] = qRgba(r, g, b, avg);
|
||||
// swizzle the bits to accommodate for the GL_RGBA upload.
|
||||
#if Q_BYTE_ORDER != Q_BIG_ENDIAN
|
||||
if (ctx->isES())
|
||||
if (ctx->isOpenGLES())
|
||||
#endif
|
||||
src[x] = ARGB2RGBA(src[x]);
|
||||
}
|
||||
@ -400,7 +400,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
|
||||
#ifdef QT_OPENGL_ES_2
|
||||
GLenum fmt = GL_RGBA;
|
||||
#else
|
||||
GLenum fmt = ctx->isES() ? GL_RGBA : GL_BGRA;
|
||||
GLenum fmt = ctx->isOpenGLES() ? GL_RGBA : GL_BGRA;
|
||||
#endif // QT_OPENGL_ES_2
|
||||
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
|
@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
|
||||
QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
|
||||
{
|
||||
// Resolve EXT_direct_state_access entry points if present
|
||||
if (!context->isES()
|
||||
if (!context->isOpenGLES()
|
||||
&& context->hasExtension(QByteArrayLiteral("GL_EXT_direct_state_access"))) {
|
||||
TextureParameteriEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLint )>(context->getProcAddress(QByteArrayLiteral("glTextureParameteriEXT")));
|
||||
TextureParameterivEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLint *)>(context->getProcAddress(QByteArrayLiteral("glTextureParameterivEXT")));
|
||||
@ -121,7 +121,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
|
||||
}
|
||||
|
||||
// Some DSA functions are part of NV_texture_multisample instead
|
||||
if (!context->isES()
|
||||
if (!context->isOpenGLES()
|
||||
&& context->hasExtension(QByteArrayLiteral("GL_NV_texture_multisample"))) {
|
||||
TextureImage3DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage3DMultisampleNV")));
|
||||
TextureImage2DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage2DMultisampleNV")));
|
||||
@ -190,7 +190,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
|
||||
TexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTexSubImage1D")));
|
||||
#endif
|
||||
|
||||
if (context->isES() && context->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"))) {
|
||||
if (context->isOpenGLES() && context->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"))) {
|
||||
TexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glTexImage3DOES")));
|
||||
TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glTexSubImage3DOES")));
|
||||
CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3DOES")));
|
||||
|
@ -135,7 +135,7 @@ bool QOpenGLTimerQueryPrivate::create()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (context->isES()) {
|
||||
if (context->isOpenGLES()) {
|
||||
qWarning("QOpenGLTimerQuery: Not supported on OpenGL ES");
|
||||
return false;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
QVertexArrayObjectHelper(QOpenGLContext *context)
|
||||
{
|
||||
Q_ASSERT(context);
|
||||
if (context->isES()) {
|
||||
if (context->isOpenGLES()) {
|
||||
GenVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysOES")));
|
||||
DeleteVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysOES")));
|
||||
BindVertexArray = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint )>(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayOES")));
|
||||
@ -159,7 +159,7 @@ bool QOpenGLVertexArrayObjectPrivate::create()
|
||||
context = ctx;
|
||||
QObject::connect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
|
||||
|
||||
if (ctx->isES()) {
|
||||
if (ctx->isOpenGLES()) {
|
||||
if (ctx->hasExtension(QByteArrayLiteral("GL_OES_vertex_array_object"))) {
|
||||
vaoFuncs.helper = new QVertexArrayObjectHelper(ctx);
|
||||
vaoFuncsType = OES;
|
||||
|
@ -314,7 +314,7 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textu
|
||||
funcs->glGenTextures(1, &d_ptr->textureId);
|
||||
funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId);
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
|
||||
funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context)
|
||||
code[NonPremultipliedImageSrcFragmentShader] = qglslNonPremultipliedImageSrcFragmentShader;
|
||||
code[CustomImageSrcFragmentShader] = qglslCustomSrcFragmentShader; // Calls "customShader", which must be appended
|
||||
code[SolidBrushSrcFragmentShader] = qglslSolidBrushSrcFragmentShader;
|
||||
if (!context->contextHandle()->isES())
|
||||
if (!context->contextHandle()->isOpenGLES())
|
||||
code[TextureBrushSrcFragmentShader] = qglslTextureBrushSrcFragmentShader_desktop;
|
||||
else
|
||||
code[TextureBrushSrcFragmentShader] = qglslTextureBrushSrcFragmentShader_ES;
|
||||
|
@ -539,7 +539,7 @@ void QGL2PaintEngineEx::beginNativePainting()
|
||||
d->funcs.glDisableVertexAttribArray(i);
|
||||
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
if (!d->ctx->contextHandle()->isES()) {
|
||||
if (!d->ctx->contextHandle()->isOpenGLES()) {
|
||||
const QGLContext *ctx = d->ctx;
|
||||
const QGLFormat &fmt = d->device->format();
|
||||
if (fmt.majorVersion() < 3 || (fmt.majorVersion() == 3 && fmt.minorVersion() < 1)
|
||||
@ -597,7 +597,7 @@ void QGL2PaintEngineExPrivate::resetGLState()
|
||||
ctx->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, false);
|
||||
ctx->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
if (!ctx->contextHandle()->isES()) {
|
||||
if (!ctx->contextHandle()->isOpenGLES()) {
|
||||
// gl_Color, corresponding to vertex attribute 3, may have been changed
|
||||
float color[] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
funcs.glVertexAttrib4fv(3, color);
|
||||
@ -1364,7 +1364,7 @@ void QGL2PaintEngineEx::renderHintsChanged()
|
||||
state()->renderHintsChanged = true;
|
||||
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!d->ctx->contextHandle()->isES()) {
|
||||
if (!d->ctx->contextHandle()->isOpenGLES()) {
|
||||
if ((state()->renderHints & QPainter::Antialiasing)
|
||||
|| (state()->renderHints & QPainter::HighQualityAntialiasing))
|
||||
glEnable(GL_MULTISAMPLE);
|
||||
@ -2040,14 +2040,14 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!d->ctx->contextHandle()->isES())
|
||||
if (!d->ctx->contextHandle()->isOpenGLES())
|
||||
glDisable(GL_MULTISAMPLE);
|
||||
#endif
|
||||
|
||||
d->glyphCacheFormat = QFontEngine::Format_A8;
|
||||
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!d->ctx->contextHandle()->isES()) {
|
||||
if (!d->ctx->contextHandle()->isOpenGLES()) {
|
||||
d->glyphCacheFormat = QFontEngine::Format_A32;
|
||||
d->multisamplingAlwaysEnabled = false;
|
||||
} else {
|
||||
|
@ -319,7 +319,7 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed sub
|
||||
uchar g = src[x] >> 8;
|
||||
uchar b = src[x];
|
||||
quint32 avg = (quint32(r) + quint32(g) + quint32(b) + 1) / 3; // "+1" for rounding.
|
||||
if (ctx->contextHandle()->isES()) {
|
||||
if (ctx->contextHandle()->isOpenGLES()) {
|
||||
// swizzle the bits to accommodate for the GL_RGBA upload.
|
||||
src[x] = (avg << 24) | (quint32(r) << 0) | (quint32(g) << 8) | (quint32(b) << 16);
|
||||
} else {
|
||||
@ -333,7 +333,7 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed sub
|
||||
if (mask.format() == QImage::Format_RGB32) {
|
||||
GLenum format = GL_RGBA;
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!ctx->contextHandle()->isES())
|
||||
if (!ctx->contextHandle()->isOpenGLES())
|
||||
format = GL_BGRA;
|
||||
#endif
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, format, GL_UNSIGNED_BYTE, mask.bits());
|
||||
|
@ -1700,7 +1700,7 @@ QImage qt_gl_read_texture(const QSize &size, bool alpha_format, bool include_alp
|
||||
int w = size.width();
|
||||
int h = size.height();
|
||||
#ifndef QT_OPENGL_ES
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
//### glGetTexImage not in GL ES 2.0, need to do something else here!
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, img.bits());
|
||||
}
|
||||
@ -2285,7 +2285,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
|
||||
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, filtering);
|
||||
|
||||
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||
bool genMipmap = !ctx->isES();
|
||||
bool genMipmap = !ctx->isOpenGLES();
|
||||
if (glFormat.directRendering()
|
||||
&& (qgl_extensions()->hasOpenGLExtension(QOpenGLExtensions::GenerateMipmap))
|
||||
&& target == GL_TEXTURE_2D
|
||||
@ -2427,7 +2427,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
|
||||
printf(" - did byte swapping (%d ms)\n", time.elapsed());
|
||||
#endif
|
||||
}
|
||||
if (ctx->isES()) {
|
||||
if (ctx->isOpenGLES()) {
|
||||
// OpenGL/ES requires that the internal and external formats be
|
||||
// identical.
|
||||
internalFormat = externalFormat;
|
||||
@ -2440,7 +2440,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
|
||||
const QImage &constRef = img; // to avoid detach in bits()...
|
||||
glTexImage2D(target, 0, internalFormat, img.width(), img.height(), 0, externalFormat,
|
||||
pixel_type, constRef.bits());
|
||||
if (genMipmap && ctx->isES())
|
||||
if (genMipmap && ctx->isOpenGLES())
|
||||
q->functions()->glGenerateMipmap(target);
|
||||
#ifndef QT_NO_DEBUG
|
||||
GLenum error = glGetError();
|
||||
@ -2524,7 +2524,7 @@ int QGLContextPrivate::maxTextureSize()
|
||||
|
||||
#ifndef QT_OPENGL_ES
|
||||
Q_Q(QGLContext);
|
||||
if (!q->contextHandle()->isES()) {
|
||||
if (!q->contextHandle()->isOpenGLES()) {
|
||||
GLenum proxy = GL_PROXY_TEXTURE_2D;
|
||||
|
||||
GLint size;
|
||||
@ -2702,7 +2702,7 @@ static void qDrawTextureRect(const QRectF &target, GLint textureWidth, GLint tex
|
||||
Q_UNUSED(textureHeight);
|
||||
Q_UNUSED(textureTarget);
|
||||
#else
|
||||
if (textureTarget != GL_TEXTURE_2D && !QOpenGLContext::currentContext()->isES()) {
|
||||
if (textureTarget != GL_TEXTURE_2D && !QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
if (textureWidth == -1 || textureHeight == -1) {
|
||||
glGetTexLevelParameteriv(textureTarget, 0, GL_TEXTURE_WIDTH, &textureWidth);
|
||||
glGetTexLevelParameteriv(textureTarget, 0, GL_TEXTURE_HEIGHT, &textureHeight);
|
||||
@ -2769,7 +2769,7 @@ void QGLContext::drawTexture(const QRectF &target, GLuint textureId, GLenum text
|
||||
#endif
|
||||
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
if (!contextHandle()->isES()) {
|
||||
if (!contextHandle()->isOpenGLES()) {
|
||||
#ifdef QT_OPENGL_ES
|
||||
if (textureTarget != GL_TEXTURE_2D) {
|
||||
qWarning("QGLContext::drawTexture(): texture target must be GL_TEXTURE_2D on OpenGL ES");
|
||||
@ -2831,7 +2831,7 @@ void QGLContext::drawTexture(const QPointF &point, GLuint textureId, GLenum text
|
||||
Q_UNUSED(textureId);
|
||||
Q_UNUSED(textureTarget);
|
||||
#else
|
||||
if (!contextHandle()->isES()) {
|
||||
if (!contextHandle()->isOpenGLES()) {
|
||||
const bool wasEnabled = glIsEnabled(GL_TEXTURE_2D);
|
||||
GLint oldTexture;
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldTexture);
|
||||
@ -4135,7 +4135,7 @@ void QGLWidget::glDraw()
|
||||
return;
|
||||
makeCurrent();
|
||||
#ifndef QT_OPENGL_ES
|
||||
if (d->glcx->deviceIsPixmap() && !d->glcx->contextHandle()->isES())
|
||||
if (d->glcx->deviceIsPixmap() && !d->glcx->contextHandle()->isOpenGLES())
|
||||
glDrawBuffer(GL_FRONT);
|
||||
#endif
|
||||
QSize readback_target_size = d->glcx->d_ptr->readback_target_size;
|
||||
@ -4180,7 +4180,7 @@ void QGLWidget::qglColor(const QColor& c) const
|
||||
#else
|
||||
Q_D(const QGLWidget);
|
||||
const QGLContext *ctx = QGLContext::currentContext();
|
||||
if (ctx && !ctx->contextHandle()->isES()) {
|
||||
if (ctx && !ctx->contextHandle()->isOpenGLES()) {
|
||||
if (ctx->format().rgba())
|
||||
glColor4f(c.redF(), c.greenF(), c.blueF(), c.alphaF());
|
||||
else if (!d->cmap.isEmpty()) { // QGLColormap in use?
|
||||
@ -4212,7 +4212,7 @@ void QGLWidget::qglClearColor(const QColor& c) const
|
||||
#else
|
||||
Q_D(const QGLWidget);
|
||||
const QGLContext *ctx = QGLContext::currentContext();
|
||||
if (ctx && !ctx->contextHandle()->isES()) {
|
||||
if (ctx && !ctx->contextHandle()->isOpenGLES()) {
|
||||
if (ctx->format().rgba())
|
||||
glClearColor(c.redF(), c.greenF(), c.blueF(), c.alphaF());
|
||||
else if (!d->cmap.isEmpty()) { // QGLColormap in use?
|
||||
@ -4387,7 +4387,7 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font)
|
||||
{
|
||||
#ifndef QT_OPENGL_ES
|
||||
Q_D(QGLWidget);
|
||||
if (!d->glcx->contextHandle()->isES()) {
|
||||
if (!d->glcx->contextHandle()->isOpenGLES()) {
|
||||
Q_D(QGLWidget);
|
||||
if (str.isEmpty() || !isValid())
|
||||
return;
|
||||
@ -4477,7 +4477,7 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con
|
||||
{
|
||||
#ifndef QT_OPENGL_ES
|
||||
Q_D(QGLWidget);
|
||||
if (!d->glcx->contextHandle()->isES()) {
|
||||
if (!d->glcx->contextHandle()->isOpenGLES()) {
|
||||
Q_D(QGLWidget);
|
||||
if (str.isEmpty() || !isValid())
|
||||
return;
|
||||
|
@ -326,7 +326,7 @@ QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *)
|
||||
|
||||
d->context = new QOpenGLContext;
|
||||
#if !defined(QT_OPENGL_ES)
|
||||
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) {
|
||||
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
|
||||
// On desktop, request latest released version
|
||||
QSurfaceFormat format;
|
||||
#if defined(Q_OS_MAC)
|
||||
|
@ -595,7 +595,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz,
|
||||
GL_DEPTH_COMPONENT16, size.width(), size.height());
|
||||
}
|
||||
#else
|
||||
if (ctx->contextHandle()->isES()) {
|
||||
if (ctx->contextHandle()->isOpenGLES()) {
|
||||
if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24))
|
||||
funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples,
|
||||
GL_DEPTH_COMPONENT24, size.width(), size.height());
|
||||
@ -617,7 +617,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz,
|
||||
size.width(), size.height());
|
||||
}
|
||||
#else
|
||||
if (ctx->contextHandle()->isES()) {
|
||||
if (ctx->contextHandle()->isOpenGLES()) {
|
||||
if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24)) {
|
||||
funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24,
|
||||
size.width(), size.height());
|
||||
@ -647,7 +647,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz,
|
||||
#ifdef QT_OPENGL_ES
|
||||
GLenum storage = GL_STENCIL_INDEX8;
|
||||
#else
|
||||
GLenum storage = ctx->contextHandle()->isES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX;
|
||||
GLenum storage = ctx->contextHandle()->isOpenGLES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX;
|
||||
#endif
|
||||
|
||||
if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample))
|
||||
@ -849,7 +849,7 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, GLenum target)
|
||||
Q_D(QGLFramebufferObject);
|
||||
d->init(this, size, NoAttachment, target,
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8
|
||||
QOpenGLContext::currentContext()->isOpenGLES() ? GL_RGBA : GL_RGBA8
|
||||
#else
|
||||
GL_RGBA
|
||||
#endif
|
||||
@ -869,7 +869,7 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, GLenum target)
|
||||
Q_D(QGLFramebufferObject);
|
||||
d->init(this, QSize(width, height), NoAttachment, target,
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8
|
||||
QOpenGLContext::currentContext()->isOpenGLES() ? GL_RGBA : GL_RGBA8
|
||||
#else
|
||||
GL_RGBA
|
||||
#endif
|
||||
@ -926,7 +926,7 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, Attachment att
|
||||
#ifdef QT_OPENGL_ES_2
|
||||
internal_format = GL_RGBA;
|
||||
#else
|
||||
internal_format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8;
|
||||
internal_format = QOpenGLContext::currentContext()->isOpenGLES() ? GL_RGBA : GL_RGBA8;
|
||||
#endif
|
||||
d->init(this, QSize(width, height), attachment, target, internal_format);
|
||||
}
|
||||
@ -953,7 +953,7 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, Attachment attachm
|
||||
#ifdef QT_OPENGL_ES_2
|
||||
internal_format = GL_RGBA;
|
||||
#else
|
||||
internal_format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8;
|
||||
internal_format = QOpenGLContext::currentContext()->isOpenGLES() ? GL_RGBA : GL_RGBA8;
|
||||
#endif
|
||||
d->init(this, size, attachment, target, internal_format);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
{
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||
const bool isES = ctx ? ctx->isES() : QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL;
|
||||
const bool isES = ctx ? ctx->isOpenGLES() : QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL;
|
||||
internal_format = isES ? GL_RGBA : GL_RGBA8;
|
||||
#else
|
||||
internal_format = GL_RGBA;
|
||||
|
@ -223,7 +223,7 @@ QGLFunctions::QGLFunctions(const QGLContext *context)
|
||||
static int qt_gl_resolve_features()
|
||||
{
|
||||
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||
if (ctx->isES()) {
|
||||
if (ctx->isOpenGLES()) {
|
||||
// OpenGL ES 2
|
||||
int features = QGLFunctions::Multitexture |
|
||||
QGLFunctions::Shaders |
|
||||
|
@ -361,7 +361,7 @@ void QGLPixelBuffer::updateDynamicTexture(GLuint texture_id) const
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texture_id);
|
||||
#ifndef QT_OPENGL_ES
|
||||
GLenum format = ctx->isES() ? GL_RGBA : GL_RGBA8;
|
||||
GLenum format = ctx->isOpenGLES() ? GL_RGBA : GL_RGBA8;
|
||||
glCopyTexImage2D(GL_TEXTURE_2D, 0, format, 0, 0, d->req_size.width(), d->req_size.height(), 0);
|
||||
#else
|
||||
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, d->req_size.width(), d->req_size.height(), 0);
|
||||
@ -488,7 +488,7 @@ GLuint QGLPixelBuffer::bindTexture(const QImage &image, GLenum target)
|
||||
{
|
||||
Q_D(QGLPixelBuffer);
|
||||
#ifndef QT_OPENGL_ES
|
||||
GLenum format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8;
|
||||
GLenum format = QOpenGLContext::currentContext()->isOpenGLES() ? GL_RGBA : GL_RGBA8;
|
||||
return d->qctx->bindTexture(image, target, GLint(format));
|
||||
#else
|
||||
return d->qctx->bindTexture(image, target, GL_RGBA);
|
||||
@ -507,7 +507,7 @@ GLuint QGLPixelBuffer::bindTexture(const QPixmap &pixmap, GLenum target)
|
||||
{
|
||||
Q_D(QGLPixelBuffer);
|
||||
#ifndef QT_OPENGL_ES
|
||||
GLenum format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8;
|
||||
GLenum format = QOpenGLContext::currentContext()->isOpenGLES() ? GL_RGBA : GL_RGBA8;
|
||||
return d->qctx->bindTexture(pixmap, target, GLint(format));
|
||||
#else
|
||||
return d->qctx->bindTexture(pixmap, target, GL_RGBA);
|
||||
|
@ -248,7 +248,7 @@ bool QGLShaderPrivate::create()
|
||||
shader = glfuncs->glCreateShader(GL_VERTEX_SHADER);
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
else if (shaderType == QGLShader::Geometry
|
||||
&& !context->contextHandle()->isES())
|
||||
&& !context->contextHandle()->isOpenGLES())
|
||||
shader = glfuncs->glCreateShader(GL_GEOMETRY_SHADER_EXT);
|
||||
#endif
|
||||
else
|
||||
@ -430,14 +430,14 @@ bool QGLShader::compileSourceCode(const char *source)
|
||||
srclen.append(GLint(headerLen));
|
||||
}
|
||||
#ifdef QGL_DEFINE_QUALIFIERS
|
||||
if (!QOpenGLContext::currentContext()->isES()) {
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
src.append(qualifierDefines);
|
||||
srclen.append(GLint(sizeof(qualifierDefines) - 1));
|
||||
}
|
||||
#endif
|
||||
#ifdef QGL_REDEFINE_HIGHP
|
||||
if (d->shaderType == Fragment
|
||||
&& QOpenGLContext::currentContext()->isES()) {
|
||||
&& QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
src.append(redefineHighp);
|
||||
srclen.append(GLint(sizeof(redefineHighp) - 1));
|
||||
}
|
||||
@ -568,7 +568,7 @@ public:
|
||||
void initializeGeometryShaderFunctions()
|
||||
{
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context->isES()) {
|
||||
if (!context->isOpenGLES()) {
|
||||
glProgramParameteri = (type_glProgramParameteri)
|
||||
context->getProcAddress("glProgramParameteri");
|
||||
|
||||
@ -936,7 +936,7 @@ bool QGLShaderProgram::link()
|
||||
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
// Set up the geometry shader parameters
|
||||
if (!QOpenGLContext::currentContext()->isES()
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES()
|
||||
&& d->glfuncs->glProgramParameteri) {
|
||||
foreach (QGLShader *shader, d->shaders) {
|
||||
if (shader->shaderType() & QGLShader::Geometry) {
|
||||
@ -3074,7 +3074,7 @@ int QGLShaderProgram::maxGeometryOutputVertices() const
|
||||
{
|
||||
GLint n = 0;
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (!QOpenGLContext::currentContext()->isES())
|
||||
if (!QOpenGLContext::currentContext()->isOpenGLES())
|
||||
glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT, &n);
|
||||
#endif
|
||||
return n;
|
||||
|
@ -242,7 +242,7 @@ EGLConfig QEglConfigChooser::chooseConfig()
|
||||
#ifdef EGL_VERSION_1_4
|
||||
case QSurfaceFormat::DefaultRenderableType:
|
||||
#ifndef QT_NO_OPENGL
|
||||
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL)
|
||||
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL)
|
||||
configureAttributes.append(EGL_OPENGL_BIT);
|
||||
else
|
||||
#endif // QT_NO_OPENGL
|
||||
@ -366,7 +366,7 @@ QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config,
|
||||
format.setRenderableType(QSurfaceFormat::OpenGL);
|
||||
else if (referenceFormat.renderableType() == QSurfaceFormat::DefaultRenderableType
|
||||
#ifndef QT_NO_OPENGL
|
||||
&& QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL
|
||||
&& QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL
|
||||
#endif
|
||||
&& (renderableType & EGL_OPENGL_BIT))
|
||||
format.setRenderableType(QSurfaceFormat::OpenGL);
|
||||
|
@ -243,7 +243,7 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
|
||||
return true;
|
||||
case ThreadedOpenGL:
|
||||
#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
|
||||
return QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL
|
||||
return QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL
|
||||
? QWindowsEGLContext::hasThreadedOpenGLCapability() : true;
|
||||
# else
|
||||
return true;
|
||||
@ -308,7 +308,7 @@ QPlatformOpenGLContext
|
||||
{
|
||||
qCDebug(lcQpaGl) << __FUNCTION__ << context->format();
|
||||
#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
|
||||
if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) {
|
||||
if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL) {
|
||||
if (d->m_staticEGLContext.isNull()) {
|
||||
QWindowsEGLStaticContext *staticContext = QWindowsEGLStaticContext::create();
|
||||
if (!staticContext)
|
||||
@ -319,7 +319,7 @@ QPlatformOpenGLContext
|
||||
}
|
||||
#endif
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) {
|
||||
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
|
||||
if (d->m_staticOpenGLContext.isNull())
|
||||
d->m_staticOpenGLContext =
|
||||
QSharedPointer<QOpenGLStaticContext>(QOpenGLStaticContext::create());
|
||||
|
@ -125,7 +125,7 @@ void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resour
|
||||
return 0;
|
||||
}
|
||||
#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
|
||||
if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) {
|
||||
if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL) {
|
||||
QWindowsEGLContext *windowsEglContext = static_cast<QWindowsEGLContext *>(context->handle());
|
||||
if (resource == QByteArrayLiteral("eglDisplay"))
|
||||
return windowsEglContext->eglDisplay();
|
||||
@ -136,7 +136,7 @@ void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resour
|
||||
}
|
||||
#endif // QT_OPENGL_ES_2 || QT_OPENGL_DYNAMIC
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) {
|
||||
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
|
||||
QWindowsGLContext *windowsContext = static_cast<QWindowsGLContext *>(context->handle());
|
||||
if (resource == QByteArrayLiteral("renderingContext"))
|
||||
return windowsContext->renderingContext();
|
||||
|
@ -880,7 +880,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data)
|
||||
if (aWindow->surfaceType() == QWindow::OpenGLSurface) {
|
||||
setFlag(OpenGLSurface);
|
||||
#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
|
||||
if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL)
|
||||
if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL)
|
||||
setFlag(OpenGL_ES2);
|
||||
#endif
|
||||
}
|
||||
|
@ -754,7 +754,7 @@ void tst_QGL::openGLVersionCheck()
|
||||
#elif defined(QT_OPENGL_ES_2)
|
||||
QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0);
|
||||
#else
|
||||
if (QOpenGLContext::currentContext()->isES())
|
||||
if (QOpenGLContext::currentContext()->isOpenGLES())
|
||||
QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0);
|
||||
else
|
||||
QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_1);
|
||||
@ -1552,7 +1552,7 @@ void tst_QGL::fboFormat()
|
||||
#ifdef QT_OPENGL_ES_2
|
||||
GL_RGBA;
|
||||
#else
|
||||
QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL ? GL_RGBA : GL_RGBA8;
|
||||
QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ? GL_RGBA : GL_RGBA8;
|
||||
#endif
|
||||
QCOMPARE(int(format1.internalTextureFormat()), expectedFormat);
|
||||
|
||||
@ -1629,7 +1629,7 @@ void tst_QGL::fboFormat()
|
||||
#ifdef QT_OPENGL_ES_2
|
||||
GL_RGBA
|
||||
#else
|
||||
QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL ? GL_RGBA : GL_RGBA8
|
||||
QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ? GL_RGBA : GL_RGBA8
|
||||
#endif
|
||||
);
|
||||
QVERIFY(!(format1c == format3c));
|
||||
@ -1642,7 +1642,7 @@ void tst_QGL::fboFormat()
|
||||
#ifdef QT_OPENGL_ES_2
|
||||
GL_RGBA
|
||||
#else
|
||||
QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL ? GL_RGBA : GL_RGBA8
|
||||
QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ? GL_RGBA : GL_RGBA8
|
||||
#endif
|
||||
);
|
||||
QVERIFY(!(format1c == format4c));
|
||||
@ -2417,10 +2417,10 @@ void tst_QGL::extensions()
|
||||
QVERIFY(allFeatures.testFlag(QOpenGLFunctions::Shaders));
|
||||
QVERIFY(allFeatures.testFlag(QOpenGLFunctions::Buffers));
|
||||
QVERIFY(allFeatures.testFlag(QOpenGLFunctions::Multisample));
|
||||
QVERIFY(!ctx->isES() || allFeatures.testFlag(QOpenGLFunctions::Framebuffers));
|
||||
QVERIFY(!ctx->isOpenGLES() || allFeatures.testFlag(QOpenGLFunctions::Framebuffers));
|
||||
QVERIFY(allFeatures.testFlag(QOpenGLFunctions::NPOTTextures)
|
||||
&& allFeatures.testFlag(QOpenGLFunctions::NPOTTextureRepeat));
|
||||
if (ctx->isES()) {
|
||||
if (ctx->isOpenGLES()) {
|
||||
QVERIFY(!allFeatures.testFlag(QOpenGLFunctions::FixedFunctionPipeline));
|
||||
QVERIFY(allFeatures.testFlag(QOpenGLFunctions::Framebuffers));
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ void tst_QGLFunctions::features()
|
||||
funcs.initializeGLFunctions();
|
||||
|
||||
// Validate the features against what we expect for this platform.
|
||||
if (QOpenGLContext::currentContext()->isES()) {
|
||||
if (QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
#if !defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2)
|
||||
QGLFunctions::OpenGLFeatures allFeatures =
|
||||
(QGLFunctions::Multitexture |
|
||||
|
@ -339,7 +339,7 @@ static inline float qrandom() { return (rand() % 100) / 100.f; }
|
||||
|
||||
void renderAScene(int w, int h)
|
||||
{
|
||||
if (QOpenGLContext::currentContext()->isES()) {
|
||||
if (QOpenGLContext::currentContext()->isOpenGLES()) {
|
||||
QGLFunctions funcs(QGLContext::currentContext());
|
||||
Q_UNUSED(w);
|
||||
Q_UNUSED(h);
|
||||
|
@ -2598,7 +2598,7 @@ void tst_QMdiArea::nativeSubWindows()
|
||||
if (platformName != QLatin1String("xcb") && platformName != QLatin1String("windows"))
|
||||
QSKIP(qPrintable(QString::fromLatin1("nativeSubWindows() does not work on this platform (%1).").arg(platformName)));
|
||||
#if defined(Q_OS_WIN) && !defined(QT_NO_OPENGL)
|
||||
if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL)
|
||||
if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL)
|
||||
QSKIP("nativeSubWindows() does not work with ANGLE on Windows, QTBUG-28545.");
|
||||
#endif
|
||||
{ // Add native widgets after show.
|
||||
|
Loading…
Reference in New Issue
Block a user