From ccfdd8d986a1369e75b729a6be30e6ae5ea1642b Mon Sep 17 00:00:00 2001 From: jabu Date: Mon, 2 Sep 2024 06:47:56 -0500 Subject: [PATCH] Fix WASM with proper shader defs --- src/render/commands.rs | 6 ------ src/render/mod.rs | 6 ++++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/render/commands.rs b/src/render/commands.rs index bee40f3..7b0eed3 100644 --- a/src/render/commands.rs +++ b/src/render/commands.rs @@ -309,12 +309,6 @@ impl RenderCommand

for DrawShape { pass: &mut TrackedRenderPass<'w>, ) -> RenderCommandResult { let batch_range = item.batch_range(); - #[cfg(all(feature = "webgl", target_arch = "wasm32"))] - pass.set_push_constants( - ShaderStages::VERTEX, - 0, - &(batch_range.start as i32).to_le_bytes(), - ); pass.set_vertex_buffer(0, quad.into_inner().buffer.slice(..)); pass.draw(0..T::VERTICES, batch_range.clone()); diff --git a/src/render/mod.rs b/src/render/mod.rs index 56484cd..17ed2ed 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -82,7 +82,7 @@ pub fn load_shaders(app: &mut App) { Shader::from_wgsl_with_defs, defs ); - let defs = NgonData::shader_defs(app); + let defs = LineData::shader_defs(app); load_internal_asset!( app, LINE_HANDLE, @@ -106,11 +106,13 @@ pub fn load_shaders(app: &mut App) { Shader::from_wgsl_with_defs, defs ); + let defs = TriangleData::shader_defs(app); load_internal_asset!( app, TRIANGLE_HANDLE, "shaders/shapes/tri.wgsl", - Shader::from_wgsl + Shader::from_wgsl_with_defs, + defs ); }