I have stumbled into a basic OpenGL driver bug and I'm not sure where to report them.
Here's how the driver identifies itself and how we create the RC:
OpenGL vendor: X.Org
OpenGL renderer: AMD CARRIZO (DRM 3.26.0, 4.18.0-13-generic, LLVM 7.0.0)
OpenGL version: 4.4 (Compatibility Profile) Mesa 18.2.2
v - using GL version 2.0 (core)
It has ARB_gpu_shader5 in its extension list but not EXT_gpu_shader4.
This shader fails to compile
#version 120
#extension GL_EXT_gpu_shader4: enable
...
uniform usampler2D u_stencilTexture;
With this error:
interaction VFWARNING:CompileShader(glprogs/interaction.fs): FAILED
0:2(12): warning: extension `GL_EXT_gpu_shader4' unsupported in fragment shader
0:27(20): error: syntax error, unexpected NEW_IDENTIFIER, expecting '{'
So my question is: how do I get the version 120 shader with the usampler extension to build on seemingly Opengl-4.4 capable GPU/driver?
Preferably in a cross-platform, cross-vendor way.
Please note that the same shader compiles just fine on a wide range of devices/drivers on both Linux and Windows.
Anyhow, you don't happen to be working on ARK Survival Evolved. That game has a stray old #version 120 in one of it's config files that could be causing problems. Some other Unreal Engine 3 and Unreal Engine 4 games have the same problem.
This is likely stray cruft from when early Unreal Engine 4 was using ToGL instead of GLSLang as it's HLSL to GLSL translation layer. It likely never got removed from many games.
Either way, using #Version 330 should solve the issue entirely.
– Robert Wm Ruedisueli Dec 14 '19 at 06:021.30 through 1.50 have a compatability mode that removes forward compatability in favor of backwards compatability.
Compatability and core shaders can't directly interact. You can use them together, though. You need to put their output to a buffer and have them operate on separate stages to pipeline them together. Each stage must be either compatability or core.
– Robert Wm Ruedisueli Dec 14 '19 at 06:10At least not if your software is solely targetting PC. (Freedrino which targets ARM only supports OpenGL 3.1)
– Robert Wm Ruedisueli Dec 14 '19 at 06:46Linux drivers have added features to boards that did not ship with them.
This includes everything Radeon HD2400 and later in AMD (i.e. back before ATI was sold to AMD), and anything Kaby Lake or later in Intel processors.
Anything below that won't run SM4 at all. So really you have two choices. Either provide an alternative fallback shader for GLSL 3.3 (which will support everything that runs on x86_64)
"Older" nVidia not supported by would be before the GT(X)600
– Robert Wm Ruedisueli Dec 15 '19 at 11:59Instead you need to create a fallback render path and fallback shaders for older cards. This isn't a big deal.
Simply put, you can't support SM4 on OpenGL 3.1 chipsets in Linux. It won't work. You need an OpenGL 4 capable chipset.
– Robert Wm Ruedisueli Dec 15 '19 at 12:16