From 3e411b1367f00e585d7d6e42ab5f68d1b5e54fe7 Mon Sep 17 00:00:00 2001 From: Rik Cabanier Date: Mon, 15 Dec 2025 23:25:33 +0100 Subject: [PATCH 1/2] 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/2] 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);