PDA

View Full Version : Problem with AMD GPU and GL_ARB_ES3_1_compatibility



no_n@me
11-15-2016, 01:45 PM
Hello. I am currently trying to run some shaders written for OpenGL ES 3.1 on a desktop AMD GPU (Radeon R7 200 Series, Ubutnu Linux). The driver reports that it supports GL_ARB_ES3_1_compatibility extension. As I understand it should compile the shaders starting with '#version 310 es' but for some reason the compilation fails with error about unsupported shader version:


ERROR: 0:1: error(#106) Invalid shader version number

I am using the proprietary drivers from AMD site (15.12). The GL context is created with pure GLX. I tried using different context versions: 4.3, 4.5, but eventually it did not work. All the shaders are compiled perfectly fine on a system with Nvidia GPU. Am I missing something?

Dark Photon
11-15-2016, 04:40 PM
Hello. I am currently trying to run some shaders written for OpenGL ES 3.1 on a desktop AMD GPU (Radeon R7 200 Series, Ubutnu Linux). The driver reports that it supports GL_ARB_ES3_1_compatibility extension. ... The GL context is created with pure GLX.

You might post your context creation code (within ... or
... tags).

Also, if your drivers support GLX_EXT_create_context_es_profile (https://www.opengl.org/registry/specs/EXT/glx_create_context_es2_profile.txt) (example (https://stackoverflow.com/questions/32548084/how-to-create-opengl-es-2-context-on-desktop)), I wonder if it'd accept the shader from OpenGL ES.

no_n@me
11-17-2016, 05:49 AM
Unfortunately I cannot disclose the complete source. Currently it is done like bellow:



static const int ctx_attribs[] =
{
GLX_CONTEXT_MAJOR_VERSION_ARB, 4,
GLX_CONTEXT_MINOR_VERSION_ARB, 3,
GLX_RENDER_TYPE, GLX_RGBA_TYPE,
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
None
};
...
ctx = glXCreateContextAttribsARB(dpy, configs[0], NULL, True, ctx_attribs);



I also tried using compatibility profile and different context versions (4.4, 4.5). Still I have the same problem. My driver does not seem to support GLX_EXT_create_context_es_profile.

Also I found this article: https://www.saschawillems.de/?page_id=1822 which says:


AMD doesn’t expose OpenGL ES on desktops via OpenGL extensions (so you won’t find these on any AMD device), but goes the same route as Android devices and exposes OpenGL ES via EGL.

I am not really a big expert in OpenGL but if that is the case, then I am wondering why the driver exports compatibility support in GL extension string while the current context does not actually support it. Isn't it incorrect?

Dark Photon
11-18-2016, 05:46 PM
Currently it is done like bellow:



GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,


I'm not 100% certain, but it sounds like the ARB_ES3_1_compatibility extension may require a compatibility context.


I am wondering why the driver exports compatibility support in GL extension string while the current context does not actually support it. Isn't it incorrect?

It does seem like a bug. Here are a few other things to try/check: verify that your #version directive is the very first line of the shader. Try a compatibility context. Try including "#extension GL_ARB_ES3_1_compatibility : require" in your shader (below the version directive). Try just using "#version 310" instead (not valid, but a shot in the dark).

no_n@me
11-21-2016, 03:01 AM
Thanks for suggestions. Though compatibility profile and all the tricks with shader version string and extension do not help much. The problem is still present. But actually I've noticed one more strange thing. Initially I did not pay attention to the shader type. It seems that vertex/fragment shaders are compiled fine with '310 es'. The compilation fails only with compute shaders, e.g.


#version 310 es
precision highp float;
precision highp int;
layout(local_size_x = 1) in;
buffer Buffer {
int res;
};
void main() {
res = 4;
}

Compilation log:


Compute shader failed to compile with the following errors:
ERROR: 0:1: error(#106) Invalid shader version number
ERROR: 0:2: error(#263) "Precision qualifier" is not supported prior to GLSL version 1.30
ERROR: 0:3: error(#263) "Precision qualifier" is not supported prior to GLSL version 1.30
WARNING: 0:4: warning(#437) Extension GL_ARB_enhanced_layouts or version 4.40 is requried''.
ERROR: error(#273) 3 compilation errors. No code generated