diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index d48b97e627..188696a1ef 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -26,20 +26,20 @@ webgl = ["wgc"] [target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "5afe832c3c8e3417e4ad4d95f92a3f65379467ff" +rev = "53bab9d68f91d6802d6913ed2dde9cad8537ed2f" features = ["raw-window-handle", "cross"] [target.'cfg(target_arch = "wasm32")'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "5afe832c3c8e3417e4ad4d95f92a3f65379467ff" +rev = "53bab9d68f91d6802d6913ed2dde9cad8537ed2f" features = ["raw-window-handle", "cross"] optional = true [dependencies.wgt] package = "wgpu-types" git = "https://github.com/gfx-rs/wgpu" -rev = "5afe832c3c8e3417e4ad4d95f92a3f65379467ff" +rev = "53bab9d68f91d6802d6913ed2dde9cad8537ed2f" [dependencies] arrayvec = "0.5" diff --git a/wgpu/examples/cube/main.rs b/wgpu/examples/cube/main.rs index a61d968cae..36b62ca061 100644 --- a/wgpu/examples/cube/main.rs +++ b/wgpu/examples/cube/main.rs @@ -316,12 +316,14 @@ impl framework::Example for Example { entry_point: "fs_wire", targets: &[wgpu::ColorTargetState { format: sc_desc.format, - color_blend: wgpu::BlendState { - operation: wgpu::BlendOperation::Add, - src_factor: wgpu::BlendFactor::SrcAlpha, - dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, - }, - alpha_blend: wgpu::BlendState::REPLACE, + blend: Some(wgpu::BlendState { + color: wgpu::BlendComponent { + operation: wgpu::BlendOperation::Add, + src_factor: wgpu::BlendFactor::SrcAlpha, + dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, + }, + alpha: wgpu::BlendComponent::REPLACE, + }), write_mask: wgpu::ColorWrite::ALL, }], }), diff --git a/wgpu/examples/water/main.rs b/wgpu/examples/water/main.rs index d50a10c27b..2fa86b05d5 100644 --- a/wgpu/examples/water/main.rs +++ b/wgpu/examples/water/main.rs @@ -524,16 +524,18 @@ impl framework::Example for Example { // and assigned to the output attachment. targets: &[wgpu::ColorTargetState { format: sc_desc.format, - color_blend: wgpu::BlendState { - src_factor: wgpu::BlendFactor::SrcAlpha, - dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, - operation: wgpu::BlendOperation::Add, - }, - alpha_blend: wgpu::BlendState { - src_factor: wgpu::BlendFactor::One, - dst_factor: wgpu::BlendFactor::One, - operation: wgpu::BlendOperation::Max, - }, + blend: Some(wgpu::BlendState { + color: wgpu::BlendComponent { + src_factor: wgpu::BlendFactor::SrcAlpha, + dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, + operation: wgpu::BlendOperation::Add, + }, + alpha: wgpu::BlendComponent { + src_factor: wgpu::BlendFactor::One, + dst_factor: wgpu::BlendFactor::One, + operation: wgpu::BlendOperation::Max, + }, + }), write_mask: wgpu::ColorWrite::ALL, }], }), diff --git a/wgpu/src/backend/web.rs b/wgpu/src/backend/web.rs index 956d462dd4..92b12c167f 100644 --- a/wgpu/src/backend/web.rs +++ b/wgpu/src/backend/web.rs @@ -594,7 +594,7 @@ fn map_depth_stencil_state_descriptor( mapped } -fn map_blend_descriptor(desc: &wgt::BlendState) -> web_sys::GpuBlendDescriptor { +fn map_blend_descriptor(desc: &wgt::BlendComponent) -> web_sys::GpuBlendDescriptor { let mut mapped = web_sys::GpuBlendDescriptor::new(); mapped.dst_factor(map_blend_factor(desc.dst_factor)); mapped.operation(map_blend_operation(desc.operation)); @@ -1226,8 +1226,10 @@ impl crate::Context for Context { let mapped_format = map_texture_format(target.format); let mut mapped_color_state_desc = web_sys::GpuColorStateDescriptor::new(mapped_format); - mapped_color_state_desc.alpha_blend(&map_blend_descriptor(&target.alpha_blend)); - mapped_color_state_desc.color_blend(&map_blend_descriptor(&target.color_blend)); + if let Some(ref bs) = target.blend { + mapped_color_state_desc.alpha_blend(&map_blend_descriptor(&bs.alpha)); + mapped_color_state_desc.color_blend(&map_blend_descriptor(&bs.color)); + } mapped_color_state_desc.write_mask(target.write_mask.bits()); mapped_color_state_desc }) diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index feec92e4c3..4c8da32ff1 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -25,14 +25,14 @@ use std::{ use parking_lot::Mutex; pub use wgt::{ - AdapterInfo, AddressMode, Backend, BackendBit, BindGroupLayoutEntry, BindingType, BlendFactor, - BlendOperation, BlendState, BufferAddress, BufferBindingType, BufferSize, BufferUsage, Color, - ColorTargetState, ColorWrite, CommandBufferDescriptor, CompareFunction, DepthBiasState, - DepthStencilState, DeviceType, DynamicOffset, Extent3d, Face, Features, FilterMode, FrontFace, - IndexFormat, InputStepMode, Limits, MultisampleState, Origin3d, PipelineStatisticsTypes, - PolygonMode, PowerPreference, PresentMode, PrimitiveState, PrimitiveTopology, - PushConstantRange, QuerySetDescriptor, QueryType, SamplerBorderColor, ShaderFlags, - ShaderLocation, ShaderStage, StencilFaceState, StencilOperation, StencilState, + AdapterInfo, AddressMode, Backend, BackendBit, BindGroupLayoutEntry, BindingType, + BlendComponent, BlendFactor, BlendOperation, BlendState, BufferAddress, BufferBindingType, + BufferSize, BufferUsage, Color, ColorTargetState, ColorWrite, CommandBufferDescriptor, + CompareFunction, DepthBiasState, DepthStencilState, DeviceType, DynamicOffset, Extent3d, Face, + Features, FilterMode, FrontFace, IndexFormat, InputStepMode, Limits, MultisampleState, + Origin3d, PipelineStatisticsTypes, PolygonMode, PowerPreference, PresentMode, PrimitiveState, + PrimitiveTopology, PushConstantRange, QuerySetDescriptor, QueryType, SamplerBorderColor, + ShaderFlags, ShaderLocation, ShaderStage, StencilFaceState, StencilOperation, StencilState, StorageTextureAccess, SwapChainDescriptor, SwapChainStatus, TextureAspect, TextureDataLayout, TextureDimension, TextureFormat, TextureSampleType, TextureUsage, TextureViewDimension, VertexAttribute, VertexFormat, BIND_BUFFER_ALIGNMENT, COPY_BUFFER_ALIGNMENT,