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

Storm: Shader compile error with mx::heighttonormal nodes #2281

Open
ashwinbhat opened this issue Feb 16, 2023 · 3 comments
Open

Storm: Shader compile error with mx::heighttonormal nodes #2281

ashwinbhat opened this issue Feb 16, 2023 · 3 comments

Comments

@ashwinbhat
Copy link
Contributor

Description of Issue

When we use MaterialX heighttonormal node to convert a height map to normal map, Storm reports a shader error.
error C7522: OpenGL requires constants to be initialized

Steps to Reproduce

  1. Extract contents of zip file
  2. Open testPreviewSurfaceNormalMap_mtlx.usda.
  3. It should render 4 planes, one of them is missing the texture and bump mapping
    testBumpMapping.zip
    image

System Information (OS, Hardware)

Windows x64

Package Versions

USD Dev at 1d2f18b

Build Flags

--tests --openimageio --opencolorio --materialx

@ashwinbhat
Copy link
Contributor Author

Attached is the shader dump.
program27_shader0_FRAGMENT_SHADER.glsl.txt

The filter kernels are uninitialized

const float c_box_filter_weights[84];
const float c_gaussian_filter_weights[84];

Adding a quick fix locally to initialize variables on emitVariableDeclarations seems to do it.
https://github.com/PixarAnimationStudios/USD/blob/5c5ebddff35012461a2b0ba773c47f05730cbab4/pxr/imaging/hdSt/materialXShaderGen.cpp#L294-L296

image

@tallytalwar
Copy link
Contributor

Filed as internal issue #USD-8019

@ashwinbhat
Copy link
Contributor Author

To clarify:

 emitVariableDeclarations(constants, _syntax->getConstantQualifier(), 
                          mx::Syntax::SEMICOLON,  
                          mxContext, mxStage, true); 

Works, but I'm not sure if this will break others use cases.

erikaharrison-adsk pushed a commit to autodesk-forks/USD that referenced this issue Jun 6, 2023
When we use MaterialX heighttonormal node to convert a height map to normal map, Storm reports a shader error.
error C7522: OpenGL requires constants to be initialized

The root cause is that the filter kernels are uninitialized

const float c_box_filter_weights[84];
const float c_gaussian_filter_weights[84];

Also logged as USD github issue
PixarAnimationStudios#2281
AdamFelt pushed a commit to autodesk-forks/USD that referenced this issue Apr 16, 2024
…ationStudios#308)

When we use MaterialX heighttonormal node to convert a height map to normal map, Storm reports a shader error.
error C7522: OpenGL requires constants to be initialized

The root cause is that the filter kernels are uninitialized

const float c_box_filter_weights[84];
const float c_gaussian_filter_weights[84];

Also logged as USD github issue
PixarAnimationStudios#2281
AdamFelt pushed a commit to autodesk-forks/USD that referenced this issue Apr 16, 2024
* Fix for shader compile error with mx::heighttonormal nodes
When we use MaterialX heighttonormal node to convert a height map to normal map, Storm reports a shader error.
error C7522: OpenGL requires constants to be initialized

The root cause is that the filter kernels are uninitialized

const float c_box_filter_weights[84];
const float c_gaussian_filter_weights[84];

Also logged as USD github issue
PixarAnimationStudios#2281
* Update basefiles
* Add readme and helper script
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

2 participants