mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Auto merge of #27425 - jdm:preserve-draw-buffer, r=asajeffrey
Support preserveDrawingBuffer Depends on https://github.com/asajeffrey/surfman-chains/pull/9 and https://github.com/servo/webxr/pull/190. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #24604 - [x] There are tests for these changes
This commit is contained in:
commit
0573e9c60d
6 changed files with 29 additions and 21 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -5878,9 +5878,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "surfman-chains"
|
name = "surfman-chains"
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d51598e1772bda3dbb1b81a9dc4b46725896948ea58d0f128e5b492a92f297af"
|
checksum = "d7370be9fb29386426ce52d9c3ac0501e7f71ea8218baf4bee061465f2fcec04"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"euclid",
|
"euclid",
|
||||||
"fnv",
|
"fnv",
|
||||||
|
@ -6910,7 +6910,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "webxr"
|
name = "webxr"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/servo/webxr#da44de55ca8c082a033787946cb59dbbd2903a15"
|
source = "git+https://github.com/servo/webxr#7763f4826fb04a1b48dbf502e48ca9d6ff3b6378"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android_injected_glue",
|
"android_injected_glue",
|
||||||
"bindgen",
|
"bindgen",
|
||||||
|
@ -6933,7 +6933,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "webxr-api"
|
name = "webxr-api"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/servo/webxr#da44de55ca8c082a033787946cb59dbbd2903a15"
|
source = "git+https://github.com/servo/webxr#7763f4826fb04a1b48dbf502e48ca9d6ff3b6378"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"euclid",
|
"euclid",
|
||||||
"ipc-channel",
|
"ipc-channel",
|
||||||
|
|
|
@ -40,7 +40,7 @@ style = { path = "../style" }
|
||||||
style_traits = { path = "../style_traits" }
|
style_traits = { path = "../style_traits" }
|
||||||
# NOTE: the sm-angle feature only enables angle on windows, not other platforms!
|
# NOTE: the sm-angle feature only enables angle on windows, not other platforms!
|
||||||
surfman = { version = "0.3", features = ["sm-angle","sm-angle-default"] }
|
surfman = { version = "0.3", features = ["sm-angle","sm-angle-default"] }
|
||||||
surfman-chains = "0.4"
|
surfman-chains = "0.5"
|
||||||
surfman-chains-api = "0.2"
|
surfman-chains-api = "0.2"
|
||||||
time = { version = "0.1.0", optional = true }
|
time = { version = "0.1.0", optional = true }
|
||||||
webrender = { git = "https://github.com/servo/webrender" }
|
webrender = { git = "https://github.com/servo/webrender" }
|
||||||
|
|
|
@ -827,12 +827,19 @@ impl WebGLThread {
|
||||||
|
|
||||||
debug!("Swapping {:?}", context_id);
|
debug!("Swapping {:?}", context_id);
|
||||||
swap_chain
|
swap_chain
|
||||||
.swap_buffers(&mut self.device, &mut data.ctx)
|
.swap_buffers(
|
||||||
|
&mut self.device,
|
||||||
|
&mut data.ctx,
|
||||||
|
if data.attributes.preserve_drawing_buffer {
|
||||||
|
surfman_chains::PreserveBuffer::Yes(&*data.gl)
|
||||||
|
} else {
|
||||||
|
surfman_chains::PreserveBuffer::No
|
||||||
|
},
|
||||||
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
debug_assert_eq!(data.gl.get_error(), gl::NO_ERROR);
|
debug_assert_eq!(data.gl.get_error(), gl::NO_ERROR);
|
||||||
|
|
||||||
// TODO: if preserveDrawingBuffer is true, then blit the front buffer to the back buffer
|
if !data.attributes.preserve_drawing_buffer {
|
||||||
// https://github.com/servo/servo/issues/24604
|
|
||||||
debug!("Clearing {:?}", context_id);
|
debug!("Clearing {:?}", context_id);
|
||||||
let alpha = data
|
let alpha = data
|
||||||
.state
|
.state
|
||||||
|
@ -843,6 +850,7 @@ impl WebGLThread {
|
||||||
.clear_surface(&mut self.device, &mut data.ctx, &*data.gl, clear_color)
|
.clear_surface(&mut self.device, &mut data.ctx, &*data.gl, clear_color)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
debug_assert_eq!(data.gl.get_error(), gl::NO_ERROR);
|
debug_assert_eq!(data.gl.get_error(), gl::NO_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
// Rebind framebuffers as appropriate.
|
// Rebind framebuffers as appropriate.
|
||||||
debug!("Rebinding {:?}", context_id);
|
debug!("Rebinding {:?}", context_id);
|
||||||
|
|
|
@ -13,5 +13,5 @@ path = "lib.rs"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
euclid = "0.20"
|
euclid = "0.20"
|
||||||
surfman = "0.3"
|
surfman = "0.3"
|
||||||
surfman-chains = "0.4"
|
surfman-chains = "0.5"
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ impl WebrenderSurfman {
|
||||||
let ref mut device = self.0.device.borrow_mut();
|
let ref mut device = self.0.device.borrow_mut();
|
||||||
let ref mut context = self.0.context.borrow_mut();
|
let ref mut context = self.0.context.borrow_mut();
|
||||||
if let Some(ref swap_chain) = self.0.swap_chain {
|
if let Some(ref swap_chain) = self.0.swap_chain {
|
||||||
return swap_chain.swap_buffers(device, context);
|
return swap_chain.swap_buffers(device, context, surfman_chains::PreserveBuffer::No);
|
||||||
}
|
}
|
||||||
let mut surface = device.unbind_surface_from_context(context)?.unwrap();
|
let mut surface = device.unbind_surface_from_context(context)?.unwrap();
|
||||||
device.present_surface(context, &mut surface)?;
|
device.present_surface(context, &mut surface)?;
|
||||||
|
|
|
@ -30,7 +30,7 @@ log = "0.4"
|
||||||
servo-media = { git = "https://github.com/servo/media" }
|
servo-media = { git = "https://github.com/servo/media" }
|
||||||
sparkle = "0.1"
|
sparkle = "0.1"
|
||||||
surfman = "0.3"
|
surfman = "0.3"
|
||||||
surfman-chains = "0.4"
|
surfman-chains = "0.5"
|
||||||
surfman-chains-api = "0.2"
|
surfman-chains-api = "0.2"
|
||||||
webxr = { git = "https://github.com/servo/webxr", features = ["glwindow"] }
|
webxr = { git = "https://github.com/servo/webxr", features = ["glwindow"] }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue