"GLSL 3.30 is not supported", is it the library or my video card's fault?

#1

I’m running OpenGL inside a virtual machine, so the ‘video cards’ I’m testing it are all simulated ones.

Currently I’m getting this error when compiling a shader with version 330:

shader info log: '0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES

I searched for it and people said it was the hardware’s fault.

I tried with several video drivers:

00:02.0 VGA compatible controller: Red Hat, Inc. QXL paravirtual graphic card (rev 04)
00:02.0 VGA compatible controller: Device 1234:1111 (rev 02)
00:02.0 VGA compatible controller: Red Hat, Inc. Virtio GPU (rev 01)
00:02.0 VGA compatible controller: VMware SVGA II Adapter
00:02.0 VGA compatible controller: Cirrus Logic GD 5446

and al of them give the same error. Could it be possible that my OpenGL library does not support GLSL 3.30? How do I find out?

UPDATE:

glxinfo  |grep -i versionsa-utils
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
    Version: 18.0.5
    Max core profile version: 3.3
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.0
OpenGL core profile version string: 3.3 (Core Profile) Mesa 18.0.5
OpenGL core profile shading language version string: 3.30
OpenGL version string: 3.0 Mesa 18.0.5
OpenGL shading language version string: 1.30
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 18.0.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00

What this means?

UPDATE:

running with

MESA_GL_VERSION_OVERRIDE=3.3 MESA_GLSL_VERSION_OVERRIDE=330 ./my_program

makes the error disappear (however I didn’t have a chance to test if everything works). Why do I need this override and how do I make my program not need it?

#2

If you want 3.3, you’ll need to explicitly request a core profile context, and you’ll be restricted to the features provided by the core profile.

How to do that depends upon how you’re creating the context (or, more likely, which library you’re using to create the context). For FreeGLUT, use glutInitContextProfile(GLUT_CORE_PROFILE). You might also want glutInitContextVersion(3,3) to request version 3.3 (although typically you’ll get the highest available version for the requested profile).