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:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user