Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

Commit

Permalink
Merge #803
Browse files Browse the repository at this point in the history
803: Shader fixes with binary expressions r=kvark a=kvark

Goes along with gfx-rs/naga#599

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
  • Loading branch information
bors[bot] and kvark authored Mar 19, 2021
2 parents 0f1b290 + 5aaca1c commit f7db718
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/boids/compute.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This should match `NUM_PARTICLES` on the Rust side.
const NUM_PARTICLES: u32 = 1500;
const NUM_PARTICLES: u32 = 1500u;

[[block]]
struct Particle {
Expand Down
4 changes: 2 additions & 2 deletions examples/conservative-raster/upscale.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ struct VertexOutput {

[[stage(vertex)]]
fn vs_main([[builtin(vertex_index)]] vertex_index: u32) -> VertexOutput {
const x: f32 = f32(i32(vertex_index & 1) << 2) - 1.0;
const y: f32 = f32(i32(vertex_index & 2) << 1) - 1.0;
const x: f32 = f32(i32(vertex_index & 1u) << 2u) - 1.0;
const y: f32 = f32(i32(vertex_index & 2u) << 1u) - 1.0;
var output: VertexOutput;
output.position = vec4<f32>(x, -y, 0.0, 1.0);
output.tex_coords = vec2<f32>(x + 1.0, y + 1.0) * 0.5;
Expand Down
2 changes: 1 addition & 1 deletion examples/hello-triangle/shader.wgsl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[[stage(vertex)]]
fn vs_main([[builtin(vertex_index)]] in_vertex_index: u32) -> [[builtin(position)]] vec4<f32> {
const x = f32(i32(in_vertex_index) - 1);
const y = f32(i32(in_vertex_index & 1) * 2 - 1);
const y = f32(i32(in_vertex_index & 1u) * 2 - 1);
return vec4<f32>(x, y, 0.0, 1.0);
}

Expand Down

0 comments on commit f7db718

Please sign in to comment.