Bug 1514735 - Update webrender to commit 4de718f9ea3435c099cabafc02e8b51da539bc62 (WR PR #3428). r=kats

https://github.com/servo/webrender/pull/3428

Differential Revision: https://phabricator.services.mozilla.com/D14823

--HG--
extra : moz-landing-system : lando
This commit is contained in:
WR Updater Bot 2018-12-18 01:32:52 +00:00
Родитель b7296f0f06
Коммит 0000d47534
3 изменённых файлов: 43 добавлений и 20 удалений

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

@ -1 +1 @@
3a4ce4b66a7bc9bd10773744d20530c609a61e90
4de718f9ea3435c099cabafc02e8b51da539bc62

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

@ -1046,11 +1046,18 @@ impl<'a> From<DrawTarget<'a>> for ReadTarget<'a> {
impl Device {
pub fn new(
gl: Rc<gl::Gl>,
mut gl: Rc<gl::Gl>,
resource_override_path: Option<PathBuf>,
upload_method: UploadMethod,
cached_programs: Option<Rc<ProgramCache>>,
) -> Device {
// On debug builds, assert that each GL call is error-free. We don't do
// this on release builds because the synchronous call can stall the
// pipeline.
if cfg!(debug_assertions) {
gl = gl::ErrorCheckingGl::wrap(gl);
}
let mut max_texture_size = [0];
let mut max_texture_layers = [0];
unsafe {
@ -1151,11 +1158,6 @@ impl Device {
let supports_copy_image_sub_data = supports_extension(&extensions, "GL_EXT_copy_image") ||
supports_extension(&extensions, "GL_ARB_copy_image");
// Explicitly set some global states to the values we expect.
gl.disable(gl::FRAMEBUFFER_SRGB);
gl.disable(gl::MULTISAMPLE);
gl.disable(gl::POLYGON_SMOOTH);
Device {
gl,
resource_override_path,
@ -1289,20 +1291,10 @@ impl Device {
}
}
// If an assertion is hit in this function, something outside of WebRender is likely
// messing with the GL context's global state.
pub fn check_gl_state(&self) {
debug_assert!(self.gl.is_enabled(gl::FRAMEBUFFER_SRGB) == 0);
debug_assert!(self.gl.is_enabled(gl::MULTISAMPLE) == 0);
debug_assert!(self.gl.is_enabled(gl::POLYGON_SMOOTH) == 0);
}
pub fn begin_frame(&mut self) -> GpuFrameId {
debug_assert!(!self.inside_frame);
self.inside_frame = true;
self.check_gl_state();
// Retrieve the currently set FBO.
let mut default_read_fbo = [0];
unsafe {
@ -1435,8 +1427,15 @@ impl Device {
);
}
/// Creates an unbound FBO object. Additional attachment API calls are
/// required to make it complete.
pub fn create_fbo(&mut self) -> FBOId {
FBOId(self.gl.gen_framebuffers(1)[0])
}
/// Creates an FBO with the given texture bound as the color attachment.
pub fn create_fbo_for_external_texture(&mut self, texture_id: u32) -> FBOId {
let fbo = FBOId(self.gl.gen_framebuffers(1)[0]);
let fbo = self.create_fbo();
fbo.bind(self.gl(), FBOTarget::Draw);
self.gl.framebuffer_texture_2d(
gl::DRAW_FRAMEBUFFER,
@ -1445,6 +1444,11 @@ impl Device {
texture_id,
0,
);
debug_assert_eq!(
self.gl.check_frame_buffer_status(gl::DRAW_FRAMEBUFFER),
gl::FRAMEBUFFER_COMPLETE,
"Incomplete framebuffer",
);
self.bound_draw_fbo.bind(self.gl(), FBOTarget::Draw);
fbo
}
@ -1867,6 +1871,12 @@ impl Device {
depth_rb.0,
);
}
debug_assert_eq!(
self.gl.check_frame_buffer_status(gl::DRAW_FRAMEBUFFER),
gl::FRAMEBUFFER_COMPLETE,
"Incomplete framebuffer",
);
}
self.bind_external_draw_target(original_bound_fbo);
}
@ -2886,11 +2896,24 @@ impl<'a, T> Drop for TextureUploader<'a, T> {
impl<'a, T> TextureUploader<'a, T> {
pub fn upload(
&mut self,
rect: DeviceIntRect,
mut rect: DeviceIntRect,
layer_index: i32,
stride: Option<i32>,
data: &[T],
) -> usize {
// Textures dimensions may have been clamped by the hardware. Crop the
// upload region to match.
let cropped = rect.intersection(
&DeviceIntRect::new(DeviceIntPoint::zero(), self.target.texture.get_dimensions())
);
if cfg!(debug_assertions) && cropped.map_or(true, |r| r != rect) {
warn!("Cropping texture upload {:?} to {:?}", rect, cropped);
}
rect = match cropped {
None => return 0,
Some(r) => r,
};
let bytes_pp = self.target.texture.format.bytes_per_pixel();
let upload_size = match stride {
Some(stride) => ((rect.size.height - 1) * stride + rect.size.width * bytes_pp) as usize,

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

@ -1969,7 +1969,7 @@ impl Renderer {
let ext_debug_marker = device.supports_extension("GL_EXT_debug_marker");
let gpu_profile = GpuProfiler::new(Rc::clone(device.rc_gl()), ext_debug_marker);
#[cfg(feature = "capture")]
let read_fbo = device.create_fbo_for_external_texture(0);
let read_fbo = device.create_fbo();
let mut renderer = Renderer {
result_rx,