Commit e65e56a1 authored by Nicolas Silva's avatar Nicolas Silva
Browse files

Bug 1757588 - Reorganize the primitive instance flag bits. r=gw

The goal is to allow the brush flags to use more bits in a followup changes.Currently it uses all of its available 8 bits, this patch allows it to use up to 12.

Differential Revision: https://phabricator.services.mozilla.com/D140967
parent 1b5cf105
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -95,8 +95,8 @@ void brush_shader_main_vs(
    PictureTask pic_task,
    ClipArea clip_area
) {
    int edge_flags = instance.flags & 0xff;
    int brush_flags = (instance.flags >> 8) & 0xff;
    int edge_flags = (instance.flags >> 12) & 0xf;
    int brush_flags = instance.flags & 0xfff;

    // Fetch the segment of this brush primitive we are drawing.
    vec4 segment_data;
+6 −3
Original line number Diff line number Diff line
@@ -545,12 +545,15 @@ impl From<SplitCompositeInstance> for PrimitiveInstanceData {
}

bitflags! {
    // Note: This can use up to 12 bits due to how it will
    // be packed in the instance data.

    /// Flags that define how the common brush shader
    /// code should process this instance.
    #[cfg_attr(feature = "capture", derive(Serialize))]
    #[cfg_attr(feature = "replay", derive(Deserialize))]
    #[derive(MallocSizeOf)]
    pub struct BrushFlags: u8 {
    pub struct BrushFlags: u16 {
        /// Apply perspective interpolation to UVs
        const PERSPECTIVE_INTERPOLATION = 1;
        /// Do interpolation relative to segment rect,
@@ -590,8 +593,8 @@ impl From<BrushInstance> for PrimitiveInstanceData {
                ((instance.render_task_address.0 as i32) << 16)
                | instance.clip_task_address.0 as i32,
                instance.segment_index
                | ((instance.edge_flags.bits() as i32) << 16)
                | ((instance.brush_flags.bits() as i32) << 24),
                | ((instance.brush_flags.bits() as i32) << 16)
                | ((instance.edge_flags.bits() as i32) << 28),
                instance.resource_address,
            ]
        }
+3 −0
Original line number Diff line number Diff line
@@ -60,6 +60,9 @@ use smallvec::SmallVec;
const MAX_SEGMENTS: usize = 64;

bitflags! {
    // Note: This can use up to 4 bits due to how it will be packed in
    // the instance data.

    /// Each bit of the edge AA mask is:
    /// 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