mirror of
https://github.com/bevyengine/bevy
synced 2024-11-24 21:53:07 +00:00
parent
bad754a986
commit
bea7fd1c0b
14 changed files with 33 additions and 25 deletions
|
@ -31,5 +31,5 @@ bevy_math = { path = "../bevy_math", version = "0.11.0-dev" }
|
|||
bevy_utils = { path = "../bevy_utils", version = "0.11.0-dev" }
|
||||
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
bitflags = "1.2"
|
||||
bitflags = "2.3"
|
||||
radsort = "0.1"
|
||||
|
|
|
@ -26,7 +26,7 @@ bevy_window = { path = "../bevy_window", version = "0.11.0-dev" }
|
|||
bevy_derive = { path = "../bevy_derive", version = "0.11.0-dev" }
|
||||
|
||||
# other
|
||||
bitflags = "1.2"
|
||||
bitflags = "2.3"
|
||||
# direct dependency required for derive macro
|
||||
bytemuck = { version = "1", features = ["derive"] }
|
||||
radsort = "0.1"
|
||||
|
|
|
@ -829,7 +829,7 @@ pub fn prepare_lights(
|
|||
.xyz()
|
||||
.extend(1.0 / (light.range * light.range)),
|
||||
position_radius: light.transform.translation().extend(light.radius),
|
||||
flags: flags.bits,
|
||||
flags: flags.bits(),
|
||||
shadow_depth_bias: light.shadow_depth_bias,
|
||||
shadow_normal_bias: light.shadow_normal_bias,
|
||||
spot_light_tan_angle,
|
||||
|
@ -876,7 +876,7 @@ pub fn prepare_lights(
|
|||
color: Vec4::from_slice(&light.color.as_linear_rgba_f32()) * intensity,
|
||||
// direction is negated to be ready for N.L
|
||||
dir_to_light: light.transform.back(),
|
||||
flags: flags.bits,
|
||||
flags: flags.bits(),
|
||||
shadow_depth_bias: light.shadow_depth_bias,
|
||||
shadow_normal_bias: light.shadow_normal_bias,
|
||||
num_cascades: num_cascades as u32,
|
||||
|
|
|
@ -181,7 +181,7 @@ pub fn extract_meshes(
|
|||
flags |= MeshFlags::SIGN_DETERMINANT_MODEL_3X3;
|
||||
}
|
||||
let uniform = MeshUniform {
|
||||
flags: flags.bits,
|
||||
flags: flags.bits(),
|
||||
transform,
|
||||
previous_transform,
|
||||
inverse_transpose_model: transform.inverse().transpose(),
|
||||
|
@ -571,6 +571,7 @@ impl MeshPipeline {
|
|||
}
|
||||
|
||||
bitflags::bitflags! {
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
#[repr(transparent)]
|
||||
// NOTE: Apparently quadro drivers support up to 64x MSAA.
|
||||
/// MSAA uses the highest 3 bits for the MSAA log2(sample count) to support up to 128x MSAA.
|
||||
|
@ -622,7 +623,7 @@ impl MeshPipelineKey {
|
|||
pub fn from_msaa_samples(msaa_samples: u32) -> Self {
|
||||
let msaa_bits =
|
||||
(msaa_samples.trailing_zeros() & Self::MSAA_MASK_BITS) << Self::MSAA_SHIFT_BITS;
|
||||
Self::from_bits(msaa_bits).unwrap()
|
||||
Self::from_bits_retain(msaa_bits)
|
||||
}
|
||||
|
||||
pub fn from_hdr(hdr: bool) -> Self {
|
||||
|
@ -634,19 +635,19 @@ impl MeshPipelineKey {
|
|||
}
|
||||
|
||||
pub fn msaa_samples(&self) -> u32 {
|
||||
1 << ((self.bits >> Self::MSAA_SHIFT_BITS) & Self::MSAA_MASK_BITS)
|
||||
1 << ((self.bits() >> Self::MSAA_SHIFT_BITS) & Self::MSAA_MASK_BITS)
|
||||
}
|
||||
|
||||
pub fn from_primitive_topology(primitive_topology: PrimitiveTopology) -> Self {
|
||||
let primitive_topology_bits = ((primitive_topology as u32)
|
||||
& Self::PRIMITIVE_TOPOLOGY_MASK_BITS)
|
||||
<< Self::PRIMITIVE_TOPOLOGY_SHIFT_BITS;
|
||||
Self::from_bits(primitive_topology_bits).unwrap()
|
||||
Self::from_bits_retain(primitive_topology_bits)
|
||||
}
|
||||
|
||||
pub fn primitive_topology(&self) -> PrimitiveTopology {
|
||||
let primitive_topology_bits =
|
||||
(self.bits >> Self::PRIMITIVE_TOPOLOGY_SHIFT_BITS) & Self::PRIMITIVE_TOPOLOGY_MASK_BITS;
|
||||
let primitive_topology_bits = (self.bits() >> Self::PRIMITIVE_TOPOLOGY_SHIFT_BITS)
|
||||
& Self::PRIMITIVE_TOPOLOGY_MASK_BITS;
|
||||
match primitive_topology_bits {
|
||||
x if x == PrimitiveTopology::PointList as u32 => PrimitiveTopology::PointList,
|
||||
x if x == PrimitiveTopology::LineList as u32 => PrimitiveTopology::LineList,
|
||||
|
|
|
@ -62,7 +62,7 @@ wgpu-hal = "0.16.0"
|
|||
codespan-reporting = "0.11.0"
|
||||
naga = { version = "0.12.0", features = ["wgsl-in"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
bitflags = "1.2.1"
|
||||
bitflags = "2.3"
|
||||
smallvec = { version = "1.6", features = ["union", "const_generics"] }
|
||||
once_cell = "1.4.1" # TODO: replace once_cell with std equivalent if/when this lands: https://github.com/rust-lang/rfcs/pull/2788
|
||||
downcast-rs = "1.2.0"
|
||||
|
|
|
@ -555,7 +555,7 @@ impl RenderAsset for Image {
|
|||
}
|
||||
|
||||
bitflags::bitflags! {
|
||||
#[derive(Default)]
|
||||
#[derive(Default, Clone, Copy, Eq, PartialEq, Debug)]
|
||||
#[repr(transparent)]
|
||||
pub struct CompressedImageFormats: u32 {
|
||||
const NONE = 0;
|
||||
|
|
|
@ -63,12 +63,14 @@ impl std::cmp::PartialEq<&Visibility> for Visibility {
|
|||
}
|
||||
|
||||
bitflags::bitflags! {
|
||||
#[derive(Reflect)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub(super) struct ComputedVisibilityFlags: u8 {
|
||||
const VISIBLE_IN_VIEW = 1 << 0;
|
||||
const VISIBLE_IN_HIERARCHY = 1 << 1;
|
||||
}
|
||||
}
|
||||
bevy_reflect::impl_reflect_value!(ComputedVisibilityFlags);
|
||||
bevy_reflect::impl_from_reflect_value!(ComputedVisibilityFlags);
|
||||
|
||||
/// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering
|
||||
#[derive(Component, Clone, Reflect, Debug, Eq, PartialEq)]
|
||||
|
@ -95,7 +97,7 @@ impl ComputedVisibility {
|
|||
/// Reading it during [`Update`](bevy_app::Update) will yield the value from the previous frame.
|
||||
#[inline]
|
||||
pub fn is_visible(&self) -> bool {
|
||||
self.flags.bits == ComputedVisibilityFlags::all().bits
|
||||
self.flags.bits() == ComputedVisibilityFlags::all().bits()
|
||||
}
|
||||
|
||||
/// Whether this entity is visible in the entity hierarchy, which is determined by the [`Visibility`] component.
|
||||
|
|
|
@ -30,4 +30,4 @@ fixedbitset = "0.4"
|
|||
guillotiere = "0.6.0"
|
||||
thiserror = "1.0"
|
||||
rectangle-pack = "0.4"
|
||||
bitflags = "1.2"
|
||||
bitflags = "2.3"
|
||||
|
|
|
@ -152,7 +152,7 @@ pub fn extract_mesh2d(
|
|||
(
|
||||
Mesh2dHandle(handle.0.clone_weak()),
|
||||
Mesh2dUniform {
|
||||
flags: MeshFlags::empty().bits,
|
||||
flags: MeshFlags::empty().bits(),
|
||||
transform,
|
||||
inverse_transpose_model: transform.inverse().transpose(),
|
||||
},
|
||||
|
@ -283,6 +283,7 @@ impl Mesh2dPipeline {
|
|||
}
|
||||
|
||||
bitflags::bitflags! {
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
#[repr(transparent)]
|
||||
// NOTE: Apparently quadro drivers support up to 64x MSAA.
|
||||
// MSAA uses the highest 3 bits for the MSAA log2(sample count) to support up to 128x MSAA.
|
||||
|
@ -318,7 +319,7 @@ impl Mesh2dPipelineKey {
|
|||
pub fn from_msaa_samples(msaa_samples: u32) -> Self {
|
||||
let msaa_bits =
|
||||
(msaa_samples.trailing_zeros() & Self::MSAA_MASK_BITS) << Self::MSAA_SHIFT_BITS;
|
||||
Self::from_bits(msaa_bits).unwrap()
|
||||
Self::from_bits_retain(msaa_bits)
|
||||
}
|
||||
|
||||
pub fn from_hdr(hdr: bool) -> Self {
|
||||
|
@ -330,19 +331,19 @@ impl Mesh2dPipelineKey {
|
|||
}
|
||||
|
||||
pub fn msaa_samples(&self) -> u32 {
|
||||
1 << ((self.bits >> Self::MSAA_SHIFT_BITS) & Self::MSAA_MASK_BITS)
|
||||
1 << ((self.bits() >> Self::MSAA_SHIFT_BITS) & Self::MSAA_MASK_BITS)
|
||||
}
|
||||
|
||||
pub fn from_primitive_topology(primitive_topology: PrimitiveTopology) -> Self {
|
||||
let primitive_topology_bits = ((primitive_topology as u32)
|
||||
& Self::PRIMITIVE_TOPOLOGY_MASK_BITS)
|
||||
<< Self::PRIMITIVE_TOPOLOGY_SHIFT_BITS;
|
||||
Self::from_bits(primitive_topology_bits).unwrap()
|
||||
Self::from_bits_retain(primitive_topology_bits)
|
||||
}
|
||||
|
||||
pub fn primitive_topology(&self) -> PrimitiveTopology {
|
||||
let primitive_topology_bits =
|
||||
(self.bits >> Self::PRIMITIVE_TOPOLOGY_SHIFT_BITS) & Self::PRIMITIVE_TOPOLOGY_MASK_BITS;
|
||||
let primitive_topology_bits = (self.bits() >> Self::PRIMITIVE_TOPOLOGY_SHIFT_BITS)
|
||||
& Self::PRIMITIVE_TOPOLOGY_MASK_BITS;
|
||||
match primitive_topology_bits {
|
||||
x if x == PrimitiveTopology::PointList as u32 => PrimitiveTopology::PointList,
|
||||
x if x == PrimitiveTopology::LineList as u32 => PrimitiveTopology::LineList,
|
||||
|
|
|
@ -137,6 +137,7 @@ impl FromWorld for SpritePipeline {
|
|||
}
|
||||
|
||||
bitflags::bitflags! {
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
#[repr(transparent)]
|
||||
// NOTE: Apparently quadro drivers support up to 64x MSAA.
|
||||
// MSAA uses the highest 3 bits for the MSAA log2(sample count) to support up to 128x MSAA.
|
||||
|
@ -170,12 +171,12 @@ impl SpritePipelineKey {
|
|||
pub const fn from_msaa_samples(msaa_samples: u32) -> Self {
|
||||
let msaa_bits =
|
||||
(msaa_samples.trailing_zeros() & Self::MSAA_MASK_BITS) << Self::MSAA_SHIFT_BITS;
|
||||
Self::from_bits_truncate(msaa_bits)
|
||||
Self::from_bits_retain(msaa_bits)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn msaa_samples(&self) -> u32 {
|
||||
1 << ((self.bits >> Self::MSAA_SHIFT_BITS) & Self::MSAA_MASK_BITS)
|
||||
1 << ((self.bits() >> Self::MSAA_SHIFT_BITS) & Self::MSAA_MASK_BITS)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -10,4 +10,4 @@ license = "MIT OR Apache-2.0"
|
|||
toml_edit = "0.19"
|
||||
tera = "1.15"
|
||||
serde = { version = "1.0", features = [ "derive" ] }
|
||||
bitflags = "1.3"
|
||||
bitflags = "2.3"
|
||||
|
|
|
@ -4,6 +4,7 @@ mod examples;
|
|||
mod features;
|
||||
|
||||
bitflags! {
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
struct Command: u32 {
|
||||
const CHECK_MISSING = 0b00000001;
|
||||
const UPDATE = 0b00000010;
|
||||
|
@ -11,6 +12,7 @@ bitflags! {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
struct Target: u32 {
|
||||
const EXAMPLES = 0b00000001;
|
||||
const FEATURES = 0b00000010;
|
||||
|
|
|
@ -8,4 +8,4 @@ license = "MIT OR Apache-2.0"
|
|||
|
||||
[dependencies]
|
||||
xshell = "0.2"
|
||||
bitflags = "1.3"
|
||||
bitflags = "2.3"
|
||||
|
|
|
@ -3,6 +3,7 @@ use xshell::{cmd, Shell};
|
|||
use bitflags::bitflags;
|
||||
|
||||
bitflags! {
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
struct Check: u32 {
|
||||
const FORMAT = 0b00000001;
|
||||
const CLIPPY = 0b00000010;
|
||||
|
|
Loading…
Reference in a new issue