mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Remove the DOMToTexture feature
This relies on WebRender's frame output API, `set_output_image_handler`, which has been removed from the latest upstream [1]. It's sad to remove this feature, which was probably a lot of work to implement, but it seems difficult to patch WebRender to restore this functionality. Fixes #29936. 1. https://hg.mozilla.org/mozilla-central/rev/361521e3c52324809553c555fb066d50f023d9bf
This commit is contained in:
parent
234d507234
commit
ec3b2826ae
10 changed files with 36 additions and 304 deletions
|
@ -24,7 +24,6 @@ use crate::dom::element::cors_setting_for_element;
|
|||
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use crate::dom::htmlcanvaselement::utils as canvas_utils;
|
||||
use crate::dom::htmlcanvaselement::{HTMLCanvasElement, LayoutCanvasRenderingContextHelpers};
|
||||
use crate::dom::htmliframeelement::HTMLIFrameElement;
|
||||
use crate::dom::node::{document_from_node, window_from_node, Node, NodeDamage};
|
||||
use crate::dom::promise::Promise;
|
||||
use crate::dom::vertexarrayobject::VertexAttribData;
|
||||
|
@ -57,11 +56,11 @@ use crate::script_runtime::JSContext as SafeJSContext;
|
|||
use backtrace::Backtrace;
|
||||
use canvas_traits::webgl::WebGLError::*;
|
||||
use canvas_traits::webgl::{
|
||||
webgl_channel, AlphaTreatment, DOMToTextureCommand, GLContextAttributes, GLLimits, GlType,
|
||||
Parameter, SizedDataType, TexDataType, TexFormat, TexParameter, WebGLChan, WebGLCommand,
|
||||
WebGLCommandBacktrace, WebGLContextId, WebGLError, WebGLFramebufferBindingRequest, WebGLMsg,
|
||||
WebGLMsgSender, WebGLProgramId, WebGLResult, WebGLSLVersion, WebGLSendResult, WebGLSender,
|
||||
WebGLVersion, YAxisTreatment,
|
||||
webgl_channel, AlphaTreatment, GLContextAttributes, GLLimits, GlType, Parameter, SizedDataType,
|
||||
TexDataType, TexFormat, TexParameter, WebGLChan, WebGLCommand, WebGLCommandBacktrace,
|
||||
WebGLContextId, WebGLError, WebGLFramebufferBindingRequest, WebGLMsg, WebGLMsgSender,
|
||||
WebGLProgramId, WebGLResult, WebGLSLVersion, WebGLSendResult, WebGLSender, WebGLVersion,
|
||||
YAxisTreatment,
|
||||
};
|
||||
use dom_struct::dom_struct;
|
||||
use embedder_traits::EventLoopWaker;
|
||||
|
@ -379,10 +378,6 @@ impl WebGLRenderingContext {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn webgl_sender(&self) -> WebGLMessageSender {
|
||||
self.webgl_sender.clone()
|
||||
}
|
||||
|
||||
pub fn context_id(&self) -> WebGLContextId {
|
||||
self.webgl_sender.context_id()
|
||||
}
|
||||
|
@ -4434,60 +4429,6 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||
fn TexImageDOM(
|
||||
&self,
|
||||
target: u32,
|
||||
level: i32,
|
||||
internal_format: u32,
|
||||
width: i32,
|
||||
height: i32,
|
||||
format: u32,
|
||||
data_type: u32,
|
||||
source: &HTMLIFrameElement,
|
||||
) -> ErrorResult {
|
||||
// Currently DOMToTexture only supports TEXTURE_2D, RGBA, UNSIGNED_BYTE and no levels.
|
||||
if target != constants::TEXTURE_2D ||
|
||||
level != 0 ||
|
||||
internal_format != constants::RGBA ||
|
||||
format != constants::RGBA ||
|
||||
data_type != constants::UNSIGNED_BYTE
|
||||
{
|
||||
return Ok(self.webgl_error(InvalidValue));
|
||||
}
|
||||
|
||||
// Get bound texture
|
||||
let texture = handle_potential_webgl_error!(
|
||||
self,
|
||||
self.textures
|
||||
.active_texture_slot(constants::TEXTURE_2D, self.webgl_version())
|
||||
.unwrap()
|
||||
.get()
|
||||
.ok_or(InvalidOperation),
|
||||
return Ok(())
|
||||
);
|
||||
|
||||
let pipeline_id = source.pipeline_id().ok_or(Error::InvalidState)?;
|
||||
let document_id = self
|
||||
.global()
|
||||
.downcast::<Window>()
|
||||
.ok_or(Error::InvalidState)?
|
||||
.webrender_document();
|
||||
|
||||
texture.set_attached_to_dom();
|
||||
|
||||
let command = DOMToTextureCommand::Attach(
|
||||
self.webgl_sender.context_id(),
|
||||
texture.id(),
|
||||
document_id,
|
||||
pipeline_id.to_webrender(),
|
||||
Size2D::new(width, height),
|
||||
);
|
||||
self.webgl_sender.send_dom_to_texture(command).unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||
#[allow(unsafe_code)]
|
||||
fn TexSubImage2D(
|
||||
|
@ -5013,10 +4954,6 @@ impl WebGLMessageSender {
|
|||
pub fn send_remove(&self) -> WebGLSendResult {
|
||||
self.wake_after_send(|| self.sender.send_remove())
|
||||
}
|
||||
|
||||
pub fn send_dom_to_texture(&self, command: DOMToTextureCommand) -> WebGLSendResult {
|
||||
self.wake_after_send(|| self.sender.send_dom_to_texture(command))
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Size2DExt {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue