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

Mesh format panics with enabled by default ShaderDef #1589

Closed
lassade opened this issue Mar 7, 2021 · 3 comments
Closed

Mesh format panics with enabled by default ShaderDef #1589

lassade opened this issue Mar 7, 2021 · 3 comments
Labels
A-Rendering Drawing game state to the screen P-Crash A sudden unexpected crash

Comments

@lassade
Copy link
Contributor

lassade commented Mar 7, 2021

Bevy version

master branch d9fb61d

Operating system & version

Windows 10 / Fedora ~31

What you did

Define a material:

#[derive(Debug, Clone, Reflect, RenderResources, ShaderDefs)]
#[reflect(Component)]
pub struct Material {
    /// Enabled by default
    #[shader_def]
    #[render_resources(ignore)]
    pub lit: bool,
}

and his respective shader

....
#ifndef MATERIAL_UNLIT // Unlit shader doesn't need normals
layout(location = 3) in vec3 Vertex_Normal;
layout(location = 2) out vec3 v_Normal;
#endif
....

Tried to spawn a mesh without the Vertex_Normal attribute and with the Material::unlit = true

What you expected to happen

The mesh should be rendered just fine

What actually happened

Panic, with a complain about the mesh missing the Vertex_Normal attribute;

Additional information

I mananged to fix this issue by making all defines off by default instead of on, so in this case I use #ifdef MATERIAL_LIT instead

@Ratysz Ratysz added P-Crash A sudden unexpected crash A-Rendering Drawing game state to the screen labels Mar 7, 2021
@cart
Copy link
Member

cart commented Mar 9, 2021

I can't repro this using the internal StandardMaterial using any permutation of:

  1. changing unlit to lit
  2. changing the default value of StandardMaterial::lit to true or false
  3. Using # ifndef or # ifdef in forward.frag

Can you attach a minimal example that repros the issue?

@lassade
Copy link
Contributor Author

lassade commented Mar 10, 2021

You should be able to reproduce the error by runing cargo run --example showcase using the repo https://github.com/lassade/bevy_gizmos/tree/issue-1589 make sure to get the issue-1589 branch

Edit
A quick and dirt update to 1e42de6 still panics

@james7132
Copy link
Member

Closing this as both RenderResources and ShaderDefs are no longer present in the post-0.6 renderer.

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 P-Crash A sudden unexpected crash
Projects
None yet
Development

No branches or pull requests

4 participants