Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Starting usdview on a system with a GL_VERSION of 3.0 shows errors in the console #1001

Closed
flashingsquare opened this issue Oct 17, 2019 · 3 comments

Comments

@flashingsquare
Copy link

Description of Issue

Starting usdview on my system which supports OpenGl 3.0 prints a lot errors of the form:

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

error: linking with uncompiled/unspecialized shadererror: linking with uncompiled/unspecialized shader
Traceback (most recent call last):
  File "/home/knud/src/c++/phanes/thirdparty/USD/build/build_usdimaging/lib/python/pxr/Usdviewq/stageView.py", line 1714, in paintGL
    self.DrawAxis(viewProjectionMatrix)
  File "/home/knud/src/c++/phanes/thirdparty/USD/build/build_usdimaging/lib/python/pxr/Usdviewq/stageView.py", line 1038, in DrawAxis
    glslProgram = self.GetSimpleGLSLProgram()
  File "/home/knud/src/c++/phanes/thirdparty/USD/build/build_usdimaging/lib/python/pxr/Usdviewq/stageView.py", line 1030, in GetSimpleGLSLProgram
    ["mvpMatrix", "color"])
  File "/home/knud/src/c++/phanes/thirdparty/USD/build/build_usdimaging/lib/python/pxr/Usdviewq/stageView.py", line 126, in __init__
    GL.glDeleteShader(vertexShader)
  File "src/errorchecker.pyx", line 53, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError
OpenGL.error.GLError: GLError(
	err = 1281,
	description = 'invalid value',
	baseOperation = glDeleteShader,
	cArguments = (5L,)
)

Looking at the chart found here https://stackoverflow.com/questions/27407774/get-supported-glsl-versions/27410925 It looks like GL 3.0 is indeed mapped to GLSL version 1.3

Changing the lines starting at stageView.py:92

if (self._glMajorVersion >= 3):
    vsSource = VS3
    fsSource = FS3
else:
    vsSource = VS2
    fsSource = FS2

to

glslVersion = float(GL.glGetString(GL.GL_SHADING_LANGUAGE_VERSION))
if (glslVersion >= 1.4):
    vsSource = VS3
    fsSource = FS3
else:
    vsSource = VS2
    fsSource = FS2

Solved the problem for me since it now uses The supported fallback shaders VS2 and FS2
VS3 => #version 140
VS2 => #version 120

Steps to Reproduce

  1. On a Linux machine with OpenGL version of 3.0 start usdview
  2. See what happens

System Information (OS, Hardware)

Fedora 29

Package Versions

19.07

Build Flags

python ../build_scripts/build_usd.py --materialx --alembic --hdf5 --openimageio --usdview --usd-imaging --ptex /home/knud/src/c++/phanes/thirdparty/USD/build/build_usdimaging

@jilliene
Copy link

Filed as internal issue #USD-5636

@DuncanHopkinsFoundry
Copy link

I have seen this issue as well. Either on MacOS or using the open source MESA nVidia drivers.
I submitted PR 965 as a manual work around for this. Set up USDVIEW_ENABLE_COREGL environment variable and i allows drivers that support OpenGL Core context but expose an OpenGL Compatibility context that is less than the minimum 3.2 value of the Core context.

@flashingsquare
Copy link
Author

I have to admit that I do not fully understand the relation to #965.
This bug (how I see it) stems from a wrong mapping of the OPENGL_VERSION to GL_SHADING_LANGUAGE_VERSION which results in selecting the wrong shader (1.4 instead of 1.2).
The current behavior is:
Get the _glMajorVersion by casting the version-string to an int.
From this _glMajorVersion select one of the two shader variants
glVersion >= 3 => select the shader with glsl-version 1.4 (VS3/FS3)
otherwise => select the shader with glsl-version 1.2 (VS2/FS2)

This is correct for all gl versions except for 3.0 since 3.0 maps to glsl-version 1.3 and should therefore select 1.2

glFormat.setProfile(QtOpenGL.QGLFormat.CoreProfile)
shouldn't do anything on my system since "QGLFormat::setProfile" is ignored for OpenGL versions of less than 3.2

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

No branches or pull requests

3 participants