Bug 1444434 - Bind pixel pack buffer before trying to map it for readback r=gw
authorBarret Rennie <barret@brennie.ca>
Mon, 15 Apr 2019 23:39:10 +0000
changeset 469587 9feaaddc3761
parent 469586 693535165c9f
child 469588 bacdb7ee8f0e
push id35874
push userccoroiu@mozilla.com
push dateTue, 16 Apr 2019 04:04:58 +0000
treeherdermozilla-central@be3f40425b52 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgw
bugs1444434
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1444434 - Bind pixel pack buffer before trying to map it for readback r=gw Differential Revision: https://phabricator.services.mozilla.com/D26946
gfx/wr/webrender/src/device/gl.rs
--- a/gfx/wr/webrender/src/device/gl.rs
+++ b/gfx/wr/webrender/src/device/gl.rs
@@ -680,16 +680,17 @@ impl Drop for PBO {
 pub struct BoundPBO<'a> {
     device: &'a mut Device,
     pub data: &'a [u8]
 }
 
 impl<'a> Drop for BoundPBO<'a> {
     fn drop(&mut self) {
         self.device.gl.unmap_buffer(gl::PIXEL_PACK_BUFFER);
+        self.device.gl.bind_buffer(gl::PIXEL_PACK_BUFFER, 0);
     }
 }
 
 #[derive(PartialEq, Eq, Hash, Debug, Copy, Clone)]
 pub struct FBOId(gl::GLuint);
 
 #[derive(PartialEq, Eq, Hash, Debug, Copy, Clone)]
 pub struct RBOId(gl::GLuint);
@@ -2402,16 +2403,18 @@ impl Device {
                 gl_format.pixel_type,
             );
         }
 
         self.gl.bind_buffer(gl::PIXEL_PACK_BUFFER, 0);
     }
 
     pub fn map_pbo_for_readback<'a>(&'a mut self, pbo: &'a PBO) -> Option<BoundPBO<'a>> {
+        self.gl.bind_buffer(gl::PIXEL_PACK_BUFFER, pbo.id);
+
         let buf_ptr = match self.gl.get_type() {
             gl::GlType::Gl => {
                 self.gl.map_buffer(gl::PIXEL_PACK_BUFFER, gl::READ_ONLY)
             }
 
             gl::GlType::Gles => {
                 self.gl.map_buffer_range(
                     gl::PIXEL_PACK_BUFFER,