Problem with AMD GPU and GL_ARB_ES3_1_compatibility

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?

You might post your context creation code (within [noparse]

...

or

...

[/noparse] tags).

Also, if your drivers support GLX_EXT_create_context_es_profile (example), I wonder if it’d accept the shader from OpenGL ES.

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: Sascha Willems 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?

[QUOTE=no_n@me;1284700]Currently it is done like bellow:


    GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,

[/QUOTE]

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).

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

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.