From 3e411b1367f00e585d7d6e42ab5f68d1b5e54fe7 Mon Sep 17 00:00:00 2001 From: Rik Cabanier Date: Mon, 15 Dec 2025 23:25:33 +0100 Subject: [PATCH 1/6] add first prototype of texElementImage2D --- specs/latest/2.0/index.html | 23 +++++++++++++++++++++++ specs/latest/2.0/webgl2.idl | 3 +++ 2 files changed, 26 insertions(+) diff --git a/specs/latest/2.0/index.html b/specs/latest/2.0/index.html index 17087d6d8..dde85cc80 100644 --- a/specs/latest/2.0/index.html +++ b/specs/latest/2.0/index.html @@ -2210,8 +2210,31 @@

Texture objects

offset is the byte offset into the WebGLBuffer's data store; generates an INVALID_VALUE error if it's less than 0.

The ETC2 and EAC texture formats defined in OpenGL ES 3.0 are not available in WebGL 2.0. + +

+ [throws] undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, + Element element); +
+
+

Renders the given element to the currently bound WebGLTexture.

+

The width and height of the texture are derived from the CSS width and height of the element at the time of rendering. Add links to whatwg.

+

TBD: define state of rendering + security. These will be more links to whatwg

+

If no WebGLBuffer is bound to the PIXEL_PACK_BUFFER target, generates an + INVALID_OPERATION error.

+

The combination of internalformat, format, and type must be listed in the following table:

+ + + + + + + + +
Internal FormatFormatType
RGBRGBUNSIGNED_BYTE
RGBARGBAUNSIGNED_BYTE
RGB16FRGBHALF_FLOAT
FLOAT
RGB32FRGBFLOAT
RGBA16FRGBAHALF_FLOAT
FLOAT
RGBA32FRGBAFLOAT
+
+

Programs and Shaders

diff --git a/specs/latest/2.0/webgl2.idl b/specs/latest/2.0/webgl2.idl index c810cbf62..f9d6d961c 100644 --- a/specs/latest/2.0/webgl2.idl +++ b/specs/latest/2.0/webgl2.idl @@ -558,6 +558,9 @@ interface mixin WebGL2RenderingContextOverloads optional unsigned long long srcOffset = 0, optional GLuint srcLengthOverride = 0); + undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, + Element element); + undefined uniform1fv(WebGLUniformLocation? location, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0); undefined uniform2fv(WebGLUniformLocation? location, Float32List data, optional unsigned long long srcOffset = 0, From c16ae72dc7bca17797c7d0a79ed6807d04fa6480 Mon Sep 17 00:00:00 2001 From: Rik Cabanier Date: Fri, 19 Dec 2025 22:41:19 +0100 Subject: [PATCH 2/6] add addition texElementImage2D + constraints + address review comments --- specs/latest/2.0/index.html | 27 ++++++++++++++++++++++++--- specs/latest/2.0/webgl2.idl | 2 ++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/specs/latest/2.0/index.html b/specs/latest/2.0/index.html index dde85cc80..66c2b0f87 100644 --- a/specs/latest/2.0/index.html +++ b/specs/latest/2.0/index.html @@ -2217,10 +2217,10 @@

Texture objects

Renders the given element to the currently bound WebGLTexture.

-

The width and height of the texture are derived from the CSS width and height of the element at the time of rendering. Add links to whatwg.

+

The width and height of the texture are derived from the CSS borderbox of the element at the time of rendering. Add links to whatwg.

TBD: define state of rendering + security. These will be more links to whatwg

-

If no WebGLBuffer is bound to the PIXEL_PACK_BUFFER target, generates an - INVALID_OPERATION error.

+

If this function is called with an HTMLElement that is not a direct descendant of the canvas of the current context, generates an INVALID_OPERATION error.

+

If a WebGLBuffer is bound to the PIXEL_UNPACK_BUFFER target, generates an INVALID_OPERATION error.

The combination of internalformat, format, and type must be listed in the following table:

@@ -2231,6 +2231,27 @@

Texture objects

Internal FormatFormatType
RGBA16FRGBAHALF_FLOAT
FLOAT
RGBA32FRGBAFLOAT
+

+ If pixel store parameter constraints are not met, + generates an INVALID_OPERATION error. +

+
+ +
+ [throws] undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLenum format, GLenum type, Element element); +
+
+

Renders the given element to the currently bound WebGLTexture.

+

The texture is resized to width and height>. Add links to whatwg.

+

TBD: define state of rendering + security. These will be more links to whatwg

+

If this function is called with an HTMLElement that is not a direct descendant of the canvas of the current context, generates an INVALID_OPERATION error.

+

If a WebGLBuffer is bound to the PIXEL_UNPACK_BUFFER target, generates an INVALID_OPERATION error.

+

See texElementImage2D for the interpretation of the internalformat, format and type arguments, and notes on the UNPACK_PREMULTIPLY_ALPHA_WEBGL pixel storage parameter.

+

+ If pixel store parameter constraints are not met, + generates an INVALID_OPERATION error. +

diff --git a/specs/latest/2.0/webgl2.idl b/specs/latest/2.0/webgl2.idl index f9d6d961c..9b6f0feb3 100644 --- a/specs/latest/2.0/webgl2.idl +++ b/specs/latest/2.0/webgl2.idl @@ -560,6 +560,8 @@ interface mixin WebGL2RenderingContextOverloads undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, Element element); + undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLenum format, GLenum type, Element element); undefined uniform1fv(WebGLUniformLocation? location, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0); From 948dc729fb1e6a80ce63f5a3a5b0d3237b2498d7 Mon Sep 17 00:00:00 2001 From: Rik Cabanier Date: Sat, 25 Apr 2026 14:23:34 -0700 Subject: [PATCH 3/6] Add missing definitions of texElementImage2D --- specs/latest/2.0/index.html | 78 ++++++++++++++++++++++++++++++++++++- specs/latest/2.0/webgl2.idl | 6 ++- 2 files changed, 81 insertions(+), 3 deletions(-) diff --git a/specs/latest/2.0/index.html b/specs/latest/2.0/index.html index 66c2b0f87..044749472 100644 --- a/specs/latest/2.0/index.html +++ b/specs/latest/2.0/index.html @@ -2212,8 +2212,7 @@

Texture objects

- [throws] undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, - Element element); + [throws] undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, Element element);

Renders the given element to the currently bound WebGLTexture.

@@ -2237,6 +2236,81 @@

Texture objects

+
+ [throws] undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, Element element); +
+
+

Renders the given element to the currently bound WebGLTexture.

+

The width and height of the texture are set by the passed in width and height.

+

TBD: define state of rendering + security. These will be more links to whatwg

+

If this function is called with an HTMLElement that is not a direct descendant of the canvas of the current context, generates an INVALID_OPERATION error.

+

If a WebGLBuffer is bound to the PIXEL_UNPACK_BUFFER target, generates an INVALID_OPERATION error.

+

The combination of internalformat, format, and type must be listed in the following table:

+ + + + + + + + +
Internal FormatFormatType
RGBRGBUNSIGNED_BYTE
RGBARGBAUNSIGNED_BYTE
RGB16FRGBHALF_FLOAT
FLOAT
RGB32FRGBFLOAT
RGBA16FRGBAHALF_FLOAT
FLOAT
RGBA32FRGBAFLOAT
+

+ If pixel store parameter constraints are not met, + generates an INVALID_OPERATION error. +

+
+ +
+ [throws] undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLfloat sx, GLfloat sy, GLfloat swidth, GLfloat sheight, GLenum format, GLenum type, Element element) +
+
+

Renders the given element to the currently bound WebGLTexture.

+

sx, sy, swidth and sheight define a rectangular slice of the element's borderbox. This slice determines the size of the generated texture.

+

TBD: define state of rendering + security. These will be more links to whatwg

+

If this function is called with an HTMLElement that is not a direct descendant of the canvas of the current context, generates an INVALID_OPERATION error.

+

If a WebGLBuffer is bound to the PIXEL_UNPACK_BUFFER target, generates an INVALID_OPERATION error.

+

The combination of internalformat, format, and type must be listed in the following table:

+ + + + + + + + +
Internal FormatFormatType
RGBRGBUNSIGNED_BYTE
RGBARGBAUNSIGNED_BYTE
RGB16FRGBHALF_FLOAT
FLOAT
RGB32FRGBFLOAT
RGBA16FRGBAHALF_FLOAT
FLOAT
RGBA32FRGBAFLOAT
+

+ If pixel store parameter constraints are not met, + generates an INVALID_OPERATION error. +

+
+ +
+ [throws] undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLfloat sx, GLfloat sy, GLfloat swidth, GLfloat sheight, GLsizei width, GLsizei height, GLenum format, GLenum type, Element element) +
+
+

Renders the given element to the currently bound WebGLTexture.

+

sx, sy, swidth and sheight define a rectangular slice of the element's when its size is set to the width and height. This slice determines the size of the generated texture.

+

TBD: define state of rendering + security. These will be more links to whatwg

+

If this function is called with an HTMLElement that is not a direct descendant of the canvas of the current context, generates an INVALID_OPERATION error.

+

If a WebGLBuffer is bound to the PIXEL_UNPACK_BUFFER target, generates an INVALID_OPERATION error.

+

The combination of internalformat, format, and type must be listed in the following table:

+ + + + + + + + +
Internal FormatFormatType
RGBRGBUNSIGNED_BYTE
RGBARGBAUNSIGNED_BYTE
RGB16FRGBHALF_FLOAT
FLOAT
RGB32FRGBFLOAT
RGBA16FRGBAHALF_FLOAT
FLOAT
RGBA32FRGBAFLOAT
+

+ If pixel store parameter constraints are not met, + generates an INVALID_OPERATION error. +

+
+
[throws] undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, Element element); diff --git a/specs/latest/2.0/webgl2.idl b/specs/latest/2.0/webgl2.idl index 9b6f0feb3..2ac7b6a62 100644 --- a/specs/latest/2.0/webgl2.idl +++ b/specs/latest/2.0/webgl2.idl @@ -562,6 +562,11 @@ interface mixin WebGL2RenderingContextOverloads Element element); undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, Element element); + undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLfloat sx, GLfloat sy, + GLfloat swidth, GLfloat sheight, GLenum format, GLenum type, Element element); + undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLfloat sx, GLfloat sy, + GLfloat swidth, GLfloat sheight, GLsizei width, GLsizei height, GLenum format, + GLenum type, Element element); undefined uniform1fv(WebGLUniformLocation? location, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0); @@ -606,4 +611,3 @@ interface WebGL2RenderingContext WebGL2RenderingContext includes WebGLRenderingContextBase; WebGL2RenderingContext includes WebGL2RenderingContextBase; WebGL2RenderingContext includes WebGL2RenderingContextOverloads; - From 5a802e755d7bbccc890acb88dcbcabd7006dcb32 Mon Sep 17 00:00:00 2001 From: Rik Cabanier Date: Fri, 29 May 2026 19:49:40 -0700 Subject: [PATCH 4/6] incorporate texElementImage2D feedback --- specs/latest/2.0/index.html | 139 ++++++++---------------------------- specs/latest/2.0/webgl2.idl | 20 +++--- 2 files changed, 42 insertions(+), 117 deletions(-) diff --git a/specs/latest/2.0/index.html b/specs/latest/2.0/index.html index 044749472..d03915a95 100644 --- a/specs/latest/2.0/index.html +++ b/specs/latest/2.0/index.html @@ -266,6 +266,15 @@

Types

 typedef long long GLint64;
 typedef unsigned long long GLuint64;
+
+dictionary WebGLCopyElementImageConfig {
+  GLfloat sx = 0;
+  GLfloat sy = 0;
+  GLfloat swidth;
+  GLfloat sheight;
+  GLsizei width;
+  GLsizei height;
+};
 
@@ -935,6 +944,9 @@

The WebGL context

optional unsigned long long srcOffset = 0, optional GLuint srcLengthOverride = 0); + undefined texElementImage2D(GLenum target, GLenum internalformat, (Element or ElementImage) element, + optional WebGLCopyElementImageConfig config = {}); // May throw DOMException + undefined uniform1fv(WebGLUniformLocation? location, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0); undefined uniform2fv(WebGLUniformLocation? location, Float32List data, optional unsigned long long srcOffset = 0, @@ -2212,116 +2224,28 @@

Texture objects

- [throws] undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, Element element); -
-
-

Renders the given element to the currently bound WebGLTexture.

-

The width and height of the texture are derived from the CSS borderbox of the element at the time of rendering. Add links to whatwg.

-

TBD: define state of rendering + security. These will be more links to whatwg

-

If this function is called with an HTMLElement that is not a direct descendant of the canvas of the current context, generates an INVALID_OPERATION error.

-

If a WebGLBuffer is bound to the PIXEL_UNPACK_BUFFER target, generates an INVALID_OPERATION error.

-

The combination of internalformat, format, and type must be listed in the following table:

- - - - - - - - -
Internal FormatFormatType
RGBRGBUNSIGNED_BYTE
RGBARGBAUNSIGNED_BYTE
RGB16FRGBHALF_FLOAT
FLOAT
RGB32FRGBFLOAT
RGBA16FRGBAHALF_FLOAT
FLOAT
RGBA32FRGBAFLOAT
-

- If pixel store parameter constraints are not met, - generates an INVALID_OPERATION error. -

-
- -
- [throws] undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, Element element); -
-
-

Renders the given element to the currently bound WebGLTexture.

-

The width and height of the texture are set by the passed in width and height.

-

TBD: define state of rendering + security. These will be more links to whatwg

-

If this function is called with an HTMLElement that is not a direct descendant of the canvas of the current context, generates an INVALID_OPERATION error.

-

If a WebGLBuffer is bound to the PIXEL_UNPACK_BUFFER target, generates an INVALID_OPERATION error.

-

The combination of internalformat, format, and type must be listed in the following table:

- - - - - - - - -
Internal FormatFormatType
RGBRGBUNSIGNED_BYTE
RGBARGBAUNSIGNED_BYTE
RGB16FRGBHALF_FLOAT
FLOAT
RGB32FRGBFLOAT
RGBA16FRGBAHALF_FLOAT
FLOAT
RGBA32FRGBAFLOAT
-

- If pixel store parameter constraints are not met, - generates an INVALID_OPERATION error. -

-
- -
- [throws] undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLfloat sx, GLfloat sy, GLfloat swidth, GLfloat sheight, GLenum format, GLenum type, Element element) + [throws] undefined texElementImage2D(GLenum target, GLenum internalformat, (Element or ElementImage) element, + optional WebGLCopyElementImageConfig config = {});
-

Renders the given element to the currently bound WebGLTexture.

-

sx, sy, swidth and sheight define a rectangular slice of the element's borderbox. This slice determines the size of the generated texture.

-

TBD: define state of rendering + security. These will be more links to whatwg

-

If this function is called with an HTMLElement that is not a direct descendant of the canvas of the current context, generates an INVALID_OPERATION error.

-

If a WebGLBuffer is bound to the PIXEL_UNPACK_BUFFER target, generates an INVALID_OPERATION error.

-

The combination of internalformat, format, and type must be listed in the following table:

- - - - - - - - -
Internal FormatFormatType
RGBRGBUNSIGNED_BYTE
RGBARGBAUNSIGNED_BYTE
RGB16FRGBHALF_FLOAT
FLOAT
RGB32FRGBFLOAT
RGBA16FRGBAHALF_FLOAT
FLOAT
RGBA32FRGBAFLOAT
-

- If pixel store parameter constraints are not met, - generates an INVALID_OPERATION error. -

-
- -
- [throws] undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLfloat sx, GLfloat sy, GLfloat swidth, GLfloat sheight, GLsizei width, GLsizei height, GLenum format, GLenum type, Element element) -
-
-

Renders the given element to the currently bound WebGLTexture.

-

sx, sy, swidth and sheight define a rectangular slice of the element's when its size is set to the width and height. This slice determines the size of the generated texture.

-

TBD: define state of rendering + security. These will be more links to whatwg

-

If this function is called with an HTMLElement that is not a direct descendant of the canvas of the current context, generates an INVALID_OPERATION error.

-

If a WebGLBuffer is bound to the PIXEL_UNPACK_BUFFER target, generates an INVALID_OPERATION error.

-

The combination of internalformat, format, and type must be listed in the following table:

- - - - - - - - +

Renders element to the currently bound WebGLTexture at level zero.

+

The element argument identifies an element image snapshot, as defined by HTML. The HTML algorithms define how element image snapshots are created, updated, retrieved, and filtered for security- or privacy-sensitive information. If element is an Element, the source rendering is the snapshot from the most recent paint event for the canvas of the current context. If element is an ElementImage, the source rendering is that captured snapshot.

+

If this function is called with an Element that is not a direct child of the canvas of the current context in the most recent rendering update, generates an INVALID_OPERATION error.

+

If target is not TEXTURE_2D, generates an INVALID_ENUM error.

+

If no WebGLTexture is bound to target, generates an INVALID_OPERATION error.

+

If a WebGLBuffer is bound to the PIXEL_UNPACK_BUFFER target, generates an INVALID_OPERATION error.

+

config.sx and config.sy are in CSS pixels and default to 0. config.swidth and config.sheight are in CSS pixels and default to the source's natural width minus config.sx and natural height minus config.sy, respectively. Together, these members define the source rectangle of the element image snapshot to render.

+

config.width and config.height are in texels and define the generated texture size. If omitted, each dimension defaults to the source rectangle size scaled by the inverse of the canvas-grid-to-CSS scaling factor used to produce the element image snapshot.

+

The internalformat argument must be one of the values in the following table. Each value has an implied source format of RGBA and the listed implied source type:

+
Internal FormatFormatType
RGBRGBUNSIGNED_BYTE
RGBARGBAUNSIGNED_BYTE
RGB16FRGBHALF_FLOAT
FLOAT
RGB32FRGBFLOAT
RGBA16FRGBAHALF_FLOAT
FLOAT
RGBA32FRGBAFLOAT
+ + + + +
Internal FormatImplied Source Type
RGBA8UNSIGNED_BYTE
SRGB8_ALPHA8UNSIGNED_BYTE
RGBA16FHALF_FLOAT
RGBA32FFLOAT
-

- If pixel store parameter constraints are not met, - generates an INVALID_OPERATION error. -

-
- -
- [throws] undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, - GLenum format, GLenum type, Element element); -
-
-

Renders the given element to the currently bound WebGLTexture.

-

The texture is resized to width and height>. Add links to whatwg.

-

TBD: define state of rendering + security. These will be more links to whatwg

-

If this function is called with an HTMLElement that is not a direct descendant of the canvas of the current context, generates an INVALID_OPERATION error.

-

If a WebGLBuffer is bound to the PIXEL_UNPACK_BUFFER target, generates an INVALID_OPERATION error.

-

See texElementImage2D for the interpretation of the internalformat, format and type arguments, and notes on the UNPACK_PREMULTIPLY_ALPHA_WEBGL pixel storage parameter.

+

If internalformat is not listed in the table above, generates an INVALID_ENUM error.

+

If any supplied numeric member of config is negative, or if the computed source rectangle width, source rectangle height, texture width, or texture height is not positive, generates an INVALID_VALUE error.

If pixel store parameter constraints are not met, generates an INVALID_OPERATION error. @@ -2329,7 +2253,6 @@

Texture objects

-

Programs and Shaders

diff --git a/specs/latest/2.0/webgl2.idl b/specs/latest/2.0/webgl2.idl index 2ac7b6a62..0ca764068 100644 --- a/specs/latest/2.0/webgl2.idl +++ b/specs/latest/2.0/webgl2.idl @@ -27,6 +27,15 @@ typedef long long GLint64; typedef unsigned long long GLuint64; +dictionary WebGLCopyElementImageConfig { + GLfloat sx = 0; + GLfloat sy = 0; + GLfloat swidth; + GLfloat sheight; + GLsizei width; + GLsizei height; +}; + [Exposed=(Window,Worker)] interface WebGLQuery : WebGLObject { @@ -558,15 +567,8 @@ interface mixin WebGL2RenderingContextOverloads optional unsigned long long srcOffset = 0, optional GLuint srcLengthOverride = 0); - undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, - Element element); - undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, - GLenum format, GLenum type, Element element); - undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLfloat sx, GLfloat sy, - GLfloat swidth, GLfloat sheight, GLenum format, GLenum type, Element element); - undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLfloat sx, GLfloat sy, - GLfloat swidth, GLfloat sheight, GLsizei width, GLsizei height, GLenum format, - GLenum type, Element element); + undefined texElementImage2D(GLenum target, GLenum internalformat, (Element or ElementImage) element, + optional WebGLCopyElementImageConfig config = {}); // May throw DOMException undefined uniform1fv(WebGLUniformLocation? location, Float32List data, optional unsigned long long srcOffset = 0, optional GLuint srcLength = 0); From 8a4b80c347430780838d5fc858eac5a7427992d2 Mon Sep 17 00:00:00 2001 From: Rik Cabanier Date: Fri, 29 May 2026 20:54:47 -0700 Subject: [PATCH 5/6] address @szager-chromium review comments --- specs/latest/2.0/index.html | 8 ++++---- specs/latest/2.0/webgl2.idl | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/specs/latest/2.0/index.html b/specs/latest/2.0/index.html index d03915a95..0a8a0db0f 100644 --- a/specs/latest/2.0/index.html +++ b/specs/latest/2.0/index.html @@ -268,8 +268,8 @@

Types

typedef unsigned long long GLuint64; dictionary WebGLCopyElementImageConfig { - GLfloat sx = 0; - GLfloat sy = 0; + GLfloat sx; + GLfloat sy; GLfloat swidth; GLfloat sheight; GLsizei width; @@ -2234,8 +2234,8 @@

Texture objects

If target is not TEXTURE_2D, generates an INVALID_ENUM error.

If no WebGLTexture is bound to target, generates an INVALID_OPERATION error.

If a WebGLBuffer is bound to the PIXEL_UNPACK_BUFFER target, generates an INVALID_OPERATION error.

-

config.sx and config.sy are in CSS pixels and default to 0. config.swidth and config.sheight are in CSS pixels and default to the source's natural width minus config.sx and natural height minus config.sy, respectively. Together, these members define the source rectangle of the element image snapshot to render.

-

config.width and config.height are in texels and define the generated texture size. If omitted, each dimension defaults to the source rectangle size scaled by the inverse of the canvas-grid-to-CSS scaling factor used to produce the element image snapshot.

+

If config.sx, config.sy, config.swidth, and config.sheight are all supplied, they define the source rectangle of the element image snapshot to render, in CSS pixels. If none of them are supplied, the source rectangle has sx and sy of 0, swidth equal to the source's natural width, and sheight equal to the source's natural height. If only some of them are supplied, generates an INVALID_VALUE error.

+

If config.width and config.height are both supplied, they define the generated texture size, in texels. If neither member is supplied, the texture width and height default to the source rectangle size scaled by the inverse of the canvas-grid-to-CSS scaling factor used to produce the element image snapshot. If only one of them is supplied, generates an INVALID_VALUE error.

The internalformat argument must be one of the values in the following table. Each value has an implied source format of RGBA and the listed implied source type:

diff --git a/specs/latest/2.0/webgl2.idl b/specs/latest/2.0/webgl2.idl index 0ca764068..d6f00953e 100644 --- a/specs/latest/2.0/webgl2.idl +++ b/specs/latest/2.0/webgl2.idl @@ -28,8 +28,8 @@ typedef long long GLint64; typedef unsigned long long GLuint64; dictionary WebGLCopyElementImageConfig { - GLfloat sx = 0; - GLfloat sy = 0; + GLfloat sx; + GLfloat sy; GLfloat swidth; GLfloat sheight; GLsizei width; From ab6501e9843d39a64c0134361f5448ff71f7139a Mon Sep 17 00:00:00 2001 From: Rik Cabanier Date: Wed, 17 Jun 2026 20:07:37 -0700 Subject: [PATCH 6/6] address @lexaknyazev's comments --- specs/latest/2.0/index.html | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/specs/latest/2.0/index.html b/specs/latest/2.0/index.html index 0a8a0db0f..3a0fdd90d 100644 --- a/specs/latest/2.0/index.html +++ b/specs/latest/2.0/index.html @@ -2228,12 +2228,12 @@

Texture objects

optional WebGLCopyElementImageConfig config = {});
-

Renders element to the currently bound WebGLTexture at level zero.

+

Renders element to the currently bound WebGLTexture, redefining level 0 of the texture. This function always operates on level 0.

The element argument identifies an element image snapshot, as defined by HTML. The HTML algorithms define how element image snapshots are created, updated, retrieved, and filtered for security- or privacy-sensitive information. If element is an Element, the source rendering is the snapshot from the most recent paint event for the canvas of the current context. If element is an ElementImage, the source rendering is that captured snapshot.

If this function is called with an Element that is not a direct child of the canvas of the current context in the most recent rendering update, generates an INVALID_OPERATION error.

If target is not TEXTURE_2D, generates an INVALID_ENUM error.

If no WebGLTexture is bound to target, generates an INVALID_OPERATION error.

-

If a WebGLBuffer is bound to the PIXEL_UNPACK_BUFFER target, generates an INVALID_OPERATION error.

+

All pixel unpack state is ignored by this function, including the PIXEL_UNPACK_BUFFER binding and all UNPACK_ pixel store parameters.

If config.sx, config.sy, config.swidth, and config.sheight are all supplied, they define the source rectangle of the element image snapshot to render, in CSS pixels. If none of them are supplied, the source rectangle has sx and sy of 0, swidth equal to the source's natural width, and sheight equal to the source's natural height. If only some of them are supplied, generates an INVALID_VALUE error.

If config.width and config.height are both supplied, they define the generated texture size, in texels. If neither member is supplied, the texture width and height default to the source rectangle size scaled by the inverse of the canvas-grid-to-CSS scaling factor used to produce the element image snapshot. If only one of them is supplied, generates an INVALID_VALUE error.

The internalformat argument must be one of the values in the following table. Each value has an implied source format of RGBA and the listed implied source type:

@@ -2246,10 +2246,6 @@

Texture objects

Internal FormatImplied Source Type

If internalformat is not listed in the table above, generates an INVALID_ENUM error.

If any supplied numeric member of config is negative, or if the computed source rectangle width, source rectangle height, texture width, or texture height is not positive, generates an INVALID_VALUE error.

-

- If pixel store parameter constraints are not met, - generates an INVALID_OPERATION error. -