mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Auto merge of #26872 - kunalmohan:gpu-canvas-context, r=kvark,jdm
Implement GPUSwapChain and GPUCanvasContext and interface with Webrender <!-- Please describe your changes on the following line: --> r?@kvark --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
abc3ed40c9
30 changed files with 886 additions and 91 deletions
|
@ -53,6 +53,7 @@ use crate::dom::event::{Event, EventBubbles, EventCancelable, EventDefault, Even
|
|||
use crate::dom::eventtarget::EventTarget;
|
||||
use crate::dom::focusevent::FocusEvent;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::gpucanvascontext::{GPUCanvasContext, WebGPUContextId};
|
||||
use crate::dom::hashchangeevent::HashChangeEvent;
|
||||
use crate::dom::htmlanchorelement::HTMLAnchorElement;
|
||||
use crate::dom::htmlareaelement::HTMLAreaElement;
|
||||
|
@ -387,6 +388,8 @@ pub struct Document {
|
|||
media_controls: DomRefCell<HashMap<String, Dom<ShadowRoot>>>,
|
||||
/// List of all WebGL context IDs that need flushing.
|
||||
dirty_webgl_contexts: DomRefCell<HashMap<WebGLContextId, Dom<WebGLRenderingContext>>>,
|
||||
/// List of all WebGPU context IDs that need flushing.
|
||||
dirty_webgpu_contexts: DomRefCell<HashMap<WebGPUContextId, Dom<GPUCanvasContext>>>,
|
||||
/// https://html.spec.whatwg.org/multipage/#concept-document-csp-list
|
||||
#[ignore_malloc_size_of = "Defined in rust-content-security-policy"]
|
||||
csp_list: DomRefCell<Option<CspList>>,
|
||||
|
@ -2685,14 +2688,14 @@ impl Document {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn add_dirty_canvas(&self, context: &WebGLRenderingContext) {
|
||||
pub fn add_dirty_webgl_canvas(&self, context: &WebGLRenderingContext) {
|
||||
self.dirty_webgl_contexts
|
||||
.borrow_mut()
|
||||
.entry(context.context_id())
|
||||
.or_insert_with(|| Dom::from_ref(context));
|
||||
}
|
||||
|
||||
pub fn flush_dirty_canvases(&self) {
|
||||
pub fn flush_dirty_webgl_canvases(&self) {
|
||||
let dirty_context_ids: Vec<_> = self
|
||||
.dirty_webgl_contexts
|
||||
.borrow_mut()
|
||||
|
@ -2720,6 +2723,21 @@ impl Document {
|
|||
receiver.recv().unwrap();
|
||||
}
|
||||
|
||||
pub fn add_dirty_webgpu_canvas(&self, context: &GPUCanvasContext) {
|
||||
self.dirty_webgpu_contexts
|
||||
.borrow_mut()
|
||||
.entry(context.context_id())
|
||||
.or_insert_with(|| Dom::from_ref(context));
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn flush_dirty_webgpu_canvases(&self) {
|
||||
self.dirty_webgpu_contexts
|
||||
.borrow_mut()
|
||||
.drain()
|
||||
.for_each(|(_, context)| context.send_swap_chain_present());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:supported-property-names
|
||||
// (This takes the filter as a method so the window named getter can use it too)
|
||||
pub fn supported_property_names_impl(
|
||||
|
@ -3081,6 +3099,7 @@ impl Document {
|
|||
shadow_roots_styles_changed: Cell::new(false),
|
||||
media_controls: DomRefCell::new(HashMap::new()),
|
||||
dirty_webgl_contexts: DomRefCell::new(HashMap::new()),
|
||||
dirty_webgpu_contexts: DomRefCell::new(HashMap::new()),
|
||||
csp_list: DomRefCell::new(None),
|
||||
selection: MutNullableDom::new(None),
|
||||
animation_timeline: if pref!(layout.animations.test.enabled) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue