Skip to content

Commit

Permalink
Auto merge of #4835 - moz-gfx:github-sync, r=auto
Browse files Browse the repository at this point in the history
Sync changes from mozilla-central gfx/wr

None
  • Loading branch information
bors-servo authored Jan 31, 2024
2 parents b0e4bdd + edef1db commit 8ce388e
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 8 deletions.
12 changes: 11 additions & 1 deletion webrender/src/clip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ impl From<ClipItemKey> for ClipNode {
// Flags that are attached to instances of clip nodes.
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, MallocSizeOf)]
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, MallocSizeOf)]
pub struct ClipNodeFlags(u8);

bitflags! {
Expand All @@ -905,6 +905,16 @@ bitflags! {
}
}

impl core::fmt::Debug for ClipNodeFlags {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if self.is_empty() {
write!(f, "{:#x}", Self::empty().bits())
} else {
bitflags::parser::to_writer(self, f)
}
}
}

// When a clip node is found to be valid for a
// clip chain instance, it's stored in an index
// buffer style structure. This struct contains
Expand Down
12 changes: 11 additions & 1 deletion webrender/src/gpu_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ pub struct MaskInstance {
/// code should process this instance.
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, MallocSizeOf)]
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, MallocSizeOf)]
pub struct BrushFlags(u16);

bitflags! {
Expand Down Expand Up @@ -646,6 +646,16 @@ bitflags! {
}
}

impl core::fmt::Debug for BrushFlags {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if self.is_empty() {
write!(f, "{:#x}", Self::empty().bits())
} else {
bitflags::parser::to_writer(self, f)
}
}
}

/// Convenience structure to encode into PrimitiveInstanceData.
pub struct BrushInstance {
pub prim_header_index: PrimitiveHeaderIndex,
Expand Down
12 changes: 11 additions & 1 deletion webrender/src/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const MAX_SEGMENTS: usize = 64;
/// `write_transform_vertex()` function.
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, MallocSizeOf)]
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, MallocSizeOf)]
pub struct EdgeAaSegmentMask(u8);

bitflags! {
Expand All @@ -86,6 +86,16 @@ bitflags! {
}
}

impl core::fmt::Debug for EdgeAaSegmentMask {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if self.is_empty() {
write!(f, "{:#x}", Self::empty().bits())
} else {
bitflags::parser::to_writer(self, f)
}
}
}

bitflags! {
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct ItemFlags: u8 {
Expand Down
24 changes: 22 additions & 2 deletions webrender_api/src/display_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub type ItemTag = (u64, u16);
pub type ItemKey = u16;

#[repr(C)]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, MallocSizeOf, Serialize, PeekPoke)]
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, MallocSizeOf, Serialize, PeekPoke)]
pub struct PrimitiveFlags(u8);

bitflags! {
Expand All @@ -59,6 +59,16 @@ bitflags! {
}
}

impl core::fmt::Debug for PrimitiveFlags {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if self.is_empty() {
write!(f, "{:#x}", Self::empty().bits())
} else {
bitflags::parser::to_writer(self, f)
}
}
}

impl Default for PrimitiveFlags {
fn default() -> Self {
PrimitiveFlags::IS_BACKFACE_VISIBLE
Expand Down Expand Up @@ -933,7 +943,7 @@ impl Hash for RasterSpace {
}

#[repr(C)]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, MallocSizeOf, Serialize, PeekPoke)]
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, MallocSizeOf, Serialize, PeekPoke)]
pub struct StackingContextFlags(u8);

bitflags! {
Expand All @@ -948,6 +958,16 @@ bitflags! {
}
}

impl core::fmt::Debug for StackingContextFlags {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if self.is_empty() {
write!(f, "{:#x}", Self::empty().bits())
} else {
bitflags::parser::to_writer(self, f)
}
}
}

impl Default for StackingContextFlags {
fn default() -> Self {
StackingContextFlags::empty()
Expand Down
12 changes: 11 additions & 1 deletion webrender_api/src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl Default for GlyphOptions {
}

#[repr(C)]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, MallocSizeOf, Serialize, PeekPoke)]
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, MallocSizeOf, Serialize, PeekPoke)]
pub struct FontInstanceFlags(u32);

bitflags! {
Expand Down Expand Up @@ -220,6 +220,16 @@ bitflags! {
}
}

impl core::fmt::Debug for FontInstanceFlags {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if self.is_empty() {
write!(f, "{:#x}", Self::empty().bits())
} else {
bitflags::parser::to_writer(self, f)
}
}
}

impl Default for FontInstanceFlags {
#[cfg(target_os = "windows")]
fn default() -> FontInstanceFlags {
Expand Down
24 changes: 22 additions & 2 deletions webrender_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ pub enum IntParameter {

/// Flags to track why we are rendering.
#[repr(C)]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Default, Deserialize, MallocSizeOf, Serialize)]
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Default, Deserialize, MallocSizeOf, Serialize)]
pub struct RenderReasons(u32);

bitflags! {
Expand Down Expand Up @@ -633,13 +633,23 @@ bitflags! {
}
}

impl core::fmt::Debug for RenderReasons {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if self.is_empty() {
write!(f, "{:#x}", Self::empty().bits())
} else {
bitflags::parser::to_writer(self, f)
}
}
}

impl RenderReasons {
pub const NUM_BITS: u32 = 17;
}

/// Flags to enable/disable various builtin debugging tools.
#[repr(C)]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Default, Deserialize, MallocSizeOf, Serialize)]
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Default, Deserialize, MallocSizeOf, Serialize)]
pub struct DebugFlags(u32);

bitflags! {
Expand Down Expand Up @@ -713,6 +723,16 @@ bitflags! {
}
}

impl core::fmt::Debug for DebugFlags {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if self.is_empty() {
write!(f, "{:#x}", Self::empty().bits())
} else {
bitflags::parser::to_writer(self, f)
}
}
}

/// Information specific to a primitive type that
/// uniquely identifies a primitive template by key.
#[derive(Debug, Clone, Eq, MallocSizeOf, PartialEq, Hash, Serialize, Deserialize)]
Expand Down

0 comments on commit 8ce388e

Please sign in to comment.