Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump bitflags to v2 #2358

Merged
merged 2 commits into from Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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"
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, PartialEq)]
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, PartialEq)]
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, PartialEq)]
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, PartialEq)]
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, PartialEq)]
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, PartialEq)]
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, PartialEq)]
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, PartialEq)]
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, PartialEq)]
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, PartialEq)]
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, PartialEq)]
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, PartialEq)]
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, PartialEq)]
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, PartialEq)]
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, PartialEq)]
pub struct TypeFlags: u8 {
/// Can be used for data variables.
///
Expand Down
2 changes: 1 addition & 1 deletion tests/in/bounds-check-image-restrict.param.ron
Expand Up @@ -8,7 +8,7 @@
),
glsl: (
version: Desktop(430),
writer_flags: (bits: 0),
writer_flags: (""),
binding_map: { },
zero_initialize_workgroup_memory: true,
),
Expand Down
2 changes: 1 addition & 1 deletion tests/in/bounds-check-image-rzsw.param.ron
Expand Up @@ -8,7 +8,7 @@
),
glsl: (
version: Desktop(430),
writer_flags: (bits: 0),
writer_flags: (""),
binding_map: { },
zero_initialize_workgroup_memory: true,
),
Expand Down
2 changes: 1 addition & 1 deletion tests/in/force_point_size_vertex_shader_webgl.param.ron
Expand Up @@ -4,7 +4,7 @@
version: 300,
is_webgl: true
),
writer_flags: (bits: 16),
writer_flags: ("FORCE_POINT_SIZE"),
binding_map: {},
zero_initialize_workgroup_memory: true,
),
Expand Down
2 changes: 1 addition & 1 deletion tests/in/functions-webgl.param.ron
Expand Up @@ -4,7 +4,7 @@
version: 320,
is_webgl: false
),
writer_flags: (bits: 0),
writer_flags: (""),
binding_map: {},
zero_initialize_workgroup_memory: true,
),
Expand Down
2 changes: 1 addition & 1 deletion tests/in/interpolate.param.ron
Expand Up @@ -8,7 +8,7 @@
),
glsl: (
version: Desktop(400),
writer_flags: (bits: 0),
writer_flags: (""),
binding_map: {},
zero_initialize_workgroup_memory: true,
),
Expand Down
2 changes: 1 addition & 1 deletion tests/in/invariant.param.ron
Expand Up @@ -4,7 +4,7 @@
version: 300,
is_webgl: true
),
writer_flags: (bits: 0),
writer_flags: (""),
binding_map: {},
zero_initialize_workgroup_memory: true,
),
Expand Down
2 changes: 1 addition & 1 deletion tests/in/multiview_webgl.param.ron
Expand Up @@ -5,7 +5,7 @@
version: 300,
is_webgl: true
),
writer_flags: (bits: 0),
writer_flags: (""),
binding_map: {},
zero_initialize_workgroup_memory: true,
),
Expand Down
2 changes: 1 addition & 1 deletion tests/in/push-constants.param.ron
Expand Up @@ -5,7 +5,7 @@
version: 320,
is_webgl: false
),
writer_flags: (bits: 0),
writer_flags: (""),
binding_map: {},
zero_initialize_workgroup_memory: true,
),
Expand Down
2 changes: 1 addition & 1 deletion tests/in/quad.param.ron
Expand Up @@ -9,7 +9,7 @@
version: 300,
is_webgl: false
),
writer_flags: (bits: 0),
writer_flags: (""),
binding_map: {},
zero_initialize_workgroup_memory: true,
),
Expand Down
2 changes: 1 addition & 1 deletion tests/in/skybox.param.ron
Expand Up @@ -42,7 +42,7 @@
version: 320,
is_webgl: false
),
writer_flags: (bits: 0),
writer_flags: (""),
binding_map: {
(group: 0, binding: 0): 0,
(group: 0, binding: 1): 0,
Expand Down