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

Gizmos broke on WASM #14696

Closed
simbleau opened this issue Aug 10, 2024 · 14 comments
Closed

Gizmos broke on WASM #14696

simbleau opened this issue Aug 10, 2024 · 14 comments
Labels
A-Gizmos Visual editor and debug gizmos A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior O-Web Specific to web (WASM) builds S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Milestone

Comments

@simbleau
Copy link
Contributor

simbleau commented Aug 10, 2024

Bevy version

0.14.1

I have bevy_gizmos enabled. The GizmoPlugin was added.

[Optional] Relevant system information

MacOS, but running my app on WASM Chromium.

Attribute offset (12) with format VertexFormat::Float32x3 (size: 12) doesn't fit in the vertex buffer stride (12).
 - While validating attributes[0].
 - While validating buffers[1].
 - While validating vertex state.
 - While calling [Device].CreateRenderPipeline([RenderPipelineDescriptor "LineGizmo Pipeline 2D"]).
Understand this warning
[Invalid RenderPipeline "LineGizmo Pipeline 2D"] is invalid.
 - While encoding [RenderPassEncoder "main_transparent_pass_2d"].SetPipeline([Invalid RenderPipeline "LineGizmo Pipeline 2D"]).
 - While finishing [CommandEncoder (unlabeled)].
Understand this warning
[Invalid CommandBuffer] is invalid.
 - While calling [Queue].Submit([[Invalid CommandBuffer]])
@simbleau simbleau added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Aug 10, 2024
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen O-MacOS Specific to the MacOS (Apple) desktop operating system and removed S-Needs-Triage This issue needs to be labelled labels Aug 10, 2024
@alice-i-cecile
Copy link
Member

Is this new in 0.14.1? Can you reproduce on main?

@alice-i-cecile alice-i-cecile added the S-Needs-Investigation This issue requires detective work to figure out what's going wrong label Aug 10, 2024
@simbleau
Copy link
Contributor Author

Is this new in 0.14.1? Can you reproduce on main?

Don't have a quick enough way to test on main due to countless migration steps

It does reproduce on =0.14.0

@alice-i-cecile
Copy link
Member

Ah, I wasn't asking you to port your app: just try one of the gizmo examples by cloning the repo :) These are basically always universal bugs with weird hardware / driver specific edges.

@jurisk
Copy link

jurisk commented Aug 11, 2024

I ran into this on WASM build when run in the browser (Chrome 127, Windows), using bevy_gizmos, but I haven't reproduced it on a smaller sample (yet).

Attribute offset (12) with format VertexFormat::Float32x3 (size: 12) doesn't fit in the vertex buffer stride (12).
 - While validating attributes[0].
 - While validating buffers[1].
 - While validating vertex state.
 - While calling [Device].CreateRenderPipeline([RenderPipelineDescriptor "LineGizmo Pipeline"]).

[Invalid RenderPipeline "LineGizmo Pipeline"] is invalid.
 - While encoding [RenderPassEncoder "main_transparent_pass_3d"].SetPipeline([Invalid RenderPipeline "LineGizmo Pipeline"]).

[Invalid CommandBuffer] is invalid.
 - While calling [Queue].Submit([[CommandBuffer], [CommandBuffer "shadow_pass_command_encoder" from CommandEncoder "shadow_pass_command_encoder"], [CommandBuffer "shadow_pass_command_encoder" from CommandEncoder "shadow_pass_command_encoder"], [CommandBuffer "shadow_pass_command_encoder" from CommandEncoder "shadow_pass_command_encoder"], [CommandBuffer "shadow_pass_command_encoder" from CommandEncoder "shadow_pass_command_encoder"], [CommandBuffer], [CommandBuffer "main_opaque_pass_3d_command_encoder" from CommandEncoder "main_opaque_pass_3d_command_encoder"], [Invalid CommandBuffer]])

@simbleau
Copy link
Contributor Author

simbleau commented Aug 11, 2024

Ah, yeah. I forgot to mention I'm also running a WASM build. This is probably more an issue with WASM than Metal, on second thought.

@simbleau simbleau changed the title Gizmos broke on Metal Gizmos broke on WASM Aug 11, 2024
@simbleau simbleau changed the title Gizmos broke on WASM Gizmos broke on WASM/Metal Aug 11, 2024
@alice-i-cecile alice-i-cecile added O-Web Specific to web (WASM) builds and removed O-MacOS Specific to the MacOS (Apple) desktop operating system labels Aug 11, 2024
@jurisk
Copy link

jurisk commented Aug 11, 2024

For me, if I comment some...

gizmos.sphere(position, Quat::default(), 0.1, color);

...calls then the issue stops occurring (at the same time, various gizmos.line calls work - even a large number of them).

@simbleau
Copy link
Contributor Author

I suspect that it only appears when:

gizmos.sphere(position, Quat::default(), 0.1, color);

...is called.

It's triggered the second I add a call to any gizmo. (I don't have any spheres, I only use 2d rects/lines).

If I disable gizmos (easily done in my app), I don't get this panic.

The panic triggers the first time you render any gizmo for me.

@simbleau simbleau changed the title Gizmos broke on WASM/Metal Gizmos broke on WASM Aug 11, 2024
@jurisk
Copy link

jurisk commented Aug 11, 2024

I can repeat this on both 0.14.0 and 0.14.1, the behaviour appears to be the same.

@alice-i-cecile alice-i-cecile added the A-Gizmos Visual editor and debug gizmos label Aug 11, 2024
@rparrett
Copy link
Contributor

Could someone do a minimal reproducer? I am not seeing this behavior in any of the deployed wasm examples that utilize gizmos.

m1 max / macOS 14.5 / chrome 127

@jurisk
Copy link

jurisk commented Aug 11, 2024

FWIW:

Tested on two systems:

  • Chrome 127.0.6533.100 (Official Build) (64-bit) on Windows 11 Pro.
  • Chrome 127 on MacOS 14.5.

@rparrett
Copy link
Contributor

Oh, okay, geat. I can reproduce with webgpu too.

@akimakinai
Copy link
Contributor

This seems to have been fixed by #14653. Tested on Chrome 127.0.6533.100/Win11, 3d-gizmos example works with e14f3cf, while e14f3cf^ reproduces the error.

@akimakinai
Copy link
Contributor

It seems gizmo joints in WebGPU are still broken on main. #14653 fixed lines but not joints.

Attribute offset (12) with format VertexFormat::Float32x3 (size: 12) doesn't fit in the vertex buffer stride (12).
 - While validating attributes[0].
 - While validating buffers[1].
 - While validating vertex state.
 - While calling [Device].CreateRenderPipeline([RenderPipelineDescriptor "LineJointGizmo Pipeline 2D"]).

[Invalid RenderPipeline "LineJointGizmo Pipeline 2D"] is invalid.
 - While encoding [RenderPassEncoder "main_transparent_pass_2d"].SetPipeline([Invalid RenderPipeline "LineJointGizmo Pipeline 2D"]).

@rparrett rparrett added this to the 0.14.2 milestone Aug 12, 2024
github-merge-queue bot pushed a commit that referenced this issue Aug 25, 2024
# Objective

- Gizmo rendering on WebGPU has been fixed by #14653, but gizmo joints
still cause error
(#14696 (comment))
when enabled.

## Solution

- Applies the same fix as #14653 to Gizmo joints.

I'm noob and just copied their solution, please correct me if I did
something wrong.

## Testing

- Tested 2d-gizmos and 3d-gizmos examples in WebGPU on Chrome. No
rendering errors, and the gizmo joints are apparently rendered ok.
@alice-i-cecile
Copy link
Member

Closing as fixed by #14721, but please correct me if this is not the case.

mockersf pushed a commit that referenced this issue Sep 5, 2024
# Objective

- Gizmo rendering on WebGPU has been fixed by #14653, but gizmo joints
still cause error
(#14696 (comment))
when enabled.

## Solution

- Applies the same fix as #14653 to Gizmo joints.

I'm noob and just copied their solution, please correct me if I did
something wrong.

## Testing

- Tested 2d-gizmos and 3d-gizmos examples in WebGPU on Chrome. No
rendering errors, and the gizmo joints are apparently rendered ok.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Gizmos Visual editor and debug gizmos A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior O-Web Specific to web (WASM) builds S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
Development

No branches or pull requests

5 participants