From 6c4476c6f286e0ce88a0d416f1df1adbc35c2127 Mon Sep 17 00:00:00 2001 From: awtterpip Date: Fri, 11 Oct 2024 19:16:21 -0500 Subject: [PATCH 1/2] fix mesh2d_manual example --- examples/2d/mesh2d_manual.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/2d/mesh2d_manual.rs b/examples/2d/mesh2d_manual.rs index 75c4c9b37b3d5..ec8c5ef3d9a35 100644 --- a/examples/2d/mesh2d_manual.rs +++ b/examples/2d/mesh2d_manual.rs @@ -150,7 +150,7 @@ impl SpecializedRenderPipeline for ColoredMesh2dPipeline { // Position VertexFormat::Float32x3, // Color - VertexFormat::Uint32, + VertexFormat::Float32x4, ]; let vertex_layout = @@ -246,7 +246,7 @@ const COLORED_MESH2D_SHADER: &str = r" struct Vertex { @builtin(instance_index) instance_index: u32, @location(0) position: vec3, - @location(1) color: u32, + @location(1) color: vec4, }; struct VertexOutput { @@ -264,7 +264,7 @@ fn vertex(vertex: Vertex) -> VertexOutput { let model = mesh2d_functions::get_world_from_local(vertex.instance_index); out.clip_position = mesh2d_functions::mesh2d_position_local_to_clip(model, vec4(vertex.position, 1.0)); // Unpack the `u32` from the vertex buffer into the `vec4` used by the fragment shader - out.color = vec4((vec4(vertex.color) >> vec4(0u, 8u, 16u, 24u)) & vec4(255u)) / 255.0; + out.color = vertex.color; return out; } From 32d96fd9acc5d609127dfaeb3f7bf16caa462dc5 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Fri, 11 Oct 2024 23:09:25 -0400 Subject: [PATCH 2/2] Remove redundant comment --- examples/2d/mesh2d_manual.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/2d/mesh2d_manual.rs b/examples/2d/mesh2d_manual.rs index ec8c5ef3d9a35..502340dc9cfce 100644 --- a/examples/2d/mesh2d_manual.rs +++ b/examples/2d/mesh2d_manual.rs @@ -263,7 +263,6 @@ fn vertex(vertex: Vertex) -> VertexOutput { // Project the world position of the mesh into screen position let model = mesh2d_functions::get_world_from_local(vertex.instance_index); out.clip_position = mesh2d_functions::mesh2d_position_local_to_clip(model, vec4(vertex.position, 1.0)); - // Unpack the `u32` from the vertex buffer into the `vec4` used by the fragment shader out.color = vertex.color; return out; }