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

Fix reftest failure in opacity_simple test. #373

Merged
merged 2 commits into from Aug 26, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -1519,6 +1519,14 @@ impl Renderer {
fn draw_tile_frame(&mut self,
frame: &Frame,
framebuffer_size: &Size2D<u32>) {
// Some tests use a restricted viewport smaller than the main screen size.
// Ensure we clear the framebuffer in these tests.
// TODO(gw): Find a better solution for this?
let viewport_size = Size2D::new(frame.viewport_size.width * self.device_pixel_ratio as i32,
frame.viewport_size.height * self.device_pixel_ratio as i32);
let needs_clear = viewport_size.width < framebuffer_size.width as i32 ||
viewport_size.height < framebuffer_size.height as i32;

//println!("render {} debug rects", frame.debug_rects.len());
self.gpu_profile_paint.begin();
self.gpu_profile_paint.end();
@@ -1567,7 +1575,7 @@ impl Renderer {
None);
}

for phase in &frame.phases {
for (phase_index, phase) in frame.phases.iter().enumerate() {
let mut render_target_index = 0;

for target in &phase.targets {
@@ -1577,7 +1585,7 @@ impl Renderer {
target,
&Size2D::new(framebuffer_size.width as f32, framebuffer_size.height as f32),
ct_index,
false);
needs_clear && phase_index == 0);
} else {
let rt_index = self.render_targets[render_target_index];
let ct_index = self.render_targets[1 - render_target_index];
@@ -216,16 +216,11 @@ impl AlphaBatcher {

if existing_batch_index == batches.len() {
let new_batch = match item {
AlphaRenderItem::Composite(info) => {
PrimitiveBatch::composite(task.child_rects[0],
task.child_rects[1],
task.target_rect,
info)
AlphaRenderItem::Composite(..) => {
PrimitiveBatch::composite()
}
AlphaRenderItem::Blend(child_index, opacity) => {
PrimitiveBatch::blend(task.child_rects[child_index],
task.target_rect,
opacity)
AlphaRenderItem::Blend(..) => {
PrimitiveBatch::blend()
}
AlphaRenderItem::Primitive(_, prim_index) => {
// See if this task fits into the tile UBO
@@ -836,10 +831,10 @@ impl Primitive {
length: 1,
};
let glyph = auxiliary_lists.glyph_instances(&glyph_range)[0];
let mut glyph_key = GlyphKey::new(text.font_key,
text.size,
text.blur_radius,
glyph.index);
let glyph_key = GlyphKey::new(text.font_key,
text.size,
text.blur_radius,
glyph.index);
let blur_offset = text.blur_radius.to_f32_px() *
(BLUR_INFLATION_FACTOR as f32) / 2.0;

@@ -1971,44 +1966,25 @@ pub struct PrimitiveBatch {
}

impl PrimitiveBatch {
fn blend(src_rect: Rect<DevicePixel>,
target_rect: Rect<DevicePixel>,
opacity: f32) -> PrimitiveBatch {
let blend = PackedBlendPrimitive {
src_rect: src_rect,
target_rect: target_rect,
opacity: opacity,
padding: [0, 0, 0],
};

fn blend() -> PrimitiveBatch {
PrimitiveBatch {
color_texture_id: TextureId(0),
transform_kind: TransformedRectKind::AxisAligned,
layer_ubo_index: 0,
tile_ubo_index: 0,
blending_enabled: true,
data: PrimitiveBatchData::Blend(vec![blend]),
data: PrimitiveBatchData::Blend(Vec::new()),
}
}

fn composite(first_src_rect: Rect<DevicePixel>,
second_src_rect: Rect<DevicePixel>,
target_rect: Rect<DevicePixel>,
info: PackedCompositeInfo) -> PrimitiveBatch {
let composite = PackedCompositePrimitive {
rect0: first_src_rect,
rect1: second_src_rect,
target_rect: target_rect,
info: info,
};

fn composite() -> PrimitiveBatch {
PrimitiveBatch {
color_texture_id: TextureId(0),
transform_kind: TransformedRectKind::AxisAligned,
layer_ubo_index: 0,
tile_ubo_index: 0,
blending_enabled: true,
data: PrimitiveBatchData::Composite(vec![composite]),
data: PrimitiveBatchData::Composite(Vec::new()),
}
}

@@ -2258,6 +2234,7 @@ pub struct FrameBuilder {
}

pub struct Frame {
pub viewport_size: Size2D<i32>,
pub debug_rects: Vec<DebugRect>,
pub cache_size: Size2D<f32>,
pub phases: Vec<RenderPhase>,
@@ -3283,6 +3260,7 @@ impl FrameBuilder {
}

Frame {
viewport_size: self.screen_rect.size,
debug_rects: debug_rects,
profile_counters: profile_counters,
phases: phases,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.