From e7d7e19c24edd0d77ffcb5edd8ce0c8ab9d5cf46 Mon Sep 17 00:00:00 2001 From: Mike Welsh Date: Wed, 3 Feb 2021 11:58:53 -0800 Subject: [PATCH] chore: Bump to wgpu 0.70 --- Cargo.lock | 114 ++++++++++-------- render/wgpu/Cargo.toml | 2 +- render/wgpu/src/pipelines.rs | 227 ++++++++++++++++++++--------------- 3 files changed, 193 insertions(+), 150 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 094335021..673eb873b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1443,8 +1443,9 @@ dependencies = [ [[package]] name = "gfx-auxil" -version = "0.5.0" -source = "git+https://github.com/gfx-rs/gfx?rev=6b3a1e36939473f0062232baf11e1deacd6605f4#6b3a1e36939473f0062232baf11e1deacd6605f4" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7b33ecf067f2117668d91c9b0f2e5f223ebd1ffec314caa2f3de27bb580186d" dependencies = [ "fxhash", "gfx-hal", @@ -1453,8 +1454,9 @@ dependencies = [ [[package]] name = "gfx-backend-dx11" -version = "0.6.0" -source = "git+https://github.com/gfx-rs/gfx?rev=6b3a1e36939473f0062232baf11e1deacd6605f4#6b3a1e36939473f0062232baf11e1deacd6605f4" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f851d03c2e8f117e3702bf41201a4fafa447d5cb1276d5375870ae7573d069dd" dependencies = [ "arrayvec", "bitflags", @@ -1474,8 +1476,9 @@ dependencies = [ [[package]] name = "gfx-backend-dx12" -version = "0.6.2" -source = "git+https://github.com/gfx-rs/gfx?rev=6b3a1e36939473f0062232baf11e1deacd6605f4#6b3a1e36939473f0062232baf11e1deacd6605f4" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36dc6ba2b7647e2c2b27b8f74ff5ccdd53c703776588eee5b1de515fdcbd6bc9" dependencies = [ "arrayvec", "bit-set", @@ -1494,8 +1497,9 @@ dependencies = [ [[package]] name = "gfx-backend-empty" -version = "0.6.0" -source = "git+https://github.com/gfx-rs/gfx?rev=6b3a1e36939473f0062232baf11e1deacd6605f4#6b3a1e36939473f0062232baf11e1deacd6605f4" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f07ef26a65954cfdd7b4c587f485100d1bb3b0bd6a51b02d817d6c87cca7a91" dependencies = [ "gfx-hal", "log", @@ -1504,8 +1508,9 @@ dependencies = [ [[package]] name = "gfx-backend-gl" -version = "0.6.0" -source = "git+https://github.com/gfx-rs/gfx?rev=6b3a1e36939473f0062232baf11e1deacd6605f4#6b3a1e36939473f0062232baf11e1deacd6605f4" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17fd85420547bceb851fadb90f196f168abfc252d57528bd2d749db0d18b75f" dependencies = [ "arrayvec", "bitflags", @@ -1519,7 +1524,6 @@ dependencies = [ "naga", "parking_lot", "raw-window-handle", - "smallvec", "spirv_cross", "wasm-bindgen", "web-sys", @@ -1527,8 +1531,9 @@ dependencies = [ [[package]] name = "gfx-backend-metal" -version = "0.6.0" -source = "git+https://github.com/gfx-rs/gfx?rev=6b3a1e36939473f0062232baf11e1deacd6605f4#6b3a1e36939473f0062232baf11e1deacd6605f4" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc54b456ece69ef49f8893269ebf24ac70969ed34ba2719c3f3abcc8fbff14e" dependencies = [ "arrayvec", "bitflags", @@ -1538,7 +1543,6 @@ dependencies = [ "foreign-types", "gfx-auxil", "gfx-hal", - "lazy_static", "log", "metal", "naga", @@ -1552,8 +1556,9 @@ dependencies = [ [[package]] name = "gfx-backend-vulkan" -version = "0.6.5" -source = "git+https://github.com/gfx-rs/gfx?rev=6b3a1e36939473f0062232baf11e1deacd6605f4#6b3a1e36939473f0062232baf11e1deacd6605f4" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dabe88b1a5c91e0f969b441cc57e70364858066e4ba937deeb62065654ef9bd9" dependencies = [ "arrayvec", "ash", @@ -1561,10 +1566,10 @@ dependencies = [ "core-graphics-types", "gfx-hal", "inplace_it", - "lazy_static", "log", "naga", "objc", + "parking_lot", "raw-window-handle", "smallvec", "winapi 0.3.9", @@ -1572,8 +1577,9 @@ dependencies = [ [[package]] name = "gfx-hal" -version = "0.6.0" -source = "git+https://github.com/gfx-rs/gfx?rev=6b3a1e36939473f0062232baf11e1deacd6605f4#6b3a1e36939473f0062232baf11e1deacd6605f4" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1d9cc8d3b573dda62d0baca4f02e0209786e22c562caff001d77c389008781d" dependencies = [ "bitflags", "naga", @@ -1605,9 +1611,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "glow" -version = "0.6.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1625b792e2f9267116dd41eb7d325e0ea2572ceba5069451906745e04f852f33" +checksum = "072136d2c3783f3a92f131acb227bc806d3886278e2a4dc1e9990ec89ef9e70b" dependencies = [ "js-sys", "slotmap", @@ -1617,8 +1623,9 @@ dependencies = [ [[package]] name = "gpu-alloc" -version = "0.2.1" -source = "git+https://github.com/zakarumych/gpu-alloc?rev=29e761f24edc50e28d238e723503b146d55d222e#29e761f24edc50e28d238e723503b146d55d222e" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7724b9aef57ea36d70faf54e0ee6265f86e41de16bed8333efdeab5b00e16b" dependencies = [ "bitflags", "gpu-alloc-types", @@ -1627,8 +1634,9 @@ dependencies = [ [[package]] name = "gpu-alloc-types" -version = "0.1.0" -source = "git+https://github.com/zakarumych/gpu-alloc?rev=29e761f24edc50e28d238e723503b146d55d222e#29e761f24edc50e28d238e723503b146d55d222e" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54804d0d6bc9d7f26db4eaec1ad10def69b599315f487d32c334a80d1efe67a5" dependencies = [ "bitflags", ] @@ -1636,7 +1644,8 @@ dependencies = [ [[package]] name = "gpu-descriptor" version = "0.1.0" -source = "git+https://github.com/zakarumych/gpu-descriptor?rev=df74fd8c7bea03149058a41aab0e4fe04077b266#df74fd8c7bea03149058a41aab0e4fe04077b266" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d74668a6a6f0202e29f212a6d47ef8c7e092a76f4ab267b0065b6e0d175e45c6" dependencies = [ "bitflags", "gpu-descriptor-types", @@ -1646,8 +1655,9 @@ dependencies = [ [[package]] name = "gpu-descriptor-types" -version = "0.1.0" -source = "git+https://github.com/zakarumych/gpu-descriptor?rev=df74fd8c7bea03149058a41aab0e4fe04077b266#df74fd8c7bea03149058a41aab0e4fe04077b266" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "363e3677e55ad168fef68cf9de3a4a310b53124c5e784c53a1d70e92d23f2126" dependencies = [ "bitflags", ] @@ -1890,8 +1900,9 @@ dependencies = [ [[package]] name = "khronos-egl" -version = "3.0.0-beta" -source = "git+https://github.com/timothee-haudebourg/khronos-egl?rev=9568b2ee3b02f2c17cc9479f824db16daecf1664#9568b2ee3b02f2c17cc9479f824db16daecf1664" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8020ff3b84f9ac87461216ad0501bc09b33c1cbe17404d8ea405160fd164bab" dependencies = [ "libc", "libloading", @@ -2101,8 +2112,9 @@ dependencies = [ [[package]] name = "metal" -version = "0.20.1" -source = "git+https://github.com/gfx-rs/metal-rs?rev=ba08f5f98c70ab941020b8997936c9c75363b9aa#ba08f5f98c70ab941020b8997936c9c75363b9aa" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4598d719460ade24c7d91f335daf055bf2a7eec030728ce751814c50cdd6a26c" dependencies = [ "bitflags", "block", @@ -2202,9 +2214,11 @@ dependencies = [ [[package]] name = "naga" -version = "0.2.0" -source = "git+https://github.com/gfx-rs/naga?tag=gfx-5#583f218c9dbca08daa6bf3efda60e80ecada63bb" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8f30d7036f137a2f64fd7d53b70a91545d3f09e030b77b3816ff7bd4cf3f789" dependencies = [ + "bit-set", "bitflags", "fxhash", "log", @@ -2855,8 +2869,9 @@ dependencies = [ [[package]] name = "range-alloc" -version = "0.1.1" -source = "git+https://github.com/gfx-rs/gfx?rev=6b3a1e36939473f0062232baf11e1deacd6605f4#6b3a1e36939473f0062232baf11e1deacd6605f4" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e935c45e09cc6dcf00d2f0b2d630a58f4095320223d47fc68918722f0538b6" [[package]] name = "raw-window-handle" @@ -3449,9 +3464,9 @@ dependencies = [ [[package]] name = "spirv_cross" -version = "0.22.2" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ebd49af36be83ecd6290b57147e2a0e26145b832634b17146d934b197ca3713" +checksum = "06db6bd7b6518f761593783e2896eefe55e90455efc5f44511078ce0426ed418" dependencies = [ "cc", "js-sys", @@ -3831,12 +3846,6 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e5d7cd7ab3e47dda6e56542f4bbf3824c15234958c6e1bd6aaa347e93499fdc" -[[package]] -name = "typed-arena" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0685c84d5d54d1c26f7d3eb96cd41550adb97baed141a761cf335d3d33bcd0ae" - [[package]] name = "unicode-bidi" version = "0.3.4" @@ -4211,17 +4220,18 @@ checksum = "4a32b378380f4e9869b22f0b5177c68a5519f03b3454fde0b291455ddbae266c" [[package]] name = "wgpu" -version = "0.6.0" -source = "git+https://github.com/gfx-rs/wgpu-rs?rev=6cfd4243603b495fed568445792feed51e78aac2#6cfd4243603b495fed568445792feed51e78aac2" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c60007fc3748278a36b458d96f86105f43aa5f0e412b15a5f934950d61ec26a9" dependencies = [ "arrayvec", "js-sys", + "naga", "parking_lot", "raw-window-handle", "serde", "smallvec", "tracing", - "typed-arena", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -4231,8 +4241,9 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.6.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=5b9cfeb9413175de366ec1e3d64ec6ee2feffa0e#5b9cfeb9413175de366ec1e3d64ec6ee2feffa0e" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d0b0acbc906c464cb75dac28062a8591ec9fe0ce61e271bb732c43196dc6aa1" dependencies = [ "arrayvec", "bitflags", @@ -4261,8 +4272,9 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.6.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=5b9cfeb9413175de366ec1e3d64ec6ee2feffa0e#5b9cfeb9413175de366ec1e3d64ec6ee2feffa0e" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72fa9ba80626278fd87351555c363378d08122d7601e58319be3d6fa85a87747" dependencies = [ "bitflags", "serde", diff --git a/render/wgpu/Cargo.toml b/render/wgpu/Cargo.toml index 5f515f827..6baad71ae 100644 --- a/render/wgpu/Cargo.toml +++ b/render/wgpu/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "MIT OR Apache-2.0" [dependencies] -wgpu = { git = "https://github.com/gfx-rs/wgpu-rs", rev = "6cfd4243603b495fed568445792feed51e78aac2" } +wgpu = "0.7.0" image = "0.23.13" jpeg-decoder = "0.1.22" log = "0.4" diff --git a/render/wgpu/src/pipelines.rs b/render/wgpu/src/pipelines.rs index 377b3ef5c..cd135d3f3 100644 --- a/render/wgpu/src/pipelines.rs +++ b/render/wgpu/src/pipelines.rs @@ -31,19 +31,30 @@ impl Pipelines { sampler_layout: &wgpu::BindGroupLayout, globals_layout: &wgpu::BindGroupLayout, ) -> Result { - let color_vs = - device.create_shader_module(&wgpu::include_spirv!("../shaders/color.vert.spv")); - let color_fs = - device.create_shader_module(&wgpu::include_spirv!("../shaders/color.frag.spv")); - let texture_vs = - device.create_shader_module(&wgpu::include_spirv!("../shaders/texture.vert.spv")); - let gradient_fs = - device.create_shader_module(&wgpu::include_spirv!("../shaders/gradient.frag.spv")); - let bitmap_fs = - device.create_shader_module(&wgpu::include_spirv!("../shaders/bitmap.frag.spv")); + // TODO: Naga validation errors when encountering push constants currently. + // Disable validation for now. Remove this when Naga can swallow it. + macro_rules! include_spirv { + ($($token:tt)*) => { + { + wgpu::ShaderModuleDescriptor { + label: Some($($token)*), + source: wgpu::util::make_spirv(include_bytes!($($token)*)), + flags: wgpu::ShaderFlags::empty(), + } + } + }; + } - let vertex_buffers_description = [wgpu::VertexBufferDescriptor { - stride: std::mem::size_of::() as u64, + let color_vs = device.create_shader_module(&include_spirv!("../shaders/color.vert.spv")); + let color_fs = device.create_shader_module(&include_spirv!("../shaders/color.frag.spv")); + let texture_vs = + device.create_shader_module(&include_spirv!("../shaders/texture.vert.spv")); + let gradient_fs = + device.create_shader_module(&include_spirv!("../shaders/gradient.frag.spv")); + let bitmap_fs = device.create_shader_module(&include_spirv!("../shaders/bitmap.frag.spv")); + + let vertex_buffers_description = [wgpu::VertexBufferLayout { + array_stride: std::mem::size_of::() as u64, step_mode: wgpu::InputStepMode::Vertex, attributes: &vertex_attr_array![ 0 => Float2, @@ -153,40 +164,36 @@ fn create_pipeline_descriptor<'a>( vertex_shader: &'a wgpu::ShaderModule, fragment_shader: &'a wgpu::ShaderModule, pipeline_layout: &'a wgpu::PipelineLayout, - depth_stencil_state: Option, - color_states: &'a [wgpu::ColorStateDescriptor], - vertex_buffers_description: &'a [wgpu::VertexBufferDescriptor<'a>], + depth_stencil_state: Option, + color_target_state: &'a [wgpu::ColorTargetState], + vertex_buffer_layout: &'a [wgpu::VertexBufferLayout<'a>], msaa_sample_count: u32, ) -> wgpu::RenderPipelineDescriptor<'a> { wgpu::RenderPipelineDescriptor { label, layout: Some(&pipeline_layout), - vertex_stage: wgpu::ProgrammableStageDescriptor { + vertex: wgpu::VertexState { module: &vertex_shader, entry_point: "main", + buffers: vertex_buffer_layout, }, - fragment_stage: Some(wgpu::ProgrammableStageDescriptor { + fragment: Some(wgpu::FragmentState { module: &fragment_shader, entry_point: "main", + targets: color_target_state, }), - rasterization_state: Some(wgpu::RasterizationStateDescriptor { + primitive: wgpu::PrimitiveState { + topology: wgpu::PrimitiveTopology::TriangleList, + strip_index_format: Some(wgpu::IndexFormat::Uint32), front_face: wgpu::FrontFace::Ccw, cull_mode: wgpu::CullMode::None, - polygon_mode: Default::default(), - clamp_depth: false, - depth_bias: 0, - depth_bias_slope_scale: 0.0, - depth_bias_clamp: 0.0, - }), - primitive_topology: wgpu::PrimitiveTopology::TriangleList, - color_states, - depth_stencil_state, - sample_count: msaa_sample_count, - sample_mask: !0, - alpha_to_coverage_enabled: false, - vertex_state: wgpu::VertexStateDescriptor { - index_format: Some(wgpu::IndexFormat::Uint32), - vertex_buffers: vertex_buffers_description, + polygon_mode: wgpu::PolygonMode::default(), + }, + depth_stencil: depth_stencil_state, + multisample: wgpu::MultisampleState { + count: msaa_sample_count, + mask: !0, + alpha_to_coverage_enabled: false, }, } } @@ -196,7 +203,7 @@ fn create_color_pipelines( vertex_shader: &wgpu::ShaderModule, fragment_shader: &wgpu::ShaderModule, msaa_sample_count: u32, - vertex_buffers_description: &[wgpu::VertexBufferDescriptor<'_>], + vertex_buffers_description: &[wgpu::VertexBufferLayout<'_>], globals_layout: &wgpu::BindGroupLayout, ) -> ShapePipeline { let transforms_size = std::mem::size_of::() as u32; @@ -226,20 +233,22 @@ fn create_color_pipelines( vertex_shader, fragment_shader, &pipeline_layout, - Some(wgpu::DepthStencilStateDescriptor { + Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24PlusStencil8, depth_write_enabled: true, depth_compare: wgpu::CompareFunction::Always, stencil, + bias: Default::default(), + clamp_depth: false, }), - &[wgpu::ColorStateDescriptor { + &[wgpu::ColorTargetState { format: wgpu::TextureFormat::Bgra8Unorm, - color_blend: wgpu::BlendDescriptor { + color_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, - alpha_blend: wgpu::BlendDescriptor { + alpha_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, @@ -258,20 +267,22 @@ fn create_color_pipelines( vertex_shader, fragment_shader, &pipeline_layout, - Some(wgpu::DepthStencilStateDescriptor { + Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24PlusStencil8, depth_write_enabled: true, depth_compare: wgpu::CompareFunction::Always, stencil, + bias: Default::default(), + clamp_depth: false, }), - &[wgpu::ColorStateDescriptor { + &[wgpu::ColorTargetState { format: wgpu::TextureFormat::Bgra8Unorm, - color_blend: wgpu::BlendDescriptor { + color_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, - alpha_blend: wgpu::BlendDescriptor { + alpha_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, @@ -290,20 +301,22 @@ fn create_color_pipelines( vertex_shader, fragment_shader, &pipeline_layout, - Some(wgpu::DepthStencilStateDescriptor { + Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24PlusStencil8, depth_write_enabled: true, depth_compare: wgpu::CompareFunction::Always, stencil, + bias: Default::default(), + clamp_depth: false, }), - &[wgpu::ColorStateDescriptor { + &[wgpu::ColorTargetState { format: wgpu::TextureFormat::Bgra8Unorm, - color_blend: wgpu::BlendDescriptor { + color_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, - alpha_blend: wgpu::BlendDescriptor { + alpha_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, @@ -322,20 +335,22 @@ fn create_color_pipelines( vertex_shader, fragment_shader, &pipeline_layout, - Some(wgpu::DepthStencilStateDescriptor { + Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24PlusStencil8, depth_write_enabled: true, depth_compare: wgpu::CompareFunction::Always, stencil, + bias: Default::default(), + clamp_depth: false, }), - &[wgpu::ColorStateDescriptor { + &[wgpu::ColorTargetState { format: wgpu::TextureFormat::Bgra8Unorm, - color_blend: wgpu::BlendDescriptor { + color_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, - alpha_blend: wgpu::BlendDescriptor { + alpha_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, @@ -357,7 +372,7 @@ fn create_bitmap_pipeline( vertex_shader: &wgpu::ShaderModule, fragment_shader: &wgpu::ShaderModule, msaa_sample_count: u32, - vertex_buffers_description: &[wgpu::VertexBufferDescriptor<'_>], + vertex_buffers_layout: &[wgpu::VertexBufferLayout<'_>], sampler_layout: &wgpu::BindGroupLayout, globals_layout: &wgpu::BindGroupLayout, bitmap_bind_layout: &wgpu::BindGroupLayout, @@ -386,27 +401,29 @@ fn create_bitmap_pipeline( vertex_shader, fragment_shader, &pipeline_layout, - Some(wgpu::DepthStencilStateDescriptor { + Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24PlusStencil8, depth_write_enabled: true, depth_compare: wgpu::CompareFunction::Always, stencil, + bias: Default::default(), + clamp_depth: false, }), - &[wgpu::ColorStateDescriptor { + &[wgpu::ColorTargetState { format: wgpu::TextureFormat::Bgra8Unorm, - color_blend: wgpu::BlendDescriptor { + color_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::One, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, - alpha_blend: wgpu::BlendDescriptor { + alpha_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, write_mask, }], - vertex_buffers_description, + vertex_buffers_layout, msaa_sample_count, )) }, @@ -418,27 +435,29 @@ fn create_bitmap_pipeline( vertex_shader, fragment_shader, &pipeline_layout, - Some(wgpu::DepthStencilStateDescriptor { + Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24PlusStencil8, depth_write_enabled: true, depth_compare: wgpu::CompareFunction::Always, stencil, + bias: Default::default(), + clamp_depth: false, }), - &[wgpu::ColorStateDescriptor { + &[wgpu::ColorTargetState { format: wgpu::TextureFormat::Bgra8Unorm, - color_blend: wgpu::BlendDescriptor { + color_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, - alpha_blend: wgpu::BlendDescriptor { + alpha_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, write_mask, }], - vertex_buffers_description, + vertex_buffers_layout, msaa_sample_count, )) }, @@ -450,27 +469,29 @@ fn create_bitmap_pipeline( vertex_shader, fragment_shader, &pipeline_layout, - Some(wgpu::DepthStencilStateDescriptor { + Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24PlusStencil8, depth_write_enabled: true, depth_compare: wgpu::CompareFunction::Equal, stencil, + bias: Default::default(), + clamp_depth: false, }), - &[wgpu::ColorStateDescriptor { + &[wgpu::ColorTargetState { format: wgpu::TextureFormat::Bgra8Unorm, - color_blend: wgpu::BlendDescriptor { + color_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::One, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, - alpha_blend: wgpu::BlendDescriptor { + alpha_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, write_mask, }], - vertex_buffers_description, + vertex_buffers_layout, msaa_sample_count, )) }, @@ -482,27 +503,29 @@ fn create_bitmap_pipeline( vertex_shader, fragment_shader, &pipeline_layout, - Some(wgpu::DepthStencilStateDescriptor { + Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24PlusStencil8, depth_write_enabled: true, depth_compare: wgpu::CompareFunction::Always, stencil, + bias: Default::default(), + clamp_depth: false, }), - &[wgpu::ColorStateDescriptor { + &[wgpu::ColorTargetState { format: wgpu::TextureFormat::Bgra8Unorm, - color_blend: wgpu::BlendDescriptor { + color_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, - alpha_blend: wgpu::BlendDescriptor { + alpha_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, write_mask, }], - vertex_buffers_description, + vertex_buffers_layout, msaa_sample_count, )) } @@ -517,7 +540,7 @@ fn create_gradient_pipeline( vertex_shader: &wgpu::ShaderModule, fragment_shader: &wgpu::ShaderModule, msaa_sample_count: u32, - vertex_buffers_description: &[wgpu::VertexBufferDescriptor<'_>], + vertex_buffers_layout: &[wgpu::VertexBufferLayout<'_>], globals_layout: &wgpu::BindGroupLayout, gradient_bind_layout: &wgpu::BindGroupLayout, ) -> ShapePipeline { @@ -545,27 +568,29 @@ fn create_gradient_pipeline( vertex_shader, fragment_shader, &pipeline_layout, - Some(wgpu::DepthStencilStateDescriptor { + Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24PlusStencil8, depth_write_enabled: true, depth_compare: wgpu::CompareFunction::Always, stencil, + bias: Default::default(), + clamp_depth: false, }), - &[wgpu::ColorStateDescriptor { + &[wgpu::ColorTargetState { format: wgpu::TextureFormat::Bgra8Unorm, - color_blend: wgpu::BlendDescriptor { + color_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, - alpha_blend: wgpu::BlendDescriptor { + alpha_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, write_mask, }], - vertex_buffers_description, + vertex_buffers_layout, msaa_sample_count, )) }, @@ -577,27 +602,29 @@ fn create_gradient_pipeline( vertex_shader, fragment_shader, &pipeline_layout, - Some(wgpu::DepthStencilStateDescriptor { + Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24PlusStencil8, depth_write_enabled: true, depth_compare: wgpu::CompareFunction::Always, stencil, + bias: Default::default(), + clamp_depth: false, }), - &[wgpu::ColorStateDescriptor { + &[wgpu::ColorTargetState { format: wgpu::TextureFormat::Bgra8Unorm, - color_blend: wgpu::BlendDescriptor { + color_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, - alpha_blend: wgpu::BlendDescriptor { + alpha_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, write_mask, }], - vertex_buffers_description, + vertex_buffers_layout, msaa_sample_count, )) }, @@ -610,27 +637,29 @@ fn create_gradient_pipeline( vertex_shader, fragment_shader, &pipeline_layout, - Some(wgpu::DepthStencilStateDescriptor { + Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24PlusStencil8, depth_write_enabled: true, depth_compare: wgpu::CompareFunction::Equal, stencil, + bias: Default::default(), + clamp_depth: false, }), - &[wgpu::ColorStateDescriptor { + &[wgpu::ColorTargetState { format: wgpu::TextureFormat::Bgra8Unorm, - color_blend: wgpu::BlendDescriptor { + color_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, - alpha_blend: wgpu::BlendDescriptor { + alpha_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, write_mask, }], - vertex_buffers_description, + vertex_buffers_layout, msaa_sample_count, )) }, @@ -642,27 +671,29 @@ fn create_gradient_pipeline( vertex_shader, fragment_shader, &pipeline_layout, - Some(wgpu::DepthStencilStateDescriptor { + Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24PlusStencil8, depth_write_enabled: true, depth_compare: wgpu::CompareFunction::Always, stencil, + bias: Default::default(), + clamp_depth: false, }), - &[wgpu::ColorStateDescriptor { + &[wgpu::ColorTargetState { format: wgpu::TextureFormat::Bgra8Unorm, - color_blend: wgpu::BlendDescriptor { + color_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, - alpha_blend: wgpu::BlendDescriptor { + alpha_blend: wgpu::BlendState { src_factor: wgpu::BlendFactor::SrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, operation: wgpu::BlendOperation::Add, }, write_mask, }], - vertex_buffers_description, + vertex_buffers_layout, msaa_sample_count, )) } @@ -671,10 +702,10 @@ fn create_gradient_pipeline( ShapePipeline { mask_pipelines } } -fn mask_render_state(state: MaskState) -> (wgpu::StencilStateDescriptor, wgpu::ColorWrite) { +fn mask_render_state(state: MaskState) -> (wgpu::StencilState, wgpu::ColorWrite) { let (stencil_state, color_write) = match state { MaskState::NoMask => ( - wgpu::StencilStateFaceDescriptor { + wgpu::StencilFaceState { compare: wgpu::CompareFunction::Always, fail_op: wgpu::StencilOperation::Keep, depth_fail_op: wgpu::StencilOperation::Keep, @@ -683,7 +714,7 @@ fn mask_render_state(state: MaskState) -> (wgpu::StencilStateDescriptor, wgpu::C wgpu::ColorWrite::ALL, ), MaskState::DrawMaskStencil => ( - wgpu::StencilStateFaceDescriptor { + wgpu::StencilFaceState { compare: wgpu::CompareFunction::Equal, fail_op: wgpu::StencilOperation::Keep, depth_fail_op: wgpu::StencilOperation::Keep, @@ -692,7 +723,7 @@ fn mask_render_state(state: MaskState) -> (wgpu::StencilStateDescriptor, wgpu::C wgpu::ColorWrite::empty(), ), MaskState::DrawMaskedContent => ( - wgpu::StencilStateFaceDescriptor { + wgpu::StencilFaceState { compare: wgpu::CompareFunction::Equal, fail_op: wgpu::StencilOperation::Keep, depth_fail_op: wgpu::StencilOperation::Keep, @@ -701,7 +732,7 @@ fn mask_render_state(state: MaskState) -> (wgpu::StencilStateDescriptor, wgpu::C wgpu::ColorWrite::ALL, ), MaskState::ClearMaskStencil => ( - wgpu::StencilStateFaceDescriptor { + wgpu::StencilFaceState { compare: wgpu::CompareFunction::Equal, fail_op: wgpu::StencilOperation::Keep, depth_fail_op: wgpu::StencilOperation::Keep, @@ -712,7 +743,7 @@ fn mask_render_state(state: MaskState) -> (wgpu::StencilStateDescriptor, wgpu::C }; ( - wgpu::StencilStateDescriptor { + wgpu::StencilState { front: stencil_state.clone(), back: stencil_state, read_mask: 0xff,