Skip to content

Commit

Permalink
Update WR (first phase of z-buffer optimizations / improvements).
Browse files Browse the repository at this point in the history
  • Loading branch information
gw3583 committed Jan 8, 2017
1 parent 183c477 commit 3d94754
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 deletions.
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions components/compositing/compositor.rs
Expand Up @@ -275,13 +275,15 @@ enum CompositeTarget {

struct RenderTargetInfo {
framebuffer_ids: Vec<gl::GLuint>,
renderbuffer_ids: Vec<gl::GLuint>,
texture_ids: Vec<gl::GLuint>,
}

impl RenderTargetInfo {
fn empty() -> RenderTargetInfo {
RenderTargetInfo {
framebuffer_ids: Vec::new(),
renderbuffer_ids: Vec::new(),
texture_ids: Vec::new(),
}
}
Expand All @@ -304,8 +306,21 @@ fn initialize_png(width: usize, height: usize) -> RenderTargetInfo {

gl::bind_texture(gl::TEXTURE_2D, 0);

let renderbuffer_ids = gl::gen_renderbuffers(1);
let depth_rb = renderbuffer_ids[0];
gl::bind_renderbuffer(gl::RENDERBUFFER, depth_rb);
gl::renderbuffer_storage(gl::RENDERBUFFER,
gl::DEPTH_COMPONENT24,
width as gl::GLsizei,
height as gl::GLsizei);
gl::framebuffer_renderbuffer(gl::FRAMEBUFFER,
gl::DEPTH_ATTACHMENT,
gl::RENDERBUFFER,
depth_rb);

RenderTargetInfo {
framebuffer_ids: framebuffer_ids,
renderbuffer_ids: renderbuffer_ids,
texture_ids: texture_ids,
}
}
Expand Down Expand Up @@ -1534,6 +1549,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
gl::bind_framebuffer(gl::FRAMEBUFFER, 0);

gl::delete_buffers(&render_target_info.texture_ids);
gl::delete_renderbuffers(&render_target_info.renderbuffer_ids);
gl::delete_frame_buffers(&render_target_info.framebuffer_ids);

// flip image vertically (texture is upside down)
Expand Down
2 changes: 1 addition & 1 deletion components/servo/lib.rs
Expand Up @@ -171,9 +171,9 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static {
enable_scrollbars: opts.output_file.is_none(),
renderer_kind: renderer_kind,
enable_subpixel_aa: opts.enable_subpixel_text_antialiasing,
clear_empty_tiles: true,
clear_framebuffer: true,
clear_color: webrender_traits::ColorF::new(1.0, 1.0, 1.0, 1.0),
render_target_debug: false,
})
};

Expand Down

0 comments on commit 3d94754

Please sign in to comment.