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

Fix crash when Msaa is off #13

Merged
merged 2 commits into from
Apr 1, 2024
Merged

Fix crash when Msaa is off #13

merged 2 commits into from
Apr 1, 2024

Conversation

mbrea-c
Copy link
Owner

@mbrea-c mbrea-c commented Mar 27, 2024

The current rendering code was assuming that Msaa was always on due to an oversight. This PR will determines whether to bind a texture with multisampling enabled based on the actual msaa configuration.

Fixes the second crash mentioned in #11, and works around the first in the example code.

@mbrea-c mbrea-c mentioned this pull request Mar 27, 2024
@rparrett
Copy link
Contributor

Seems to fix the issue on my end.

I would probably do something like

diff --git a/examples/pbr.rs b/examples/pbr.rs
index 159e631..91d3353 100644
--- a/examples/pbr.rs
+++ b/examples/pbr.rs
@@ -11,8 +11,13 @@ use bevy_utilitarian::prelude::*;
 
 fn main() {
     let mut app = App::new();
-    app.add_plugins(DefaultPlugins)
-        .add_plugins(ParticleSystemPlugin)
+    app.add_plugins(DefaultPlugins);
+
+    // Msaa must be disabled on the web. See issue#whatever
+    #[cfg(target_arch = "wasm32")]
+    app.insert_resource(Msaa::Off);
+
+    app.add_plugins(ParticleSystemPlugin)
         .add_systems(Startup, setup)
         .add_systems(Update, adjust_time_scale);

rather than duplicate the pbr example, personally, especially as this workaround is currently needed in the non-pbr examples too.

@mbrea-c
Copy link
Owner Author

mbrea-c commented Apr 1, 2024

rather than duplicate the pbr example, personally, especially as this workaround is currently needed in the non-pbr examples too.

Yeah, good point. I wanted to test that the plugin does not crash with either Msaa setting, but I should just do it the proper way and set up some integration tests

@mbrea-c mbrea-c merged commit ec3afd2 into master Apr 1, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants