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

Unlit materials cause shader panic #2190

Closed
aevyrie opened this issue May 17, 2021 · 1 comment
Closed

Unlit materials cause shader panic #2190

aevyrie opened this issue May 17, 2021 · 1 comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior P-Regression Functionality that used to work but no longer does. Add a test for this!

Comments

@aevyrie
Copy link
Member

aevyrie commented May 17, 2021

Bevy version

Commit e3435e5

Confirmed the breaking change happened in 73f4a9d

Operating system & version

Windows 10

What you did

Existing plugins that use unlit materials now panic as soon as meshes with that material are shown. Results in the following panic:

thread 'main' panicked at 'Shader compilation error:
glslang_shader_parse:
Info log:
ERROR: 0:293: 'getDistanceAttenuation' : no matching overloaded function found
ERROR: 0:293: '' : compilation terminated
ERROR: 2 compilation errors.  No code generated.

Lines in question appear to be in the pbr frag shader here:

float rangeAttenuation =
getDistanceAttenuation(distance_square, light.lightParams.r);

@aevyrie aevyrie added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels May 17, 2021
@alice-i-cecile alice-i-cecile added P-Regression Functionality that used to work but no longer does. Add a test for this! A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels May 17, 2021
@aevyrie
Copy link
Member Author

aevyrie commented May 17, 2021

I think I found the issue. Looks like a function that was previously only run if the material is not unlit, is now being run for unlit materials, and refers to the getDistanceAttenuation which is not defined for unlit materials.

Will PR solution.

@bors bors bot closed this as completed in 85b1729 May 17, 2021
ostwilkens pushed a commit to ostwilkens/bevy that referenced this issue Jul 27, 2021
Fixes the frag shader for unlit materials by correcting the scope of the `#ifndef` to include the light functions. Closes bevyengine#2190, introduced in bevyengine#2112.

Tested by changing materials in the the `3d_scene` example to be unlit. Unsure how to prevent future regressions without creating a test case scene that will catch these runtime panics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior P-Regression Functionality that used to work but no longer does. Add a test for this!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants