1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -04:00

Update wgpu to 0.13 (#1670)

* Update the wgsl syntax used in egui-wgpu

* Updates for the latest version of wgpu

* Update the wgpu version

* get_preffered_format -> get_supported_formats

* Just use an array access for compatible formats

* Use the naga cli to validate the egui demo app custom wgpu shader

* Run cargo check on the custom3d wgpu app

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
Ashley
2022-07-03 15:43:39 +02:00
committed by GitHub
parent 433719717a
commit 9739009f20
8 changed files with 92 additions and 74 deletions

View File

@@ -17,7 +17,7 @@ impl Custom3d {
let device = &render_state.device;
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
label: None,
source: wgpu::ShaderSource::Wgsl(include_str!("./custom3d_wgpu_shader.wgsl").into()),
});
@@ -53,7 +53,7 @@ impl Custom3d {
fragment: Some(wgpu::FragmentState {
module: &shader,
entry_point: "fs_main",
targets: &[render_state.target_format.into()],
targets: &[Some(render_state.target_format.into())],
}),
primitive: wgpu::PrimitiveState::default(),
depth_stencil: None,

View File

@@ -1,13 +1,13 @@
struct VertexOut {
[[location(0)]] color: vec4<f32>;
[[builtin(position)]] position: vec4<f32>;
@location(0) color: vec4<f32>,
@builtin(position) position: vec4<f32>,
};
struct Uniforms {
angle: f32;
angle: f32,
};
[[group(0), binding(0)]]
@group(0) @binding(0)
var<uniform> uniforms: Uniforms;
var<private> v_positions: array<vec2<f32>, 3> = array<vec2<f32>, 3>(
@@ -22,8 +22,8 @@ var<private> v_colors: array<vec4<f32>, 3> = array<vec4<f32>, 3>(
vec4<f32>(0.0, 0.0, 1.0, 1.0),
);
[[stage(vertex)]]
fn vs_main([[builtin(vertex_index)]] v_idx: u32) -> VertexOut {
@vertex
fn vs_main(@builtin(vertex_index) v_idx: u32) -> VertexOut {
var out: VertexOut;
out.position = vec4<f32>(v_positions[v_idx], 0.0, 1.0);
@@ -33,7 +33,7 @@ fn vs_main([[builtin(vertex_index)]] v_idx: u32) -> VertexOut {
return out;
}
[[stage(fragment)]]
fn fs_main(in: VertexOut) -> [[location(0)]] vec4<f32> {
@fragment
fn fs_main(in: VertexOut) -> @location(0) vec4<f32> {
return in.color;
}