[Interest] [qt-android] Is it possible to create OpenGL ES 2 context even when ES 3 is available?

Agocs Laszlo laszlo.agocs at theqtcompany.com
Thu Mar 12 11:27:01 CET 2015


I would not consider that as a hack at all. It is perfectly fine. There’s nothing wrong with using ESSL1 shaders with ES 3.0+, as long as you do not rely on features that need the newer language features. Qt Quick for examples uses ESSL1 compatible shaders always and does not include ESSL3 variants just because we might be running on ES 3.0 or 3.1.

However, the PowerVR case you describe is a bit puzzling indeed.
Cheers,
Laszlo

From: Liang Jian [mailto:jianliang79 at gmail.com]
Sent: 12. mars 2015 11:13
To: Agocs Laszlo
Cc: interest at qt-project.org
Subject: Re: [Interest] [qt-android] Is it possible to create OpenGL ES 2 context even when ES 3 is available?

     Can you take a look at http://community.arm.com/message/16669
     As you have said, Using GLSL 3 with GL_OES_EGL_image_external is not permitted, but using GLSL 1 with GL_OES_EGL_image_external under opengl es 3 context is more like a hack according to the post. GL_OES_EGL_image_external_essl3 should be the right way but I didn't find a phone support that extension.
     According to my test, at least in my Meizu MX4 (with PowerVR Rogue Han) I fail to compile the fragment shader with GL_OES_EGL_image_external, other phone with opengl es 3 works fine. I guess if I can create a opengl es 2 context maybe I can make it work. But As you have said Qt will request 2.0 context, and it is the implentation choose openges 3 context, then It seems that it is a bug of the driver. But I am curious about how can this phone pass through the Android CTS test? Android CTS test will use SurfaceTexture and GL_OES_EGL_image_external

On Thu, Mar 12, 2015 at 5:42 PM, Agocs Laszlo <laszlo.agocs at theqtcompany.com<mailto:laszlo.agocs at theqtcompany.com>> wrote:
Qt does exactly what you ask for: it requests a 2.0 context. Now since implementations are free to return a later version that is backwards compatible with the requested, getting a 3.0 or 3.1 context is perfectly fine (and is the standard behavior you will get with any driver that supports ES 3.0 and newer).
There is no reason for GL_OES_EGL_image_external not to work with ES 3.x, as long as you use ES2-style (ESSL1) shaders. The typical problem is that drivers are free to reject it in ESSL3 shaders, unless they also support the fairly fresh GL_OES_EGL_image_external_essl3.

Now, it could be that your particular driver disables the extension completely in non-2.0 contexts (regardless of the shading language version in use), but there is no solution to that since there is no standard way to force a given context version.

Best regards,
Laszlo


From: interest-bounces+laszlo.agocs=theqtcompany.com at qt-project.org<mailto:theqtcompany.com at qt-project.org> [mailto:interest-bounces+laszlo.agocs<mailto:interest-bounces%2Blaszlo.agocs>=theqtcompany.com at qt-project.org<mailto:theqtcompany.com at qt-project.org>] On Behalf Of Liang Jian
Sent: 12. mars 2015 08:02
To: interest at qt-project.org<mailto:interest at qt-project.org>
Subject: [Interest] [qt-android] Is it possible to create OpenGL ES 2 context even when ES 3 is available?

     Now qt-android will create an OpenGL ES 3 context if that ES3 is supported by the devices even if I have call QSurfaceFormat::setVersion(2,0). Is it a way to just create the specific version I wanted using QOpenGLContext?
    The reason why I care about that is: I need to use SurfaceTexture in my android app, and that require GL_OES_EGL_image_external extenstion, but GL_OES_EGL_image_external is written against OpenGL ES 2. If I create a OpenGL ES 3 context, some GPU (such as PowerVR rogue han) driver will fail to compile my fragment shader if I add the line to my fragment shader:
    #extension GL_OES_EGL_image_external : require
    In this case I must create a OpenGL ES 2 context to make it work.
    I think qtmultimedia for android will also suffer from this because it will also use GL_OES_EGL_image_external. In fact I tried to deloy qmlvideo example to my Meizu MX4 (PowerVR Rogue Han) it didin't work, But I didn't see the shader compilation error from debug output.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150312/15eb01e0/attachment.html>


More information about the Interest mailing list