Bug 1855870 - Upgrade webrender to bitflags 2. r=gfx-reviewers,gw

Differential Revision: https://phabricator.services.mozilla.com/D189605
This commit is contained in:
Mike Hommey 2023-09-29 08:20:59 +00:00
Родитель 1915d07f5c
Коммит f553129f78
26 изменённых файлов: 118 добавлений и 79 удалений

6
Cargo.lock сгенерированный
Просмотреть файл

@ -6223,7 +6223,7 @@ name = "webrender"
version = "0.62.0" version = "0.62.0"
dependencies = [ dependencies = [
"bincode", "bincode",
"bitflags 1.999.999", "bitflags 2.4.0",
"build-parallel", "build-parallel",
"byteorder", "byteorder",
"derive_more 0.99.999", "derive_more 0.99.999",
@ -6260,7 +6260,7 @@ name = "webrender_api"
version = "0.62.0" version = "0.62.0"
dependencies = [ dependencies = [
"app_units", "app_units",
"bitflags 1.999.999", "bitflags 2.4.0",
"byteorder", "byteorder",
"crossbeam-channel", "crossbeam-channel",
"euclid", "euclid",
@ -6307,7 +6307,7 @@ dependencies = [
name = "webrender_build" name = "webrender_build"
version = "0.0.2" version = "0.0.2"
dependencies = [ dependencies = [
"bitflags 1.999.999", "bitflags 2.4.0",
"lazy_static", "lazy_static",
"serde", "serde",
] ]

Просмотреть файл

@ -574,7 +574,7 @@ static void WebRenderDebugPrefChangeCallback(const char* aPrefName, void*) {
wr::DebugFlags::WINDOW_VISIBILITY_DBG) wr::DebugFlags::WINDOW_VISIBILITY_DBG)
GFX_WEBRENDER_DEBUG(".restrict-blob-size", wr::DebugFlags::RESTRICT_BLOB_SIZE) GFX_WEBRENDER_DEBUG(".restrict-blob-size", wr::DebugFlags::RESTRICT_BLOB_SIZE)
#undef GFX_WEBRENDER_DEBUG #undef GFX_WEBRENDER_DEBUG
gfx::gfxVars::SetWebRenderDebugFlags(flags.bits); gfx::gfxVars::SetWebRenderDebugFlags(flags._0);
} }
static void WebRenderQualityPrefChangeCallback(const char* aPref, void*) { static void WebRenderQualityPrefChangeCallback(const char* aPref, void*) {

51
gfx/wr/Cargo.lock сгенерированный
Просмотреть файл

@ -178,6 +178,15 @@ 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.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "bitvec" name = "bitvec"
version = "0.19.6" version = "0.19.6"
@ -333,7 +342,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b" checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b"
dependencies = [ dependencies = [
"atty", "atty",
"bitflags", "bitflags 1.3.2",
"clap_lex", "clap_lex",
"indexmap", "indexmap",
"strsim", "strsim",
@ -366,7 +375,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 = "6f63902e9223530efb4e26ccd0cf55ec30d592d3b42e21a28defc42a9586e832" checksum = "6f63902e9223530efb4e26ccd0cf55ec30d592d3b42e21a28defc42a9586e832"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"block", "block",
"cocoa-foundation", "cocoa-foundation",
"core-foundation 0.9.2", "core-foundation 0.9.2",
@ -382,7 +391,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 0.9.2", "core-foundation 0.9.2",
"core-graphics-types", "core-graphics-types",
@ -460,7 +469,7 @@ version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"core-foundation 0.7.0", "core-foundation 0.7.0",
"foreign-types 0.3.2", "foreign-types 0.3.2",
"libc", "libc",
@ -472,7 +481,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 0.9.2", "core-foundation 0.9.2",
"core-graphics-types", "core-graphics-types",
"foreign-types 0.3.2", "foreign-types 0.3.2",
@ -485,7 +494,7 @@ version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212" checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"core-foundation 0.9.2", "core-foundation 0.9.2",
"core-graphics-types", "core-graphics-types",
"foreign-types 0.5.0", "foreign-types 0.5.0",
@ -498,7 +507,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"core-foundation 0.9.2", "core-foundation 0.9.2",
"libc", "libc",
] ]
@ -1518,7 +1527,7 @@ version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447a296f7aca299cfbb50f4e4f3d49451549af655fb7215d7f8c0c3d64bad42b" checksum = "447a296f7aca299cfbb50f4e4f3d49451549af655fb7215d7f8c0c3d64bad42b"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"byteorder", "byteorder",
"libc", "libc",
"lmdb-rkv-sys", "lmdb-rkv-sys",
@ -1688,7 +1697,7 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96d868f654c72e75f8687572699cdabe755f03effbb62542768e995d5b8d699d" checksum = "96d868f654c72e75f8687572699cdabe755f03effbb62542768e995d5b8d699d"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"jni-sys", "jni-sys",
"ndk-sys", "ndk-sys",
"num_enum", "num_enum",
@ -1747,7 +1756,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 = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"cc", "cc",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
@ -2055,7 +2064,7 @@ version = "0.16.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "910f09135b1ed14bb16be445a8c23ddf0777eca485fbfc7cee00d81fecab158a" checksum = "910f09135b1ed14bb16be445a8c23ddf0777eca485fbfc7cee00d81fecab158a"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"crc32fast", "crc32fast",
"deflate", "deflate",
"inflate", "inflate",
@ -2214,7 +2223,7 @@ version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
] ]
[[package]] [[package]]
@ -2253,7 +2262,7 @@ checksum = "9f0ea3af1393b22f8fe25615b6fa5d13072b7b622e66acffc8b12b2baa0342b1"
dependencies = [ dependencies = [
"arrayref", "arrayref",
"bincode", "bincode",
"bitflags", "bitflags 1.3.2",
"byteorder", "byteorder",
"id-arena", "id-arena",
"lazy_static", "lazy_static",
@ -2275,7 +2284,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "300a51053b1cb55c80b7a9fde4120726ddf25ca241a1cbb926626f62fb136bff" checksum = "300a51053b1cb55c80b7a9fde4120726ddf25ca241a1cbb926626f62fb136bff"
dependencies = [ dependencies = [
"base64", "base64",
"bitflags", "bitflags 1.3.2",
"serde", "serde",
] ]
@ -2452,7 +2461,7 @@ version = "0.15.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a28f16a97fa0e8ce563b2774d1e732dd5d4025d2772c5dba0a41a0f90a29da3" checksum = "8a28f16a97fa0e8ce563b2774d1e732dd5d4025d2772c5dba0a41a0f90a29da3"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"calloop", "calloop",
"dlib", "dlib",
"lazy_static", "lazy_static",
@ -2958,7 +2967,7 @@ version = "0.29.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91223460e73257f697d9e23d401279123d36039a3f7a449e983f123292d4458f" checksum = "91223460e73257f697d9e23d401279123d36039a3f7a449e983f123292d4458f"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"downcast-rs", "downcast-rs",
"libc", "libc",
"nix", "nix",
@ -3007,7 +3016,7 @@ version = "0.29.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60147ae23303402e41fe034f74fb2c35ad0780ee88a1c40ac09a3be1e7465741" checksum = "60147ae23303402e41fe034f74fb2c35ad0780ee88a1c40ac09a3be1e7465741"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"wayland-client", "wayland-client",
"wayland-commons", "wayland-commons",
"wayland-scanner", "wayland-scanner",
@ -3050,7 +3059,7 @@ name = "webrender"
version = "0.62.0" version = "0.62.0"
dependencies = [ dependencies = [
"bincode", "bincode",
"bitflags", "bitflags 2.4.0",
"build-parallel", "build-parallel",
"byteorder", "byteorder",
"derive_more", "derive_more",
@ -3105,7 +3114,7 @@ name = "webrender_api"
version = "0.62.0" version = "0.62.0"
dependencies = [ dependencies = [
"app_units", "app_units",
"bitflags", "bitflags 2.4.0",
"byteorder", "byteorder",
"crossbeam-channel", "crossbeam-channel",
"euclid", "euclid",
@ -3122,7 +3131,7 @@ dependencies = [
name = "webrender_build" name = "webrender_build"
version = "0.0.2" version = "0.0.2"
dependencies = [ dependencies = [
"bitflags", "bitflags 2.4.0",
"lazy_static", "lazy_static",
"serde", "serde",
] ]
@ -3250,7 +3259,7 @@ version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a" checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"cocoa", "cocoa",
"core-foundation 0.9.2", "core-foundation 0.9.2",
"core-graphics 0.22.3", "core-graphics 0.22.3",

Просмотреть файл

@ -6,6 +6,8 @@ check-alphabetical-order = false
[ignore] [ignore]
# Ignored packages with duplicated versions # Ignored packages with duplicated versions
packages = [ packages = [
# transition to bitflags 2 is underway.
"bitflags",
"cfg-if", "cfg-if",
"core-foundation", "core-foundation",
"core-foundation-sys", "core-foundation-sys",

Просмотреть файл

@ -28,7 +28,7 @@ webrender_build = { version = "0.0.2", path = "../webrender_build" }
[dependencies] [dependencies]
bincode = "1.0" bincode = "1.0"
bitflags = "1.2" bitflags = { version = "2", features = ["serde"] }
byteorder = "1.0" byteorder = "1.0"
euclid = { version = "0.22.0", features = ["serde"] } euclid = { version = "0.22.0", features = ["serde"] }
fxhash = "0.2.1" fxhash = "0.2.1"

Просмотреть файл

@ -523,6 +523,7 @@ bitflags! {
/// Not all shaders necessarily implement all of these features. /// Not all shaders necessarily implement all of these features.
#[cfg_attr(feature = "capture", derive(Serialize))] #[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))] #[cfg_attr(feature = "replay", derive(Deserialize))]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct BatchFeatures: u8 { pub struct BatchFeatures: u8 {
const ALPHA_PASS = 1 << 0; const ALPHA_PASS = 1 << 0;
const ANTIALIASING = 1 << 1; const ANTIALIASING = 1 << 1;

Просмотреть файл

@ -892,11 +892,13 @@ impl From<ClipItemKey> for ClipNode {
} }
// Flags that are attached to instances of clip nodes. // 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)]
pub struct ClipNodeFlags(u8);
bitflags! { bitflags! {
#[cfg_attr(feature = "capture", derive(Serialize))] impl ClipNodeFlags : u8 {
#[cfg_attr(feature = "replay", derive(Deserialize))]
#[derive(MallocSizeOf)]
pub struct ClipNodeFlags: u8 {
const SAME_SPATIAL_NODE = 0x1; const SAME_SPATIAL_NODE = 0x1;
const SAME_COORD_SYSTEM = 0x2; const SAME_COORD_SYSTEM = 0x2;
const USE_FAST_PATH = 0x4; const USE_FAST_PATH = 0x4;

Просмотреть файл

@ -71,6 +71,7 @@ bitflags! {
#[repr(transparent)] #[repr(transparent)]
#[cfg_attr(feature = "capture", derive(Serialize))] #[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))] #[cfg_attr(feature = "replay", derive(Deserialize))]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct QuadFlags : u8 { pub struct QuadFlags : u8 {
const IS_OPAQUE = 1 << 0; const IS_OPAQUE = 1 << 0;
@ -93,6 +94,7 @@ bitflags! {
#[repr(transparent)] #[repr(transparent)]
#[cfg_attr(feature = "capture", derive(Serialize))] #[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))] #[cfg_attr(feature = "replay", derive(Deserialize))]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct MaskFlags : i32 { pub struct MaskFlags : i32 {
const PRIM_SPACE = 1 << 0; const PRIM_SPACE = 1 << 0;
} }

Просмотреть файл

@ -108,6 +108,7 @@ pub enum CompositeSurfaceFormat {
bitflags! { bitflags! {
/// Optional features that can be opted-out of when compositing, /// Optional features that can be opted-out of when compositing,
/// possibly allowing a fast path to be selected. /// possibly allowing a fast path to be selected.
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct CompositeFeatures: u8 { pub struct CompositeFeatures: u8 {
// UV coordinates do not require clamping, for example because the // UV coordinates do not require clamping, for example because the
// entire texture is being composited. // entire texture is being composited.

Просмотреть файл

@ -416,7 +416,7 @@ impl ExternalTexture {
} }
bitflags! { bitflags! {
#[derive(Default)] #[derive(Default, Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct TextureFlags: u32 { pub struct TextureFlags: u32 {
/// This texture corresponds to one of the shared texture caches. /// This texture corresponds to one of the shared texture caches.
const IS_SHARED_TEXTURE_CACHE = 1 << 0; const IS_SHARED_TEXTURE_CACHE = 1 << 0;

Просмотреть файл

@ -605,16 +605,18 @@ pub struct MaskInstance {
} }
bitflags! { // Note: This can use up to 12 bits due to how it will
// Note: This can use up to 12 bits due to how it will // be packed in the instance data.
// be packed in the instance data.
/// Flags that define how the common brush shader /// Flags that define how the common brush shader
/// code should process this instance. /// code should process this instance.
#[cfg_attr(feature = "capture", derive(Serialize))] #[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))] #[cfg_attr(feature = "replay", derive(Deserialize))]
#[derive(MallocSizeOf)] #[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, MallocSizeOf)]
pub struct BrushFlags: u16 { pub struct BrushFlags(u16);
bitflags! {
impl BrushFlags: u16 {
/// Apply perspective interpolation to UVs /// Apply perspective interpolation to UVs
const PERSPECTIVE_INTERPOLATION = 1; const PERSPECTIVE_INTERPOLATION = 1;
/// Do interpolation relative to segment rect, /// Do interpolation relative to segment rect,

Просмотреть файл

@ -3962,6 +3962,7 @@ pub struct RasterConfig {
bitflags! { bitflags! {
/// A set of flags describing why a picture may need a backing surface. /// A set of flags describing why a picture may need a backing surface.
#[cfg_attr(feature = "capture", derive(Serialize))] #[cfg_attr(feature = "capture", derive(Serialize))]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct BlitReason: u32 { pub struct BlitReason: u32 {
/// Mix-blend-mode on a child that requires isolation. /// Mix-blend-mode on a child that requires isolation.
const ISOLATE = 1; const ISOLATE = 1;
@ -4219,6 +4220,7 @@ pub struct OrderedPictureChild {
bitflags! { bitflags! {
/// A set of flags describing why a picture may need a backing surface. /// A set of flags describing why a picture may need a backing surface.
#[cfg_attr(feature = "capture", derive(Serialize))] #[cfg_attr(feature = "capture", derive(Serialize))]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct ClusterFlags: u32 { pub struct ClusterFlags: u32 {
/// Whether this cluster is visible when the position node is a backface. /// Whether this cluster is visible when the position node is a backface.
const IS_BACKFACE_VISIBLE = 1; const IS_BACKFACE_VISIBLE = 1;
@ -4424,6 +4426,7 @@ impl PrimitiveList {
bitflags! { bitflags! {
#[cfg_attr(feature = "capture", derive(Serialize))] #[cfg_attr(feature = "capture", derive(Serialize))]
/// Flags describing properties for a given PicturePrimitive /// Flags describing properties for a given PicturePrimitive
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct PictureFlags : u8 { pub struct PictureFlags : u8 {
/// This picture is a resolve target (doesn't actually render content itself, /// This picture is a resolve target (doesn't actually render content itself,
/// will have content copied in to it) /// will have content copied in to it)

Просмотреть файл

@ -832,6 +832,7 @@ impl fmt::Debug for FrameMsg {
bitflags!{ bitflags!{
/// Bit flags for WR stages to store in a capture. /// Bit flags for WR stages to store in a capture.
// Note: capturing `FRAME` without `SCENE` is not currently supported. // Note: capturing `FRAME` without `SCENE` is not currently supported.
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct CaptureBits: u8 { pub struct CaptureBits: u8 {
/// ///
const SCENE = 0x1; const SCENE = 0x1;
@ -846,6 +847,7 @@ bitflags!{
bitflags!{ bitflags!{
/// Mask for clearing caches in debug commands. /// Mask for clearing caches in debug commands.
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct ClearCache: u8 { pub struct ClearCache: u8 {
/// ///
const IMAGES = 0b1; const IMAGES = 0b1;

Просмотреть файл

@ -5484,7 +5484,7 @@ impl Renderer {
bitflags! { bitflags! {
/// Flags that control how shaders are pre-cached, if at all. /// Flags that control how shaders are pre-cached, if at all.
#[derive(Default)] #[derive(Default, Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct ShaderPrecacheFlags: u32 { pub struct ShaderPrecacheFlags: u32 {
/// Needed for const initialization /// Needed for const initialization
const EMPTY = 0; const EMPTY = 0;

Просмотреть файл

@ -417,6 +417,7 @@ impl PictureChainBuilder {
bitflags! { bitflags! {
/// Slice flags /// Slice flags
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct SliceFlags : u8 { pub struct SliceFlags : u8 {
/// Slice created by a prim that has PrimitiveFlags::IS_SCROLLBAR_CONTAINER /// Slice created by a prim that has PrimitiveFlags::IS_SCROLLBAR_CONTAINER
const IS_SCROLLBAR = 1; const IS_SCROLLBAR = 1;

Просмотреть файл

@ -59,20 +59,22 @@ use smallvec::SmallVec;
// clip mask overhead, and possibly exceeding the maximum row size of the GPU cache. // clip mask overhead, and possibly exceeding the maximum row size of the GPU cache.
const MAX_SEGMENTS: usize = 64; const MAX_SEGMENTS: usize = 64;
bitflags! { // Note: This can use up to 4 bits due to how it will be packed in
// Note: This can use up to 4 bits due to how it will be packed in // the instance data.
// the instance data.
/// Each bit of the edge AA mask is: /// Each bit of the edge AA mask is:
/// 0, when the edge of the primitive needs to be considered for AA /// 0, when the edge of the primitive needs to be considered for AA
/// 1, when the edge of the segment needs to be considered for AA /// 1, when the edge of the segment needs to be considered for AA
/// ///
/// *Note*: the bit values have to match the shader logic in /// *Note*: the bit values have to match the shader logic in
/// `write_transform_vertex()` function. /// `write_transform_vertex()` function.
#[cfg_attr(feature = "capture", derive(Serialize))] #[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))] #[cfg_attr(feature = "replay", derive(Deserialize))]
#[derive(MallocSizeOf)] #[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, MallocSizeOf)]
pub struct EdgeAaSegmentMask: u8 { pub struct EdgeAaSegmentMask(u8);
bitflags! {
impl EdgeAaSegmentMask: u8 {
/// ///
const LEFT = 0x1; const LEFT = 0x1;
/// ///
@ -85,6 +87,7 @@ bitflags! {
} }
bitflags! { bitflags! {
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct ItemFlags: u8 { pub struct ItemFlags: u8 {
const X_ACTIVE = 0x1; const X_ACTIVE = 0x1;
const Y_ACTIVE = 0x2; const Y_ACTIVE = 0x2;

Просмотреть файл

@ -72,6 +72,7 @@ bitflags! {
// TODO(gw): We should also move `is_compositor_surface` to be part of // TODO(gw): We should also move `is_compositor_surface` to be part of
// this flags struct. // this flags struct.
#[cfg_attr(feature = "capture", derive(Serialize))] #[cfg_attr(feature = "capture", derive(Serialize))]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct PrimitiveVisibilityFlags: u8 { pub struct PrimitiveVisibilityFlags: u8 {
/// Implies that this primitive covers the entire picture cache slice, /// Implies that this primitive covers the entire picture cache slice,
/// and can thus be dropped during batching and drawn with clear color. /// and can thus be dropped during batching and drawn with clear color.

Просмотреть файл

@ -15,7 +15,7 @@ display_list_stats = []
[dependencies] [dependencies]
app_units = "0.7.3" app_units = "0.7.3"
bitflags = "1.2" bitflags = { version = "2", features = ["serde"] }
byteorder = "1.2.1" byteorder = "1.2.1"
euclid = { version = "0.22.6", features = ["serde"] } euclid = { version = "0.22.6", features = ["serde"] }
malloc_size_of_derive = "0.1" malloc_size_of_derive = "0.1"

Просмотреть файл

@ -34,10 +34,12 @@ pub type ItemTag = (u64, u16);
/// refers to individual display items, but this may change later. /// refers to individual display items, but this may change later.
pub type ItemKey = u16; pub type ItemKey = u16;
#[repr(C)]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, MallocSizeOf, Serialize, PeekPoke)]
pub struct PrimitiveFlags(u8);
bitflags! { bitflags! {
#[repr(C)] impl PrimitiveFlags: u8 {
#[derive(Deserialize, MallocSizeOf, Serialize, PeekPoke)]
pub struct PrimitiveFlags: u8 {
/// The CSS backface-visibility property (yes, it can be really granular) /// The CSS backface-visibility property (yes, it can be really granular)
const IS_BACKFACE_VISIBLE = 1 << 0; const IS_BACKFACE_VISIBLE = 1 << 0;
/// If set, this primitive represents a scroll bar container /// If set, this primitive represents a scroll bar container
@ -930,10 +932,12 @@ impl Hash for RasterSpace {
} }
} }
#[repr(C)]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, MallocSizeOf, Serialize, PeekPoke)]
pub struct StackingContextFlags(u8);
bitflags! { bitflags! {
#[repr(C)] impl StackingContextFlags: u8 {
#[derive(Deserialize, MallocSizeOf, Serialize, PeekPoke)]
pub struct StackingContextFlags: u8 {
/// If true, this stacking context is a blend container than contains /// If true, this stacking context is a blend container than contains
/// mix-blend-mode children (and should thus be isolated). /// mix-blend-mode children (and should thus be isolated).
const IS_BLEND_CONTAINER = 1 << 0; const IS_BLEND_CONTAINER = 1 << 0;

Просмотреть файл

@ -181,10 +181,12 @@ impl Default for GlyphOptions {
} }
} }
#[repr(C)]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, MallocSizeOf, Serialize, PeekPoke)]
pub struct FontInstanceFlags(u32);
bitflags! { bitflags! {
#[repr(C)] impl FontInstanceFlags: u32 {
#[derive(Deserialize, MallocSizeOf, Serialize, PeekPoke)]
pub struct FontInstanceFlags: u32 {
// Common flags // Common flags
// Use native synthetic bold, if supported. // Use native synthetic bold, if supported.
const SYNTHETIC_BOLD = 1 << 1; const SYNTHETIC_BOLD = 1 << 1;

Просмотреть файл

@ -229,7 +229,7 @@ impl ColorDepth {
bitflags! { bitflags! {
/// Various flags that are part of an image descriptor. /// Various flags that are part of an image descriptor.
#[derive(Deserialize, Serialize)] #[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, Serialize)]
pub struct ImageDescriptorFlags: u32 { pub struct ImageDescriptorFlags: u32 {
/// Whether this image is opaque, or has an alpha channel. Avoiding blending /// Whether this image is opaque, or has an alpha channel. Avoiding blending
/// for opaque surfaces is an important optimization. /// for opaque surfaces is an important optimization.

Просмотреть файл

@ -576,11 +576,13 @@ pub enum IntParameter {
BatchedUploadThreshold = 0, BatchedUploadThreshold = 0,
} }
/// Flags to track why we are rendering.
#[repr(C)]
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Default, Deserialize, MallocSizeOf, Serialize)]
pub struct RenderReasons(u32);
bitflags! { bitflags! {
/// Flags to track why we are rendering. impl RenderReasons: u32 {
#[repr(C)]
#[derive(Default, Deserialize, MallocSizeOf, Serialize)]
pub struct RenderReasons: u32 {
/// Equivalent of empty() for the C++ side. /// Equivalent of empty() for the C++ side.
const NONE = 0; const NONE = 0;
const SCENE = 1 << 0; const SCENE = 1 << 0;
@ -618,11 +620,13 @@ impl RenderReasons {
pub const NUM_BITS: u32 = 17; 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)]
pub struct DebugFlags(u32);
bitflags! { bitflags! {
/// Flags to enable/disable various builtin debugging tools. impl DebugFlags: u32 {
#[repr(C)]
#[derive(Default, Deserialize, MallocSizeOf, Serialize)]
pub struct DebugFlags: u32 {
/// Display the frame profiler on screen. /// Display the frame profiler on screen.
const PROFILER_DBG = 1 << 0; const PROFILER_DBG = 1 << 0;
/// Display intermediate render targets on screen. /// Display intermediate render targets on screen.

Просмотреть файл

@ -11,6 +11,6 @@ edition = "2018"
serialize_program = ["serde"] serialize_program = ["serde"]
[dependencies] [dependencies]
bitflags = "1.2" bitflags = "2"
lazy_static = "1" lazy_static = "1"
serde = { optional = true, version = "1.0", features = ["serde_derive"] } serde = { optional = true, version = "1.0", features = ["serde_derive"] }

Просмотреть файл

@ -5,7 +5,7 @@
use std::collections::HashMap; use std::collections::HashMap;
bitflags! { bitflags! {
#[derive(Default)] #[derive(Default, Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct ShaderFeatureFlags: u32 { pub struct ShaderFeatureFlags: u32 {
const GL = 1 << 0; const GL = 1 << 0;
const GLES = 1 << 1; const GLES = 1 << 1;

Просмотреть файл

@ -7101,7 +7101,7 @@ void nsWindow::OnSizeModeChange() {
this, mode != nsSizeMode_Minimized); this, mode != nsSizeMode_Minimized);
wr::DebugFlags flags{0}; wr::DebugFlags flags{0};
flags.bits = gfx::gfxVars::WebRenderDebugFlags(); flags._0 = gfx::gfxVars::WebRenderDebugFlags();
bool debugEnabled = bool(flags & wr::DebugFlags::WINDOW_VISIBILITY_DBG); bool debugEnabled = bool(flags & wr::DebugFlags::WINDOW_VISIBILITY_DBG);
if (debugEnabled && mCompositorWidgetDelegate) { if (debugEnabled && mCompositorWidgetDelegate) {
mCompositorWidgetDelegate->NotifyVisibilityUpdated(mode, mCompositorWidgetDelegate->NotifyVisibilityUpdated(mode,

Просмотреть файл

@ -407,7 +407,7 @@ void nsWindow::NotifyOcclusionState(mozilla::widget::OcclusionState aState) {
mIsFullyOccluded, mFrameState->GetSizeMode())); mIsFullyOccluded, mFrameState->GetSizeMode()));
wr::DebugFlags flags{0}; wr::DebugFlags flags{0};
flags.bits = gfx::gfxVars::WebRenderDebugFlags(); flags._0 = gfx::gfxVars::WebRenderDebugFlags();
bool debugEnabled = bool(flags & wr::DebugFlags::WINDOW_VISIBILITY_DBG); bool debugEnabled = bool(flags & wr::DebugFlags::WINDOW_VISIBILITY_DBG);
if (debugEnabled && mCompositorWidgetDelegate) { if (debugEnabled && mCompositorWidgetDelegate) {
mCompositorWidgetDelegate->NotifyVisibilityUpdated( mCompositorWidgetDelegate->NotifyVisibilityUpdated(
@ -434,7 +434,7 @@ void nsWindow::MaybeEnableWindowOcclusion(bool aEnable) {
WinWindowOcclusionTracker::Get()->Enable(this, mWnd); WinWindowOcclusionTracker::Get()->Enable(this, mWnd);
wr::DebugFlags flags{0}; wr::DebugFlags flags{0};
flags.bits = gfx::gfxVars::WebRenderDebugFlags(); flags._0 = gfx::gfxVars::WebRenderDebugFlags();
bool debugEnabled = bool(flags & wr::DebugFlags::WINDOW_VISIBILITY_DBG); bool debugEnabled = bool(flags & wr::DebugFlags::WINDOW_VISIBILITY_DBG);
if (debugEnabled && mCompositorWidgetDelegate) { if (debugEnabled && mCompositorWidgetDelegate) {
mCompositorWidgetDelegate->NotifyVisibilityUpdated( mCompositorWidgetDelegate->NotifyVisibilityUpdated(
@ -455,7 +455,7 @@ void nsWindow::MaybeEnableWindowOcclusion(bool aEnable) {
NotifyOcclusionState(OcclusionState::VISIBLE); NotifyOcclusionState(OcclusionState::VISIBLE);
wr::DebugFlags flags{0}; wr::DebugFlags flags{0};
flags.bits = gfx::gfxVars::WebRenderDebugFlags(); flags._0 = gfx::gfxVars::WebRenderDebugFlags();
bool debugEnabled = bool(flags & wr::DebugFlags::WINDOW_VISIBILITY_DBG); bool debugEnabled = bool(flags & wr::DebugFlags::WINDOW_VISIBILITY_DBG);
if (debugEnabled && mCompositorWidgetDelegate) { if (debugEnabled && mCompositorWidgetDelegate) {
mCompositorWidgetDelegate->NotifyVisibilityUpdated( mCompositorWidgetDelegate->NotifyVisibilityUpdated(