From 568ac3fa249add46145c01f6f66ed76967eab30e Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Wed, 30 Jun 2021 14:43:36 -0400 Subject: [PATCH] Switch all bitflag names to plural --- player/src/bin/play.rs | 7 +--- player/tests/test.rs | 2 +- wgpu-core/src/binding_model.rs | 38 +++++++++---------- wgpu-core/src/command/bind.rs | 4 +- wgpu-core/src/command/bundle.rs | 2 +- wgpu-core/src/command/clear.rs | 4 +- wgpu-core/src/command/compute.rs | 11 +++--- wgpu-core/src/command/draw.rs | 2 +- wgpu-core/src/command/render.rs | 24 +++++++----- wgpu-core/src/command/transfer.rs | 2 +- wgpu-core/src/conv.rs | 4 +- wgpu-core/src/device/mod.rs | 46 +++++++++++------------ wgpu-core/src/device/queue.rs | 2 +- wgpu-core/src/hub.rs | 2 +- wgpu-core/src/instance.rs | 28 +++++++------- wgpu-core/src/pipeline.rs | 6 +-- wgpu-core/src/resource.rs | 4 +- wgpu-core/src/track/texture.rs | 2 +- wgpu-core/src/validation.rs | 8 ++-- wgpu-hal/examples/halmark/main.rs | 24 ++++++------ wgpu-hal/src/empty.rs | 6 +-- wgpu-hal/src/gles/adapter.rs | 14 +++---- wgpu-hal/src/gles/command.rs | 36 +++++++++--------- wgpu-hal/src/gles/device.rs | 14 +++---- wgpu-hal/src/gles/egl.rs | 12 +++--- wgpu-hal/src/gles/mod.rs | 10 ++--- wgpu-hal/src/gles/queue.rs | 4 +- wgpu-hal/src/lib.rs | 34 ++++++++--------- wgpu-hal/src/metal/adapter.rs | 4 +- wgpu-hal/src/metal/command.rs | 18 ++++----- wgpu-hal/src/metal/device.rs | 19 ++++++---- wgpu-hal/src/metal/mod.rs | 2 +- wgpu-hal/src/util.rs | 8 ++-- wgpu-hal/src/vulkan/adapter.rs | 6 +-- wgpu-hal/src/vulkan/command.rs | 6 +-- wgpu-hal/src/vulkan/conv.rs | 34 ++++++++--------- wgpu-hal/src/vulkan/device.rs | 8 ++-- wgpu-hal/src/vulkan/instance.rs | 6 +-- wgpu-hal/src/vulkan/mod.rs | 12 +++--- wgpu-info/src/main.rs | 6 +-- wgpu-types/src/lib.rs | 12 +++--- wgpu/examples/boids/main.rs | 6 +-- wgpu/examples/bunnymark/main.rs | 8 ++-- wgpu/examples/capture/main.rs | 2 +- wgpu/examples/conservative-raster/main.rs | 4 +- wgpu/examples/cube/main.rs | 4 +- wgpu/examples/framework.rs | 2 +- wgpu/examples/hello-compute/main.rs | 2 +- wgpu/examples/hello-triangle/main.rs | 2 +- wgpu/examples/hello-windows/main.rs | 2 +- wgpu/examples/hello/main.rs | 2 +- wgpu/examples/mipmap/main.rs | 2 +- wgpu/examples/shadow/main.rs | 12 +++--- wgpu/examples/skybox/main.rs | 8 ++-- wgpu/examples/texture-arrays/main.rs | 10 ++--- wgpu/examples/water/main.rs | 10 ++--- wgpu/src/backend/direct.rs | 12 +++--- wgpu/src/backend/web.rs | 8 ++-- wgpu/src/lib.rs | 44 +++++++++++----------- wgpu/src/util/encoder.rs | 6 +-- wgpu/src/util/init.rs | 25 ++++++------ wgpu/tests/common/mod.rs | 31 +++++++-------- wgpu/tests/instance.rs | 4 +- wgpu/tests/vertex_indices/mod.rs | 6 +-- 64 files changed, 349 insertions(+), 356 deletions(-) diff --git a/player/src/bin/play.rs b/player/src/bin/play.rs index 481005518..5af9187cf 100644 --- a/player/src/bin/play.rs +++ b/player/src/bin/play.rs @@ -41,11 +41,8 @@ fn main() { .build(&event_loop) .unwrap(); - let global = wgc::hub::Global::new( - "player", - IdentityPassThroughFactory, - wgt::BackendBit::PRIMARY, - ); + let global = + wgc::hub::Global::new("player", IdentityPassThroughFactory, wgt::Backends::PRIMARY); let mut command_buffer_id_manager = wgc::hub::IdentityManager::default(); #[cfg(feature = "winit")] diff --git a/player/tests/test.rs b/player/tests/test.rs index 26163d2a0..cfecb57d7 100644 --- a/player/tests/test.rs +++ b/player/tests/test.rs @@ -159,7 +159,7 @@ impl Test<'_> { #[derive(serde::Deserialize)] struct Corpus { - backends: wgt::BackendBit, + backends: wgt::Backends, tests: Vec, } diff --git a/wgpu-core/src/binding_model.rs b/wgpu-core/src/binding_model.rs index c949d71f0..a4d2a560a 100644 --- a/wgpu-core/src/binding_model.rs +++ b/wgpu-core/src/binding_model.rs @@ -158,7 +158,7 @@ pub enum CreateBindGroupError { #[derive(Clone, Debug, Error)] pub enum BindingZone { #[error("stage {0:?}")] - Stage(wgt::ShaderStage), + Stage(wgt::ShaderStages), #[error("whole pipeline")] Pipeline, } @@ -191,29 +191,29 @@ pub(crate) struct PerStageBindingTypeCounter { } impl PerStageBindingTypeCounter { - pub(crate) fn add(&mut self, stage: wgt::ShaderStage, count: u32) { - if stage.contains(wgt::ShaderStage::VERTEX) { + pub(crate) fn add(&mut self, stage: wgt::ShaderStages, count: u32) { + if stage.contains(wgt::ShaderStages::VERTEX) { self.vertex += count; } - if stage.contains(wgt::ShaderStage::FRAGMENT) { + if stage.contains(wgt::ShaderStages::FRAGMENT) { self.fragment += count; } - if stage.contains(wgt::ShaderStage::COMPUTE) { + if stage.contains(wgt::ShaderStages::COMPUTE) { self.compute += count; } } pub(crate) fn max(&self) -> (BindingZone, u32) { let max_value = self.vertex.max(self.fragment.max(self.compute)); - let mut stage = wgt::ShaderStage::NONE; + let mut stage = wgt::ShaderStages::NONE; if max_value == self.vertex { - stage |= wgt::ShaderStage::VERTEX + stage |= wgt::ShaderStages::VERTEX } if max_value == self.fragment { - stage |= wgt::ShaderStage::FRAGMENT + stage |= wgt::ShaderStages::FRAGMENT } if max_value == self.compute { - stage |= wgt::ShaderStage::COMPUTE + stage |= wgt::ShaderStages::COMPUTE } (BindingZone::Stage(stage), max_value) } @@ -426,8 +426,8 @@ pub enum CreatePipelineLayoutError { #[error("push constant range (index {index}) provides for stage(s) {provided:?} but there exists another range that provides stage(s) {intersected:?}. Each stage may only be provided by one range")] MoreThanOnePushConstantRangePerStage { index: usize, - provided: wgt::ShaderStage, - intersected: wgt::ShaderStage, + provided: wgt::ShaderStages, + intersected: wgt::ShaderStages, }, #[error("push constant at index {index} has range {}..{} which exceeds device push constant size limit 0..{max}", range.start, range.end)] PushConstantRangeTooLarge { @@ -452,20 +452,20 @@ pub enum PushConstantUploadError { }, #[error("provided push constant is for stage(s) {actual:?}, stage with a partial match found at index {idx} with stage(s) {matched:?}, however push constants must be complete matches")] PartialRangeMatch { - actual: wgt::ShaderStage, + actual: wgt::ShaderStages, idx: usize, - matched: wgt::ShaderStage, + matched: wgt::ShaderStages, }, #[error("provided push constant is for stage(s) {actual:?}, but intersects a push constant range (at index {idx}) with stage(s) {missing:?}. Push constants must provide the stages for all ranges they intersect")] MissingStages { - actual: wgt::ShaderStage, + actual: wgt::ShaderStages, idx: usize, - missing: wgt::ShaderStage, + missing: wgt::ShaderStages, }, #[error("provided push constant is for stage(s) {actual:?}, however the pipeline layout has no push constant range for the stage(s) {unmatched:?}")] UnmatchedStages { - actual: wgt::ShaderStage, - unmatched: wgt::ShaderStage, + actual: wgt::ShaderStages, + unmatched: wgt::ShaderStages, }, #[error("provided push constant offset {0} does not respect `PUSH_CONSTANT_ALIGNMENT`")] Unaligned(u32), @@ -504,7 +504,7 @@ impl PipelineLayout { /// Validate push constants match up with expected ranges. pub(crate) fn validate_push_constant_ranges( &self, - stages: wgt::ShaderStage, + stages: wgt::ShaderStages, offset: u32, end_offset: u32, ) -> Result<(), PushConstantUploadError> { @@ -535,7 +535,7 @@ impl PipelineLayout { // when we check for 1, we can simply check that our entire updated range // is within a push constant range. i.e. our range for a specific stage cannot // intersect more than one push constant range. - let mut used_stages = wgt::ShaderStage::NONE; + let mut used_stages = wgt::ShaderStages::NONE; for (idx, range) in self.push_constant_ranges.iter().enumerate() { // contains not intersects due to 2 if stages.contains(range.stages) { diff --git a/wgpu-core/src/command/bind.rs b/wgpu-core/src/command/bind.rs index da7ef47e4..4ba251aa9 100644 --- a/wgpu-core/src/command/bind.rs +++ b/wgpu-core/src/command/bind.rs @@ -218,7 +218,7 @@ impl Binder { } struct PushConstantChange { - stages: wgt::ShaderStage, + stages: wgt::ShaderStages, offset: u32, enable: bool, } @@ -251,7 +251,7 @@ pub fn compute_nonoverlapping_ranges( let mut output_ranges = ArrayVec::new(); let mut position = 0_u32; - let mut stages = wgt::ShaderStage::NONE; + let mut stages = wgt::ShaderStages::NONE; for bk in breaks { if bk.offset - position > 0 && !stages.is_empty() { diff --git a/wgpu-core/src/command/bundle.rs b/wgpu-core/src/command/bundle.rs index cd9b9a61f..55477fe2e 100644 --- a/wgpu-core/src/command/bundle.rs +++ b/wgpu-core/src/command/bundle.rs @@ -1221,7 +1221,7 @@ pub mod bundle_ffi { #[no_mangle] pub unsafe extern "C" fn wgpu_render_bundle_set_push_constants( pass: &mut RenderBundleEncoder, - stages: wgt::ShaderStage, + stages: wgt::ShaderStages, offset: u32, size_bytes: u32, data: *const u8, diff --git a/wgpu-core/src/command/clear.rs b/wgpu-core/src/command/clear.rs index a3b7e47ad..daa42be58 100644 --- a/wgpu-core/src/command/clear.rs +++ b/wgpu-core/src/command/clear.rs @@ -181,8 +181,8 @@ impl Global { .map_err(|_| ClearError::InvalidTexture(dst))?; // Check if subresource aspects are valid. - let requested_aspects = hal::FormatAspect::from(subresource_range.aspect); - let clear_aspects = hal::FormatAspect::from(dst_texture.desc.format) & requested_aspects; + let requested_aspects = hal::FormatAspects::from(subresource_range.aspect); + let clear_aspects = hal::FormatAspects::from(dst_texture.desc.format) & requested_aspects; if clear_aspects.is_empty() { return Err(ClearError::MissingTextureAspect { texture_format: dst_texture.desc.format, diff --git a/wgpu-core/src/command/compute.rs b/wgpu-core/src/command/compute.rs index 73f037460..363cb0703 100644 --- a/wgpu-core/src/command/compute.rs +++ b/wgpu-core/src/command/compute.rs @@ -17,7 +17,6 @@ use crate::{ use hal::CommandEncoder as _; use thiserror::Error; -use wgt::{BufferAddress, BufferUsage, ShaderStage}; use std::{fmt, mem, str}; @@ -46,7 +45,7 @@ pub enum ComputeCommand { Dispatch([u32; 3]), DispatchIndirect { buffer_id: id::BufferId, - offset: BufferAddress, + offset: wgt::BufferAddress, }, PushDebugGroup { color: u32, @@ -430,7 +429,7 @@ impl Global { |clear_offset, clear_data| unsafe { raw.set_push_constants( &pipeline_layout.raw, - wgt::ShaderStage::COMPUTE, + wgt::ShaderStages::COMPUTE, clear_offset, clear_data, ); @@ -464,7 +463,7 @@ impl Global { pipeline_layout .validate_push_constant_ranges( - ShaderStage::COMPUTE, + wgt::ShaderStages::COMPUTE, offset, end_offset_bytes, ) @@ -473,7 +472,7 @@ impl Global { unsafe { raw.set_push_constants( &pipeline_layout.raw, - wgt::ShaderStage::COMPUTE, + wgt::ShaderStages::COMPUTE, offset, data_slice, ); @@ -517,7 +516,7 @@ impl Global { .use_extend(&*buffer_guard, buffer_id, (), hal::BufferUse::INDIRECT) .map_err(|_| ComputePassErrorInner::InvalidIndirectBuffer(buffer_id)) .map_pass_err(scope)?; - check_buffer_usage(indirect_buffer.usage, BufferUsage::INDIRECT) + check_buffer_usage(indirect_buffer.usage, wgt::BufferUsage::INDIRECT) .map_pass_err(scope)?; let end_offset = offset + mem::size_of::() as u64; diff --git a/wgpu-core/src/command/draw.rs b/wgpu-core/src/command/draw.rs index 6f19b41a4..6bbf26622 100644 --- a/wgpu-core/src/command/draw.rs +++ b/wgpu-core/src/command/draw.rs @@ -149,7 +149,7 @@ pub enum RenderCommand { }, SetScissor(Rect), SetPushConstant { - stages: wgt::ShaderStage, + stages: wgt::ShaderStages, offset: u32, size_bytes: u32, /// None means there is no data and the data should be an array of zeros. diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index 0acba4a77..10ecf1109 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -80,14 +80,14 @@ pub struct PassChannel { } impl PassChannel { - fn hal_ops(&self) -> hal::AttachmentOp { - let mut ops = hal::AttachmentOp::empty(); + fn hal_ops(&self) -> hal::AttachmentOps { + let mut ops = hal::AttachmentOps::empty(); match self.load_op { - LoadOp::Load => ops |= hal::AttachmentOp::LOAD, + LoadOp::Load => ops |= hal::AttachmentOps::LOAD, LoadOp::Clear => (), }; match self.store_op { - StoreOp::Store => ops |= hal::AttachmentOp::STORE, + StoreOp::Store => ops |= hal::AttachmentOps::STORE, StoreOp::Clear => (), }; ops @@ -123,14 +123,14 @@ pub struct RenderPassDepthStencilAttachment { } impl RenderPassDepthStencilAttachment { - fn is_read_only(&self, aspects: hal::FormatAspect) -> Result { - if aspects.contains(hal::FormatAspect::DEPTH) && !self.depth.read_only { + fn is_read_only(&self, aspects: hal::FormatAspects) -> Result { + if aspects.contains(hal::FormatAspects::DEPTH) && !self.depth.read_only { return Ok(false); } if (self.depth.load_op, self.depth.store_op) != (LoadOp::Load, StoreOp::Store) { return Err(RenderPassErrorInner::InvalidDepthOps); } - if aspects.contains(hal::FormatAspect::STENCIL) && !self.stencil.read_only { + if aspects.contains(hal::FormatAspects::STENCIL) && !self.stencil.read_only { return Ok(false); } if (self.stencil.load_op, self.stencil.store_op) != (LoadOp::Load, StoreOp::Store) { @@ -564,7 +564,7 @@ impl<'a, A: HalApi> RenderPassInfo<'a, A> { add_view(view, "depth")?; let ds_aspects = view.desc.aspects(); - if ds_aspects.contains(hal::FormatAspect::COLOR) { + if ds_aspects.contains(hal::FormatAspects::COLOR) { return Err(RenderPassErrorInner::InvalidDepthStencilAttachmentFormat( view.desc.format, )); @@ -616,7 +616,11 @@ impl<'a, A: HalApi> RenderPassInfo<'a, A> { .map_err(|_| RenderPassErrorInner::InvalidAttachment(at.view))?; add_view(color_view, "color")?; - if !color_view.desc.aspects().contains(hal::FormatAspect::COLOR) { + if !color_view + .desc + .aspects() + .contains(hal::FormatAspects::COLOR) + { return Err(RenderPassErrorInner::InvalidColorAttachmentFormat( color_view.desc.format, )); @@ -1889,7 +1893,7 @@ pub mod render_ffi { #[no_mangle] pub unsafe extern "C" fn wgpu_render_pass_set_push_constants( pass: &mut RenderPass, - stages: wgt::ShaderStage, + stages: wgt::ShaderStages, offset: u32, size_bytes: u32, data: *const u8, diff --git a/wgpu-core/src/command/transfer.rs b/wgpu-core/src/command/transfer.rs index dbfea509f..cf5ed2972 100644 --- a/wgpu-core/src/command/transfer.rs +++ b/wgpu-core/src/command/transfer.rs @@ -112,7 +112,7 @@ pub(crate) fn extract_texture_selector( let format = texture.desc.format; let copy_aspect = - hal::FormatAspect::from(format) & hal::FormatAspect::from(copy_texture.aspect); + hal::FormatAspects::from(format) & hal::FormatAspects::from(copy_texture.aspect); if copy_aspect.is_empty() { return Err(TransferError::InvalidTextureAspect { format, diff --git a/wgpu-core/src/conv.rs b/wgpu-core/src/conv.rs index 90d25abb7..41c38712d 100644 --- a/wgpu-core/src/conv.rs +++ b/wgpu-core/src/conv.rs @@ -61,7 +61,7 @@ pub fn map_buffer_usage(usage: wgt::BufferUsage) -> hal::BufferUse { u } -pub fn map_texture_usage(usage: wgt::TextureUsage, aspect: hal::FormatAspect) -> hal::TextureUse { +pub fn map_texture_usage(usage: wgt::TextureUsage, aspect: hal::FormatAspects) -> hal::TextureUse { let mut u = hal::TextureUse::empty(); u.set( hal::TextureUse::COPY_SRC, @@ -79,7 +79,7 @@ pub fn map_texture_usage(usage: wgt::TextureUsage, aspect: hal::FormatAspect) -> hal::TextureUse::STORAGE_LOAD | hal::TextureUse::STORAGE_STORE, usage.contains(wgt::TextureUsage::STORAGE), ); - let is_color = aspect.contains(hal::FormatAspect::COLOR); + let is_color = aspect.contains(hal::FormatAspects::COLOR); u.set( hal::TextureUse::COLOR_TARGET, usage.contains(wgt::TextureUsage::RENDER_ATTACHMENT) && is_color, diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index 4d972ad68..40e783abe 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -499,8 +499,8 @@ impl Device { usage |= hal::BufferUse::COPY_DST; } - let mut memory_flags = hal::MemoryFlag::empty(); - memory_flags.set(hal::MemoryFlag::TRANSIENT, transient); + let mut memory_flags = hal::MemoryFlags::empty(); + memory_flags.set(hal::MemoryFlags::TRANSIENT, transient); let hal_desc = hal::BufferDescriptor { label: desc.label.borrow_option(), @@ -583,7 +583,7 @@ impl Device { dimension: desc.dimension, format: desc.format, usage: hal_usage, - memory_flags: hal::MemoryFlag::empty(), + memory_flags: hal::MemoryFlags::empty(), }; let raw = unsafe { self.raw @@ -683,8 +683,8 @@ impl Device { _ => {} } - let full_aspect = hal::FormatAspect::from(texture.desc.format); - let select_aspect = hal::FormatAspect::from(desc.range.aspect); + let full_aspect = hal::FormatAspects::from(texture.desc.format); + let select_aspect = hal::FormatAspects::from(desc.range.aspect); if (full_aspect & select_aspect).is_empty() { return Err(resource::CreateTextureViewError::InvalidAspect { texture_format: texture.desc.format, @@ -1037,10 +1037,10 @@ impl Device { error, })?; } - if is_writable_storage && entry.visibility.contains(wgt::ShaderStage::VERTEX) { + if is_writable_storage && entry.visibility.contains(wgt::ShaderStages::VERTEX) { required_features |= wgt::Features::VERTEX_WRITABLE_STORAGE; } - if is_writable_storage && entry.visibility.contains(wgt::ShaderStage::FRAGMENT) { + if is_writable_storage && entry.visibility.contains(wgt::ShaderStages::FRAGMENT) { self.require_downlevel_flags(wgt::DownlevelFlags::FRAGMENT_WRITABLE_STORAGE) .map_err(binding_model::BindGroupLayoutEntryError::MissingDownlevelFlags) .map_err(|error| binding_model::CreateBindGroupLayoutError::Entry { @@ -1483,8 +1483,8 @@ impl Device { expected: &'static str, ) -> Result<(wgt::TextureUsage, hal::TextureUse), binding_model::CreateBindGroupError> { use crate::binding_model::CreateBindGroupError as Error; - if hal::FormatAspect::from(view.desc.format) - .contains(hal::FormatAspect::DEPTH | hal::FormatAspect::STENCIL) + if hal::FormatAspects::from(view.desc.format) + .contains(hal::FormatAspects::DEPTH | hal::FormatAspects::STENCIL) { return Err(Error::DepthStencilAspect); } @@ -1598,7 +1598,7 @@ impl Device { self.require_features(wgt::Features::PUSH_CONSTANTS)?; } - let mut used_stages = wgt::ShaderStage::empty(); + let mut used_stages = wgt::ShaderStages::empty(); for (index, pc) in desc.push_constant_ranges.iter().enumerate() { if pc.stages.intersects(used_stages) { return Err(Error::MoreThanOnePushConstantRangePerStage { @@ -1764,7 +1764,7 @@ impl Device { .map_err(|_| validation::StageError::InvalidModule)?; { - let flag = wgt::ShaderStage::COMPUTE; + let flag = wgt::ShaderStages::COMPUTE; let provided_layouts = match desc.layout { Some(pipeline_layout_id) => Some(Device::get_introspection_bind_group_layouts( pipeline_layout_guard @@ -1885,7 +1885,7 @@ impl Device { } let mut io = validation::StageIo::default(); - let mut validated_stages = wgt::ShaderStage::empty(); + let mut validated_stages = wgt::ShaderStages::empty(); let mut vertex_strides = Vec::with_capacity(desc.vertex.buffers.len()); let mut vertex_buffers = Vec::with_capacity(desc.vertex.buffers.len()); @@ -1995,7 +1995,7 @@ impl Device { if cs.blend.is_some() && !format_features.filterable { break Some(pipeline::ColorStateError::FormatNotBlendable(cs.format)); } - if !hal::FormatAspect::from(cs.format).contains(hal::FormatAspect::COLOR) { + if !hal::FormatAspects::from(cs.format).contains(hal::FormatAspects::COLOR) { break Some(pipeline::ColorStateError::FormatNotColor(cs.format)); } @@ -2017,11 +2017,11 @@ impl Device { ds.format, )); } - let aspect = hal::FormatAspect::from(ds.format); - if ds.is_depth_enabled() && !aspect.contains(hal::FormatAspect::DEPTH) { + let aspect = hal::FormatAspects::from(ds.format); + if ds.is_depth_enabled() && !aspect.contains(hal::FormatAspects::DEPTH) { break Some(pipeline::DepthStencilStateError::FormatNotDepth(ds.format)); } - if ds.stencil.is_enabled() && !aspect.contains(hal::FormatAspect::STENCIL) { + if ds.stencil.is_enabled() && !aspect.contains(hal::FormatAspects::STENCIL) { break Some(pipeline::DepthStencilStateError::FormatNotStencil( ds.format, )); @@ -2051,7 +2051,7 @@ impl Device { let vertex_stage = { let stage = &desc.vertex.stage; - let flag = wgt::ShaderStage::VERTEX; + let flag = wgt::ShaderStages::VERTEX; let shader_module = shader_module_guard.get(stage.module).map_err(|_| { pipeline::CreateRenderPipelineError::Stage { @@ -2097,7 +2097,7 @@ impl Device { let fragment_stage = match desc.fragment { Some(ref fragment) => { - let flag = wgt::ShaderStage::FRAGMENT; + let flag = wgt::ShaderStages::FRAGMENT; let shader_module = shader_module_guard @@ -2117,7 +2117,7 @@ impl Device { None => None, }; - if validated_stages == wgt::ShaderStage::VERTEX { + if validated_stages == wgt::ShaderStages::VERTEX { if let Some(ref interface) = shader_module.interface { io = interface .check_stage( @@ -2143,7 +2143,7 @@ impl Device { None => None, }; - if validated_stages.contains(wgt::ShaderStage::FRAGMENT) { + if validated_stages.contains(wgt::ShaderStages::FRAGMENT) { for (i, state) in color_targets.iter().enumerate() { match io.get(&(i as wgt::ShaderLocation)) { Some(ref output) => { @@ -2171,8 +2171,8 @@ impl Device { } } let last_stage = match desc.fragment { - Some(_) => wgt::ShaderStage::FRAGMENT, - None => wgt::ShaderStage::VERTEX, + Some(_) => wgt::ShaderStages::FRAGMENT, + None => wgt::ShaderStages::VERTEX, }; if desc.layout.is_none() && !validated_stages.contains(last_stage) { return Err(pipeline::ImplicitLayoutError::ReflectionError(last_stage).into()); @@ -4221,7 +4221,7 @@ impl Global { height: desc.height, depth_or_array_layers: 1, }, - usage: conv::map_texture_usage(desc.usage, hal::FormatAspect::COLOR), + usage: conv::map_texture_usage(desc.usage, hal::FormatAspects::COLOR), }; if let Err(error) = validate_swap_chain_descriptor(&mut config, &caps) { diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index 8d67aecc5..609694deb 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -208,7 +208,7 @@ impl super::Device { label: Some("_Staging"), size, usage: hal::BufferUse::MAP_WRITE | hal::BufferUse::COPY_SRC, - memory_flags: hal::MemoryFlag::TRANSIENT, + memory_flags: hal::MemoryFlags::TRANSIENT, }; let buffer = unsafe { self.raw.create_buffer(&stage_desc)? }; Ok(StagingData { buffer }) diff --git a/wgpu-core/src/hub.rs b/wgpu-core/src/hub.rs index e592c70b6..bfaa0f214 100644 --- a/wgpu-core/src/hub.rs +++ b/wgpu-core/src/hub.rs @@ -750,7 +750,7 @@ pub struct Global { } impl Global { - pub fn new(name: &str, factory: G, backends: wgt::BackendBit) -> Self { + pub fn new(name: &str, factory: G, backends: wgt::Backends) -> Self { profiling::scope!("new", "Global"); Self { instance: Instance::new(name, backends), diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index 2d6cd1368..8680df234 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -5,7 +5,7 @@ use crate::{ LabelHelpers, LifeGuard, Stored, DOWNLEVEL_WARNING_MESSAGE, }; -use wgt::{Backend, BackendBit, PowerPreference, BIND_BUFFER_ALIGNMENT}; +use wgt::{Backend, Backends, PowerPreference, BIND_BUFFER_ALIGNMENT}; use hal::{Adapter as _, Instance as _}; use thiserror::Error; @@ -30,13 +30,13 @@ pub struct Instance { } impl Instance { - pub fn new(name: &str, backends: BackendBit) -> Self { - fn init(mask: BackendBit) -> Option { + pub fn new(name: &str, backends: Backends) -> Self { + fn init(mask: Backends) -> Option { if mask.contains(A::VARIANT.into()) { - let mut flags = hal::InstanceFlag::empty(); + let mut flags = hal::InstanceFlags::empty(); if cfg!(debug_assertions) { - flags |= hal::InstanceFlag::VALIDATION; - flags |= hal::InstanceFlag::DEBUG; + flags |= hal::InstanceFlags::VALIDATION; + flags |= hal::InstanceFlags::DEBUG; } let hal_desc = hal::InstanceDescriptor { name: "wgpu", @@ -162,31 +162,31 @@ impl Adapter { let mut allowed_usages = format.describe().guaranteed_format_features.allowed_usages; allowed_usages.set( wgt::TextureUsage::SAMPLED, - caps.contains(hal::TextureFormatCapability::SAMPLED), + caps.contains(hal::TextureFormatCapabilities::SAMPLED), ); allowed_usages.set( wgt::TextureUsage::STORAGE, - caps.contains(hal::TextureFormatCapability::STORAGE), + caps.contains(hal::TextureFormatCapabilities::STORAGE), ); allowed_usages.set( wgt::TextureUsage::RENDER_ATTACHMENT, caps.intersects( - hal::TextureFormatCapability::COLOR_ATTACHMENT - | hal::TextureFormatCapability::DEPTH_STENCIL_ATTACHMENT, + hal::TextureFormatCapabilities::COLOR_ATTACHMENT + | hal::TextureFormatCapabilities::DEPTH_STENCIL_ATTACHMENT, ), ); let mut flags = wgt::TextureFormatFeatureFlags::empty(); flags.set( wgt::TextureFormatFeatureFlags::STORAGE_ATOMICS, - caps.contains(hal::TextureFormatCapability::STORAGE_ATOMIC), + caps.contains(hal::TextureFormatCapabilities::STORAGE_ATOMIC), ); flags.set( wgt::TextureFormatFeatureFlags::STORAGE_READ_WRITE, - caps.contains(hal::TextureFormatCapability::STORAGE_READ_WRITE), + caps.contains(hal::TextureFormatCapabilities::STORAGE_READ_WRITE), ); - let filterable = caps.contains(hal::TextureFormatCapability::SAMPLED_LINEAR); + let filterable = caps.contains(hal::TextureFormatCapabilities::SAMPLED_LINEAR); wgt::TextureFormatFeatures { allowed_usages, @@ -307,7 +307,7 @@ pub enum RequestDeviceError { pub enum AdapterInputs<'a, I> { IdSet(&'a [I], fn(&I) -> Backend), - Mask(BackendBit, fn(Backend) -> I), + Mask(Backends, fn(Backend) -> I), } impl AdapterInputs<'_, I> { diff --git a/wgpu-core/src/pipeline.rs b/wgpu-core/src/pipeline.rs index 9d32afd0b..30272e343 100644 --- a/wgpu-core/src/pipeline.rs +++ b/wgpu-core/src/pipeline.rs @@ -78,7 +78,7 @@ pub enum ImplicitLayoutError { #[error("missing IDs for deriving {0} bind groups")] MissingIds(ImplicitBindGroupCount), #[error("unable to reflect the shader {0:?} interface")] - ReflectionError(wgt::ShaderStage), + ReflectionError(wgt::ShaderStages), #[error(transparent)] BindGroup(#[from] CreateBindGroupLayoutError), #[error(transparent)] @@ -259,13 +259,13 @@ pub enum CreateRenderPipelineError { MissingDownlevelFlags(#[from] MissingDownlevelFlags), #[error("error matching {stage:?} shader requirements against the pipeline")] Stage { - stage: wgt::ShaderStage, + stage: wgt::ShaderStages, #[source] error: validation::StageError, }, #[error("Internal error in {stage:?} shader: {error}")] Internal { - stage: wgt::ShaderStage, + stage: wgt::ShaderStages, error: String, }, } diff --git a/wgpu-core/src/resource.rs b/wgpu-core/src/resource.rs index 4d1e382a9..87e7a9831 100644 --- a/wgpu-core/src/resource.rs +++ b/wgpu-core/src/resource.rs @@ -251,8 +251,8 @@ pub(crate) struct HalTextureViewDescriptor { } impl HalTextureViewDescriptor { - pub fn aspects(&self) -> hal::FormatAspect { - hal::FormatAspect::from(self.format) & hal::FormatAspect::from(self.range.aspect) + pub fn aspects(&self) -> hal::FormatAspects { + hal::FormatAspects::from(self.format) & hal::FormatAspects::from(self.range.aspect) } } diff --git a/wgpu-core/src/track/texture.rs b/wgpu-core/src/track/texture.rs index 242292c36..48472d576 100644 --- a/wgpu-core/src/track/texture.rs +++ b/wgpu-core/src/track/texture.rs @@ -11,7 +11,7 @@ type PlaneStates = RangedStates>; #[derive(Clone, Debug, PartialEq, Eq)] pub struct TextureSelector { //TODO: rename to `mip_levels` and `array_layers` for consistency - //pub aspects: hal::FormatAspect, + //pub aspects: hal::FormatAspects, pub levels: Range, pub layers: Range, } diff --git a/wgpu-core/src/validation.rs b/wgpu-core/src/validation.rs index 8f136f430..56fc72a4c 100644 --- a/wgpu-core/src/validation.rs +++ b/wgpu-core/src/validation.rs @@ -864,15 +864,15 @@ impl Interface { given_layouts: Option<&[&BindEntryMap]>, derived_layouts: &mut [BindEntryMap], entry_point_name: &str, - stage_bit: wgt::ShaderStage, + stage_bit: wgt::ShaderStages, inputs: StageIo, ) -> Result { // Since a shader module can have multiple entry points with the same name, // we need to look for one with the right execution model. let shader_stage = match stage_bit { - wgt::ShaderStage::VERTEX => naga::ShaderStage::Vertex, - wgt::ShaderStage::FRAGMENT => naga::ShaderStage::Fragment, - wgt::ShaderStage::COMPUTE => naga::ShaderStage::Compute, + wgt::ShaderStages::VERTEX => naga::ShaderStage::Vertex, + wgt::ShaderStages::FRAGMENT => naga::ShaderStage::Fragment, + wgt::ShaderStages::COMPUTE => naga::ShaderStage::Compute, _ => unreachable!(), }; let pair = (shader_stage, entry_point_name.to_string()); diff --git a/wgpu-hal/examples/halmark/main.rs b/wgpu-hal/examples/halmark/main.rs index cd68c053d..63620e16e 100644 --- a/wgpu-hal/examples/halmark/main.rs +++ b/wgpu-hal/examples/halmark/main.rs @@ -80,9 +80,9 @@ impl Example { let instance_desc = hal::InstanceDescriptor { name: "example", flags: if cfg!(debug_assertions) { - hal::InstanceFlag::all() + hal::InstanceFlags::all() } else { - hal::InstanceFlag::empty() + hal::InstanceFlags::empty() }, }; let instance = unsafe { A::Instance::init(&instance_desc)? }; @@ -147,7 +147,7 @@ impl Example { entries: &[ wgt::BindGroupLayoutEntry { binding: 0, - visibility: wgt::ShaderStage::VERTEX, + visibility: wgt::ShaderStages::VERTEX, ty: wgt::BindingType::Buffer { ty: wgt::BufferBindingType::Uniform, has_dynamic_offset: false, @@ -157,7 +157,7 @@ impl Example { }, wgt::BindGroupLayoutEntry { binding: 1, - visibility: wgt::ShaderStage::FRAGMENT, + visibility: wgt::ShaderStages::FRAGMENT, ty: wgt::BindingType::Texture { sample_type: wgt::TextureSampleType::Float { filterable: true }, view_dimension: wgt::TextureViewDimension::D2, @@ -167,7 +167,7 @@ impl Example { }, wgt::BindGroupLayoutEntry { binding: 2, - visibility: wgt::ShaderStage::FRAGMENT, + visibility: wgt::ShaderStages::FRAGMENT, ty: wgt::BindingType::Sampler { filtering: true, comparison: false, @@ -183,7 +183,7 @@ impl Example { let local_bgl_desc = hal::BindGroupLayoutDescriptor { entries: &[wgt::BindGroupLayoutEntry { binding: 0, - visibility: wgt::ShaderStage::VERTEX, + visibility: wgt::ShaderStages::VERTEX, ty: wgt::BindingType::Buffer { ty: wgt::BufferBindingType::Uniform, has_dynamic_offset: true, @@ -239,7 +239,7 @@ impl Example { label: Some("stage"), size: texture_data.len() as wgt::BufferAddress, usage: hal::BufferUse::MAP_WRITE | hal::BufferUse::COPY_SRC, - memory_flags: hal::MemoryFlag::TRANSIENT | hal::MemoryFlag::PREFER_COHERENT, + memory_flags: hal::MemoryFlags::TRANSIENT | hal::MemoryFlags::PREFER_COHERENT, }; let staging_buffer = unsafe { device.create_buffer(&staging_buffer_desc).unwrap() }; unsafe { @@ -267,7 +267,7 @@ impl Example { dimension: wgt::TextureDimension::D2, format: wgt::TextureFormat::Rgba8UnormSrgb, usage: hal::TextureUse::COPY_DST | hal::TextureUse::SAMPLED, - memory_flags: hal::MemoryFlag::empty(), + memory_flags: hal::MemoryFlags::empty(), }; let texture = unsafe { device.create_texture(&texture_desc).unwrap() }; @@ -301,7 +301,7 @@ impl Example { texture_base: hal::TextureCopyBase { origin: wgt::Origin3d::ZERO, mip_level: 0, - aspect: hal::FormatAspect::COLOR, + aspect: hal::FormatAspects::COLOR, }, size: texture_desc.size, }; @@ -342,7 +342,7 @@ impl Example { label: Some("global"), size: mem::size_of::() as wgt::BufferAddress, usage: hal::BufferUse::MAP_WRITE | hal::BufferUse::UNIFORM, - memory_flags: hal::MemoryFlag::PREFER_COHERENT, + memory_flags: hal::MemoryFlags::PREFER_COHERENT, }; let global_buffer = unsafe { let buffer = device.create_buffer(&global_buffer_desc).unwrap(); @@ -363,7 +363,7 @@ impl Example { label: Some("local"), size: (MAX_BUNNIES as wgt::BufferAddress) * wgt::BIND_BUFFER_ALIGNMENT, usage: hal::BufferUse::MAP_WRITE | hal::BufferUse::UNIFORM, - memory_flags: hal::MemoryFlag::PREFER_COHERENT, + memory_flags: hal::MemoryFlags::PREFER_COHERENT, }; let local_buffer = unsafe { device.create_buffer(&local_buffer_desc).unwrap() }; @@ -614,7 +614,7 @@ impl Example { boundary_usage: hal::TextureUse::UNINITIALIZED..hal::TextureUse::empty(), }, resolve_target: None, - ops: hal::AttachmentOp::STORE, + ops: hal::AttachmentOps::STORE, clear_value: wgt::Color { r: 0.1, g: 0.2, diff --git a/wgpu-hal/src/empty.rs b/wgpu-hal/src/empty.rs index a2682e26c..34dc02cfc 100644 --- a/wgpu-hal/src/empty.rs +++ b/wgpu-hal/src/empty.rs @@ -80,8 +80,8 @@ impl crate::Adapter for Context { unsafe fn texture_format_capabilities( &self, format: wgt::TextureFormat, - ) -> crate::TextureFormatCapability { - crate::TextureFormatCapability::empty() + ) -> crate::TextureFormatCapabilities { + crate::TextureFormatCapabilities::empty() } unsafe fn surface_capabilities(&self, surface: &Context) -> Option { None @@ -299,7 +299,7 @@ impl crate::CommandEncoder for Encoder { unsafe fn set_push_constants( &mut self, layout: &Resource, - stages: wgt::ShaderStage, + stages: wgt::ShaderStages, offset: u32, data: &[u32], ) { diff --git a/wgpu-hal/src/gles/adapter.rs b/wgpu-hal/src/gles/adapter.rs index 3ef2d98b6..2176c639e 100644 --- a/wgpu-hal/src/gles/adapter.rs +++ b/wgpu-hal/src/gles/adapter.rs @@ -251,18 +251,18 @@ impl super::Adapter { max_push_constant_size: 0, }; - let mut private_caps = super::PrivateCapability::empty(); + let mut private_caps = super::PrivateCapabilities::empty(); private_caps.set( - super::PrivateCapability::SHADER_BINDING_LAYOUT, + super::PrivateCapabilities::SHADER_BINDING_LAYOUT, ver >= (3, 1), ); private_caps.set( - super::PrivateCapability::SHADER_TEXTURE_SHADOW_LOD, + super::PrivateCapabilities::SHADER_TEXTURE_SHADOW_LOD, extensions.contains("GL_EXT_texture_shadow_lod"), ); - private_caps.set(super::PrivateCapability::MEMORY_BARRIERS, ver >= (3, 1)); + private_caps.set(super::PrivateCapabilities::MEMORY_BARRIERS, ver >= (3, 1)); private_caps.set( - super::PrivateCapability::VERTEX_BUFFER_LAYOUT, + super::PrivateCapabilities::VERTEX_BUFFER_LAYOUT, ver >= (3, 1), ); @@ -345,8 +345,8 @@ impl crate::Adapter for super::Adapter { unsafe fn texture_format_capabilities( &self, format: wgt::TextureFormat, - ) -> crate::TextureFormatCapability { - use crate::TextureFormatCapability as Tfc; + ) -> crate::TextureFormatCapabilities { + use crate::TextureFormatCapabilities as Tfc; use wgt::TextureFormat as Tf; // The storage types are sprinkled based on section // "TEXTURE IMAGE LOADS AND STORES" of GLES-3.2 spec. diff --git a/wgpu-hal/src/gles/command.rs b/wgpu-hal/src/gles/command.rs index fc0bbe4c6..c63ac5274 100644 --- a/wgpu-hal/src/gles/command.rs +++ b/wgpu-hal/src/gles/command.rs @@ -72,7 +72,7 @@ impl super::CommandEncoder { fn rebind_vertex_data(&mut self, first_instance: u32) { if self .private_caps - .contains(super::PrivateCapability::VERTEX_BUFFER_LAYOUT) + .contains(super::PrivateCapabilities::VERTEX_BUFFER_LAYOUT) { for (index, &(ref vb_desc, ref vb)) in self.state.vertex_buffers.iter().enumerate() { if self.state.dirty_vbuf_mask & (1 << index) == 0 { @@ -190,7 +190,7 @@ impl crate::CommandEncoder for super::CommandEncoder { { if !self .private_caps - .contains(super::PrivateCapability::MEMORY_BARRIERS) + .contains(super::PrivateCapabilities::MEMORY_BARRIERS) { return; } @@ -211,7 +211,7 @@ impl crate::CommandEncoder for super::CommandEncoder { { if !self .private_caps - .contains(super::PrivateCapability::MEMORY_BARRIERS) + .contains(super::PrivateCapabilities::MEMORY_BARRIERS) { return; } @@ -390,30 +390,30 @@ impl crate::CommandEncoder for super::CommandEncoder { .resolve_attachments .push((attachment, rat.view.clone())); } - if !cat.ops.contains(crate::AttachmentOp::STORE) { + if !cat.ops.contains(crate::AttachmentOps::STORE) { self.state.invalidate_attachments.push(attachment); } } if let Some(ref dsat) = desc.depth_stencil_attachment { let aspects = dsat.target.view.aspects; let attachment = match aspects { - crate::FormatAspect::DEPTH => glow::DEPTH_ATTACHMENT, - crate::FormatAspect::STENCIL => glow::STENCIL_ATTACHMENT, + crate::FormatAspects::DEPTH => glow::DEPTH_ATTACHMENT, + crate::FormatAspects::STENCIL => glow::STENCIL_ATTACHMENT, _ => glow::DEPTH_STENCIL_ATTACHMENT, }; self.cmd_buffer.commands.push(C::BindAttachment { attachment, view: dsat.target.view.clone(), }); - if aspects.contains(crate::FormatAspect::DEPTH) - && !dsat.depth_ops.contains(crate::AttachmentOp::STORE) + if aspects.contains(crate::FormatAspects::DEPTH) + && !dsat.depth_ops.contains(crate::AttachmentOps::STORE) { self.state .invalidate_attachments .push(glow::DEPTH_ATTACHMENT); } - if aspects.contains(crate::FormatAspect::STENCIL) - && !dsat.stencil_ops.contains(crate::AttachmentOp::STORE) + if aspects.contains(crate::FormatAspects::STENCIL) + && !dsat.stencil_ops.contains(crate::AttachmentOps::STORE) { self.state .invalidate_attachments @@ -439,7 +439,7 @@ impl crate::CommandEncoder for super::CommandEncoder { // issue the clears for (i, cat) in desc.color_attachments.iter().enumerate() { - if !cat.ops.contains(crate::AttachmentOp::LOAD) { + if !cat.ops.contains(crate::AttachmentOps::LOAD) { let c = &cat.clear_value; self.cmd_buffer .commands @@ -461,12 +461,12 @@ impl crate::CommandEncoder for super::CommandEncoder { } } if let Some(ref dsat) = desc.depth_stencil_attachment { - if !dsat.depth_ops.contains(crate::AttachmentOp::LOAD) { + if !dsat.depth_ops.contains(crate::AttachmentOps::LOAD) { self.cmd_buffer .commands .push(C::ClearDepth(dsat.clear_value.0)); } - if !dsat.stencil_ops.contains(crate::AttachmentOp::LOAD) { + if !dsat.stencil_ops.contains(crate::AttachmentOps::LOAD) { self.cmd_buffer .commands .push(C::ClearStencil(dsat.clear_value.1)); @@ -574,7 +574,7 @@ impl crate::CommandEncoder for super::CommandEncoder { unsafe fn set_push_constants( &mut self, _layout: &super::PipelineLayout, - _stages: wgt::ShaderStage, + _stages: wgt::ShaderStages, _offset: u32, _data: &[u32], ) { @@ -604,7 +604,7 @@ impl crate::CommandEncoder for super::CommandEncoder { if self .private_caps - .contains(super::PrivateCapability::VERTEX_BUFFER_LAYOUT) + .contains(super::PrivateCapabilities::VERTEX_BUFFER_LAYOUT) { for vat in pipeline.vertex_attributes.iter() { let vb = &pipeline.vertex_buffers[vat.buffer_index as usize]; @@ -655,7 +655,7 @@ impl crate::CommandEncoder for super::CommandEncoder { } // set depth/stencil states - let mut aspects = crate::FormatAspect::empty(); + let mut aspects = crate::FormatAspects::empty(); if pipeline.depth_bias != self.state.depth_bias { self.state.depth_bias = pipeline.depth_bias; self.cmd_buffer @@ -663,11 +663,11 @@ impl crate::CommandEncoder for super::CommandEncoder { .push(C::SetDepthBias(pipeline.depth_bias)); } if let Some(ref depth) = pipeline.depth { - aspects |= crate::FormatAspect::DEPTH; + aspects |= crate::FormatAspects::DEPTH; self.cmd_buffer.commands.push(C::SetDepth(depth.clone())); } if let Some(ref stencil) = pipeline.stencil { - aspects |= crate::FormatAspect::STENCIL; + aspects |= crate::FormatAspects::STENCIL; self.state.stencil = stencil.clone(); self.rebind_stencil_func(); if stencil.front.ops == stencil.back.ops diff --git a/wgpu-hal/src/gles/device.rs b/wgpu-hal/src/gles/device.rs index e8e2e78ab..94095ae60 100644 --- a/wgpu-hal/src/gles/device.rs +++ b/wgpu-hal/src/gles/device.rs @@ -175,7 +175,7 @@ impl super::Device { let mut name_binding_map = NameBindingMap::default(); let mut sampler_map = [None; super::MAX_TEXTURE_SLOTS]; - let mut has_stages = wgt::ShaderStage::empty(); + let mut has_stages = wgt::ShaderStages::empty(); let mut shaders_to_delete = arrayvec::ArrayVec::<[_; 3]>::new(); for (naga_stage, stage) in shaders { @@ -191,7 +191,7 @@ impl super::Device { } // Create empty fragment shader if only vertex shader is present - if has_stages == wgt::ShaderStage::VERTEX { + if has_stages == wgt::ShaderStages::VERTEX { let version = match self.shared.shading_language_version { naga::back::glsl::Version::Embedded(v) => v, naga::back::glsl::Version::Desktop(_) => unreachable!(), @@ -226,7 +226,7 @@ impl super::Device { if !self .shared .private_caps - .contains(super::PrivateCapability::SHADER_BINDING_LAYOUT) + .contains(super::PrivateCapabilities::SHADER_BINDING_LAYOUT) { // This remapping is only needed if we aren't able to put the binding layout // in the shader. We can't remap storage buffers this way. @@ -311,7 +311,7 @@ impl crate::Device for super::Device { .intersects(crate::BufferUse::MAP_READ | crate::BufferUse::MAP_WRITE); let is_coherent = desc .memory_flags - .contains(crate::MemoryFlag::PREFER_COHERENT); + .contains(crate::MemoryFlags::PREFER_COHERENT); let mut map_flags = 0; if is_host_visible { @@ -582,8 +582,8 @@ impl crate::Device for super::Device { //TODO: use `conv::map_view_dimension(desc.dimension)`? inner: texture.inner.clone(), sample_type: texture.format.describe().sample_type, - aspects: crate::FormatAspect::from(texture.format) - & crate::FormatAspect::from(desc.range.aspect), + aspects: crate::FormatAspects::from(texture.format) + & crate::FormatAspects::from(desc.range.aspect), mip_levels: desc.range.base_mip_level..end_mip_level, array_layers: desc.range.base_array_layer..end_array_layer, }) @@ -705,7 +705,7 @@ impl crate::Device for super::Device { glsl::WriterFlags::TEXTURE_SHADOW_LOD, self.shared .private_caps - .contains(super::PrivateCapability::SHADER_TEXTURE_SHADOW_LOD), + .contains(super::PrivateCapabilities::SHADER_TEXTURE_SHADOW_LOD), ); let mut binding_map = glsl::BindingMap::default(); diff --git a/wgpu-hal/src/gles/egl.rs b/wgpu-hal/src/gles/egl.rs index 62ced7e9a..10cbff0a0 100644 --- a/wgpu-hal/src/gles/egl.rs +++ b/wgpu-hal/src/gles/egl.rs @@ -226,7 +226,7 @@ struct Inner { impl Inner { fn create( - flags: crate::InstanceFlag, + flags: crate::InstanceFlags, egl: Arc>, display: egl::Display, ) -> Result { @@ -265,7 +265,7 @@ impl Inner { egl::CONTEXT_CLIENT_VERSION, 3, // Request GLES 3.0 or higher ]; - if flags.contains(crate::InstanceFlag::DEBUG) && !cfg!(target_os = "android") { + if flags.contains(crate::InstanceFlags::DEBUG) && !cfg!(target_os = "android") { log::info!("\tEGL context: +debug"); //TODO: figure out why this is needed context_attributes.push(egl::CONTEXT_OPENGL_DEBUG); @@ -328,7 +328,7 @@ impl Drop for Inner { pub struct Instance { wsi_library: Option, - flags: crate::InstanceFlag, + flags: crate::InstanceFlags, inner: Mutex, } @@ -395,7 +395,7 @@ impl crate::Instance for Instance { egl.get_display(egl::DEFAULT_DISPLAY).unwrap() }; - if desc.flags.contains(crate::InstanceFlag::VALIDATION) + if desc.flags.contains(crate::InstanceFlags::VALIDATION) && client_ext_str.contains(&"EGL_KHR_debug") { log::info!("Enabling EGL debug output"); @@ -606,14 +606,14 @@ impl crate::Instance for Instance { .map_or(ptr::null(), |p| p as *const _) }); - if self.flags.contains(crate::InstanceFlag::DEBUG) && gl.supports_debug() { + if self.flags.contains(crate::InstanceFlags::DEBUG) && gl.supports_debug() { log::info!( "Max label length: {}", gl.get_parameter_i32(glow::MAX_LABEL_LENGTH) ); } - if self.flags.contains(crate::InstanceFlag::VALIDATION) && gl.supports_debug() { + if self.flags.contains(crate::InstanceFlags::VALIDATION) && gl.supports_debug() { log::info!("Enabling GLES debug output"); gl.enable(glow::DEBUG_OUTPUT); gl.debug_message_callback(gl_debug_message_callback); diff --git a/wgpu-hal/src/gles/mod.rs b/wgpu-hal/src/gles/mod.rs index 2c42e7f7c..332cc0ad7 100644 --- a/wgpu-hal/src/gles/mod.rs +++ b/wgpu-hal/src/gles/mod.rs @@ -111,7 +111,7 @@ impl crate::Api for Api { bitflags::bitflags! { /// Flags that affect internal code paths but do not /// change the exposed feature set. - struct PrivateCapability: u32 { + struct PrivateCapabilities: u32 { /// Support explicit layouts in shader. const SHADER_BINDING_LAYOUT = 0x0001; /// Support extended shadow sampling instructions. @@ -147,7 +147,7 @@ struct TextureFormatDesc { struct AdapterShared { context: glow::Context, - private_caps: PrivateCapability, + private_caps: PrivateCapabilities, shading_language_version: naga::back::glsl::Version, } @@ -213,7 +213,7 @@ pub struct Texture { pub struct TextureView { inner: TextureInner, sample_type: wgt::TextureSampleType, - aspects: crate::FormatAspect, + aspects: crate::FormatAspects, mip_levels: Range, array_layers: Range, } @@ -585,7 +585,7 @@ enum Command { }, SetDepth(DepthState), SetDepthBias(wgt::DepthBiasState), - ConfigureDepthStencil(crate::FormatAspect), + ConfigureDepthStencil(crate::FormatAspects), SetVertexAttribute { buffer: Option, buffer_desc: VertexBufferDesc, @@ -641,5 +641,5 @@ pub struct CommandBuffer { pub struct CommandEncoder { cmd_buffer: CommandBuffer, state: command::State, - private_caps: PrivateCapability, + private_caps: PrivateCapabilities, } diff --git a/wgpu-hal/src/gles/queue.rs b/wgpu-hal/src/gles/queue.rs index 548fe6fbf..4347ea26a 100644 --- a/wgpu-hal/src/gles/queue.rs +++ b/wgpu-hal/src/gles/queue.rs @@ -760,12 +760,12 @@ impl super::Queue { } } C::ConfigureDepthStencil(aspects) => { - if aspects.contains(crate::FormatAspect::DEPTH) { + if aspects.contains(crate::FormatAspects::DEPTH) { gl.enable(glow::DEPTH_TEST); } else { gl.disable(glow::DEPTH_TEST); } - if aspects.contains(crate::FormatAspect::STENCIL) { + if aspects.contains(crate::FormatAspects::STENCIL) { gl.enable(glow::STENCIL_TEST); } else { gl.disable(glow::STENCIL_TEST); diff --git a/wgpu-hal/src/lib.rs b/wgpu-hal/src/lib.rs index 2d066d681..37e964ed3 100644 --- a/wgpu-hal/src/lib.rs +++ b/wgpu-hal/src/lib.rs @@ -105,7 +105,7 @@ pub enum ShaderError { #[derive(Clone, Debug, PartialEq, Error)] pub enum PipelineError { #[error("linkage failed for stage {0:?}: {1}")] - Linkage(wgt::ShaderStage, String), + Linkage(wgt::ShaderStages, String), #[error("entry point for stage {0:?} is invalid")] EntryPoint(naga::ShaderStage), #[error(transparent)] @@ -188,7 +188,7 @@ pub trait Adapter: Send + Sync { unsafe fn texture_format_capabilities( &self, format: wgt::TextureFormat, - ) -> TextureFormatCapability; + ) -> TextureFormatCapabilities; /// Returns the capabilities of working with a specified surface. /// @@ -384,7 +384,7 @@ pub trait CommandEncoder: Send + Sync { unsafe fn set_push_constants( &mut self, layout: &A::PipelineLayout, - stages: wgt::ShaderStage, + stages: wgt::ShaderStages, offset: u32, data: &[u32], ); @@ -485,7 +485,7 @@ pub trait CommandEncoder: Send + Sync { bitflags!( /// Instance initialization flags. - pub struct InstanceFlag: u32 { + pub struct InstanceFlags: u32 { /// Generate debug information in shaders and objects. const DEBUG = 0x1; /// Enable validation, if possible. @@ -495,7 +495,7 @@ bitflags!( bitflags!( /// Texture format capability flags. - pub struct TextureFormatCapability: u32 { + pub struct TextureFormatCapabilities: u32 { /// Format can be sampled. const SAMPLED = 0x1; /// Format can be sampled with a linear sampler. @@ -526,14 +526,14 @@ bitflags!( bitflags!( /// Texture format capability flags. - pub struct FormatAspect: u8 { + pub struct FormatAspects: u8 { const COLOR = 1; const DEPTH = 2; const STENCIL = 4; } ); -impl From for FormatAspect { +impl From for FormatAspects { fn from(aspect: wgt::TextureAspect) -> Self { match aspect { wgt::TextureAspect::All => Self::all(), @@ -543,7 +543,7 @@ impl From for FormatAspect { } } -impl From for FormatAspect { +impl From for FormatAspects { fn from(format: wgt::TextureFormat) -> Self { match format { wgt::TextureFormat::Depth32Float | wgt::TextureFormat::Depth24Plus => Self::DEPTH, @@ -554,7 +554,7 @@ impl From for FormatAspect { } bitflags!( - pub struct MemoryFlag: u32 { + pub struct MemoryFlags: u32 { const TRANSIENT = 1; const PREFER_COHERENT = 2; } @@ -563,7 +563,7 @@ bitflags!( //TODO: it's not intuitive for the backends to consider `LOAD` being optional. bitflags!( - pub struct AttachmentOp: u8 { + pub struct AttachmentOps: u8 { const LOAD = 1; const STORE = 2; } @@ -621,7 +621,7 @@ bitflags::bitflags! { #[derive(Clone, Debug)] pub struct InstanceDescriptor<'a> { pub name: &'a str, - pub flags: InstanceFlag, + pub flags: InstanceFlags, } #[derive(Clone, Debug)] @@ -715,7 +715,7 @@ pub struct BufferDescriptor<'a> { pub label: Label<'a>, pub size: wgt::BufferAddress, pub usage: BufferUse, - pub memory_flags: MemoryFlag, + pub memory_flags: MemoryFlags, } #[derive(Clone, Debug)] @@ -727,7 +727,7 @@ pub struct TextureDescriptor<'a> { pub dimension: wgt::TextureDimension, pub format: wgt::TextureFormat, pub usage: TextureUse, - pub memory_flags: MemoryFlag, + pub memory_flags: MemoryFlags, } /// TextureView descriptor. @@ -1001,7 +1001,7 @@ pub struct BufferCopy { pub struct TextureCopyBase { pub origin: wgt::Origin3d, pub mip_level: u32, - pub aspect: FormatAspect, + pub aspect: FormatAspects, } #[derive(Clone, Debug)] @@ -1045,7 +1045,7 @@ impl Clone for Attachment<'_, A> { pub struct ColorAttachment<'a, A: Api> { pub target: Attachment<'a, A>, pub resolve_target: Option>, - pub ops: AttachmentOp, + pub ops: AttachmentOps, pub clear_value: wgt::Color, } @@ -1064,8 +1064,8 @@ impl Clone for ColorAttachment<'_, A> { #[derive(Clone, Debug)] pub struct DepthStencilAttachment<'a, A: Api> { pub target: Attachment<'a, A>, - pub depth_ops: AttachmentOp, - pub stencil_ops: AttachmentOp, + pub depth_ops: AttachmentOps, + pub stencil_ops: AttachmentOps, pub clear_value: (f32, u32), } diff --git a/wgpu-hal/src/metal/adapter.rs b/wgpu-hal/src/metal/adapter.rs index 0624a33be..e081e8477 100644 --- a/wgpu-hal/src/metal/adapter.rs +++ b/wgpu-hal/src/metal/adapter.rs @@ -33,8 +33,8 @@ impl crate::Adapter for super::Adapter { unsafe fn texture_format_capabilities( &self, format: wgt::TextureFormat, - ) -> crate::TextureFormatCapability { - use crate::TextureFormatCapability as Tfc; + ) -> crate::TextureFormatCapabilities { + use crate::TextureFormatCapabilities as Tfc; use wgt::TextureFormat as Tf; let pc = &self.shared.private_caps; diff --git a/wgpu-hal/src/metal/command.rs b/wgpu-hal/src/metal/command.rs index ceec1c872..49105be25 100644 --- a/wgpu-hal/src/metal/command.rs +++ b/wgpu-hal/src/metal/command.rs @@ -323,14 +323,14 @@ impl crate::CommandEncoder for super::CommandEncoder { //Note: the selection of levels and slices is already handled by `TextureView` at_descriptor.set_resolve_texture(Some(&resolve.view.raw)); } - let load_action = if at.ops.contains(crate::AttachmentOp::LOAD) { + let load_action = if at.ops.contains(crate::AttachmentOps::LOAD) { mtl::MTLLoadAction::Load } else { at_descriptor.set_clear_color(conv::map_clear_color(&at.clear_value)); mtl::MTLLoadAction::Clear }; let store_action = conv::map_store_action( - at.ops.contains(crate::AttachmentOp::STORE), + at.ops.contains(crate::AttachmentOps::STORE), at.resolve_target.is_some(), ); at_descriptor.set_load_action(load_action); @@ -338,17 +338,17 @@ impl crate::CommandEncoder for super::CommandEncoder { } if let Some(ref at) = desc.depth_stencil_attachment { - if at.target.view.aspects.contains(crate::FormatAspect::DEPTH) { + if at.target.view.aspects.contains(crate::FormatAspects::DEPTH) { let at_descriptor = descriptor.depth_attachment().unwrap(); at_descriptor.set_texture(Some(&at.target.view.raw)); - let load_action = if at.depth_ops.contains(crate::AttachmentOp::LOAD) { + let load_action = if at.depth_ops.contains(crate::AttachmentOps::LOAD) { mtl::MTLLoadAction::Load } else { at_descriptor.set_clear_depth(at.clear_value.0 as f64); mtl::MTLLoadAction::Clear }; - let store_action = if at.depth_ops.contains(crate::AttachmentOp::STORE) { + let store_action = if at.depth_ops.contains(crate::AttachmentOps::STORE) { mtl::MTLStoreAction::Store } else { mtl::MTLStoreAction::DontCare @@ -360,18 +360,18 @@ impl crate::CommandEncoder for super::CommandEncoder { .target .view .aspects - .contains(crate::FormatAspect::STENCIL) + .contains(crate::FormatAspects::STENCIL) { let at_descriptor = descriptor.stencil_attachment().unwrap(); at_descriptor.set_texture(Some(&at.target.view.raw)); - let load_action = if at.depth_ops.contains(crate::AttachmentOp::LOAD) { + let load_action = if at.depth_ops.contains(crate::AttachmentOps::LOAD) { mtl::MTLLoadAction::Load } else { at_descriptor.set_clear_stencil(at.clear_value.1); mtl::MTLLoadAction::Clear }; - let store_action = if at.depth_ops.contains(crate::AttachmentOp::STORE) { + let store_action = if at.depth_ops.contains(crate::AttachmentOps::STORE) { mtl::MTLStoreAction::Store } else { mtl::MTLStoreAction::DontCare @@ -563,7 +563,7 @@ impl crate::CommandEncoder for super::CommandEncoder { unsafe fn set_push_constants( &mut self, _layout: &super::PipelineLayout, - _stages: wgt::ShaderStage, + _stages: wgt::ShaderStages, _offset: u32, _data: &[u32], ) { diff --git a/wgpu-hal/src/metal/device.rs b/wgpu-hal/src/metal/device.rs index 91b2f60a9..9db98321d 100644 --- a/wgpu-hal/src/metal/device.rs +++ b/wgpu-hal/src/metal/device.rs @@ -140,7 +140,7 @@ impl crate::Device for super::Device { let mut options = mtl::MTLResourceOptions::empty(); options |= if map_read || map_write { - // `crate::MemoryFlag::PREFER_COHERENT` is ignored here + // `crate::MemoryFlags::PREFER_COHERENT` is ignored here mtl::MTLResourceOptions::StorageModeShared } else { mtl::MTLResourceOptions::StorageModePrivate @@ -290,7 +290,7 @@ impl crate::Device for super::Device { raw }; - let aspects = crate::FormatAspect::from(desc.format); + let aspects = crate::FormatAspects::from(desc.format); Ok(super::TextureView { raw, aspects }) } unsafe fn destroy_texture_view(&self, _view: super::TextureView) {} @@ -717,11 +717,11 @@ impl crate::Device for super::Device { let depth_stencil = match desc.depth_stencil { Some(ref ds) => { let raw_format = self.shared.private_caps.map_format(ds.format); - let aspects = crate::FormatAspect::from(ds.format); - if aspects.contains(crate::FormatAspect::DEPTH) { + let aspects = crate::FormatAspects::from(ds.format); + if aspects.contains(crate::FormatAspects::DEPTH) { descriptor.set_depth_attachment_pixel_format(raw_format); } - if aspects.contains(crate::FormatAspect::STENCIL) { + if aspects.contains(crate::FormatAspects::STENCIL) { descriptor.set_stencil_attachment_pixel_format(raw_format); } @@ -744,7 +744,10 @@ impl crate::Device for super::Device { desc.vertex_buffers.len(), desc.layout.total_counters.vs.buffers ); - return Err(crate::PipelineError::Linkage(wgt::ShaderStage::VERTEX, msg)); + return Err(crate::PipelineError::Linkage( + wgt::ShaderStages::VERTEX, + msg, + )); } if !desc.vertex_buffers.is_empty() { @@ -788,7 +791,7 @@ impl crate::Device for super::Device { .new_render_pipeline_state(&descriptor) .map_err(|e| { crate::PipelineError::Linkage( - wgt::ShaderStage::VERTEX | wgt::ShaderStage::FRAGMENT, + wgt::ShaderStages::VERTEX | wgt::ShaderStages::FRAGMENT, format!("new_render_pipeline_state: {:?}", e), ) })?; @@ -849,7 +852,7 @@ impl crate::Device for super::Device { .new_compute_pipeline_state(&descriptor) .map_err(|e| { crate::PipelineError::Linkage( - wgt::ShaderStage::COMPUTE, + wgt::ShaderStages::COMPUTE, format!("new_compute_pipeline_state: {:?}", e), ) })?; diff --git a/wgpu-hal/src/metal/mod.rs b/wgpu-hal/src/metal/mod.rs index caf61044f..bc4afc2ad 100644 --- a/wgpu-hal/src/metal/mod.rs +++ b/wgpu-hal/src/metal/mod.rs @@ -398,7 +398,7 @@ unsafe impl Sync for Texture {} #[derive(Debug)] pub struct TextureView { raw: mtl::Texture, - aspects: crate::FormatAspect, + aspects: crate::FormatAspects, } unsafe impl Send for TextureView {} diff --git a/wgpu-hal/src/util.rs b/wgpu-hal/src/util.rs index 0813b7a0f..0f76810cf 100644 --- a/wgpu-hal/src/util.rs +++ b/wgpu-hal/src/util.rs @@ -6,10 +6,10 @@ pub mod db { } } -pub fn map_naga_stage(stage: naga::ShaderStage) -> wgt::ShaderStage { +pub fn map_naga_stage(stage: naga::ShaderStage) -> wgt::ShaderStages { match stage { - naga::ShaderStage::Vertex => wgt::ShaderStage::VERTEX, - naga::ShaderStage::Fragment => wgt::ShaderStage::FRAGMENT, - naga::ShaderStage::Compute => wgt::ShaderStage::COMPUTE, + naga::ShaderStage::Vertex => wgt::ShaderStages::VERTEX, + naga::ShaderStage::Fragment => wgt::ShaderStages::FRAGMENT, + naga::ShaderStage::Compute => wgt::ShaderStages::COMPUTE, } } diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 604d482a6..5585d68ef 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -790,7 +790,7 @@ impl crate::Adapter for super::Adapter { let mut flags = spv::WriterFlags::empty(); flags.set( spv::WriterFlags::DEBUG, - self.instance.flags.contains(crate::InstanceFlag::DEBUG), + self.instance.flags.contains(crate::InstanceFlags::DEBUG), ); spv::Options { lang_version: (1, 0), @@ -866,8 +866,8 @@ impl crate::Adapter for super::Adapter { unsafe fn texture_format_capabilities( &self, format: wgt::TextureFormat, - ) -> crate::TextureFormatCapability { - use crate::TextureFormatCapability as Tfc; + ) -> crate::TextureFormatCapabilities { + use crate::TextureFormatCapabilities as Tfc; let vk_format = self.private_caps.map_texture_format(format); let properties = self .instance diff --git a/wgpu-hal/src/vulkan/command.rs b/wgpu-hal/src/vulkan/command.rs index 7b1cd2b09..468e5b560 100644 --- a/wgpu-hal/src/vulkan/command.rs +++ b/wgpu-hal/src/vulkan/command.rs @@ -368,7 +368,7 @@ impl crate::CommandEncoder for super::CommandEncoder { resolve: cat .resolve_target .as_ref() - .map(|target| target.make_attachment_key(crate::AttachmentOp::STORE, caps)), + .map(|target| target.make_attachment_key(crate::AttachmentOps::STORE, caps)), }); fb_key.attachments.push(cat.target.view.attachment.clone()); if let Some(ref at) = cat.resolve_target { @@ -469,7 +469,7 @@ impl crate::CommandEncoder for super::CommandEncoder { unsafe fn set_push_constants( &mut self, layout: &super::PipelineLayout, - stages: wgt::ShaderStage, + stages: wgt::ShaderStages, offset: u32, data: &[u32], ) { @@ -746,7 +746,7 @@ impl crate::CommandEncoder for super::CommandEncoder { #[test] fn check_dst_image_layout() { assert_eq!( - conv::derive_image_layout(crate::TextureUse::COPY_DST, crate::FormatAspect::empty()), + conv::derive_image_layout(crate::TextureUse::COPY_DST, crate::FormatAspects::empty()), DST_IMAGE_LAYOUT ); } diff --git a/wgpu-hal/src/vulkan/conv.rs b/wgpu-hal/src/vulkan/conv.rs index 899492ab5..527df726a 100644 --- a/wgpu-hal/src/vulkan/conv.rs +++ b/wgpu-hal/src/vulkan/conv.rs @@ -113,7 +113,7 @@ impl super::PrivateCapabilities { impl crate::Attachment<'_, super::Api> { pub(super) fn make_attachment_key( &self, - ops: crate::AttachmentOp, + ops: crate::AttachmentOps, caps: &super::PrivateCapabilities, ) -> super::AttachmentKey { let aspects = self.view.aspects(); @@ -155,10 +155,10 @@ impl crate::ColorAttachment<'_, super::Api> { pub fn derive_image_layout( usage: crate::TextureUse, - aspects: crate::FormatAspect, + aspects: crate::FormatAspects, ) -> vk::ImageLayout { //Note: depth textures are always sampled with RODS layout - let is_color = aspects.contains(crate::FormatAspect::COLOR); + let is_color = aspects.contains(crate::FormatAspects::COLOR); match usage { crate::TextureUse::UNINITIALIZED => vk::ImageLayout::UNDEFINED, crate::TextureUse::COPY_SRC => vk::ImageLayout::TRANSFER_SRC_OPTIMAL, @@ -336,15 +336,15 @@ pub fn map_vertex_format(vertex_format: wgt::VertexFormat) -> vk::Format { } } -pub fn map_aspects(aspects: crate::FormatAspect) -> vk::ImageAspectFlags { +pub fn map_aspects(aspects: crate::FormatAspects) -> vk::ImageAspectFlags { let mut flags = vk::ImageAspectFlags::empty(); - if aspects.contains(crate::FormatAspect::COLOR) { + if aspects.contains(crate::FormatAspects::COLOR) { flags |= vk::ImageAspectFlags::COLOR; } - if aspects.contains(crate::FormatAspect::DEPTH) { + if aspects.contains(crate::FormatAspects::DEPTH) { flags |= vk::ImageAspectFlags::DEPTH; } - if aspects.contains(crate::FormatAspect::STENCIL) { + if aspects.contains(crate::FormatAspects::STENCIL) { flags |= vk::ImageAspectFlags::STENCIL; } flags @@ -387,14 +387,14 @@ pub fn map_extent( } pub fn map_attachment_ops( - op: crate::AttachmentOp, + op: crate::AttachmentOps, ) -> (vk::AttachmentLoadOp, vk::AttachmentStoreOp) { - let load_op = if op.contains(crate::AttachmentOp::LOAD) { + let load_op = if op.contains(crate::AttachmentOps::LOAD) { vk::AttachmentLoadOp::LOAD } else { vk::AttachmentLoadOp::CLEAR }; - let store_op = if op.contains(crate::AttachmentOp::STORE) { + let store_op = if op.contains(crate::AttachmentOps::STORE) { vk::AttachmentStoreOp::STORE } else { vk::AttachmentStoreOp::DONT_CARE @@ -541,10 +541,10 @@ pub fn map_view_dimension(dim: wgt::TextureViewDimension) -> vk::ImageViewType { pub fn map_subresource_range( range: &wgt::ImageSubresourceRange, - texture_aspect: crate::FormatAspect, + texture_aspect: crate::FormatAspects, ) -> vk::ImageSubresourceRange { vk::ImageSubresourceRange { - aspect_mask: map_aspects(crate::FormatAspect::from(range.aspect) & texture_aspect), + aspect_mask: map_aspects(crate::FormatAspects::from(range.aspect) & texture_aspect), base_mip_level: range.base_mip_level, level_count: range .mip_level_count @@ -559,7 +559,7 @@ pub fn map_subresource_range( pub fn map_subresource_layers( base: &crate::TextureCopyBase, texture_dim: wgt::TextureDimension, - texture_aspect: crate::FormatAspect, + texture_aspect: crate::FormatAspects, layer_count: u32, ) -> (vk::ImageSubresourceLayers, vk::Offset3D) { let (base_array_layer, offset) = map_origin(base.origin, texture_dim); @@ -618,15 +618,15 @@ pub fn map_comparison(fun: wgt::CompareFunction) -> vk::CompareOp { } } -pub fn map_shader_stage(stage: wgt::ShaderStage) -> vk::ShaderStageFlags { +pub fn map_shader_stage(stage: wgt::ShaderStages) -> vk::ShaderStageFlags { let mut flags = vk::ShaderStageFlags::empty(); - if stage.contains(wgt::ShaderStage::VERTEX) { + if stage.contains(wgt::ShaderStages::VERTEX) { flags |= vk::ShaderStageFlags::VERTEX; } - if stage.contains(wgt::ShaderStage::FRAGMENT) { + if stage.contains(wgt::ShaderStages::FRAGMENT) { flags |= vk::ShaderStageFlags::FRAGMENT; } - if stage.contains(wgt::ShaderStage::COMPUTE) { + if stage.contains(wgt::ShaderStages::COMPUTE) { flags |= vk::ShaderStageFlags::COMPUTE; } flags diff --git a/wgpu-hal/src/vulkan/device.rs b/wgpu-hal/src/vulkan/device.rs index 22117dc52..572afdc6c 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -557,7 +557,7 @@ impl crate::Device for super::Device { .intersects(crate::BufferUse::MAP_READ | crate::BufferUse::MAP_WRITE) { let mut flags = gpu_alloc::UsageFlags::HOST_ACCESS; - //TODO: find a way to use `crate::MemoryFlag::PREFER_COHERENT` + //TODO: find a way to use `crate::MemoryFlags::PREFER_COHERENT` flags.set( gpu_alloc::UsageFlags::DOWNLOAD, desc.usage.contains(crate::BufferUse::MAP_READ), @@ -572,7 +572,7 @@ impl crate::Device for super::Device { }; alloc_usage.set( gpu_alloc::UsageFlags::TRANSIENT, - desc.memory_flags.contains(crate::MemoryFlag::TRANSIENT), + desc.memory_flags.contains(crate::MemoryFlags::TRANSIENT), ); let block = self.mem_allocator.lock().alloc( @@ -696,7 +696,7 @@ impl crate::Device for super::Device { block: Some(block), usage: desc.usage, dim: desc.dimension, - aspects: crate::FormatAspect::from(desc.format), + aspects: crate::FormatAspects::from(desc.format), format_info: desc.format.describe(), raw_flags, }) @@ -1198,7 +1198,7 @@ impl crate::Device for super::Device { }; compatible_rp_key.depth_stencil = Some(super::DepthStencilAttachmentKey { base: super::AttachmentKey::compatible(vk_format, vk_layout), - stencil_ops: crate::AttachmentOp::all(), + stencil_ops: crate::AttachmentOps::all(), }); if ds.is_depth_enabled() { diff --git a/wgpu-hal/src/vulkan/instance.rs b/wgpu-hal/src/vulkan/instance.rs index 1f046ec02..2e7c38a84 100644 --- a/wgpu-hal/src/vulkan/instance.rs +++ b/wgpu-hal/src/vulkan/instance.rs @@ -376,7 +376,7 @@ impl crate::Instance for super::Instance { extensions.push(ext::MetalSurface::name()); } - if desc.flags.contains(crate::InstanceFlag::DEBUG) { + if desc.flags.contains(crate::InstanceFlags::DEBUG) { extensions.push(ext::DebugUtils::name()); } @@ -412,7 +412,7 @@ impl crate::Instance for super::Instance { // Check requested layers against the available layers let layers = { let mut layers: Vec<&'static CStr> = Vec::new(); - if desc.flags.contains(crate::InstanceFlag::VALIDATION) { + if desc.flags.contains(crate::InstanceFlags::VALIDATION) { layers.push(CStr::from_bytes_with_nul(b"VK_LAYER_KHRONOS_validation\0").unwrap()); } @@ -648,7 +648,7 @@ impl crate::Surface for super::Surface { block: None, usage: sc.config.usage, dim: wgt::TextureDimension::D2, - aspects: crate::FormatAspect::COLOR, + aspects: crate::FormatAspects::COLOR, format_info: sc.config.format.describe(), raw_flags: vk::ImageCreateFlags::empty(), }, diff --git a/wgpu-hal/src/vulkan/mod.rs b/wgpu-hal/src/vulkan/mod.rs index 2a87e4a74..387ad9ebf 100644 --- a/wgpu-hal/src/vulkan/mod.rs +++ b/wgpu-hal/src/vulkan/mod.rs @@ -75,7 +75,7 @@ struct DebugUtils { struct InstanceShared { raw: ash::Instance, - flags: crate::InstanceFlag, + flags: crate::InstanceFlags, debug_utils: Option, get_physical_device_properties: Option, } @@ -158,7 +158,7 @@ struct AttachmentKey { layout_pre: vk::ImageLayout, layout_in: vk::ImageLayout, layout_post: vk::ImageLayout, - ops: crate::AttachmentOp, + ops: crate::AttachmentOps, } impl AttachmentKey { @@ -169,7 +169,7 @@ impl AttachmentKey { layout_pre: vk::ImageLayout::GENERAL, layout_in, layout_post: vk::ImageLayout::GENERAL, - ops: crate::AttachmentOp::all(), + ops: crate::AttachmentOps::all(), } } } @@ -183,7 +183,7 @@ struct ColorAttachmentKey { #[derive(Clone, Eq, Hash, PartialEq)] struct DepthStencilAttachmentKey { base: AttachmentKey, - stencil_ops: crate::AttachmentOp, + stencil_ops: crate::AttachmentOps, } #[derive(Clone, Eq, Default, Hash, PartialEq)] @@ -249,7 +249,7 @@ pub struct Texture { block: Option>, usage: crate::TextureUse, dim: wgt::TextureDimension, - aspects: crate::FormatAspect, + aspects: crate::FormatAspects, format_info: wgt::TextureFormatInfo, raw_flags: vk::ImageCreateFlags, } @@ -261,7 +261,7 @@ pub struct TextureView { } impl TextureView { - fn aspects(&self) -> crate::FormatAspect { + fn aspects(&self) -> crate::FormatAspects { self.attachment.view_format.into() } } diff --git a/wgpu-info/src/main.rs b/wgpu-info/src/main.rs index c1cdd4221..9727a4b27 100644 --- a/wgpu-info/src/main.rs +++ b/wgpu-info/src/main.rs @@ -87,10 +87,8 @@ fn print_info_from_adapter(adapter: &wgpu::Adapter, idx: usize) { fn main() { let args: Vec<_> = std::env::args().skip(1).collect(); - let instance = wgpu::Instance::new(wgpu::BackendBit::all()); - let adapters: Vec<_> = instance - .enumerate_adapters(wgpu::BackendBit::all()) - .collect(); + let instance = wgpu::Instance::new(wgpu::Backends::all()); + let adapters: Vec<_> = instance.enumerate_adapters(wgpu::Backends::all()).collect(); let adapter_count = adapters.len(); if args.is_empty() { diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 2a285277b..c77bb01e3 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -92,7 +92,7 @@ bitflags::bitflags! { #[repr(transparent)] #[cfg_attr(feature = "trace", derive(Serialize))] #[cfg_attr(feature = "replay", derive(Deserialize))] - pub struct BackendBit: u32 { + pub struct Backends: u32 { /// Supported on Windows, Linux/Android, and macOS/iOS via Vulkan Portability (with the Vulkan feature enabled) const VULKAN = 1 << Backend::Vulkan as u32; /// Currently unsupported @@ -120,7 +120,7 @@ bitflags::bitflags! { } } -impl From for BackendBit { +impl From for Backends { fn from(backend: Backend) -> Self { Self::from_bits(1 << backend as u32).unwrap() } @@ -741,10 +741,10 @@ bitflags::bitflags! { /// /// These can be combined so something that is visible from both vertex and fragment shaders can be defined as: /// - /// `ShaderStage::VERTEX | ShaderStage::FRAGMENT` + /// `ShaderStages::VERTEX | ShaderStages::FRAGMENT` #[repr(transparent)] #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] - pub struct ShaderStage: u32 { + pub struct ShaderStages: u32 { /// Binding is not visible from any shader stage. const NONE = 0; /// Binding is visible from the vertex shader of a render pipeline. @@ -2627,7 +2627,7 @@ impl Default for FilterMode { pub struct PushConstantRange { /// Stage push constant range is visible from. Each stage can only be served by at most one range. /// One range can serve multiple stages however. - pub stages: ShaderStage, + pub stages: ShaderStages, /// Range in push constant memory to use for the stage. Must be less than [`Limits::max_push_constant_size`]. /// Start and end must be aligned to the 4s. pub range: Range, @@ -2928,7 +2928,7 @@ pub struct BindGroupLayoutEntry { /// of index 1, would be described as `layout(set = 0, binding = 1) uniform` in shaders. pub binding: u32, /// Which shader stages can see this binding. - pub visibility: ShaderStage, + pub visibility: ShaderStages, /// The type of the binding pub ty: BindingType, /// If this value is Some, indicates this entry is an array. Array size must be 1 or greater. diff --git a/wgpu/examples/boids/main.rs b/wgpu/examples/boids/main.rs index e2d39644d..e9f0ca83d 100644 --- a/wgpu/examples/boids/main.rs +++ b/wgpu/examples/boids/main.rs @@ -72,7 +72,7 @@ impl framework::Example for Example { entries: &[ wgpu::BindGroupLayoutEntry { binding: 0, - visibility: wgpu::ShaderStage::COMPUTE, + visibility: wgpu::ShaderStages::COMPUTE, ty: wgpu::BindingType::Buffer { ty: wgpu::BufferBindingType::Uniform, has_dynamic_offset: false, @@ -84,7 +84,7 @@ impl framework::Example for Example { }, wgpu::BindGroupLayoutEntry { binding: 1, - visibility: wgpu::ShaderStage::COMPUTE, + visibility: wgpu::ShaderStages::COMPUTE, ty: wgpu::BindingType::Buffer { ty: wgpu::BufferBindingType::Storage { read_only: true }, has_dynamic_offset: false, @@ -94,7 +94,7 @@ impl framework::Example for Example { }, wgpu::BindGroupLayoutEntry { binding: 2, - visibility: wgpu::ShaderStage::COMPUTE, + visibility: wgpu::ShaderStages::COMPUTE, ty: wgpu::BindingType::Buffer { ty: wgpu::BufferBindingType::Storage { read_only: false }, has_dynamic_offset: false, diff --git a/wgpu/examples/bunnymark/main.rs b/wgpu/examples/bunnymark/main.rs index a4a4899c9..df5db1133 100644 --- a/wgpu/examples/bunnymark/main.rs +++ b/wgpu/examples/bunnymark/main.rs @@ -56,7 +56,7 @@ impl framework::Example for Example { entries: &[ wgpu::BindGroupLayoutEntry { binding: 0, - visibility: wgpu::ShaderStage::VERTEX, + visibility: wgpu::ShaderStages::VERTEX, ty: wgpu::BindingType::Buffer { ty: wgpu::BufferBindingType::Uniform, has_dynamic_offset: false, @@ -66,7 +66,7 @@ impl framework::Example for Example { }, wgpu::BindGroupLayoutEntry { binding: 1, - visibility: wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Texture { sample_type: wgpu::TextureSampleType::Float { filterable: true }, view_dimension: wgpu::TextureViewDimension::D2, @@ -76,7 +76,7 @@ impl framework::Example for Example { }, wgpu::BindGroupLayoutEntry { binding: 2, - visibility: wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Sampler { filtering: true, comparison: false, @@ -90,7 +90,7 @@ impl framework::Example for Example { device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { entries: &[wgpu::BindGroupLayoutEntry { binding: 0, - visibility: wgpu::ShaderStage::VERTEX, + visibility: wgpu::ShaderStages::VERTEX, ty: wgpu::BindingType::Buffer { ty: wgpu::BufferBindingType::Uniform, has_dynamic_offset: true, diff --git a/wgpu/examples/capture/main.rs b/wgpu/examples/capture/main.rs index 9682a9ac1..9dc5bd353 100644 --- a/wgpu/examples/capture/main.rs +++ b/wgpu/examples/capture/main.rs @@ -28,7 +28,7 @@ async fn create_red_image_with_dimensions( width: usize, height: usize, ) -> (Device, Buffer, BufferDimensions) { - let adapter = wgpu::Instance::new(wgpu::BackendBit::PRIMARY) + let adapter = wgpu::Instance::new(wgpu::Backends::PRIMARY) .request_adapter(&wgpu::RequestAdapterOptions::default()) .await .unwrap(); diff --git a/wgpu/examples/conservative-raster/main.rs b/wgpu/examples/conservative-raster/main.rs index 718e10dc2..4fa8afcdf 100644 --- a/wgpu/examples/conservative-raster/main.rs +++ b/wgpu/examples/conservative-raster/main.rs @@ -171,7 +171,7 @@ impl framework::Example for Example { entries: &[ wgpu::BindGroupLayoutEntry { binding: 0, - visibility: wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Texture { sample_type: wgpu::TextureSampleType::Float { filterable: false }, view_dimension: wgpu::TextureViewDimension::D2, @@ -181,7 +181,7 @@ impl framework::Example for Example { }, wgpu::BindGroupLayoutEntry { binding: 1, - visibility: wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Sampler { filtering: false, comparison: false, diff --git a/wgpu/examples/cube/main.rs b/wgpu/examples/cube/main.rs index f0a41e1d4..c1ed0bb5f 100644 --- a/wgpu/examples/cube/main.rs +++ b/wgpu/examples/cube/main.rs @@ -139,7 +139,7 @@ impl framework::Example for Example { entries: &[ wgpu::BindGroupLayoutEntry { binding: 0, - visibility: wgpu::ShaderStage::VERTEX, + visibility: wgpu::ShaderStages::VERTEX, ty: wgpu::BindingType::Buffer { ty: wgpu::BufferBindingType::Uniform, has_dynamic_offset: false, @@ -149,7 +149,7 @@ impl framework::Example for Example { }, wgpu::BindGroupLayoutEntry { binding: 1, - visibility: wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Texture { multisampled: false, sample_type: wgpu::TextureSampleType::Uint, diff --git a/wgpu/examples/framework.rs b/wgpu/examples/framework.rs index f74aa48a9..3a31e780d 100644 --- a/wgpu/examples/framework.rs +++ b/wgpu/examples/framework.rs @@ -110,7 +110,7 @@ async fn setup(title: &str) -> Setup { log::info!("Initializing the surface..."); - let backend = wgpu::util::backend_bits_from_env().unwrap_or(wgpu::BackendBit::PRIMARY); + let backend = wgpu::util::backend_bits_from_env().unwrap_or(wgpu::Backends::PRIMARY); let instance = wgpu::Instance::new(backend); let (size, surface) = unsafe { diff --git a/wgpu/examples/hello-compute/main.rs b/wgpu/examples/hello-compute/main.rs index 086509a13..85b0b162f 100644 --- a/wgpu/examples/hello-compute/main.rs +++ b/wgpu/examples/hello-compute/main.rs @@ -33,7 +33,7 @@ async fn run() { async fn execute_gpu(numbers: &[u32]) -> Option> { // Instantiates instance of WebGPU - let instance = wgpu::Instance::new(wgpu::BackendBit::PRIMARY); + let instance = wgpu::Instance::new(wgpu::Backends::PRIMARY); // `request_adapter` instantiates the general connection to the GPU let adapter = instance diff --git a/wgpu/examples/hello-triangle/main.rs b/wgpu/examples/hello-triangle/main.rs index 4d27af83f..3979e90a9 100644 --- a/wgpu/examples/hello-triangle/main.rs +++ b/wgpu/examples/hello-triangle/main.rs @@ -7,7 +7,7 @@ use winit::{ async fn run(event_loop: EventLoop<()>, window: Window) { let size = window.inner_size(); - let instance = wgpu::Instance::new(wgpu::BackendBit::all()); + let instance = wgpu::Instance::new(wgpu::Backends::all()); let surface = unsafe { instance.create_surface(&window) }; let adapter = instance .request_adapter(&wgpu::RequestAdapterOptions { diff --git a/wgpu/examples/hello-windows/main.rs b/wgpu/examples/hello-windows/main.rs index 3e55d6539..5f5f363f2 100644 --- a/wgpu/examples/hello-windows/main.rs +++ b/wgpu/examples/hello-windows/main.rs @@ -65,7 +65,7 @@ impl Viewport { } async fn run(event_loop: EventLoop<()>, viewports: Vec<(Window, wgpu::Color)>) { - let instance = wgpu::Instance::new(wgpu::BackendBit::PRIMARY); + let instance = wgpu::Instance::new(wgpu::Backends::PRIMARY); let viewports: Vec<_> = viewports .into_iter() .map(|(window, color)| ViewportDesc::new(window, color, &instance)) diff --git a/wgpu/examples/hello/main.rs b/wgpu/examples/hello/main.rs index 8ee08329e..a4c5d3f87 100644 --- a/wgpu/examples/hello/main.rs +++ b/wgpu/examples/hello/main.rs @@ -1,7 +1,7 @@ /// This example shows how to describe the adapter in use. async fn run() { #[cfg_attr(target_arch = "wasm32", allow(unused_variables))] - let adapter = wgpu::Instance::new(wgpu::BackendBit::PRIMARY) + let adapter = wgpu::Instance::new(wgpu::Backends::PRIMARY) .request_adapter(&wgpu::RequestAdapterOptions::default()) .await .unwrap(); diff --git a/wgpu/examples/mipmap/main.rs b/wgpu/examples/mipmap/main.rs index 1f1501be6..a5479ed4b 100644 --- a/wgpu/examples/mipmap/main.rs +++ b/wgpu/examples/mipmap/main.rs @@ -483,7 +483,7 @@ fn mipmap() { height: 768, optional_features: wgpu::Features::default(), base_test_parameters: framework::test_common::TestParameters::default() - .backend_failures(wgpu::BackendBit::VULKAN), + .backend_failures(wgpu::Backends::VULKAN), tollerance: 25, max_outliers: 3000, // Mipmap sampling is highly variant between impls. This is currently bounded by AMD on mac }); diff --git a/wgpu/examples/shadow/main.rs b/wgpu/examples/shadow/main.rs index 2db478ebc..30c0c8c34 100644 --- a/wgpu/examples/shadow/main.rs +++ b/wgpu/examples/shadow/main.rs @@ -335,7 +335,7 @@ impl framework::Example for Example { device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { entries: &[wgpu::BindGroupLayoutEntry { binding: 0, - visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Buffer { ty: wgpu::BufferBindingType::Uniform, has_dynamic_offset: true, @@ -453,7 +453,7 @@ impl framework::Example for Example { label: None, entries: &[wgpu::BindGroupLayoutEntry { binding: 0, // global - visibility: wgpu::ShaderStage::VERTEX, + visibility: wgpu::ShaderStages::VERTEX, ty: wgpu::BindingType::Buffer { ty: wgpu::BufferBindingType::Uniform, has_dynamic_offset: false, @@ -530,7 +530,7 @@ impl framework::Example for Example { entries: &[ wgpu::BindGroupLayoutEntry { binding: 0, // global - visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Buffer { ty: wgpu::BufferBindingType::Uniform, has_dynamic_offset: false, @@ -542,7 +542,7 @@ impl framework::Example for Example { }, wgpu::BindGroupLayoutEntry { binding: 1, // lights - visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Buffer { ty: wgpu::BufferBindingType::Storage { read_only: true }, has_dynamic_offset: false, @@ -552,7 +552,7 @@ impl framework::Example for Example { }, wgpu::BindGroupLayoutEntry { binding: 2, - visibility: wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Texture { multisampled: false, sample_type: wgpu::TextureSampleType::Depth, @@ -562,7 +562,7 @@ impl framework::Example for Example { }, wgpu::BindGroupLayoutEntry { binding: 3, - visibility: wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Sampler { comparison: true, filtering: true, diff --git a/wgpu/examples/skybox/main.rs b/wgpu/examples/skybox/main.rs index b036887c5..069d91452 100644 --- a/wgpu/examples/skybox/main.rs +++ b/wgpu/examples/skybox/main.rs @@ -145,7 +145,7 @@ impl framework::Example for Skybox { entries: &[ wgpu::BindGroupLayoutEntry { binding: 0, - visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Buffer { ty: wgpu::BufferBindingType::Uniform, has_dynamic_offset: false, @@ -155,7 +155,7 @@ impl framework::Example for Skybox { }, wgpu::BindGroupLayoutEntry { binding: 1, - visibility: wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Texture { sample_type: wgpu::TextureSampleType::Float { filterable: true }, multisampled: false, @@ -165,7 +165,7 @@ impl framework::Example for Skybox { }, wgpu::BindGroupLayoutEntry { binding: 2, - visibility: wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Sampler { comparison: false, filtering: true, @@ -472,7 +472,7 @@ fn skybox() { height: 768, optional_features: wgpu::Features::default(), base_test_parameters: framework::test_common::TestParameters::default() - .backend_failures(wgpu::BackendBit::VULKAN), + .backend_failures(wgpu::Backends::VULKAN), tollerance: 2, max_outliers: 3, }); diff --git a/wgpu/examples/texture-arrays/main.rs b/wgpu/examples/texture-arrays/main.rs index 41cbaf7fe..fa5f99434 100644 --- a/wgpu/examples/texture-arrays/main.rs +++ b/wgpu/examples/texture-arrays/main.rs @@ -174,7 +174,7 @@ impl framework::Example for Example { entries: &[ wgpu::BindGroupLayoutEntry { binding: 0, - visibility: wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Texture { sample_type: wgpu::TextureSampleType::Float { filterable: true }, view_dimension: wgpu::TextureViewDimension::D2, @@ -184,7 +184,7 @@ impl framework::Example for Example { }, wgpu::BindGroupLayoutEntry { binding: 1, - visibility: wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Sampler { comparison: false, filtering: true, @@ -217,7 +217,7 @@ impl framework::Example for Example { bind_group_layouts: &[&bind_group_layout], push_constant_ranges: if uniform_workaround { &[wgpu::PushConstantRange { - stages: wgpu::ShaderStage::FRAGMENT, + stages: wgpu::ShaderStages::FRAGMENT, range: 0..4, }] } else { @@ -301,9 +301,9 @@ impl framework::Example for Example { rpass.set_vertex_buffer(0, self.vertex_buffer.slice(..)); rpass.set_index_buffer(self.index_buffer.slice(..), self.index_format); if self.uniform_workaround { - rpass.set_push_constants(wgpu::ShaderStage::FRAGMENT, 0, bytemuck::cast_slice(&[0])); + rpass.set_push_constants(wgpu::ShaderStages::FRAGMENT, 0, bytemuck::cast_slice(&[0])); rpass.draw_indexed(0..6, 0, 0..1); - rpass.set_push_constants(wgpu::ShaderStage::FRAGMENT, 0, bytemuck::cast_slice(&[1])); + rpass.set_push_constants(wgpu::ShaderStages::FRAGMENT, 0, bytemuck::cast_slice(&[1])); rpass.draw_indexed(6..12, 0, 0..1); } else { rpass.draw_indexed(0..12, 0, 0..1); diff --git a/wgpu/examples/water/main.rs b/wgpu/examples/water/main.rs index 6a375ce6c..d306831c7 100644 --- a/wgpu/examples/water/main.rs +++ b/wgpu/examples/water/main.rs @@ -355,7 +355,7 @@ impl framework::Example for Example { // Uniform variables such as projection/view. wgpu::BindGroupLayoutEntry { binding: 0, - visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Buffer { ty: wgpu::BufferBindingType::Uniform, has_dynamic_offset: false, @@ -368,7 +368,7 @@ impl framework::Example for Example { // Reflection texture. wgpu::BindGroupLayoutEntry { binding: 1, - visibility: wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Texture { multisampled: false, sample_type: wgpu::TextureSampleType::Float { filterable: true }, @@ -379,7 +379,7 @@ impl framework::Example for Example { // Depth texture for terrain. wgpu::BindGroupLayoutEntry { binding: 2, - visibility: wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Texture { multisampled: false, sample_type: wgpu::TextureSampleType::Float { filterable: true }, @@ -390,7 +390,7 @@ impl framework::Example for Example { // Sampler to be able to sample the textures. wgpu::BindGroupLayoutEntry { binding: 3, - visibility: wgpu::ShaderStage::FRAGMENT, + visibility: wgpu::ShaderStages::FRAGMENT, ty: wgpu::BindingType::Sampler { comparison: false, filtering: true, @@ -407,7 +407,7 @@ impl framework::Example for Example { // Regular uniform variables like view/projection. wgpu::BindGroupLayoutEntry { binding: 0, - visibility: wgpu::ShaderStage::VERTEX, + visibility: wgpu::ShaderStages::VERTEX, ty: wgpu::BindingType::Buffer { ty: wgpu::BufferBindingType::Uniform, has_dynamic_offset: false, diff --git a/wgpu/src/backend/direct.rs b/wgpu/src/backend/direct.rs index c5fc38159..58a9b3f2a 100644 --- a/wgpu/src/backend/direct.rs +++ b/wgpu/src/backend/direct.rs @@ -43,7 +43,7 @@ impl Context { &self.0 } - pub fn enumerate_adapters(&self, backends: wgt::BackendBit) -> Vec { + pub fn enumerate_adapters(&self, backends: wgt::Backends) -> Vec { self.0 .enumerate_adapters(wgc::instance::AdapterInputs::Mask(backends, |_| { PhantomData @@ -235,7 +235,7 @@ mod pass_impl { ) { wgpu_render_pass_set_vertex_buffer(self, slot, buffer.id, offset, size) } - fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u8]) { + fn set_push_constants(&mut self, stages: wgt::ShaderStages, offset: u32, data: &[u8]) { unsafe { wgpu_render_pass_set_push_constants( self, @@ -446,7 +446,7 @@ mod pass_impl { wgpu_render_bundle_set_vertex_buffer(self, slot, buffer.id, offset, size) } - fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u8]) { + fn set_push_constants(&mut self, stages: wgt::ShaderStages, offset: u32, data: &[u8]) { unsafe { wgpu_render_bundle_set_push_constants( self, @@ -642,7 +642,7 @@ impl crate::Context for Context { Ready>; type MapAsyncFuture = native_gpu_future::GpuFuture>; - fn init(backends: wgt::BackendBit) -> Self { + fn init(backends: wgt::Backends) -> Self { Self(wgc::hub::Global::new( "wgpu", wgc::hub::IdentityManagerFactory, @@ -666,7 +666,7 @@ impl crate::Context for Context { power_preference: options.power_preference, compatible_surface: options.compatible_surface.map(|surface| surface.id), }, - wgc::instance::AdapterInputs::Mask(wgt::BackendBit::all(), |_| PhantomData), + wgc::instance::AdapterInputs::Mask(wgt::Backends::all(), |_| PhantomData), ); ready(id.ok()) } @@ -1127,7 +1127,7 @@ impl crate::Context for Context { if let wgc::pipeline::CreateComputePipelineError::Internal(ref error) = cause { log::warn!( "Shader translation error for stage {:?}: {}", - wgt::ShaderStage::COMPUTE, + wgt::ShaderStages::COMPUTE, error ); log::warn!("Please report it to https://github.com/gfx-rs/naga"); diff --git a/wgpu/src/backend/web.rs b/wgpu/src/backend/web.rs index 50b89bc7e..59d939436 100644 --- a/wgpu/src/backend/web.rs +++ b/wgpu/src/backend/web.rs @@ -186,7 +186,7 @@ impl crate::RenderInner for RenderPass { self.0 .set_vertex_buffer_with_f64_and_f64(slot, &buffer.0, offset as f64, mapped_size); } - fn set_push_constants(&mut self, _stages: wgt::ShaderStage, _offset: u32, _data: &[u8]) { + fn set_push_constants(&mut self, _stages: wgt::ShaderStages, _offset: u32, _data: &[u8]) { panic!("PUSH_CONSTANTS feature must be enabled to call multi_draw_indexed_indirect") } fn draw(&mut self, vertices: Range, instances: Range) { @@ -315,7 +315,7 @@ impl crate::RenderInner for RenderBundleEncoder { self.0 .set_vertex_buffer_with_f64_and_f64(slot, &buffer.0, offset as f64, mapped_size); } - fn set_push_constants(&mut self, _stages: wgt::ShaderStage, _offset: u32, _data: &[u8]) { + fn set_push_constants(&mut self, _stages: wgt::ShaderStages, _offset: u32, _data: &[u8]) { panic!("PUSH_CONSTANTS feature must be enabled to call multi_draw_indexed_indirect") } fn draw(&mut self, vertices: Range, instances: Range) { @@ -924,7 +924,7 @@ impl crate::Context for Context { fn(JsFutureResult) -> Result<(), crate::BufferAsyncError>, >; - fn init(_backends: wgt::BackendBit) -> Self { + fn init(_backends: wgt::Backends) -> Self { Context(web_sys::window().unwrap().navigator().gpu()) } @@ -960,7 +960,7 @@ impl crate::Context for Context { //TODO: support this check, return `None` if the flag is not set. // It's not trivial, since we need the Future logic to have this check, // and currently the Future here has no room for extra parameter `backends`. - //assert!(backends.contains(wgt::BackendBit::BROWSER_WEBGPU)); + //assert!(backends.contains(wgt::Backends::BROWSER_WEBGPU)); let mut mapped_options = web_sys::GpuRequestAdapterOptions::new(); let mapped_power_preference = match options.power_preference { wgt::PowerPreference::LowPower => web_sys::GpuPowerPreference::LowPower, diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 542904132..56431b805 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -25,20 +25,20 @@ use std::{ use parking_lot::Mutex; pub use wgt::{ - AdapterInfo, AddressMode, Backend, BackendBit, BindGroupLayoutEntry, BindingType, - BlendComponent, BlendFactor, BlendOperation, BlendState, BufferAddress, BufferBindingType, - BufferSize, BufferUsage, Color, ColorTargetState, ColorWrite, CommandBufferDescriptor, - CompareFunction, DepthBiasState, DepthStencilState, DeviceType, DownlevelCapabilities, - DownlevelFlags, DynamicOffset, Extent3d, Face, Features, FilterMode, FrontFace, - ImageDataLayout, IndexFormat, InputStepMode, Limits, MultisampleState, Origin3d, - PipelineStatisticsTypes, PolygonMode, PowerPreference, PresentMode, PrimitiveState, - PrimitiveTopology, PushConstantRange, QueryType, SamplerBorderColor, ShaderLocation, - ShaderModel, ShaderStage, StencilFaceState, StencilOperation, StencilState, - StorageTextureAccess, SwapChainDescriptor, SwapChainStatus, TextureAspect, TextureDimension, - TextureFormat, TextureFormatFeatureFlags, TextureFormatFeatures, TextureSampleType, - TextureUsage, TextureViewDimension, VertexAttribute, VertexFormat, BIND_BUFFER_ALIGNMENT, - COPY_BUFFER_ALIGNMENT, COPY_BYTES_PER_ROW_ALIGNMENT, MAP_ALIGNMENT, PUSH_CONSTANT_ALIGNMENT, - QUERY_SET_MAX_QUERIES, QUERY_SIZE, VERTEX_STRIDE_ALIGNMENT, + AdapterInfo, AddressMode, Backend, Backends, BindGroupLayoutEntry, BindingType, BlendComponent, + BlendFactor, BlendOperation, BlendState, BufferAddress, BufferBindingType, BufferSize, + BufferUsage, Color, ColorTargetState, ColorWrite, CommandBufferDescriptor, CompareFunction, + DepthBiasState, DepthStencilState, DeviceType, DownlevelCapabilities, DownlevelFlags, + DynamicOffset, Extent3d, Face, Features, FilterMode, FrontFace, ImageDataLayout, IndexFormat, + InputStepMode, Limits, MultisampleState, Origin3d, PipelineStatisticsTypes, PolygonMode, + PowerPreference, PresentMode, PrimitiveState, PrimitiveTopology, PushConstantRange, QueryType, + SamplerBorderColor, ShaderLocation, ShaderModel, ShaderStages, StencilFaceState, + StencilOperation, StencilState, StorageTextureAccess, SwapChainDescriptor, SwapChainStatus, + TextureAspect, TextureDimension, TextureFormat, TextureFormatFeatureFlags, + TextureFormatFeatures, TextureSampleType, TextureUsage, TextureViewDimension, VertexAttribute, + VertexFormat, BIND_BUFFER_ALIGNMENT, COPY_BUFFER_ALIGNMENT, COPY_BYTES_PER_ROW_ALIGNMENT, + MAP_ALIGNMENT, PUSH_CONSTANT_ALIGNMENT, QUERY_SET_MAX_QUERIES, QUERY_SIZE, + VERTEX_STRIDE_ALIGNMENT, }; use backend::{BufferMappedRange, Context as C}; @@ -88,7 +88,7 @@ trait RenderInner { offset: BufferAddress, size: Option, ); - fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u8]); + fn set_push_constants(&mut self, stages: wgt::ShaderStages, offset: u32, data: &[u8]); fn draw(&mut self, vertices: Range, instances: Range); fn draw_indexed(&mut self, indices: Range, base_vertex: i32, instances: Range); fn draw_indirect(&mut self, indirect_buffer: &Ctx::BufferId, indirect_offset: BufferAddress); @@ -183,7 +183,7 @@ trait Context: Debug + Send + Sized + Sync { + Send; type MapAsyncFuture: Future> + Send; - fn init(backends: BackendBit) -> Self; + fn init(backends: Backends) -> Self; fn instance_create_surface( &self, handle: &impl raw_window_handle::HasRawWindowHandle, @@ -1380,21 +1380,21 @@ impl Instance { /// /// # Arguments /// - /// - `backends` - Controls from which [backends][BackendBit] wgpu will choose + /// - `backends` - Controls from which [backends][Backends] wgpu will choose /// during instantiation. - pub fn new(backends: BackendBit) -> Self { + pub fn new(backends: Backends) -> Self { Instance { context: Arc::new(C::init(backends)), } } - /// Retrieves all available [`Adapter`]s that match the given [`BackendBit`]. + /// Retrieves all available [`Adapter`]s that match the given [`Backends`]. /// /// # Arguments /// /// - `backends` - Backends from which to enumerate adapters. #[cfg(not(target_arch = "wasm32"))] - pub fn enumerate_adapters(&self, backends: BackendBit) -> impl Iterator { + pub fn enumerate_adapters(&self, backends: Backends) -> impl Iterator { let context = Arc::clone(&self.context); self.context .enumerate_adapters(backends) @@ -2635,7 +2635,7 @@ impl<'a> RenderPass<'a> { /// /// You would need to upload this in three set_push_constants calls. First for the `Vertex` only range 0..4, second /// for the `Vertex | Fragment` range 4..8, third for the `Fragment` range 8..12. - pub fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u8]) { + pub fn set_push_constants(&mut self, stages: wgt::ShaderStages, offset: u32, data: &[u8]) { self.id.set_push_constants(stages, offset, data); } } @@ -2942,7 +2942,7 @@ impl<'a> RenderBundleEncoder<'a> { /// /// You would need to upload this in three set_push_constants calls. First for the `Vertex` only range 0..4, second /// for the `Vertex | Fragment` range 4..8, third for the `Fragment` range 8..12. - pub fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u8]) { + pub fn set_push_constants(&mut self, stages: wgt::ShaderStages, offset: u32, data: &[u8]) { self.id.set_push_constants(stages, offset, data); } } diff --git a/wgpu/src/util/encoder.rs b/wgpu/src/util/encoder.rs index bc79260fa..0af884023 100644 --- a/wgpu/src/util/encoder.rs +++ b/wgpu/src/util/encoder.rs @@ -117,7 +117,7 @@ pub trait RenderEncoder<'a> { /// /// You would need to upload this in three set_push_constants calls. First for the `Vertex` only range 0..4, second /// for the `Vertex | Fragment` range 4..8, third for the `Fragment` range 8..12. - fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u8]); + fn set_push_constants(&mut self, stages: wgt::ShaderStages, offset: u32, data: &[u8]); } impl<'a> RenderEncoder<'a> for RenderPass<'a> { @@ -166,7 +166,7 @@ impl<'a> RenderEncoder<'a> for RenderPass<'a> { } #[inline(always)] - fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u8]) { + fn set_push_constants(&mut self, stages: wgt::ShaderStages, offset: u32, data: &[u8]) { Self::set_push_constants(self, stages, offset, data); } } @@ -217,7 +217,7 @@ impl<'a> RenderEncoder<'a> for RenderBundleEncoder<'a> { } #[inline(always)] - fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u8]) { + fn set_push_constants(&mut self, stages: wgt::ShaderStages, offset: u32, data: &[u8]) { Self::set_push_constants(self, stages, offset, data); } } diff --git a/wgpu/src/util/init.rs b/wgpu/src/util/init.rs index 8afaa2445..abe61ae7b 100644 --- a/wgpu/src/util/init.rs +++ b/wgpu/src/util/init.rs @@ -1,21 +1,21 @@ -use wgt::{BackendBit, PowerPreference, RequestAdapterOptions}; +use wgt::{Backends, PowerPreference, RequestAdapterOptions}; use crate::{Adapter, Instance}; /// Get a set of backend bits from the environment variable WGPU_BACKEND. -pub fn backend_bits_from_env() -> Option { +pub fn backend_bits_from_env() -> Option { Some( match std::env::var("WGPU_BACKEND") .as_deref() .map(str::to_lowercase) .as_deref() { - Ok("vulkan") => BackendBit::VULKAN, - Ok("dx12") => BackendBit::DX12, - Ok("dx11") => BackendBit::DX11, - Ok("metal") => BackendBit::METAL, - Ok("gl") => BackendBit::GL, - Ok("webgpu") => BackendBit::BROWSER_WEBGPU, + Ok("vulkan") => Backends::VULKAN, + Ok("dx12") => Backends::DX12, + Ok("dx11") => Backends::DX11, + Ok("metal") => Backends::METAL, + Ok("gl") => Backends::GL, + Ok("webgpu") => Backends::BROWSER_WEBGPU, _ => return None, }, ) @@ -38,10 +38,7 @@ pub fn power_preference_from_env() -> Option { /// Initialize the adapter obeying the WGPU_ADAPTER_NAME environment variable. #[cfg(not(target_arch = "wasm32"))] -pub fn initialize_adapter_from_env( - instance: &Instance, - backend_bits: BackendBit, -) -> Option { +pub fn initialize_adapter_from_env(instance: &Instance, backend_bits: Backends) -> Option { let desired_adapter_name = std::env::var("WGPU_ADAPTER_NAME") .as_deref() .map(str::to_lowercase) @@ -66,7 +63,7 @@ pub fn initialize_adapter_from_env( #[cfg(target_arch = "wasm32")] pub fn initialize_adapter_from_env( _instance: &Instance, - _backend_bits: BackendBit, + _backend_bits: Backends, ) -> Option { None } @@ -74,7 +71,7 @@ pub fn initialize_adapter_from_env( /// Initialize the adapter obeying the WGPU_ADAPTER_NAME environment variable and if it doesn't exist fall back on a default adapter. pub async fn initialize_adapter_from_env_or_default( instance: &Instance, - backend_bits: wgt::BackendBit, + backend_bits: wgt::Backends, ) -> Option { match initialize_adapter_from_env(&instance, backend_bits) { Some(a) => Some(a), diff --git a/wgpu/tests/common/mod.rs b/wgpu/tests/common/mod.rs index 330484920..05d320d00 100644 --- a/wgpu/tests/common/mod.rs +++ b/wgpu/tests/common/mod.rs @@ -3,7 +3,7 @@ use std::panic::{catch_unwind, AssertUnwindSafe}; -use wgt::{BackendBit, DeviceDescriptor, DownlevelCapabilities, Features, Limits}; +use wgt::{Backends, DeviceDescriptor, DownlevelCapabilities, Features, Limits}; use wgpu::{util, Adapter, Device, Instance, Queue}; @@ -77,12 +77,7 @@ pub struct TestParameters { pub required_limits: Limits, pub required_downlevel_properties: DownlevelCapabilities, // Backends where test should fail. - pub failures: Vec<( - Option, - Option, - Option, - bool, - )>, + pub failures: Vec<(Option, Option, Option, bool)>, } impl Default for TestParameters { @@ -97,7 +92,7 @@ impl Default for TestParameters { } bitflags::bitflags! { - pub struct FailureReason: u8 { + pub struct FailureReasons: u8 { const BACKEND = 0x1; const VENDOR = 0x2; const ADAPTER = 0x4; @@ -131,7 +126,7 @@ impl TestParameters { } /// Mark the test as always failing on a specific backend, equivilant to specific_failure(backend, None, None) - pub fn backend_failures(mut self, backends: wgpu::BackendBit) -> Self { + pub fn backend_failures(mut self, backends: wgpu::Backends) -> Self { self.failures.push((Some(backends), None, None, false)); self } @@ -139,13 +134,13 @@ impl TestParameters { /// Determines if a test should fail under a particular set of conditions. If any of these are None, that means that it will match anything in that field. /// /// ex. - /// `specific_failure(Some(wgpu::BackendBit::DX11 | wgpu::BackendBit::DX12), None, Some("RTX"), false)` + /// `specific_failure(Some(wgpu::Backends::DX11 | wgpu::Backends::DX12), None, Some("RTX"), false)` /// means that this test will fail on all cards with RTX in their name on either D3D backend, no matter the vendor ID. /// /// If segfault is set to true, the test won't be run at all due to avoid segfaults. pub fn specific_failure( mut self, - backends: Option, + backends: Option, vendor: Option, device: Option<&'static str>, segfault: bool, @@ -164,7 +159,7 @@ pub fn initialize_test(parameters: TestParameters, test_function: impl FnOnce(Te // We don't actually care if it fails let _ = env_logger::try_init(); - let backend_bits = util::backend_bits_from_env().unwrap_or_else(BackendBit::all); + let backend_bits = util::backend_bits_from_env().unwrap_or_else(Backends::all); let instance = Instance::new(backend_bits); let adapter = pollster::block_on(util::initialize_adapter_from_env_or_default( &instance, @@ -228,7 +223,7 @@ pub fn initialize_test(parameters: TestParameters, test_function: impl FnOnce(Te backend_failure.is_none() && vendor_failure.is_none() && adapter_failure.is_none(); let expect_failure_backend = backend_failure - .map(|f| f.contains(wgpu::BackendBit::from(adapter_info.backend))) + .map(|f| f.contains(wgpu::Backends::from(adapter_info.backend))) .unwrap_or(true); let expect_failure_vendor = vendor_failure .map(|v| v == adapter_info.vendor) @@ -240,12 +235,12 @@ pub fn initialize_test(parameters: TestParameters, test_function: impl FnOnce(Te if expect_failure_backend && expect_failure_vendor && expect_failure_adapter { if always { - Some((FailureReason::ALWAYS, *segfault)) + Some((FailureReasons::ALWAYS, *segfault)) } else { - let mut reason = FailureReason::empty(); - reason.set(FailureReason::BACKEND, expect_failure_backend); - reason.set(FailureReason::VENDOR, expect_failure_vendor); - reason.set(FailureReason::ADAPTER, expect_failure_adapter); + let mut reason = FailureReasons::empty(); + reason.set(FailureReasons::BACKEND, expect_failure_backend); + reason.set(FailureReasons::VENDOR, expect_failure_vendor); + reason.set(FailureReasons::ADAPTER, expect_failure_adapter); Some((reason, *segfault)) } } else { diff --git a/wgpu/tests/instance.rs b/wgpu/tests/instance.rs index 850a7170a..7758f6df0 100644 --- a/wgpu/tests/instance.rs +++ b/wgpu/tests/instance.rs @@ -1,13 +1,13 @@ #[test] fn initialize() { let _ = wgpu::Instance::new( - wgpu::util::backend_bits_from_env().unwrap_or_else(wgpu::BackendBit::all), + wgpu::util::backend_bits_from_env().unwrap_or_else(wgpu::Backends::all), ); } fn request_adapter_inner(power: wgt::PowerPreference) { let instance = wgpu::Instance::new( - wgpu::util::backend_bits_from_env().unwrap_or_else(wgpu::BackendBit::all), + wgpu::util::backend_bits_from_env().unwrap_or_else(wgpu::Backends::all), ); let _adapter = pollster::block_on(instance.request_adapter(&wgpu::RequestAdapterOptions { diff --git a/wgpu/tests/vertex_indices/mod.rs b/wgpu/tests/vertex_indices/mod.rs index e5e107450..222ba8254 100644 --- a/wgpu/tests/vertex_indices/mod.rs +++ b/wgpu/tests/vertex_indices/mod.rs @@ -24,7 +24,7 @@ fn pulling_common( has_dynamic_offset: false, min_binding_size: NonZeroU64::new(4), }, - visibility: wgpu::ShaderStage::VERTEX, + visibility: wgpu::ShaderStages::VERTEX, count: None, }], }); @@ -143,7 +143,7 @@ fn draw_vertex_offset() { initialize_test( TestParameters::default() .test_features() - .backend_failures(wgpu::BackendBit::DX12 | wgpu::BackendBit::DX11), + .backend_failures(wgpu::Backends::DX12 | wgpu::Backends::DX11), |ctx| { pulling_common(ctx, &[0, 1, 2, 3, 4, 5], |cmb| { cmb.draw(0..3, 0..1); @@ -167,7 +167,7 @@ fn draw_instanced_offset() { initialize_test( TestParameters::default() .test_features() - .backend_failures(wgpu::BackendBit::DX12 | wgpu::BackendBit::DX11), + .backend_failures(wgpu::Backends::DX12 | wgpu::Backends::DX11), |ctx| { pulling_common(ctx, &[0, 1, 2, 3, 4, 5], |cmb| { cmb.draw(0..3, 0..1);