Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync changes from mozilla-central #3735

Merged
merged 11 commits into from Aug 15, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Bug 1573886 - Fix backdrop-filter blur errors due to incorrect scalin…

  • Loading branch information
cbrewster authored and moz-gfx committed Aug 15, 2019
commit 60d37bd256aebf5b18b13c8cdff4b4f53a2ef315
@@ -25,14 +25,16 @@ in int aBlurDirection;
struct BlurTask {
RenderTaskCommonData common_data;
float blur_radius;
vec2 blur_region;
};

BlurTask fetch_blur_task(int address) {
RenderTaskData task_data = fetch_render_task_data(address);

BlurTask task = BlurTask(
task_data.common_data,
task_data.user_data.x
task_data.user_data.x,
task_data.user_data.yz
);

return task;
@@ -72,7 +74,7 @@ void main(void) {
}

vUvRect = vec4(src_rect.p0 + vec2(0.5),
src_rect.p0 + src_rect.size - vec2(0.5));
src_rect.p0 + blur_task.blur_region - vec2(0.5));
vUvRect /= texture_size.xyxy;

vec2 pos = target_rect.p0 + target_rect.size * aPosition.xy;
@@ -2563,7 +2563,7 @@ impl PicturePrimitive {
blur_std_deviation * scale_factors.0,
blur_std_deviation * scale_factors.1
);
let device_rect = if self.options.inflate_if_required {
let mut device_rect = if self.options.inflate_if_required {
let inflation_factor = frame_state.surfaces[raster_config.surface_index.0].inflation_factor;
let inflation_factor = (inflation_factor * device_pixel_scale.0).ceil();

@@ -2582,26 +2582,26 @@ impl PicturePrimitive {
.intersection(&unclipped)
.unwrap();

let mut device_rect = match device_rect.try_cast::<i32>() {
match device_rect.try_cast::<i32>() {
Some(rect) => rect,
None => {
return None
}
};

// Adjust the size to avoid introducing sampling errors during the down-scaling passes.
// what would be even better is to rasterize the picture at the down-scaled size
// directly.
device_rect.size = RenderTask::adjusted_blur_source_size(
device_rect.size,
blur_std_deviation,
);

device_rect
}
} else {
clipped
};

let original_size = device_rect.size;

// Adjust the size to avoid introducing sampling errors during the down-scaling passes.
// what would be even better is to rasterize the picture at the down-scaled size
// directly.
device_rect.size = RenderTask::adjusted_blur_source_size(
device_rect.size,
blur_std_deviation,
);

let uv_rect_kind = calculate_uv_rect_kind(
&pic_rect,
&transform,
@@ -2630,6 +2630,7 @@ impl PicturePrimitive {
RenderTargetKind::Color,
ClearMode::Transparent,
None,
original_size,
);

Some((blur_render_task_id, picture_task_id))
@@ -2701,6 +2702,7 @@ impl PicturePrimitive {
RenderTargetKind::Color,
ClearMode::Transparent,
Some(&mut blur_tasks),
device_rect.size,
);
}

@@ -559,6 +559,7 @@ pub struct BlurTask {
pub blur_std_deviation: f32,
pub target_kind: RenderTargetKind,
pub uv_rect_handle: GpuCacheHandle,
pub blur_region: DeviceIntSize,
uv_rect_kind: UvRectKind,
}

@@ -975,6 +976,7 @@ impl RenderTask {
RenderTargetKind::Alpha,
ClearMode::Zero,
None,
cache_size,
)
}
));
@@ -1086,6 +1088,7 @@ impl RenderTask {
target_kind: RenderTargetKind,
clear_mode: ClearMode,
mut blur_cache: Option<&mut BlurTaskCache>,
blur_region: DeviceIntSize,
) -> RenderTaskId {
// Adjust large std deviation value.
let mut adjusted_blur_std_deviation = blur_std_deviation;
@@ -1137,6 +1140,8 @@ impl RenderTask {
None => None,
};

let blur_region = blur_region / (scale_factor as i32);

let blur_task_id = cached_task.unwrap_or_else(|| {
let blur_task_v = RenderTask::with_dynamic_location(
adjusted_blur_target_size,
@@ -1145,6 +1150,7 @@ impl RenderTask {
blur_std_deviation: adjusted_blur_std_deviation.height,
target_kind,
uv_rect_handle: GpuCacheHandle::new(),
blur_region,
uv_rect_kind,
}),
clear_mode,
@@ -1159,6 +1165,7 @@ impl RenderTask {
blur_std_deviation: adjusted_blur_std_deviation.width,
target_kind,
uv_rect_handle: GpuCacheHandle::new(),
blur_region,
uv_rect_kind,
}),
clear_mode,
@@ -1363,6 +1370,7 @@ impl RenderTask {
RenderTargetKind::Color,
ClearMode::Transparent,
None,
content_size,
)
}
FilterPrimitiveKind::Opacity(ref opacity) => {
@@ -1432,6 +1440,7 @@ impl RenderTask {
RenderTargetKind::Color,
ClearMode::Transparent,
None,
content_size,
);

let task = RenderTask::new_svg_filter_primitive(
@@ -1585,8 +1594,8 @@ impl RenderTask {
RenderTaskKind::HorizontalBlur(ref task) => {
[
task.blur_std_deviation,
0.0,
0.0,
task.blur_region.width as f32,
task.blur_region.height as f32,
]
}
RenderTaskKind::Readback(..) |
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.