Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

GLSL 1.40 is not supported. #957

Closed
gonsolo opened this issue Sep 9, 2019 · 5 comments
Closed

GLSL 1.40 is not supported. #957

gonsolo opened this issue Sep 9, 2019 · 5 comments

Comments

@gonsolo
Copy link

gonsolo commented Sep 9, 2019

Description of Issue

usdview reports GL errors:

0:1(10): error: GLSL 1.40 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, and 3.10 ES

0:1(10): error: GLSL 1.40 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, and 3.10 ES

error: vertex shader lacks `main'

Traceback (most recent call last):
File "/home/gonsolo/lib/python/pxr/Usdviewq/stageView.py", line 1712, in paintGL
self.DrawAxis(viewProjectionMatrix)
File "/home/gonsolo/lib/python/pxr/Usdviewq/stageView.py", line 1039, in DrawAxis
glslProgram = self.GetSimpleGLSLProgram()
File "/home/gonsolo/lib/python/pxr/Usdviewq/stageView.py", line 1031, in GetSimpleGLSLProgram
["mvpMatrix", "color"])
File "/home/gonsolo/lib/python/pxr/Usdviewq/stageView.py", line 116, in init
GL.glDeleteShader(vertexShader)
File "/usr/lib/python2.7/dist-packages/OpenGL/error.py", line 232, in glCheckError
baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
err = 1281,
description = 'invalid value',
baseOperation = glDeleteShader,
cArguments = (2L,)

System Information (OS, Hardware)

Intel Haswell on Linux

@gonsolo
Copy link
Author

gonsolo commented Sep 9, 2019

Default QGLFormat() results in compat profile (which is also wrong since Haswell supports 4.5) with GL version 3.0 with GLSL version 1.30. USD checks for 3.0 and uses 1.40 which is wrong. The fix is to check for OpenGL 3.1 with GLSL version 1.40 in pxr/usdImaging/lib/usdviewq/stageView.py.

+++ stageView.py 2019-09-09 15:47:26.747184981 +0200
@@ -83,13 +83,16 @@
class GLSLProgram():
def init(self, VS3, FS3, VS2, FS2, uniformDict):
from OpenGL import GL

  •    self._glMajorVersion = int(GL.glGetString(GL.GL_VERSION)[0])
    
  •    glVersionString = GL.glGetString(GL.GL_VERSION)
    
  •    self._glMajorVersion = int(glVersionString[0])
    
  •    glMinorVersion = int(glVersionString[2])
    
  •    print(glMinorVersion)
    
       self.program   = GL.glCreateProgram()
       vertexShader   = GL.glCreateShader(GL.GL_VERTEX_SHADER)
       fragmentShader = GL.glCreateShader(GL.GL_FRAGMENT_SHADER)
    
  •    if (self._glMajorVersion >= 3):
    
  •    if (self._glMajorVersion >= 3 and glMinorVersion >= 1):
           vsSource = VS3
           fsSource = FS3
       else:
    

@jilliene
Copy link

jilliene commented Sep 9, 2019

Filed as internal issue #USD-5534

@gonsolo
Copy link
Author

gonsolo commented May 18, 2021

After two years I tried again; same error.

The relevant part of the file should be like this:

        versionNumberString = versionString.split()[0]
        splitted = versionNumberString.split('.')
        self._glMajorVersion = int(splitted[0])
        self._glMinorVersion = int(splitted[1])

        # requires PyOpenGL 3.0.2 or later for glGenVertexArrays.
        self.useVAO = (self._glMajorVersion >= 3 and
                        hasattr(GL, 'glGenVertexArrays'))
        self.useSampleAlphaToCoverage = (self._glMajorVersion >= 4)

        self.program   = GL.glCreateProgram()
        vertexShader   = GL.glCreateShader(GL.GL_VERTEX_SHADER)
        fragmentShader = GL.glCreateShader(GL.GL_FRAGMENT_SHADER)

        if (self._glMajorVersion >= 3 and self._glMinorVersion >= 1):
            vsSource = VS3
            fsSource = FS3

@VikingScientist
Copy link

The issue also affects me. After installing through build_usd.py and running the tutorial Hello World - creating your first USD stage I am faced with the following error message

State file not found, a new one will be created.
b'0:1(10): error: GLSL 1.40 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES\n'
b'0:1(10): error: GLSL 1.40 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES\n'
b'error: linking with uncompiled/unspecialized shadererror: linking with uncompiled/unspecialized shader'
ERROR: Usdview encountered an error while rendering.GLError(
	err = 1281,
	description = b'invalid value',
	baseOperation = glDeleteShader,
	cArguments = (2,)
)

To dump the detail on my hardware I ran glxinfo | grep OpenGL which gives

OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 5500 (BDW GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.0.8
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 20.0.8
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 20.0.8
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:

The install is running on Ubuntu 18.04

@VikingScientist
Copy link

I found a solution in #1001, courtesy of @flashingsquare by changing the file pxr/usdImaging/usdviewq/stageView.py

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants