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

#imports seem to ignore #ifdef blocks (WGSL) #4011

Closed
Toqozz opened this issue Feb 22, 2022 · 0 comments
Closed

#imports seem to ignore #ifdef blocks (WGSL) #4011

Toqozz opened this issue Feb 22, 2022 · 0 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior

Comments

@Toqozz
Copy link

Toqozz commented Feb 22, 2022

Bevy version

0.6

Operating system & version

Windows 10 (Build 19042)

What you did

#ifdef FLAG
    #import bevy_pbr::mesh_view_bind_group
#else
    #import bevy_pbr::mesh_view_bind_group
#endif

What you expected to happen

Only one import should happen.

What actually happened

Both imports seem to happen and I get an error:

2022-02-22T04:30:48.159248Z ERROR bevy_render::render_resource::pipeline_cache: failed to process shader:
error: redefinition of `POINT_LIGHT_FLAGS_SHADOWS_ENABLED_BIT`
    ┌─ wgsl:23:5
    │
 23 │ let POINT_LIGHT_FLAGS_SHADOWS_ENABLED_BIT: u32 = 1u;
    │     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ previous definition of `POINT_LIGHT_FLAGS_SHADOWS_ENABLED_BIT`
    ·
113 │ let POINT_LIGHT_FLAGS_SHADOWS_ENABLED_BIT: u32 = 1u;
    │     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ redefinition of `POINT_LIGHT_FLAGS_SHADOWS_ENABLED_BIT`
@Toqozz Toqozz added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Feb 22, 2022
@Toqozz Toqozz changed the title #imports seem to ignore #ifdef blocks #imports seem to ignore #ifdef blocks (WGSL) Feb 22, 2022
@mockersf mockersf added A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Feb 22, 2022
@bors bors bot closed this as completed in e4203c3 Feb 22, 2022
kurtkuehnert pushed a commit to kurtkuehnert/bevy that referenced this issue Mar 6, 2022
…#4012)

# Objective

- fix bevyengine#4011 
- imports are not limited by the current `ifdef` they are in

## Solution

- process imports only if the current scope is enabled
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants