update to wgpu master to fix M1 shader issues

This commit is contained in:
Anton-4 2022-02-19 14:07:19 +01:00
parent 7548f97221
commit b1245ffd7f
No known key found for this signature in database
GPG key ID: C954D6E0F9C0ABFD
4 changed files with 35 additions and 67 deletions

View file

@ -4,31 +4,35 @@ struct Globals {
ortho: mat4x4<f32>;
};
[[group(0), binding(0)]]
@group(0)
@binding(0)
var<uniform> globals: Globals;
struct VertexInput {
[[location(0)]] position: vec2<f32>;
@location(0) position: vec2<f32>;
};
struct Quad {
[[location(1)]] position: vec2<f32>;
[[location(2)]] width: f32;
[[location(3)]] height: f32;
[[location(4)]] color: vec4<f32>;
[[location(5)]] border_color: vec4<f32>;
[[location(6)]] border_width: f32;
@location(1) position: vec2<f32>;
@location(2) width: f32;
@location(3) height: f32;
@location(4) color: vec4<f32>;
@location(5) border_color: vec4<f32>;
@location(6) border_width: f32;
};
struct VertexOutput {
[[builtin(position)]] position: vec4<f32>;
[[location(0)]] color: vec4<f32>;
[[location(1)]] border_color: vec4<f32>;
[[location(2)]] border_width: f32;
@builtin(position) position: vec4<f32>;
@location(0) color: vec4<f32>;
@location(1) border_color: vec4<f32>;
@location(2) border_width: f32;
};
[[stage(vertex)]]
fn vs_main(input: VertexInput, quad: Quad) -> VertexOutput {
@stage(vertex)
fn vs_main(
input: VertexInput,
quad: Quad
) -> VertexOutput {
var transform: mat4x4<f32> = mat4x4<f32>(
vec4<f32>(quad.width, 0.0, 0.0, 0.0),
@ -48,9 +52,9 @@ fn vs_main(input: VertexInput, quad: Quad) -> VertexOutput {
}
[[stage(fragment)]]
@stage(fragment)
fn fs_main(
input: VertexOutput
) -> [[location(0)]] vec4<f32> {
) -> @location(0) vec4<f32> {
return input.color;
}

View file

@ -1,30 +0,0 @@
struct VertexOutput {
[[location(0)]] color: vec4<f32>;
[[builtin(position)]] position: vec4<f32>;
};
struct Globals {
ortho: mat4x4<f32>; // The ortho transformation keeps everything the same size when the window size is changed.
};
[[group(0), binding(0)]]
var<uniform> u_globals: Globals;
[[stage(vertex)]]
fn vs_main(
[[location(0)]] in_position: vec2<f32>,
[[location(1)]] in_color: vec4<f32>,
) -> VertexOutput {
var out: VertexOutput;
out.position = u_globals.ortho * vec4<f32>(in_position, 0.0, 1.0);
out.color = in_color;
return out;
}
[[stage(fragment)]]
fn fs_main(in: VertexOutput) -> [[location(0)]] vec4<f32> {
return in.color;
}