Bump bitflags from 1.3.2 to 2.0.2 (#3606)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
This commit is contained in:
dependabot[bot] 2023-04-05 22:24:59 +00:00 committed by GitHub
parent 27cdfd2954
commit a13ed91626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 83 additions and 55 deletions

66
Cargo.lock generated
View File

@ -191,6 +191,12 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "487f1e0fcbe47deb8b0574e646def1c903389d95241dd1bbcc6ce4a715dfc0c1"
[[package]] [[package]]
name = "block" name = "block"
version = "0.1.6" version = "0.1.6"
@ -296,7 +302,7 @@ version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"block", "block",
"cocoa-foundation", "cocoa-foundation",
"core-foundation", "core-foundation",
@ -312,7 +318,7 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"block", "block",
"core-foundation", "core-foundation",
"core-graphics-types", "core-graphics-types",
@ -400,7 +406,7 @@ version = "0.22.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"core-foundation", "core-foundation",
"core-graphics-types", "core-graphics-types",
"foreign-types 0.3.2", "foreign-types 0.3.2",
@ -413,7 +419,7 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"core-foundation", "core-foundation",
"foreign-types 0.3.2", "foreign-types 0.3.2",
"libc", "libc",
@ -497,7 +503,7 @@ name = "d3d12"
version = "0.6.0" version = "0.6.0"
source = "git+https://github.com/gfx-rs/d3d12-rs?rev=b940b1d71#b940b1d71ab7083ae80eec697872672dc1f2bd32" source = "git+https://github.com/gfx-rs/d3d12-rs?rev=b940b1d71#b940b1d71ab7083ae80eec697872672dc1f2bd32"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"libloading", "libloading",
"winapi", "winapi",
] ]
@ -543,7 +549,7 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "594ecd967c2f40db5dde8da4c356975fc1fe030e951c7c3962f6dc2e80042e87" checksum = "594ecd967c2f40db5dde8da4c356975fc1fe030e951c7c3962f6dc2e80042e87"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"byteorder", "byteorder",
"enum_primitive", "enum_primitive",
] ]
@ -869,7 +875,7 @@ version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74eadec9d0a5c28c54bb9882e54787275152a4e36ce206b45d7451384e5bf5fb" checksum = "74eadec9d0a5c28c54bb9882e54787275152a4e36ce206b45d7451384e5bf5fb"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"freetype-sys", "freetype-sys",
"libc", "libc",
] ]
@ -1138,7 +1144,7 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fc59e5f710e310e76e6707f86c561dd646f69a8876da9131703b2f717de818d" checksum = "7fc59e5f710e310e76e6707f86c561dd646f69a8876da9131703b2f717de818d"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"gpu-alloc-types", "gpu-alloc-types",
] ]
@ -1148,7 +1154,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54804d0d6bc9d7f26db4eaec1ad10def69b599315f487d32c334a80d1efe67a5" checksum = "54804d0d6bc9d7f26db4eaec1ad10def69b599315f487d32c334a80d1efe67a5"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
] ]
[[package]] [[package]]
@ -1170,7 +1176,7 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a" checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"gpu-descriptor-types", "gpu-descriptor-types",
"hashbrown", "hashbrown",
] ]
@ -1181,7 +1187,7 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "363e3677e55ad168fef68cf9de3a4a310b53124c5e784c53a1d70e92d23f2126" checksum = "363e3677e55ad168fef68cf9de3a4a310b53124c5e784c53a1d70e92d23f2126"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
] ]
[[package]] [[package]]
@ -1199,7 +1205,7 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1397650ee315e8891a0df210707f0fc61771b0cc518c3023896064c5407cb3b0" checksum = "1397650ee315e8891a0df210707f0fc61771b0cc518c3023896064c5407cb3b0"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"com-rs", "com-rs",
"libc", "libc",
"libloading", "libloading",
@ -1461,7 +1467,7 @@ version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de11355d1f6781482d027a3b4d4de7825dcedb197bf573e0596d00008402d060" checksum = "de11355d1f6781482d027a3b4d4de7825dcedb197bf573e0596d00008402d060"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"block", "block",
"core-graphics-types", "core-graphics-types",
"foreign-types 0.3.2", "foreign-types 0.3.2",
@ -1511,7 +1517,7 @@ version = "0.11.0"
source = "git+https://github.com/gfx-rs/naga?rev=9742f1616c3e3dd2cc9a5880616fc886c391bb9f#9742f1616c3e3dd2cc9a5880616fc886c391bb9f" source = "git+https://github.com/gfx-rs/naga?rev=9742f1616c3e3dd2cc9a5880616fc886c391bb9f#9742f1616c3e3dd2cc9a5880616fc886c391bb9f"
dependencies = [ dependencies = [
"bit-set", "bit-set",
"bitflags", "bitflags 1.3.2",
"codespan-reporting", "codespan-reporting",
"hexf-parse", "hexf-parse",
"indexmap", "indexmap",
@ -1539,7 +1545,7 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"jni-sys", "jni-sys",
"ndk-sys", "ndk-sys",
"num_enum", "num_enum",
@ -1597,7 +1603,7 @@ version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"cfg-if", "cfg-if",
"libc", "libc",
"memoffset", "memoffset",
@ -1893,7 +1899,7 @@ version = "0.17.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d708eaf860a19b19ce538740d2b4bdeeb8337fa53f7738455e706623ad5c638" checksum = "5d708eaf860a19b19ce538740d2b4bdeeb8337fa53f7738455e706623ad5c638"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"crc32fast", "crc32fast",
"flate2", "flate2",
"miniz_oxide 0.6.2", "miniz_oxide 0.6.2",
@ -2032,7 +2038,7 @@ version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
] ]
[[package]] [[package]]
@ -2065,7 +2071,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "300a51053b1cb55c80b7a9fde4120726ddf25ca241a1cbb926626f62fb136bff" checksum = "300a51053b1cb55c80b7a9fde4120726ddf25ca241a1cbb926626f62fb136bff"
dependencies = [ dependencies = [
"base64 0.13.1", "base64 0.13.1",
"bitflags", "bitflags 1.3.2",
"serde", "serde",
] ]
@ -2112,7 +2118,7 @@ version = "0.36.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"errno", "errno",
"io-lifetimes", "io-lifetimes",
"libc", "libc",
@ -2322,7 +2328,7 @@ version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"calloop", "calloop",
"dlib", "dlib",
"lazy_static", "lazy_static",
@ -2367,7 +2373,7 @@ version = "0.2.0+1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830" checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"num-traits 0.2.15", "num-traits 0.2.15",
] ]
@ -2648,7 +2654,7 @@ version = "0.64.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2287b485fa902172da3722d7e557e083afd63921777e0c6e5c0fba28e6d59d3" checksum = "a2287b485fa902172da3722d7e557e083afd63921777e0c6e5c0fba28e6d59d3"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"fslock", "fslock",
"lazy_static", "lazy_static",
"which", "which",
@ -2911,7 +2917,7 @@ version = "0.29.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"downcast-rs", "downcast-rs",
"libc", "libc",
"nix", "nix",
@ -2960,7 +2966,7 @@ version = "0.29.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"wayland-client", "wayland-client",
"wayland-commons", "wayland-commons",
"wayland-scanner", "wayland-scanner",
@ -3004,7 +3010,7 @@ version = "0.15.0"
dependencies = [ dependencies = [
"arrayvec 0.7.2", "arrayvec 0.7.2",
"async-executor", "async-executor",
"bitflags", "bitflags 2.0.2",
"bytemuck", "bytemuck",
"cfg-if", "cfg-if",
"console_error_panic_hook", "console_error_panic_hook",
@ -3044,7 +3050,7 @@ version = "0.15.0"
dependencies = [ dependencies = [
"arrayvec 0.7.2", "arrayvec 0.7.2",
"bit-vec", "bit-vec",
"bitflags", "bitflags 2.0.2",
"codespan-reporting", "codespan-reporting",
"log", "log",
"naga", "naga",
@ -3069,7 +3075,7 @@ dependencies = [
"arrayvec 0.7.2", "arrayvec 0.7.2",
"ash", "ash",
"bit-set", "bit-set",
"bitflags", "bitflags 2.0.2",
"block", "block",
"core-graphics-types", "core-graphics-types",
"d3d12", "d3d12",
@ -3117,7 +3123,7 @@ dependencies = [
name = "wgpu-types" name = "wgpu-types"
version = "0.15.0" version = "0.15.0"
dependencies = [ dependencies = [
"bitflags", "bitflags 2.0.2",
"js-sys", "js-sys",
"serde", "serde",
"serde_json", "serde_json",
@ -3311,7 +3317,7 @@ version = "0.27.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb796d6fbd86b2fd896c9471e6f04d39d750076ebe5680a3958f00f5ab97657c" checksum = "bb796d6fbd86b2fd896c9471e6f04d39d750076ebe5680a3958f00f5ab97657c"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"cocoa", "cocoa",
"core-foundation", "core-foundation",
"core-graphics", "core-graphics",

View File

@ -48,7 +48,7 @@ version = "0.11.0"
[workspace.dependencies] [workspace.dependencies]
arrayvec = "0.7" arrayvec = "0.7"
async-executor = "1.0" async-executor = "1.0"
bitflags = "1" bitflags = "2"
bit-vec = "0.6" bit-vec = "0.6"
bytemuck = "1.13" bytemuck = "1.13"
cargo-run-wasm = "0.3.2" cargo-run-wasm = "0.3.2"

View File

@ -51,7 +51,7 @@ wgsl = ["naga/wgsl-in"]
[dependencies] [dependencies]
arrayvec = "0.7" arrayvec = "0.7"
bitflags = "1" bitflags = "2"
bit-vec = "0.6" bit-vec = "0.6"
codespan-reporting = "0.11" codespan-reporting = "0.11"
rustc-hash = "1.1" rustc-hash = "1.1"

View File

@ -382,6 +382,7 @@ pub enum CreateRenderPipelineError {
bitflags::bitflags! { bitflags::bitflags! {
#[repr(transparent)] #[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct PipelineFlags: u32 { pub struct PipelineFlags: u32 {
const BLEND_CONSTANT = 1 << 0; const BLEND_CONSTANT = 1 << 0;
const STENCIL_REFERENCE = 1 << 1; const STENCIL_REFERENCE = 1 << 1;

View File

@ -52,7 +52,7 @@ name = "raw-gles"
required-features = ["gles"] required-features = ["gles"]
[dependencies] [dependencies]
bitflags = "1" bitflags = "2"
parking_lot = ">=0.11,<0.13" parking_lot = ">=0.11,<0.13"
profiling = { version = "1", default-features = false } profiling = { version = "1", default-features = false }
raw-window-handle = "0.5" raw-window-handle = "0.5"

View File

@ -519,6 +519,7 @@ pub struct BindGroup {
} }
bitflags::bitflags! { bitflags::bitflags! {
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
struct TableTypes: u8 { struct TableTypes: u8 {
const SRV_CBV_UAV = 1 << 0; const SRV_CBV_UAV = 1 << 0;
const SAMPLERS = 1 << 1; const SAMPLERS = 1 << 1;

View File

@ -131,6 +131,7 @@ impl crate::Api for Api {
bitflags::bitflags! { bitflags::bitflags! {
/// Flags that affect internal code paths but do not /// Flags that affect internal code paths but do not
/// change the exposed feature set. /// change the exposed feature set.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
struct PrivateCapabilities: u32 { struct PrivateCapabilities: u32 {
/// Indicates support for `glBufferStorage` allocation. /// Indicates support for `glBufferStorage` allocation.
const BUFFER_ALLOCATION = 1 << 0; const BUFFER_ALLOCATION = 1 << 0;
@ -160,6 +161,7 @@ bitflags::bitflags! {
bitflags::bitflags! { bitflags::bitflags! {
/// Flags that indicate necessary workarounds for specific devices or driver bugs /// Flags that indicate necessary workarounds for specific devices or driver bugs
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
struct Workarounds: u32 { struct Workarounds: u32 {
// Needs workaround for Intel Mesa bug: // Needs workaround for Intel Mesa bug:
// https://gitlab.freedesktop.org/mesa/mesa/-/issues/2565. // https://gitlab.freedesktop.org/mesa/mesa/-/issues/2565.

View File

@ -552,6 +552,7 @@ pub trait CommandEncoder<A: Api>: Send + Sync + fmt::Debug {
bitflags!( bitflags!(
/// Instance initialization flags. /// Instance initialization flags.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct InstanceFlags: u32 { pub struct InstanceFlags: u32 {
/// Generate debug information in shaders and objects. /// Generate debug information in shaders and objects.
const DEBUG = 1 << 0; const DEBUG = 1 << 0;
@ -562,6 +563,7 @@ bitflags!(
bitflags!( bitflags!(
/// Pipeline layout creation flags. /// Pipeline layout creation flags.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct PipelineLayoutFlags: u32 { pub struct PipelineLayoutFlags: u32 {
/// Include support for base vertex/instance drawing. /// Include support for base vertex/instance drawing.
const BASE_VERTEX_INSTANCE = 1 << 0; const BASE_VERTEX_INSTANCE = 1 << 0;
@ -572,6 +574,7 @@ bitflags!(
bitflags!( bitflags!(
/// Pipeline layout creation flags. /// Pipeline layout creation flags.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct BindGroupLayoutFlags: u32 { pub struct BindGroupLayoutFlags: u32 {
/// Allows for bind group binding arrays to be shorter than the array in the BGL. /// Allows for bind group binding arrays to be shorter than the array in the BGL.
const PARTIALLY_BOUND = 1 << 0; const PARTIALLY_BOUND = 1 << 0;
@ -580,6 +583,7 @@ bitflags!(
bitflags!( bitflags!(
/// Texture format capability flags. /// Texture format capability flags.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct TextureFormatCapabilities: u32 { pub struct TextureFormatCapabilities: u32 {
/// Format can be sampled. /// Format can be sampled.
const SAMPLED = 1 << 0; const SAMPLED = 1 << 0;
@ -623,6 +627,7 @@ bitflags!(
bitflags!( bitflags!(
/// Texture format capability flags. /// Texture format capability flags.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct FormatAspects: u8 { pub struct FormatAspects: u8 {
const COLOR = 1 << 0; const COLOR = 1 << 0;
const DEPTH = 1 << 1; const DEPTH = 1 << 1;
@ -671,6 +676,7 @@ impl From<wgt::TextureFormat> for FormatAspects {
} }
bitflags!( bitflags!(
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct MemoryFlags: u32 { pub struct MemoryFlags: u32 {
const TRANSIENT = 1 << 0; const TRANSIENT = 1 << 0;
const PREFER_COHERENT = 1 << 1; const PREFER_COHERENT = 1 << 1;
@ -680,6 +686,7 @@ bitflags!(
//TODO: it's not intuitive for the backends to consider `LOAD` being optional. //TODO: it's not intuitive for the backends to consider `LOAD` being optional.
bitflags!( bitflags!(
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct AttachmentOps: u8 { pub struct AttachmentOps: u8 {
const LOAD = 1 << 0; const LOAD = 1 << 0;
const STORE = 1 << 1; const STORE = 1 << 1;
@ -688,6 +695,7 @@ bitflags!(
bitflags::bitflags! { bitflags::bitflags! {
/// Similar to `wgt::BufferUsages` but for internal use. /// Similar to `wgt::BufferUsages` but for internal use.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct BufferUses: u16 { pub struct BufferUses: u16 {
/// The argument to a read-only mapping. /// The argument to a read-only mapping.
const MAP_READ = 1 << 0; const MAP_READ = 1 << 0;
@ -710,20 +718,21 @@ bitflags::bitflags! {
/// The indirect or count buffer in a indirect draw or dispatch. /// The indirect or count buffer in a indirect draw or dispatch.
const INDIRECT = 1 << 9; const INDIRECT = 1 << 9;
/// The combination of states that a buffer may be in _at the same time_. /// The combination of states that a buffer may be in _at the same time_.
const INCLUSIVE = Self::MAP_READ.bits | Self::COPY_SRC.bits | const INCLUSIVE = Self::MAP_READ.bits() | Self::COPY_SRC.bits() |
Self::INDEX.bits | Self::VERTEX.bits | Self::UNIFORM.bits | Self::INDEX.bits() | Self::VERTEX.bits() | Self::UNIFORM.bits() |
Self::STORAGE_READ.bits | Self::INDIRECT.bits; Self::STORAGE_READ.bits() | Self::INDIRECT.bits();
/// The combination of states that a buffer must exclusively be in. /// The combination of states that a buffer must exclusively be in.
const EXCLUSIVE = Self::MAP_WRITE.bits | Self::COPY_DST.bits | Self::STORAGE_READ_WRITE.bits; const EXCLUSIVE = Self::MAP_WRITE.bits() | Self::COPY_DST.bits() | Self::STORAGE_READ_WRITE.bits();
/// The combination of all usages that the are guaranteed to be be ordered by the hardware. /// The combination of all usages that the are guaranteed to be be ordered by the hardware.
/// If a usage is ordered, then if the buffer state doesn't change between draw calls, there /// If a usage is ordered, then if the buffer state doesn't change between draw calls, there
/// are no barriers needed for synchronization. /// are no barriers needed for synchronization.
const ORDERED = Self::INCLUSIVE.bits | Self::MAP_WRITE.bits; const ORDERED = Self::INCLUSIVE.bits() | Self::MAP_WRITE.bits();
} }
} }
bitflags::bitflags! { bitflags::bitflags! {
/// Similar to `wgt::TextureUsages` but for internal use. /// Similar to `wgt::TextureUsages` but for internal use.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct TextureUses: u16 { pub struct TextureUses: u16 {
/// The texture is in unknown state. /// The texture is in unknown state.
const UNINITIALIZED = 1 << 0; const UNINITIALIZED = 1 << 0;
@ -746,13 +755,13 @@ bitflags::bitflags! {
/// Read-write or write-only storage buffer usage. /// Read-write or write-only storage buffer usage.
const STORAGE_READ_WRITE = 1 << 9; const STORAGE_READ_WRITE = 1 << 9;
/// The combination of states that a texture may be in _at the same time_. /// The combination of states that a texture may be in _at the same time_.
const INCLUSIVE = Self::COPY_SRC.bits | Self::RESOURCE.bits | Self::DEPTH_STENCIL_READ.bits; const INCLUSIVE = Self::COPY_SRC.bits() | Self::RESOURCE.bits() | Self::DEPTH_STENCIL_READ.bits();
/// The combination of states that a texture must exclusively be in. /// The combination of states that a texture must exclusively be in.
const EXCLUSIVE = Self::COPY_DST.bits | Self::COLOR_TARGET.bits | Self::DEPTH_STENCIL_WRITE.bits | Self::STORAGE_READ.bits | Self::STORAGE_READ_WRITE.bits | Self::PRESENT.bits; const EXCLUSIVE = Self::COPY_DST.bits() | Self::COLOR_TARGET.bits() | Self::DEPTH_STENCIL_WRITE.bits() | Self::STORAGE_READ.bits() | Self::STORAGE_READ_WRITE.bits() | Self::PRESENT.bits();
/// The combination of all usages that the are guaranteed to be be ordered by the hardware. /// The combination of all usages that the are guaranteed to be be ordered by the hardware.
/// If a usage is ordered, then if the texture state doesn't change between draw calls, there /// If a usage is ordered, then if the texture state doesn't change between draw calls, there
/// are no barriers needed for synchronization. /// are no barriers needed for synchronization.
const ORDERED = Self::INCLUSIVE.bits | Self::COLOR_TARGET.bits | Self::DEPTH_STENCIL_WRITE.bits | Self::STORAGE_READ.bits; const ORDERED = Self::INCLUSIVE.bits() | Self::COLOR_TARGET.bits() | Self::DEPTH_STENCIL_WRITE.bits() | Self::STORAGE_READ.bits();
/// Flag used by the wgpu-core texture tracker to say a texture is in different states for every sub-resource /// Flag used by the wgpu-core texture tracker to say a texture is in different states for every sub-resource
const COMPLEX = 1 << 10; const COMPLEX = 1 << 10;

View File

@ -173,6 +173,7 @@ struct PrivateCapabilities {
bitflags::bitflags!( bitflags::bitflags!(
/// Workaround flags. /// Workaround flags.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Workarounds: u32 { pub struct Workarounds: u32 {
/// Only generate SPIR-V for one entry point at a time. /// Only generate SPIR-V for one entry point at a time.
const SEPARATE_ENTRY_POINTS = 0x1; const SEPARATE_ENTRY_POINTS = 0x1;

View File

@ -27,7 +27,7 @@ replay = ["serde"]
strict_asserts = [] strict_asserts = []
[dependencies] [dependencies]
bitflags = "1" bitflags = "2"
serde = { version = "1", features = ["serde_derive"], optional = true } serde = { version = "1", features = ["serde_derive"], optional = true }
[target.'cfg(target_arch = "wasm32")'.dependencies] [target.'cfg(target_arch = "wasm32")'.dependencies]

View File

@ -42,9 +42,7 @@ macro_rules! impl_bitflags {
D: serde::Deserializer<'de>, D: serde::Deserializer<'de>,
{ {
let value = <_ as serde::Deserialize<'de>>::deserialize(deserializer)?; let value = <_ as serde::Deserialize<'de>>::deserialize(deserializer)?;
// Note: newer version of bitflags replaced from_bits_unchecked with Ok($name::from_bits_retain(value))
// from_bits_retain which is not marked as unsafe (same implementation).
Ok(unsafe { $name::from_bits_unchecked(value) })
} }
} }
@ -132,6 +130,7 @@ pub enum PowerPreference {
bitflags::bitflags! { bitflags::bitflags! {
/// Represents the backends that wgpu will use. /// Represents the backends that wgpu will use.
#[repr(transparent)] #[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Backends: u32 { pub struct Backends: u32 {
/// Supported on Windows, Linux/Android, and macOS/iOS via Vulkan Portability (with the Vulkan feature enabled) /// Supported on Windows, Linux/Android, and macOS/iOS via Vulkan Portability (with the Vulkan feature enabled)
const VULKAN = 1 << Backend::Vulkan as u32; const VULKAN = 1 << Backend::Vulkan as u32;
@ -149,15 +148,15 @@ bitflags::bitflags! {
/// All the apis that wgpu offers first tier of support for. /// All the apis that wgpu offers first tier of support for.
/// ///
/// Vulkan + Metal + DX12 + Browser WebGPU /// Vulkan + Metal + DX12 + Browser WebGPU
const PRIMARY = Self::VULKAN.bits const PRIMARY = Self::VULKAN.bits()
| Self::METAL.bits | Self::METAL.bits()
| Self::DX12.bits | Self::DX12.bits()
| Self::BROWSER_WEBGPU.bits; | Self::BROWSER_WEBGPU.bits();
/// All the apis that wgpu offers second tier of support for. These may /// All the apis that wgpu offers second tier of support for. These may
/// be unsupported/still experimental. /// be unsupported/still experimental.
/// ///
/// OpenGL + DX11 /// OpenGL + DX11
const SECONDARY = Self::GL.bits | Self::DX11.bits; const SECONDARY = Self::GL.bits() | Self::DX11.bits();
} }
} }
@ -214,6 +213,7 @@ bitflags::bitflags! {
/// https://gpuweb.github.io/gpuweb/#enumdef-gpufeaturename). /// https://gpuweb.github.io/gpuweb/#enumdef-gpufeaturename).
#[repr(transparent)] #[repr(transparent)]
#[derive(Default)] #[derive(Default)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Features: u64 { pub struct Features: u64 {
// //
// ---- Start numbering at 1 << 0 ---- // ---- Start numbering at 1 << 0 ----
@ -1145,6 +1145,7 @@ bitflags::bitflags! {
/// ///
/// You can check whether a set of flags is compliant through the /// You can check whether a set of flags is compliant through the
/// [`DownlevelCapabilities::is_webgpu_compliant()`] function. /// [`DownlevelCapabilities::is_webgpu_compliant()`] function.
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DownlevelFlags: u32 { pub struct DownlevelFlags: u32 {
/// The device supports compiling and using compute shaders. /// The device supports compiling and using compute shaders.
/// ///
@ -1249,7 +1250,7 @@ impl DownlevelFlags {
// We use manual bit twiddling to make this a const fn as `Sub` and `.remove` aren't const // We use manual bit twiddling to make this a const fn as `Sub` and `.remove` aren't const
// WebGPU doesn't actually require aniso // WebGPU doesn't actually require aniso
Self::from_bits_truncate(Self::all().bits() & !Self::ANISOTROPIC_FILTERING.bits) Self::from_bits_truncate(Self::all().bits() & !Self::ANISOTROPIC_FILTERING.bits())
} }
} }
@ -1349,6 +1350,7 @@ bitflags::bitflags! {
/// Corresponds to [WebGPU `GPUShaderStageFlags`]( /// Corresponds to [WebGPU `GPUShaderStageFlags`](
/// https://gpuweb.github.io/gpuweb/#typedefdef-gpushaderstageflags). /// https://gpuweb.github.io/gpuweb/#typedefdef-gpushaderstageflags).
#[repr(transparent)] #[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct ShaderStages: u32 { pub struct ShaderStages: u32 {
/// Binding is not visible from any shader stage. /// Binding is not visible from any shader stage.
const NONE = 0; const NONE = 0;
@ -1359,7 +1361,7 @@ bitflags::bitflags! {
/// Binding is visible from the compute shader of a compute pipeline. /// Binding is visible from the compute shader of a compute pipeline.
const COMPUTE = 1 << 2; const COMPUTE = 1 << 2;
/// Binding is visible from the vertex and fragment shaders of a render pipeline. /// Binding is visible from the vertex and fragment shaders of a render pipeline.
const VERTEX_FRAGMENT = Self::VERTEX.bits | Self::FRAGMENT.bits; const VERTEX_FRAGMENT = Self::VERTEX.bits() | Self::FRAGMENT.bits();
} }
} }
@ -1774,6 +1776,7 @@ impl Default for MultisampleState {
bitflags::bitflags! { bitflags::bitflags! {
/// Feature flags for a texture format. /// Feature flags for a texture format.
#[repr(transparent)] #[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct TextureFormatFeatureFlags: u32 { pub struct TextureFormatFeatureFlags: u32 {
/// If not present, the texture can't be sampled with a filtering sampler. /// If not present, the texture can't be sampled with a filtering sampler.
/// This may overwrite TextureSampleType::Float.filterable /// This may overwrite TextureSampleType::Float.filterable
@ -3631,6 +3634,7 @@ bitflags::bitflags! {
/// Corresponds to [WebGPU `GPUColorWriteFlags`]( /// Corresponds to [WebGPU `GPUColorWriteFlags`](
/// https://gpuweb.github.io/gpuweb/#typedefdef-gpucolorwriteflags). /// https://gpuweb.github.io/gpuweb/#typedefdef-gpucolorwriteflags).
#[repr(transparent)] #[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct ColorWrites: u32 { pub struct ColorWrites: u32 {
/// Enable red channel writes /// Enable red channel writes
const RED = 1 << 0; const RED = 1 << 0;
@ -3641,9 +3645,9 @@ bitflags::bitflags! {
/// Enable alpha channel writes /// Enable alpha channel writes
const ALPHA = 1 << 3; const ALPHA = 1 << 3;
/// Enable red, green, and blue channel writes /// Enable red, green, and blue channel writes
const COLOR = Self::RED.bits | Self::GREEN.bits | Self::BLUE.bits; const COLOR = Self::RED.bits() | Self::GREEN.bits() | Self::BLUE.bits();
/// Enable writes to all channels. /// Enable writes to all channels.
const ALL = Self::RED.bits | Self::GREEN.bits | Self::BLUE.bits | Self::ALPHA.bits; const ALL = Self::RED.bits() | Self::GREEN.bits() | Self::BLUE.bits() | Self::ALPHA.bits();
} }
} }
@ -4191,6 +4195,7 @@ bitflags::bitflags! {
/// Corresponds to [WebGPU `GPUBufferUsageFlags`]( /// Corresponds to [WebGPU `GPUBufferUsageFlags`](
/// https://gpuweb.github.io/gpuweb/#typedefdef-gpubufferusageflags). /// https://gpuweb.github.io/gpuweb/#typedefdef-gpubufferusageflags).
#[repr(transparent)] #[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct BufferUsages: u32 { pub struct BufferUsages: u32 {
/// Allow a buffer to be mapped for reading using [`Buffer::map_async`] + [`Buffer::get_mapped_range`]. /// Allow a buffer to be mapped for reading using [`Buffer::map_async`] + [`Buffer::get_mapped_range`].
/// This does not include creating a buffer with [`BufferDescriptor::mapped_at_creation`] set. /// This does not include creating a buffer with [`BufferDescriptor::mapped_at_creation`] set.
@ -4411,6 +4416,7 @@ bitflags::bitflags! {
/// Corresponds to [WebGPU `GPUTextureUsageFlags`]( /// Corresponds to [WebGPU `GPUTextureUsageFlags`](
/// https://gpuweb.github.io/gpuweb/#typedefdef-gputextureusageflags). /// https://gpuweb.github.io/gpuweb/#typedefdef-gputextureusageflags).
#[repr(transparent)] #[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct TextureUsages: u32 { pub struct TextureUsages: u32 {
/// Allows a texture to be the source in a [`CommandEncoder::copy_texture_to_buffer`] or /// Allows a texture to be the source in a [`CommandEncoder::copy_texture_to_buffer`] or
/// [`CommandEncoder::copy_texture_to_texture`] operation. /// [`CommandEncoder::copy_texture_to_texture`] operation.
@ -5992,6 +5998,7 @@ bitflags::bitflags! {
/// the first 8 bytes being the primitive out value, the last 8 /// the first 8 bytes being the primitive out value, the last 8
/// bytes being the compute shader invocation count. /// bytes being the compute shader invocation count.
#[repr(transparent)] #[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct PipelineStatisticsTypes : u8 { pub struct PipelineStatisticsTypes : u8 {
/// Amount of times the vertex shader is ran. Accounts for /// Amount of times the vertex shader is ran. Accounts for
/// the vertex cache when doing indexed rendering. /// the vertex cache when doing indexed rendering.

View File

@ -52,7 +52,7 @@ fn buffer_usage() {
Bu::MAP_WRITE | Bu::COPY_SRC | Bu::STORAGE, Bu::MAP_WRITE | Bu::COPY_SRC | Bu::STORAGE,
Bu::all(), Bu::all(),
]; ];
let invalid_bits = unsafe { Bu::from_bits_unchecked(0b1111111111111) }; let invalid_bits = Bu::from_bits_retain(0b1111111111111);
let always_fail = &[Bu::empty(), invalid_bits]; let always_fail = &[Bu::empty(), invalid_bits];
try_create( try_create(

View File

@ -79,6 +79,7 @@ impl Default for TestParameters {
} }
bitflags::bitflags! { bitflags::bitflags! {
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct FailureReasons: u8 { pub struct FailureReasons: u8 {
const BACKEND = 1 << 0; const BACKEND = 1 << 0;
const VENDOR = 1 << 1; const VENDOR = 1 << 1;