Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update wgpu to 0.13 #1670

Merged
merged 9 commits into from
Jul 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 54 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion eframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ egui-wgpu = { version = "0.18.0", path = "../egui-wgpu", optional = true, featur
glow = { version = "0.11", optional = true }
ron = { version = "0.7", optional = true }
serde = { version = "1", optional = true, features = ["derive"] }
wgpu = { version = "0.12", optional = true }
wgpu = { version = "0.13", optional = true }

# -------------------------------------------
# native:
Expand Down
2 changes: 1 addition & 1 deletion egui-wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ egui = { version = "0.18.1", path = "../egui", default-features = false, feature
bytemuck = "1.7"
tracing = "0.1"
type-map = "0.5.0"
wgpu = "0.12"
wgpu = "0.13"

#! ### Optional dependencies
## Enable this when generating docs.
Expand Down
37 changes: 20 additions & 17 deletions egui-wgpu/src/egui.wgsl
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
// Vertex shader bindings

struct VertexOutput {
[[location(0)]] tex_coord: vec2<f32>;
[[location(1)]] color: vec4<f32>;
[[builtin(position)]] position: vec4<f32>;
@location(0) tex_coord: vec2<f32>,
@location(1) color: vec4<f32>,
@builtin(position) position: vec4<f32>,
};

struct Locals {
screen_size: vec2<f32>;
screen_size: vec2<f32>,
// Uniform buffers need to be at least 16 bytes in WebGL.
// See https://github.com/gfx-rs/wgpu/issues/2072
_padding: vec2<u32>,
};
[[group(0), binding(0)]] var<uniform> r_locals: Locals;
@group(0) @binding(0) var<uniform> r_locals: Locals;

// 0-1 from 0-255
fn linear_from_srgb(srgb: vec3<f32>) -> vec3<f32> {
Expand Down Expand Up @@ -38,11 +41,11 @@ fn position_from_screen(screen_pos: vec2<f32>) -> vec4<f32> {
);
}

[[stage(vertex)]]
@vertex
fn vs_main(
[[location(0)]] a_pos: vec2<f32>,
[[location(1)]] a_tex_coord: vec2<f32>,
[[location(2)]] a_color: u32,
@location(0) a_pos: vec2<f32>,
@location(1) a_tex_coord: vec2<f32>,
@location(2) a_color: u32,
) -> VertexOutput {
var out: VertexOutput;
out.tex_coord = a_tex_coord;
Expand All @@ -52,11 +55,11 @@ fn vs_main(
return out;
}

[[stage(vertex)]]
@vertex
fn vs_conv_main(
[[location(0)]] a_pos: vec2<f32>,
[[location(1)]] a_tex_coord: vec2<f32>,
[[location(2)]] a_color: u32,
@location(0) a_pos: vec2<f32>,
@location(1) a_tex_coord: vec2<f32>,
@location(2) a_color: u32,
) -> VertexOutput {
var out: VertexOutput;
out.tex_coord = a_tex_coord;
Expand All @@ -68,10 +71,10 @@ fn vs_conv_main(

// Fragment shader bindings

[[group(1), binding(0)]] var r_tex_color: texture_2d<f32>;
[[group(1), binding(1)]] var r_tex_sampler: sampler;
@group(1) @binding(0) var r_tex_color: texture_2d<f32>;
@group(1) @binding(1) var r_tex_sampler: sampler;

[[stage(fragment)]]
fn fs_main(in: VertexOutput) -> [[location(0)]] vec4<f32> {
@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
return in.color * textureSample(r_tex_color, r_tex_sampler, in.tex_coord);
}
Loading