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

MaterialX: fix for GLSL shader generation if not using bindless textures #1634

Conversation

pmolodo
Copy link
Contributor

@pmolodo pmolodo commented Sep 30, 2021

Description of Change(s)

Currently, if you try to use usdview to view an object with a materialX shader applied, and bindless textures are not enabled, then you will get an error:

error C7554: OpenGL requires sampler variables to be explicitly declared as uniform

This can be reproduced on the dev branch by building a stock USD, then setting GLF_ENABLE_BINDLESS_SHADOW_TEXTURES=0 in your environment before launching usdview on any file displaying materialx shaders.

Fixes Issue(s)

  • Ability to view MaterialX in OpenGL if not using bindless textures.

@pmolodo
Copy link
Contributor Author

pmolodo commented Sep 30, 2021

This is a bit messy, as it adds more special case branching. Wasn't sure how to do a cleaner version that didn't require much more intrusive changes, though...

@pmolodo
Copy link
Contributor Author

pmolodo commented Sep 30, 2021

Attaching a simple scene that can be used to show the issue - thanks to Jerry Gamache and Spiff (https://groups.google.com/g/usd-interest/c/8Wy8zi1SN-o/m/YS4P1TFPCAAJ)

Just unzip and do:

Windows:

set GLF_ENABLE_BINDLESS_SHADOW_TEXTURES=0
usdview jerry_gamache_mtlx_example.usda

Linux/MacOS:

export GLF_ENABLE_BINDLESS_SHADOW_TEXTURES=0
usdview jerry_gamache_mtlx_example.usda

jerry_gamache_mtlx_example.zip

@jilliene
Copy link

jilliene commented Oct 4, 2021

Filed as internal issue #USD-6939

@klucknav
Copy link
Contributor

Thank you for the change. Unfortunately, we cannot directly merge your change as there are a handful of changes we would like to make. But we have a fix for the underlying issue based on your change that should be in dev soon. Thanks again.

@klucknav klucknav closed this Dec 17, 2021
@pmolodo
Copy link
Contributor Author

pmolodo commented Dec 17, 2021

Great! Was by no means enamored of my particular solution - as long as the underlying issue gets fixed!

pixar-oss pushed a commit that referenced this pull request Dec 18, 2021
lkerley pushed a commit to imageworks/USD that referenced this pull request Jan 7, 2022
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

Successfully merging this pull request may close these issues.

3 participants