Skip to content

Commit

Permalink
Merge pull request #45 from jabuwu/fix_shader_defs
Browse files Browse the repository at this point in the history
Fix WASM with proper shader defs
  • Loading branch information
james-j-obrien authored Sep 2, 2024
2 parents 2ea2e5b + ccfdd8d commit b69a787
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 0 additions & 6 deletions src/render/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,6 @@ impl<P: PhaseItem, T: ShapeData> RenderCommand<P> for DrawShape<T> {
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());

Expand Down
6 changes: 4 additions & 2 deletions src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
);
}

Expand Down

0 comments on commit b69a787

Please sign in to comment.