Skip to content

Commit

Permalink
Bump bitflags to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda committed May 27, 2023
1 parent 907b7c7 commit 971ced3
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Expand Up @@ -28,9 +28,9 @@ dot-out = []
glsl-in = ["pp-rs"]
glsl-out = []
msl-out = []
serialize = ["serde", "indexmap/serde-1"]
deserialize = ["serde", "indexmap/serde-1"]
arbitrary = ["dep:arbitrary", "indexmap/arbitrary"]
serialize = ["serde", "bitflags/serde", "indexmap/serde-1"]
deserialize = ["serde", "bitflags/serde", "indexmap/serde-1"]
arbitrary = ["dep:arbitrary", "bitflags/arbitrary", "indexmap/arbitrary"]
spv-in = ["petgraph", "spirv"]
spv-out = ["spirv"]
wgsl-in = ["codespan-reporting", "hexf-parse", "termcolor", "unicode-xid"]
Expand All @@ -45,7 +45,7 @@ harness = false

[dependencies]
arbitrary = { version = "1.0.2", features = ["derive"], optional = true }
bitflags = "1.0.5"
bitflags = "2.0.0"
bit-set = "0.5"
termcolor = { version = "1.0.4", optional = true }
# remove termcolor dep when updating to the next version of codespan-reporting
Expand Down
1 change: 1 addition & 0 deletions src/back/glsl/features.rs
Expand Up @@ -7,6 +7,7 @@ use std::fmt::Write;

bitflags::bitflags! {
/// Structure used to encode additions to GLSL that aren't supported by all versions.
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Features: u32 {
/// Buffer address space support.
const BUFFER_STORAGE = 1;
Expand Down
1 change: 1 addition & 0 deletions src/back/glsl/mod.rs
Expand Up @@ -216,6 +216,7 @@ bitflags::bitflags! {
/// Configuration flags for the [`Writer`].
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct WriterFlags: u32 {
/// Flip output Y and extend Z from (0, 1) to (-1, 1).
const ADJUST_COORDINATE_SPACE = 0x1;
Expand Down
2 changes: 1 addition & 1 deletion src/back/mod.rs
Expand Up @@ -228,7 +228,7 @@ bitflags::bitflags! {
/// we might as well make one back end's life easier.)
///
/// [`RayDesc`]: crate::Module::generate_ray_desc_type
#[derive(Default)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RayFlag: u32 {
const OPAQUE = 0x01;
const NO_OPAQUE = 0x02;
Expand Down
2 changes: 2 additions & 0 deletions src/back/spv/mod.rs
Expand Up @@ -176,6 +176,7 @@ struct LocalImageType {

bitflags::bitflags! {
/// Flags corresponding to the boolean(-ish) parameters to OpTypeImage.
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ImageTypeFlags: u8 {
const DEPTH = 0x1;
const ARRAYED = 0x2;
Expand Down Expand Up @@ -624,6 +625,7 @@ pub struct Writer {
}

bitflags::bitflags! {
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct WriterFlags: u32 {
/// Include debug labels for everything.
const DEBUG = 0x1;
Expand Down
1 change: 1 addition & 0 deletions src/back/wgsl/writer.rs
Expand Up @@ -53,6 +53,7 @@ enum Indirection {
bitflags::bitflags! {
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct WriterFlags: u32 {
/// Always annotate the type information instead of inferring.
const EXPLICIT_TYPES = 0x1;
Expand Down
1 change: 1 addition & 0 deletions src/front/glsl/ast.rs
Expand Up @@ -67,6 +67,7 @@ bitflags::bitflags! {
/// builtins overloads can't be generated unless explicitly used, since they might cause
/// unneeded capabilities to be requested
#[derive(Default)]
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BuiltinVariations: u32 {
/// Request the standard overloads
const STANDARD = 1 << 0;
Expand Down
1 change: 1 addition & 0 deletions src/front/spv/image.rs
Expand Up @@ -10,6 +10,7 @@ pub(super) struct LookupSampledImage {

bitflags::bitflags! {
/// Flags describing sampling method.
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SamplingFlags: u32 {
/// Regular sampling.
const REGULAR = 0x1;
Expand Down
2 changes: 1 addition & 1 deletion src/front/spv/mod.rs
Expand Up @@ -168,7 +168,7 @@ impl crate::ImageDimension {
type MemberIndex = u32;

bitflags::bitflags! {
#[derive(Default)]
#[derive(Clone, Copy, Debug, Default)]
struct DecorationFlags: u32 {
const NON_READABLE = 0x1;
const NON_WRITABLE = 0x2;
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Expand Up @@ -501,7 +501,7 @@ bitflags::bitflags! {
#[cfg_attr(feature = "serialize", derive(Serialize))]
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[derive(Default)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StorageAccess: u32 {
/// Storage can be used as a source for load ops.
const LOAD = 0x1;
Expand Down Expand Up @@ -1195,7 +1195,7 @@ bitflags::bitflags! {
#[cfg_attr(feature = "serialize", derive(Serialize))]
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[derive(Default)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Barrier: u32 {
/// Barrier affects all `AddressSpace::Storage` accesses.
const STORAGE = 0x1;
Expand Down
3 changes: 3 additions & 0 deletions src/valid/analyzer.rs
Expand Up @@ -20,6 +20,7 @@ bitflags::bitflags! {
/// Kinds of expressions that require uniform control flow.
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct UniformityRequirements: u8 {
const WORK_GROUP_BARRIER = 0x1;
const DERIVATIVE = 0x2;
Expand Down Expand Up @@ -59,6 +60,7 @@ impl Uniformity {
}

bitflags::bitflags! {
#[derive(Clone, Copy, Debug, PartialEq)]
struct ExitFlags: u8 {
/// Control flow may return from the function, which makes all the
/// subsequent statements within the current function (only!)
Expand Down Expand Up @@ -117,6 +119,7 @@ bitflags::bitflags! {
/// Indicates how a global variable is used.
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct GlobalUse: u8 {
/// Data will be read from the variable.
const READ = 0x1;
Expand Down
1 change: 1 addition & 0 deletions src/valid/function.rs
Expand Up @@ -161,6 +161,7 @@ pub enum FunctionError {

bitflags::bitflags! {
#[repr(transparent)]
#[derive(Clone, Copy)]
struct ControlFlowAbility: u8 {
/// The control can return out of this block.
const RETURN = 0x1;
Expand Down
3 changes: 3 additions & 0 deletions src/valid/mod.rs
Expand Up @@ -53,6 +53,7 @@ bitflags::bitflags! {
/// by default.)
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ValidationFlags: u8 {
/// Expressions.
#[cfg(feature = "validate")]
Expand Down Expand Up @@ -86,6 +87,7 @@ bitflags::bitflags! {
#[must_use]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Capabilities: u16 {
/// Support for [`AddressSpace:PushConstant`].
const PUSH_CONSTANT = 0x1;
Expand Down Expand Up @@ -126,6 +128,7 @@ bitflags::bitflags! {
/// Validation flags.
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ShaderStages: u8 {
const VERTEX = 0x1;
const FRAGMENT = 0x2;
Expand Down
1 change: 1 addition & 0 deletions src/valid/type.rs
Expand Up @@ -9,6 +9,7 @@ bitflags::bitflags! {
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TypeFlags: u8 {
/// Can be used for data variables.
///
Expand Down
1 change: 1 addition & 0 deletions tests/snapshots.rs
Expand Up @@ -11,6 +11,7 @@ const BASE_DIR_IN: &str = "tests/in";
const BASE_DIR_OUT: &str = "tests/out";

bitflags::bitflags! {
#[derive(Clone, Copy)]
struct Targets: u32 {
const IR = 0x1;
const ANALYSIS = 0x2;
Expand Down

0 comments on commit 971ced3

Please sign in to comment.