mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
webgl: Update IDL exposed members (#33509)
* Update IDLs to expose on Workers Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update usage of Canvas/OffscreenCanvas union, add label Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update WPT expectations Signed-off-by: Daniel Adams <msub2official@gmail.com> * Fix match arm Signed-off-by: Daniel Adams <msub2official@gmail.com> * Add missing spec links Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update expectations Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update interfaces.worker.js Signed-off-by: Daniel Adams <msub2official@gmail.com> --------- Signed-off-by: Daniel Adams <msub2official@gmail.com>
This commit is contained in:
parent
8276673bae
commit
3a0d27b231
22 changed files with 117 additions and 4772 deletions
|
@ -26,6 +26,7 @@ use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::{
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::codegen::Bindings::MediaStreamBinding::MediaStreamMethods;
|
use crate::dom::bindings::codegen::Bindings::MediaStreamBinding::MediaStreamMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes;
|
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes;
|
||||||
|
use crate::dom::bindings::codegen::UnionTypes::HTMLCanvasElementOrOffscreenCanvas;
|
||||||
use crate::dom::bindings::conversions::ConversionResult;
|
use crate::dom::bindings::conversions::ConversionResult;
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
|
@ -206,7 +207,9 @@ impl HTMLCanvasElement {
|
||||||
let window = window_from_node(self);
|
let window = window_from_node(self);
|
||||||
let size = self.get_size();
|
let size = self.get_size();
|
||||||
let attrs = Self::get_gl_attributes(cx, options)?;
|
let attrs = Self::get_gl_attributes(cx, options)?;
|
||||||
let context = WebGLRenderingContext::new(&window, self, WebGLVersion::WebGL1, size, attrs)?;
|
let canvas = HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(DomRoot::from_ref(self));
|
||||||
|
let context =
|
||||||
|
WebGLRenderingContext::new(&window, &canvas, WebGLVersion::WebGL1, size, attrs)?;
|
||||||
*self.context.borrow_mut() = Some(CanvasContext::WebGL(Dom::from_ref(&*context)));
|
*self.context.borrow_mut() = Some(CanvasContext::WebGL(Dom::from_ref(&*context)));
|
||||||
Some(context)
|
Some(context)
|
||||||
}
|
}
|
||||||
|
@ -229,7 +232,8 @@ impl HTMLCanvasElement {
|
||||||
let window = window_from_node(self);
|
let window = window_from_node(self);
|
||||||
let size = self.get_size();
|
let size = self.get_size();
|
||||||
let attrs = Self::get_gl_attributes(cx, options)?;
|
let attrs = Self::get_gl_attributes(cx, options)?;
|
||||||
let context = WebGL2RenderingContext::new(&window, self, size, attrs)?;
|
let canvas = HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(DomRoot::from_ref(self));
|
||||||
|
let context = WebGL2RenderingContext::new(&window, &canvas, size, attrs)?;
|
||||||
*self.context.borrow_mut() = Some(CanvasContext::WebGL2(Dom::from_ref(&*context)));
|
*self.context.borrow_mut() = Some(CanvasContext::WebGL2(Dom::from_ref(&*context)));
|
||||||
Some(context)
|
Some(context)
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::codegen::UnionTypes::{
|
use crate::dom::bindings::codegen::UnionTypes::{
|
||||||
ArrayBufferViewOrArrayBuffer, Float32ArrayOrUnrestrictedFloatSequence,
|
ArrayBufferViewOrArrayBuffer, Float32ArrayOrUnrestrictedFloatSequence,
|
||||||
|
HTMLCanvasElementOrOffscreenCanvas,
|
||||||
ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement, Int32ArrayOrLongSequence,
|
ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement, Int32ArrayOrLongSequence,
|
||||||
Uint32ArrayOrUnsignedLongSequence,
|
Uint32ArrayOrUnsignedLongSequence,
|
||||||
};
|
};
|
||||||
|
@ -42,7 +43,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom};
|
use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::htmlcanvaselement::{HTMLCanvasElement, LayoutCanvasRenderingContextHelpers};
|
use crate::dom::htmlcanvaselement::LayoutCanvasRenderingContextHelpers;
|
||||||
use crate::dom::promise::Promise;
|
use crate::dom::promise::Promise;
|
||||||
use crate::dom::webgl_validations::tex_image_2d::{
|
use crate::dom::webgl_validations::tex_image_2d::{
|
||||||
TexImage2DValidator, TexImage2DValidatorResult, TexStorageValidator, TexStorageValidatorResult,
|
TexImage2DValidator, TexImage2DValidatorResult, TexStorageValidator, TexStorageValidatorResult,
|
||||||
|
@ -139,7 +140,7 @@ struct ReadPixelsSizes {
|
||||||
impl WebGL2RenderingContext {
|
impl WebGL2RenderingContext {
|
||||||
fn new_inherited(
|
fn new_inherited(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
canvas: &HTMLCanvasElement,
|
canvas: &HTMLCanvasElementOrOffscreenCanvas,
|
||||||
size: Size2D<u32>,
|
size: Size2D<u32>,
|
||||||
attrs: GLContextAttributes,
|
attrs: GLContextAttributes,
|
||||||
) -> Option<WebGL2RenderingContext> {
|
) -> Option<WebGL2RenderingContext> {
|
||||||
|
@ -186,7 +187,7 @@ impl WebGL2RenderingContext {
|
||||||
#[allow(crown::unrooted_must_root)]
|
#[allow(crown::unrooted_must_root)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
canvas: &HTMLCanvasElement,
|
canvas: &HTMLCanvasElementOrOffscreenCanvas,
|
||||||
size: Size2D<u32>,
|
size: Size2D<u32>,
|
||||||
attrs: GLContextAttributes,
|
attrs: GLContextAttributes,
|
||||||
) -> Option<DomRoot<WebGL2RenderingContext>> {
|
) -> Option<DomRoot<WebGL2RenderingContext>> {
|
||||||
|
@ -902,7 +903,7 @@ impl WebGL2RenderingContext {
|
||||||
|
|
||||||
impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
/// <https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.1>
|
/// <https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.1>
|
||||||
fn Canvas(&self) -> DomRoot<HTMLCanvasElement> {
|
fn Canvas(&self) -> HTMLCanvasElementOrOffscreenCanvas {
|
||||||
self.base.Canvas()
|
self.base.Canvas()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,18 @@
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
|
||||||
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
|
use crate::dom::bindings::codegen::Bindings::WebGLObjectBinding::WebGLObjectMethods;
|
||||||
use crate::dom::bindings::reflector::Reflector;
|
use crate::dom::bindings::reflector::Reflector;
|
||||||
use crate::dom::bindings::root::Dom;
|
use crate::dom::bindings::root::Dom;
|
||||||
|
use crate::dom::bindings::str::USVString;
|
||||||
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
|
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct WebGLObject {
|
pub struct WebGLObject {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
context: Dom<WebGLRenderingContext>,
|
context: Dom<WebGLRenderingContext>,
|
||||||
|
label: DomRefCell<USVString>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WebGLObject {
|
impl WebGLObject {
|
||||||
|
@ -20,6 +24,7 @@ impl WebGLObject {
|
||||||
WebGLObject {
|
WebGLObject {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
context: Dom::from_ref(context),
|
context: Dom::from_ref(context),
|
||||||
|
label: DomRefCell::new(USVString::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,3 +32,15 @@ impl WebGLObject {
|
||||||
&self.context
|
&self.context
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebGLObjectMethods for WebGLObject {
|
||||||
|
/// <https://registry.khronos.org/webgl/specs/latest/1.0/#5.3>
|
||||||
|
fn Label(&self) -> USVString {
|
||||||
|
self.label.borrow().clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <https://registry.khronos.org/webgl/specs/latest/1.0/#5.3>
|
||||||
|
fn SetLabel(&self, value: USVString) {
|
||||||
|
*self.label.borrow_mut() = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -48,19 +48,18 @@ use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{
|
||||||
WebGLRenderingContextMethods,
|
WebGLRenderingContextMethods,
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::codegen::UnionTypes::{
|
use crate::dom::bindings::codegen::UnionTypes::{
|
||||||
ArrayBufferViewOrArrayBuffer, Float32ArrayOrUnrestrictedFloatSequence, Int32ArrayOrLongSequence,
|
ArrayBufferViewOrArrayBuffer, Float32ArrayOrUnrestrictedFloatSequence,
|
||||||
|
HTMLCanvasElementOrOffscreenCanvas, Int32ArrayOrLongSequence,
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::conversions::{DerivedFrom, ToJSValConvertible};
|
use crate::dom::bindings::conversions::{DerivedFrom, ToJSValConvertible};
|
||||||
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
||||||
use crate::dom::bindings::root::{Dom, DomOnceCell, DomRoot, LayoutDom, MutNullableDom};
|
use crate::dom::bindings::root::{DomOnceCell, DomRoot, LayoutDom, MutNullableDom};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::element::cors_setting_for_element;
|
use crate::dom::element::cors_setting_for_element;
|
||||||
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
||||||
use crate::dom::htmlcanvaselement::{
|
use crate::dom::htmlcanvaselement::{utils as canvas_utils, LayoutCanvasRenderingContextHelpers};
|
||||||
utils as canvas_utils, HTMLCanvasElement, LayoutCanvasRenderingContextHelpers,
|
|
||||||
};
|
|
||||||
use crate::dom::node::{document_from_node, window_from_node, Node, NodeDamage};
|
use crate::dom::node::{document_from_node, window_from_node, Node, NodeDamage};
|
||||||
use crate::dom::promise::Promise;
|
use crate::dom::promise::Promise;
|
||||||
use crate::dom::vertexarrayobject::VertexAttribData;
|
use crate::dom::vertexarrayobject::VertexAttribData;
|
||||||
|
@ -182,7 +181,7 @@ pub struct WebGLRenderingContext {
|
||||||
#[ignore_malloc_size_of = "Defined in surfman"]
|
#[ignore_malloc_size_of = "Defined in surfman"]
|
||||||
#[no_trace]
|
#[no_trace]
|
||||||
limits: GLLimits,
|
limits: GLLimits,
|
||||||
canvas: Dom<HTMLCanvasElement>,
|
canvas: HTMLCanvasElementOrOffscreenCanvas,
|
||||||
#[ignore_malloc_size_of = "Defined in canvas_traits"]
|
#[ignore_malloc_size_of = "Defined in canvas_traits"]
|
||||||
#[no_trace]
|
#[no_trace]
|
||||||
last_error: Cell<Option<WebGLError>>,
|
last_error: Cell<Option<WebGLError>>,
|
||||||
|
@ -218,7 +217,7 @@ pub struct WebGLRenderingContext {
|
||||||
impl WebGLRenderingContext {
|
impl WebGLRenderingContext {
|
||||||
pub fn new_inherited(
|
pub fn new_inherited(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
canvas: &HTMLCanvasElement,
|
canvas: &HTMLCanvasElementOrOffscreenCanvas,
|
||||||
webgl_version: WebGLVersion,
|
webgl_version: WebGLVersion,
|
||||||
size: Size2D<u32>,
|
size: Size2D<u32>,
|
||||||
attrs: GLContextAttributes,
|
attrs: GLContextAttributes,
|
||||||
|
@ -248,7 +247,7 @@ impl WebGLRenderingContext {
|
||||||
webgl_version,
|
webgl_version,
|
||||||
glsl_version: ctx_data.glsl_version,
|
glsl_version: ctx_data.glsl_version,
|
||||||
limits: ctx_data.limits,
|
limits: ctx_data.limits,
|
||||||
canvas: Dom::from_ref(canvas),
|
canvas: canvas.clone(),
|
||||||
last_error: Cell::new(None),
|
last_error: Cell::new(None),
|
||||||
texture_packing_alignment: Cell::new(4),
|
texture_packing_alignment: Cell::new(4),
|
||||||
texture_unpacking_settings: Cell::new(TextureUnpacking::CONVERT_COLORSPACE),
|
texture_unpacking_settings: Cell::new(TextureUnpacking::CONVERT_COLORSPACE),
|
||||||
|
@ -285,7 +284,7 @@ impl WebGLRenderingContext {
|
||||||
#[allow(crown::unrooted_must_root)]
|
#[allow(crown::unrooted_must_root)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
canvas: &HTMLCanvasElement,
|
canvas: &HTMLCanvasElementOrOffscreenCanvas,
|
||||||
webgl_version: WebGLVersion,
|
webgl_version: WebGLVersion,
|
||||||
size: Size2D<u32>,
|
size: Size2D<u32>,
|
||||||
attrs: GLContextAttributes,
|
attrs: GLContextAttributes,
|
||||||
|
@ -301,7 +300,14 @@ impl WebGLRenderingContext {
|
||||||
EventCancelable::Cancelable,
|
EventCancelable::Cancelable,
|
||||||
DOMString::from(msg),
|
DOMString::from(msg),
|
||||||
);
|
);
|
||||||
event.upcast::<Event>().fire(canvas.upcast());
|
match canvas {
|
||||||
|
HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(canvas) => {
|
||||||
|
event.upcast::<Event>().fire(canvas.upcast());
|
||||||
|
},
|
||||||
|
HTMLCanvasElementOrOffscreenCanvas::OffscreenCanvas(canvas) => {
|
||||||
|
event.upcast::<Event>().fire(canvas.upcast());
|
||||||
|
},
|
||||||
|
}
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -395,7 +401,12 @@ impl WebGLRenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn onscreen(&self) -> bool {
|
pub fn onscreen(&self) -> bool {
|
||||||
self.canvas.upcast::<Node>().is_connected()
|
match self.canvas {
|
||||||
|
HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(ref canvas) => {
|
||||||
|
canvas.upcast::<Node>().is_connected()
|
||||||
|
},
|
||||||
|
HTMLCanvasElementOrOffscreenCanvas::OffscreenCanvas(_) => false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -535,12 +546,14 @@ impl WebGLRenderingContext {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.canvas
|
match self.canvas {
|
||||||
.upcast::<Node>()
|
HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(ref canvas) => {
|
||||||
.dirty(NodeDamage::OtherNodeDamage);
|
canvas.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||||
|
let document = document_from_node(&**canvas);
|
||||||
let document = document_from_node(&*self.canvas);
|
document.add_dirty_webgl_canvas(self);
|
||||||
document.add_dirty_webgl_canvas(self);
|
},
|
||||||
|
HTMLCanvasElementOrOffscreenCanvas::OffscreenCanvas(_) => {},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn vertex_attrib(&self, indx: u32, x: f32, y: f32, z: f32, w: f32) {
|
fn vertex_attrib(&self, indx: u32, x: f32, y: f32, z: f32, w: f32) {
|
||||||
|
@ -648,7 +661,15 @@ impl WebGLRenderingContext {
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
TexImageSource::HTMLImageElement(image) => {
|
TexImageSource::HTMLImageElement(image) => {
|
||||||
let document = document_from_node(&*self.canvas);
|
let document = match self.canvas {
|
||||||
|
HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(ref canvas) => {
|
||||||
|
document_from_node(&**canvas)
|
||||||
|
},
|
||||||
|
HTMLCanvasElementOrOffscreenCanvas::OffscreenCanvas(ref canvas) => {
|
||||||
|
// TODO: Support retrieving image pixels here for OffscreenCanvas
|
||||||
|
return Ok(None);
|
||||||
|
},
|
||||||
|
};
|
||||||
if !image.same_origin(document.origin()) {
|
if !image.same_origin(document.origin()) {
|
||||||
return Err(Error::Security);
|
return Err(Error::Security);
|
||||||
}
|
}
|
||||||
|
@ -658,7 +679,13 @@ impl WebGLRenderingContext {
|
||||||
None => return Ok(None),
|
None => return Ok(None),
|
||||||
};
|
};
|
||||||
|
|
||||||
let window = window_from_node(&*self.canvas);
|
let window = match self.canvas {
|
||||||
|
HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(ref canvas) => {
|
||||||
|
window_from_node(&**canvas)
|
||||||
|
},
|
||||||
|
// This is marked as unreachable as we should have returned already
|
||||||
|
HTMLCanvasElementOrOffscreenCanvas::OffscreenCanvas(_) => unreachable!(),
|
||||||
|
};
|
||||||
let cors_setting = cors_setting_for_element(image.upcast());
|
let cors_setting = cors_setting_for_element(image.upcast());
|
||||||
|
|
||||||
let img =
|
let img =
|
||||||
|
@ -1959,8 +1986,8 @@ impl Drop for WebGLRenderingContext {
|
||||||
|
|
||||||
impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.1
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.1
|
||||||
fn Canvas(&self) -> DomRoot<HTMLCanvasElement> {
|
fn Canvas(&self) -> HTMLCanvasElementOrOffscreenCanvas {
|
||||||
DomRoot::from_ref(&*self.canvas)
|
self.canvas.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.7
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.7
|
||||||
//
|
//
|
||||||
|
|
||||||
[Exposed=Window]
|
[Exposed=(Window,Worker)]
|
||||||
interface WebGLActiveInfo {
|
interface WebGLActiveInfo {
|
||||||
readonly attribute GLint size;
|
readonly attribute GLint size;
|
||||||
readonly attribute GLenum type;
|
readonly attribute GLenum type;
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.4
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.4
|
||||||
//
|
//
|
||||||
|
|
||||||
[Exposed=Window]
|
[Exposed=(Window,Worker)]
|
||||||
interface WebGLBuffer : WebGLObject {
|
interface WebGLBuffer : WebGLObject {
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.7
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.7
|
||||||
//
|
//
|
||||||
|
|
||||||
[Exposed=Window]
|
[Exposed=(Window,Worker)]
|
||||||
interface WebGLFramebuffer : WebGLObject {
|
interface WebGLFramebuffer : WebGLObject {
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.3
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.3
|
||||||
//
|
//
|
||||||
|
|
||||||
[Abstract, Exposed=Window]
|
[Abstract, Exposed=(Window,Worker)]
|
||||||
interface WebGLObject {
|
interface WebGLObject {
|
||||||
|
attribute USVString label;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.6
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.6
|
||||||
//
|
//
|
||||||
|
|
||||||
[Exposed=Window]
|
[Exposed=(Window,Worker)]
|
||||||
interface WebGLProgram : WebGLObject {
|
interface WebGLProgram : WebGLObject {
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.5
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.5
|
||||||
//
|
//
|
||||||
|
|
||||||
[Exposed=Window]
|
[Exposed=(Window,Worker)]
|
||||||
interface WebGLRenderbuffer : WebGLObject {
|
interface WebGLRenderbuffer : WebGLObject {
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,7 +43,7 @@ dictionary WebGLContextAttributes {
|
||||||
GLboolean failIfMajorPerformanceCaveat = false;
|
GLboolean failIfMajorPerformanceCaveat = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
[Exposed=Window]
|
[Exposed=(Window,Worker)]
|
||||||
interface mixin WebGLRenderingContextBase
|
interface mixin WebGLRenderingContextBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ interface mixin WebGLRenderingContextBase
|
||||||
const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
|
const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
|
||||||
const GLenum BROWSER_DEFAULT_WEBGL = 0x9244;
|
const GLenum BROWSER_DEFAULT_WEBGL = 0x9244;
|
||||||
|
|
||||||
readonly attribute HTMLCanvasElement canvas;
|
readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;
|
||||||
readonly attribute GLsizei drawingBufferWidth;
|
readonly attribute GLsizei drawingBufferWidth;
|
||||||
readonly attribute GLsizei drawingBufferHeight;
|
readonly attribute GLsizei drawingBufferHeight;
|
||||||
|
|
||||||
|
@ -680,7 +680,7 @@ interface mixin WebGLRenderingContextOverloads
|
||||||
undefined uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value);
|
undefined uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value);
|
||||||
};
|
};
|
||||||
|
|
||||||
[Exposed=(Window)]
|
[Exposed=(Window,Worker)]
|
||||||
interface WebGLRenderingContext
|
interface WebGLRenderingContext
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.8
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.8
|
||||||
//
|
//
|
||||||
|
|
||||||
[Exposed=Window]
|
[Exposed=(Window,Worker)]
|
||||||
interface WebGLShader : WebGLObject {
|
interface WebGLShader : WebGLObject {
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.7
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.7
|
||||||
//
|
//
|
||||||
|
|
||||||
[Exposed=Window]
|
[Exposed=(Window,Worker)]
|
||||||
interface WebGLShaderPrecisionFormat {
|
interface WebGLShaderPrecisionFormat {
|
||||||
readonly attribute GLint rangeMin;
|
readonly attribute GLint rangeMin;
|
||||||
readonly attribute GLint rangeMax;
|
readonly attribute GLint rangeMax;
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/#5.9
|
// https://www.khronos.org/registry/webgl/specs/latest/#5.9
|
||||||
//
|
//
|
||||||
|
|
||||||
[Exposed=Window]
|
[Exposed=(Window,Worker)]
|
||||||
interface WebGLTexture : WebGLObject {
|
interface WebGLTexture : WebGLObject {
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.10
|
||||||
//
|
//
|
||||||
|
|
||||||
[Exposed=Window]
|
[Exposed=(Window,Worker)]
|
||||||
interface WebGLUniformLocation {
|
interface WebGLUniformLocation {
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,6 +15,7 @@ use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGL
|
||||||
use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::{
|
use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::{
|
||||||
XRWebGLLayerInit, XRWebGLLayerMethods, XRWebGLRenderingContext,
|
XRWebGLLayerInit, XRWebGLLayerMethods, XRWebGLRenderingContext,
|
||||||
};
|
};
|
||||||
|
use crate::dom::bindings::codegen::UnionTypes::HTMLCanvasElementOrOffscreenCanvas;
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::num::Finite;
|
use crate::dom::bindings::num::Finite;
|
||||||
|
@ -189,7 +190,16 @@ impl XRWebGLLayer {
|
||||||
size.1.try_into().unwrap_or(0),
|
size.1.try_into().unwrap_or(0),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
let size = self.context().Canvas().get_size();
|
let size = match self.context().Canvas() {
|
||||||
|
HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(canvas) => canvas.get_size(),
|
||||||
|
HTMLCanvasElementOrOffscreenCanvas::OffscreenCanvas(canvas) => {
|
||||||
|
let size = canvas.get_size();
|
||||||
|
Size2D::new(
|
||||||
|
size.width.try_into().unwrap_or(0),
|
||||||
|
size.height.try_into().unwrap_or(0),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
};
|
||||||
Size2D::from_untyped(size)
|
Size2D::from_untyped(size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2364
tests/wpt/meta-legacy-layout/webgl/idlharness.any.js.ini
vendored
2364
tests/wpt/meta-legacy-layout/webgl/idlharness.any.js.ini
vendored
File diff suppressed because it is too large
Load diff
2364
tests/wpt/meta/webgl/idlharness.any.js.ini
vendored
2364
tests/wpt/meta/webgl/idlharness.any.js.ini
vendored
File diff suppressed because it is too large
Load diff
2
tests/wpt/mozilla/meta/MANIFEST.json
vendored
2
tests/wpt/mozilla/meta/MANIFEST.json
vendored
|
@ -13502,7 +13502,7 @@
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"interfaces.worker.js": [
|
"interfaces.worker.js": [
|
||||||
"2782a452ac10b97c4cd4418fb7ba516325a76fab",
|
"c8e8ae9921eb01f71a63ebbce42ff589d0a12bf8",
|
||||||
[
|
[
|
||||||
"mozilla/interfaces.worker.html",
|
"mozilla/interfaces.worker.html",
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -60,6 +60,17 @@ test_interfaces([
|
||||||
"TextEncoder",
|
"TextEncoder",
|
||||||
"URL",
|
"URL",
|
||||||
"URLSearchParams",
|
"URLSearchParams",
|
||||||
|
"WebGLActiveInfo",
|
||||||
|
"WebGLBuffer",
|
||||||
|
"WebGLFramebuffer",
|
||||||
|
"WebGLObject",
|
||||||
|
"WebGLProgram",
|
||||||
|
"WebGLRenderbuffer",
|
||||||
|
"WebGLRenderingContext",
|
||||||
|
"WebGLShader",
|
||||||
|
"WebGLShaderPrecisionFormat",
|
||||||
|
"WebGLTexture",
|
||||||
|
"WebGLUniformLocation",
|
||||||
"WebSocket",
|
"WebSocket",
|
||||||
"WeakRef",
|
"WeakRef",
|
||||||
"Worker",
|
"Worker",
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
[context-creation-worker.html]
|
[context-creation-worker.html]
|
||||||
expected: ERROR
|
[WebGL test #0: Some tests failed]
|
||||||
|
expected: FAIL
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
[context-creation-worker.html]
|
[context-creation-worker.html]
|
||||||
expected: ERROR
|
[WebGL test #0: Some tests failed]
|
||||||
|
expected: FAIL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue