Bug 1711806 - Backed out changeset 456370072e8f for causing bug 1711806 and bug 1711808. r=gfx-reviewers,aosmond

Differential Revision: https://phabricator.services.mozilla.com/D115489
This commit is contained in:
Nicolas Silva 2021-05-19 14:13:22 +00:00
Родитель 4e346690ad
Коммит 41d60e3642
1 изменённых файлов: 71 добавлений и 52 удалений

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

@ -1161,7 +1161,7 @@ impl BatchBuilder {
// TODO: it would be less error-prone to get this info from the texture cache.
let image_buffer_kind = ImageBufferKind::Texture2D;
let blend_mode = if !common_data.opacity.is_opaque ||
let non_segmented_blend_mode = if !common_data.opacity.is_opaque ||
prim_info.clip_task_index != ClipTaskIndex::INVALID ||
transform_kind == TransformedRectKind::Complex
{
@ -1199,7 +1199,8 @@ impl BatchBuilder {
Some(border_data.brush_segments.as_slice()),
common_data.opacity,
&batch_params,
blend_mode,
specified_blend_mode,
non_segmented_blend_mode,
batch_features,
prim_header_index,
bounding_rect,
@ -1536,7 +1537,7 @@ impl BatchBuilder {
}
PrimitiveInstanceKind::Picture { pic_index, segment_instance_index, .. } => {
let picture = &ctx.prim_store.pictures[pic_index.0];
let blend_mode = BlendMode::PremultipliedAlpha;
let non_segmented_blend_mode = BlendMode::PremultipliedAlpha;
let prim_cache_address = gpu_cache.get_address(&ctx.globals.default_image_handle);
let prim_header = PrimitiveHeader {
@ -1607,7 +1608,7 @@ impl BatchBuilder {
let key = BatchKey::new(
kind,
blend_mode,
non_segmented_blend_mode,
textures,
);
let prim_header_index = prim_headers.push(
@ -1681,8 +1682,8 @@ impl BatchBuilder {
);
// Build batch keys for shadow/content
let shadow_key = BatchKey::new(kind, blend_mode, shadow_textures);
let content_key = BatchKey::new(kind, blend_mode, content_textures);
let shadow_key = BatchKey::new(kind, non_segmented_blend_mode, shadow_textures);
let content_key = BatchKey::new(kind, non_segmented_blend_mode, content_textures);
for (shadow, shadow_gpu_data) in shadows.iter().zip(picture.extra_gpu_data_handles.iter()) {
// Get the GPU cache address of the extra data handle.
@ -2124,7 +2125,7 @@ impl BatchBuilder {
batch_params.prim_user_data,
);
let (opacity, blend_mode) = if is_opaque {
let (opacity, specified_blend_mode) = if is_opaque {
(PrimitiveOpacity::opaque(), BlendMode::None)
} else {
(PrimitiveOpacity::translucent(), BlendMode::PremultipliedAlpha)
@ -2134,7 +2135,8 @@ impl BatchBuilder {
segments,
opacity,
&batch_params,
blend_mode,
specified_blend_mode,
non_segmented_blend_mode,
batch_features,
prim_header_index,
bounding_rect,
@ -2165,7 +2167,7 @@ impl BatchBuilder {
);
let key = BatchKey::new(
kind,
blend_mode,
non_segmented_blend_mode,
textures,
);
let prim_header_index = prim_headers.push(
@ -2214,11 +2216,12 @@ impl BatchBuilder {
let textures = TextureSet::prim_textured(texture);
let prim_cache_address = gpu_cache.get_address(&common_data.gpu_cache_handle);
let blend_mode = if !common_data.opacity.is_opaque ||
let specified_blend_mode = BlendMode::PremultipliedAlpha;
let non_segmented_blend_mode = if !common_data.opacity.is_opaque ||
prim_info.clip_task_index != ClipTaskIndex::INVALID ||
transform_kind == TransformedRectKind::Complex
{
BlendMode::PremultipliedAlpha
specified_blend_mode
} else {
BlendMode::None
};
@ -2252,7 +2255,8 @@ impl BatchBuilder {
Some(border_data.brush_segments.as_slice()),
common_data.opacity,
&batch_params,
blend_mode,
specified_blend_mode,
non_segmented_blend_mode,
batch_features,
prim_header_index,
bounding_rect,
@ -2266,12 +2270,13 @@ impl BatchBuilder {
}
PrimitiveInstanceKind::Rectangle { data_handle, segment_instance_index, .. } => {
let prim_data = &ctx.data_stores.prim[data_handle];
let specified_blend_mode = BlendMode::PremultipliedAlpha;
let blend_mode = if !prim_data.opacity.is_opaque ||
let non_segmented_blend_mode = if !prim_data.opacity.is_opaque ||
prim_info.clip_task_index != ClipTaskIndex::INVALID ||
transform_kind == TransformedRectKind::Complex
{
BlendMode::PremultipliedAlpha
specified_blend_mode
} else {
BlendMode::None
};
@ -2308,7 +2313,8 @@ impl BatchBuilder {
segments,
prim_data.opacity,
&batch_params,
blend_mode,
specified_blend_mode,
non_segmented_blend_mode,
batch_features,
prim_header_index,
bounding_rect,
@ -2374,13 +2380,14 @@ impl BatchBuilder {
0,
);
let specified_blend_mode = BlendMode::PremultipliedAlpha;
let prim_common_data = &ctx.data_stores.as_common_data(&prim_instance);
let blend_mode = if !prim_common_data.opacity.is_opaque ||
let non_segmented_blend_mode = if !prim_common_data.opacity.is_opaque ||
prim_info.clip_task_index != ClipTaskIndex::INVALID ||
transform_kind == TransformedRectKind::Complex
{
BlendMode::PremultipliedAlpha
specified_blend_mode
} else {
BlendMode::None
};
@ -2411,7 +2418,8 @@ impl BatchBuilder {
segments,
prim_common_data.opacity,
&batch_params,
blend_mode,
specified_blend_mode,
non_segmented_blend_mode,
batch_features,
prim_header_index,
bounding_rect,
@ -2429,6 +2437,10 @@ impl BatchBuilder {
let image_data = &ctx.data_stores.image[data_handle].kind;
let common_data = &ctx.data_stores.image[data_handle].common;
let image_instance = &ctx.prim_store.images[image_instance_index];
let specified_blend_mode = match image_data.alpha_type {
AlphaType::PremultipliedAlpha => BlendMode::PremultipliedAlpha,
AlphaType::Alpha => BlendMode::Alpha,
};
let prim_user_data = ImageBrushData {
color_mode: ShaderColorMode::Image,
alpha_type: image_data.alpha_type,
@ -2436,18 +2448,6 @@ impl BatchBuilder {
opacity: 1.0,
}.encode();
let blend_mode = if !common_data.opacity.is_opaque ||
prim_info.clip_task_index != ClipTaskIndex::INVALID ||
transform_kind == TransformedRectKind::Complex
{
match image_data.alpha_type {
AlphaType::PremultipliedAlpha => BlendMode::PremultipliedAlpha,
AlphaType::Alpha => BlendMode::Alpha,
}
} else {
BlendMode::None
};
if image_instance.visible_tiles.is_empty() {
if cfg!(debug_assertions) {
match ctx.resource_cache.get_image_properties(image_data.key) {
@ -2465,6 +2465,15 @@ impl BatchBuilder {
}
};
let non_segmented_blend_mode = if !common_data.opacity.is_opaque ||
prim_info.clip_task_index != ClipTaskIndex::INVALID ||
transform_kind == TransformedRectKind::Complex
{
specified_blend_mode
} else {
BlendMode::None
};
let batch_params = BrushBatchParameters::shared(
BrushBatchKind::Image(texture_source.image_buffer_kind()),
TextureSet::prim_textured(texture_source),
@ -2498,7 +2507,8 @@ impl BatchBuilder {
segments,
common_data.opacity,
&batch_params,
blend_mode,
specified_blend_mode,
non_segmented_blend_mode,
batch_features,
prim_header_index,
bounding_rect,
@ -2555,7 +2565,7 @@ impl BatchBuilder {
);
let batch_key = BatchKey {
blend_mode,
blend_mode: specified_blend_mode,
kind: BatchKind::Brush(BrushBatchKind::Image(texture.image_buffer_kind())),
textures,
};
@ -2579,6 +2589,7 @@ impl BatchBuilder {
}
PrimitiveInstanceKind::LinearGradient { data_handle, ref visible_tiles_range, .. } => {
let prim_data = &ctx.data_stores.linear_grad[data_handle];
let specified_blend_mode = BlendMode::PremultipliedAlpha;
let mut prim_header = PrimitiveHeader {
local_rect: prim_rect,
@ -2587,11 +2598,11 @@ impl BatchBuilder {
transform_id,
};
let blend_mode = if !prim_data.opacity.is_opaque ||
let non_segmented_blend_mode = if !prim_data.opacity.is_opaque ||
prim_info.clip_task_index != ClipTaskIndex::INVALID ||
transform_kind == TransformedRectKind::Complex
{
BlendMode::PremultipliedAlpha
specified_blend_mode
} else {
BlendMode::None
};
@ -2620,7 +2631,8 @@ impl BatchBuilder {
segments,
prim_data.opacity,
&batch_params,
blend_mode,
specified_blend_mode,
non_segmented_blend_mode,
batch_features,
prim_header_index,
bounding_rect,
@ -2640,7 +2652,7 @@ impl BatchBuilder {
).unwrap();
let key = BatchKey {
blend_mode,
blend_mode: specified_blend_mode,
kind: BatchKind::Brush(BrushBatchKind::LinearGradient),
textures: BatchTextures::prim_untextured(clip_mask_texture_id),
};
@ -2673,6 +2685,7 @@ impl BatchBuilder {
PrimitiveInstanceKind::CachedLinearGradient { data_handle, ref visible_tiles_range, .. } => {
let prim_data = &ctx.data_stores.linear_grad[data_handle];
let common_data = &prim_data.common;
let specified_blend_mode = BlendMode::PremultipliedAlpha;
let src_color = render_tasks.resolve_location(prim_data.src_color, gpu_cache);
@ -2699,11 +2712,11 @@ impl BatchBuilder {
opacity: 1.0,
}.encode();
let blend_mode = if !common_data.opacity.is_opaque ||
let non_segmented_blend_mode = if !common_data.opacity.is_opaque ||
prim_info.clip_task_index != ClipTaskIndex::INVALID ||
transform_kind == TransformedRectKind::Complex
{
BlendMode::PremultipliedAlpha
specified_blend_mode
} else {
BlendMode::None
};
@ -2734,7 +2747,8 @@ impl BatchBuilder {
segments,
common_data.opacity,
&batch_params,
blend_mode,
specified_blend_mode,
non_segmented_blend_mode,
batch_features,
prim_header_index,
bounding_rect,
@ -2754,7 +2768,7 @@ impl BatchBuilder {
).unwrap();
let batch_key = BatchKey {
blend_mode,
blend_mode: non_segmented_blend_mode,
kind: BatchKind::Brush(batch_kind),
textures: BatchTextures {
input: textures,
@ -2789,6 +2803,7 @@ impl BatchBuilder {
PrimitiveInstanceKind::RadialGradient { data_handle, ref visible_tiles_range, .. } => {
let prim_data = &ctx.data_stores.radial_grad[data_handle];
let common_data = &prim_data.common;
let specified_blend_mode = BlendMode::PremultipliedAlpha;
let src_color = render_tasks.resolve_location(prim_data.src_color, gpu_cache);
@ -2816,11 +2831,11 @@ impl BatchBuilder {
}.encode();
let blend_mode = if !common_data.opacity.is_opaque ||
let non_segmented_blend_mode = if !common_data.opacity.is_opaque ||
prim_info.clip_task_index != ClipTaskIndex::INVALID ||
transform_kind == TransformedRectKind::Complex
{
BlendMode::PremultipliedAlpha
specified_blend_mode
} else {
BlendMode::None
};
@ -2851,7 +2866,8 @@ impl BatchBuilder {
segments,
common_data.opacity,
&batch_params,
blend_mode,
specified_blend_mode,
non_segmented_blend_mode,
batch_features,
prim_header_index,
bounding_rect,
@ -2871,7 +2887,7 @@ impl BatchBuilder {
).unwrap();
let batch_key = BatchKey {
blend_mode,
blend_mode: non_segmented_blend_mode,
kind: BatchKind::Brush(batch_kind),
textures: BatchTextures {
input: textures,
@ -2907,6 +2923,7 @@ impl BatchBuilder {
PrimitiveInstanceKind::ConicGradient { data_handle, ref visible_tiles_range, .. } => {
let prim_data = &ctx.data_stores.conic_grad[data_handle];
let common_data = &prim_data.common;
let specified_blend_mode = BlendMode::PremultipliedAlpha;
let src_color = render_tasks.resolve_location(prim_data.src_color, gpu_cache);
@ -2934,11 +2951,11 @@ impl BatchBuilder {
}.encode();
let blend_mode = if !common_data.opacity.is_opaque ||
let non_segmented_blend_mode = if !common_data.opacity.is_opaque ||
prim_info.clip_task_index != ClipTaskIndex::INVALID ||
transform_kind == TransformedRectKind::Complex
{
BlendMode::PremultipliedAlpha
specified_blend_mode
} else {
BlendMode::None
};
@ -2969,7 +2986,8 @@ impl BatchBuilder {
segments,
common_data.opacity,
&batch_params,
blend_mode,
specified_blend_mode,
non_segmented_blend_mode,
batch_features,
prim_header_index,
bounding_rect,
@ -2989,7 +3007,7 @@ impl BatchBuilder {
).unwrap();
let batch_key = BatchKey {
blend_mode,
blend_mode: non_segmented_blend_mode,
kind: BatchKind::Brush(batch_kind),
textures: BatchTextures {
input: textures,
@ -3146,7 +3164,8 @@ impl BatchBuilder {
brush_segments: Option<&[BrushSegment]>,
prim_opacity: PrimitiveOpacity,
params: &BrushBatchParameters,
blend_mode: BlendMode,
alpha_blend_mode: BlendMode,
non_segmented_blend_mode: BlendMode,
features: BatchFeatures,
prim_header_index: PrimitiveHeaderIndex,
bounding_rect: &PictureRect,
@ -3173,7 +3192,7 @@ impl BatchBuilder {
segment_index as i32,
params.batch_kind,
prim_header_index,
blend_mode,
alpha_blend_mode,
features,
bounding_rect,
transform_kind,
@ -3199,7 +3218,7 @@ impl BatchBuilder {
segment_index as i32,
params.batch_kind,
prim_header_index,
blend_mode,
alpha_blend_mode,
features,
bounding_rect,
transform_kind,
@ -3227,7 +3246,7 @@ impl BatchBuilder {
};
let batch_key = BatchKey {
blend_mode,
blend_mode: non_segmented_blend_mode,
kind: BatchKind::Brush(params.batch_kind),
textures,
};