chore: Rename CompositeTarget enum (#35263)

* chore: Rename CompositeTarget enum

Signed-off-by: DK Liao <dklassic@gmail.com>

sync name in other documents

Signed-off-by: DK Liao <dklassic@gmail.com>

sync more name in other documents

Signed-off-by: DK Liao <dklassic@gmail.com>

* Fix Android/ohos

Signed-off-by: DK Liao <dklassic@gmail.com>

---------

Signed-off-by: DK Liao <dklassic@gmail.com>
This commit is contained in:
DK Liao 2025-02-04 12:38:11 +08:00 committed by GitHub
parent 24ead9c3a9
commit 4461380792
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 18 additions and 15 deletions

View file

@ -192,12 +192,12 @@ pub struct IOCompositor {
/// Offscreen framebuffer object to render our next frame to. /// Offscreen framebuffer object to render our next frame to.
/// We use this and `prev_offscreen_framebuffer` for double buffering when compositing to /// We use this and `prev_offscreen_framebuffer` for double buffering when compositing to
/// [`CompositeTarget::Fbo`]. /// [`CompositeTarget::OffscreenFbo`].
next_offscreen_framebuffer: OnceCell<gl::RenderTargetInfo>, next_offscreen_framebuffer: OnceCell<gl::RenderTargetInfo>,
/// Offscreen framebuffer object for our most-recently-completed frame. /// Offscreen framebuffer object for our most-recently-completed frame.
/// We use this and `next_offscreen_framebuffer` for double buffering when compositing to /// We use this and `next_offscreen_framebuffer` for double buffering when compositing to
/// [`CompositeTarget::Fbo`]. /// [`CompositeTarget::OffscreenFbo`].
prev_offscreen_framebuffer: Option<gl::RenderTargetInfo>, prev_offscreen_framebuffer: Option<gl::RenderTargetInfo>,
/// Whether to invalidate `prev_offscreen_framebuffer` at the end of the next frame. /// Whether to invalidate `prev_offscreen_framebuffer` at the end of the next frame.
@ -342,12 +342,13 @@ impl PipelineDetails {
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
pub enum CompositeTarget { pub enum CompositeTarget {
/// Draw directly to a window. /// Draw to a OpenGL framebuffer object that will then be used by the compositor to composite
Window, /// to [`RenderingContext::framebuffer_object`]
ContextFbo,
/// Draw to an offscreen OpenGL framebuffer object, which can be retrieved once complete at /// Draw to an offscreen OpenGL framebuffer object, which can be retrieved once complete at
/// [`IOCompositor::offscreen_framebuffer_id`]. /// [`IOCompositor::offscreen_framebuffer_id`].
Fbo, OffscreenFbo,
/// Draw to an uncompressed image in shared memory. /// Draw to an uncompressed image in shared memory.
SharedMemory, SharedMemory,
@ -2016,7 +2017,9 @@ impl IOCompositor {
) || self.exit_after_load; ) || self.exit_after_load;
let use_offscreen_framebuffer = matches!( let use_offscreen_framebuffer = matches!(
target, target,
CompositeTarget::SharedMemory | CompositeTarget::PngFile(_) | CompositeTarget::Fbo CompositeTarget::SharedMemory |
CompositeTarget::PngFile(_) |
CompositeTarget::OffscreenFbo
); );
if wait_for_stable_image { if wait_for_stable_image {
@ -2089,8 +2092,8 @@ impl IOCompositor {
}; };
let rv = match target { let rv = match target {
CompositeTarget::Window => None, CompositeTarget::ContextFbo => None,
CompositeTarget::Fbo => { CompositeTarget::OffscreenFbo => {
self.next_offscreen_framebuffer self.next_offscreen_framebuffer
.get() .get()
.expect("Guaranteed by needs_fbo") .expect("Guaranteed by needs_fbo")
@ -2244,7 +2247,7 @@ impl IOCompositor {
} }
/// Return the OpenGL framebuffer name of the most-recently-completed frame when compositing to /// Return the OpenGL framebuffer name of the most-recently-completed frame when compositing to
/// [`CompositeTarget::Fbo`], or None otherwise. /// [`CompositeTarget::OffscreenFbo`], or None otherwise.
pub fn offscreen_framebuffer_id(&self) -> Option<gleam::gl::GLuint> { pub fn offscreen_framebuffer_id(&self) -> Option<gleam::gl::GLuint> {
self.prev_offscreen_framebuffer self.prev_offscreen_framebuffer
.as_ref() .as_ref()

View file

@ -100,7 +100,7 @@ impl ApplicationHandler<WakerEvent> for App {
}), }),
window_delegate.clone(), window_delegate.clone(),
Default::default(), Default::default(),
compositing::CompositeTarget::Window, compositing::CompositeTarget::ContextFbo,
); );
servo.setup_logging(); servo.setup_logging();
let webviews = vec![servo.new_webview( let webviews = vec![servo.new_webview(

View file

@ -1016,7 +1016,7 @@ impl Servo {
} }
/// Return the OpenGL framebuffer name of the most-recently-completed frame when compositing to /// Return the OpenGL framebuffer name of the most-recently-completed frame when compositing to
/// [`CompositeTarget::Fbo`], or None otherwise. /// [`CompositeTarget::OffscreenFbo`], or None otherwise.
pub fn offscreen_framebuffer_id(&self) -> Option<u32> { pub fn offscreen_framebuffer_id(&self) -> Option<u32> {
self.compositor.borrow().offscreen_framebuffer_id() self.compositor.borrow().offscreen_framebuffer_id()
} }

View file

@ -209,9 +209,9 @@ impl App {
let embedder = Box::new(EmbedderCallbacks::new(self.waker.clone(), xr_discovery)); let embedder = Box::new(EmbedderCallbacks::new(self.waker.clone(), xr_discovery));
let composite_target = if self.minibrowser.is_some() { let composite_target = if self.minibrowser.is_some() {
CompositeTarget::Fbo CompositeTarget::OffscreenFbo
} else { } else {
CompositeTarget::Window CompositeTarget::ContextFbo
}; };
let servo = Servo::new( let servo = Servo::new(
self.opts.clone(), self.opts.clone(),

View file

@ -113,7 +113,7 @@ pub fn init(
embedder_callbacks, embedder_callbacks,
window_callbacks.clone(), window_callbacks.clone(),
None, None,
CompositeTarget::Window, CompositeTarget::ContextFbo,
); );
SERVO.with(|s| { SERVO.with(|s| {

View file

@ -114,7 +114,7 @@ pub fn init(
embedder_callbacks, embedder_callbacks,
window_callbacks.clone(), window_callbacks.clone(),
None, /* user_agent */ None, /* user_agent */
CompositeTarget::Window, CompositeTarget::ContextFbo,
); );
let servo_glue = ServoGlue::new( let servo_glue = ServoGlue::new(