From 6d6e472f13b37ebc579b961007563fe7b79c6cb2 Mon Sep 17 00:00:00 2001 From: Kenneth Russell Date: Wed, 21 Feb 2024 23:24:24 -0800 Subject: [PATCH] Remove WebGLObject superinterface. Currently no browser exposes this type, causing failures of the automatically-generated Web IDL tests in the Interop suite. This PR removes WebGLObject from the core WebGL spec and all extension specs. Fixes #3542. --- .../EXT_disjoint_timer_query/extension.xml | 10 +- .../OES_vertex_array_object/extension.xml | 12 +- .../proposals/WEBGL_debug/extension.xml | 28 +++- specs/latest/1.0/index.html | 120 ++++++++++-------- specs/latest/1.0/webgl.idl | 18 +-- specs/latest/2.0/index.html | 43 +++++-- specs/latest/2.0/webgl2.idl | 12 +- 7 files changed, 156 insertions(+), 87 deletions(-) diff --git a/extensions/EXT_disjoint_timer_query/extension.xml b/extensions/EXT_disjoint_timer_query/extension.xml index 3cbab755de..0fb9162eac 100644 --- a/extensions/EXT_disjoint_timer_query/extension.xml +++ b/extensions/EXT_disjoint_timer_query/extension.xml @@ -42,6 +42,12 @@ only on WebGL 1.0 contexts. See the EXT_disjoint_timer_query_webgl2 extension for how it is exposed on WebGL 2.0 contexts. + + WebGLTimerQueryEXT is a WebGL resource object. + Each WebGLTimerQueryEXT has an invalidated + flag, which is initially unset. + @@ -49,7 +55,7 @@ typedef unsigned long long GLuint64EXT; [Exposed=(Window,Worker), LegacyNoInterfaceObject] -interface WebGLTimerQueryEXT : WebGLObject { +interface WebGLTimerQueryEXT { }; [Exposed=(Window,Worker), LegacyNoInterfaceObject] @@ -97,7 +103,7 @@ interface EXT_disjoint_timer_query { Returns true if the passed WebGLTimerQueryEXT is valid and false otherwise. Returns false if the query's invalidated + href="#webgl-timerqueryext-invalidated-flag">invalidated flag is set or if the query was generated by a different WebGLRenderingContext than this one. diff --git a/extensions/OES_vertex_array_object/extension.xml b/extensions/OES_vertex_array_object/extension.xml index 224be15839..9bb0367683 100644 --- a/extensions/OES_vertex_array_object/extension.xml +++ b/extensions/OES_vertex_array_object/extension.xml @@ -15,10 +15,18 @@ + + + WebGLVertexArrayObjectOES is a WebGL resource object. + Each WebGLVertexArrayObjectOES has an invalidated + flag, which is initially unset. + + [Exposed=(Window,Worker), LegacyNoInterfaceObject] -interface WebGLVertexArrayObjectOES : WebGLObject { +interface WebGLVertexArrayObjectOES { }; [Exposed=(Window,Worker), LegacyNoInterfaceObject] @@ -68,7 +76,7 @@ interface OES_vertex_array_object { WebGLRenderingContext than this one.

Returns false if the vertex array's - invalidated + invalidated flag is set.

diff --git a/extensions/proposals/WEBGL_debug/extension.xml b/extensions/proposals/WEBGL_debug/extension.xml index be23bc2564..b65a1eab68 100644 --- a/extensions/proposals/WEBGL_debug/extension.xml +++ b/extensions/proposals/WEBGL_debug/extension.xml @@ -55,7 +55,8 @@ The identifier and name arguments of ObjectLabel and GetObjectLabel are replaced - with a WebGLObject object argument. + with a union type argument representing all possible WebGL resource + types. @@ -92,7 +93,7 @@ objectLabelKHR and getObjectLabelKHR are - exposed, to assign a label to a WebGLObject and retrieve + exposed, to assign a label to a WebGL resource object and retrieve it. @@ -112,6 +113,25 @@ WebGL Resources

OpenGL manages several types of resources as part of its state. These are identified - by integer object names and are obtained from OpenGL by various creation calls. - In contrast WebGL represents these resources as DOM objects. Each object is derived - from the WebGLObject interface. Currently supported resources are: - textures, buffers (i.e., VBOs), framebuffers, renderbuffers, shaders and - programs. The WebGLRenderingContext interface has a method to create a - WebGLObject subclass for each type. Data from the underlying graphics library are - stored in these objects and are fully managed by them. - The DOM object will stay alive not only as long as the author retains an explicit reference - to it, but also as long as it is in use by the underlying graphics library. - When the DOM object is destroyed, it marks its resources for deletion. - If authors wish to mark an object for deletion prior to the DOM object being destroyed, - they may explicitly call the respective delete function. (e.g. deleteTexture) + by integer object names and are obtained from OpenGL by various creation calls. In + contrast, WebGL represents these resources as opaque, typed objects. Each resource + type has an associated Web IDL interface type. Currently supported resources are: + textures, buffers (i.e., vertex buffer objects, or VBOs), framebuffers, + renderbuffers, shaders and programs. The WebGLRenderingContext interface contains + methods to create objects of each type. Data from the underlying graphics library + are stored in these objects and are fully managed by them. The object will stay + alive not only as long as the author retains an explicit reference to it, but also as + long as it is in use by the underlying graphics library. When the ECMAScript object + is destroyed, it marks its resources for deletion. If authors wish to mark a + resource for deletion prior to the ECMAScript object being destroyed, they may + explicitly call the respective delete function: for + example, deleteTexture.

@@ -983,21 +984,6 @@

Context creation parameters

- - -

WebGLObject

- -

- The WebGLObject interface is the parent interface for all GL objects. -

-

- Each WebGLObject has - an invalidated flag, which is initially unset. -

-
[Exposed=(Window,Worker)]
-interface WebGLObject {
-};
-

WebGLBuffer

@@ -1012,8 +998,13 @@

WebGLBuffer

(OpenGL ES 2.0 §2.9, man page) .

+

+ Each WebGLBuffer has + an invalidated flag, which is + initially unset. +

[Exposed=(Window,Worker)]
-interface WebGLBuffer : WebGLObject {
+interface WebGLBuffer {
 };
@@ -1030,8 +1021,13 @@

WebGLFramebuffer

(OpenGL ES 2.0 §4.4.1, man page) .

+

+ Each WebGLFramebuffer has + an invalidated flag, which is + initially unset. +

[Exposed=(Window,Worker)]
-interface WebGLFramebuffer : WebGLObject {
+interface WebGLFramebuffer {
 };
@@ -1048,8 +1044,13 @@

WebGLProgram

(OpenGL ES 2.0 §2.10.3, man page) .

+

+ Each WebGLProgram has + an invalidated flag, which is + initially unset. +

[Exposed=(Window,Worker)]
-interface WebGLProgram : WebGLObject {
+interface WebGLProgram {
 };
@@ -1066,8 +1067,13 @@

WebGLRenderbuffer

(OpenGL ES 2.0 §4.4.3, man page) .

+

+ Each WebGLRenderbuffer has + an invalidated flag, which + is initially unset. +

[Exposed=(Window,Worker)]
-interface WebGLRenderbuffer : WebGLObject {
+interface WebGLRenderbuffer {
 };
@@ -1084,8 +1090,13 @@

WebGLShader

(OpenGL ES 2.0 §2.10.1, man page) .

+

+ Each WebGLShader has + an invalidated flag, which is + initially unset. +

[Exposed=(Window,Worker)]
-interface WebGLShader : WebGLObject {
+interface WebGLShader {
 };
@@ -1102,8 +1113,13 @@

WebGLTexture

(OpenGL ES 2.0 §3.7.13, man page) .

+

+ Each WebGLTexture has + an invalidated flag, which is + initially unset. +

[Exposed=(Window,Worker)]
-interface WebGLTexture : WebGLObject {
+interface WebGLTexture {
 };
@@ -1306,10 +1322,10 @@

The WebGL context

    -
  1. Otherwise, if any argument to the method is a WebGLObject with - its invalidated flag set, generate - an INVALID_OPERATION error and let use default return value be - true.
  2. +
  3. Otherwise, if any argument to the method is a WebGL resource object + (WebGLBuffer, WebGLFramebuffer, etc.) with + its invalidated flag set, generate an INVALID_OPERATION error + and let use default return value be true.
@@ -2433,7 +2449,7 @@

Buffer objects

Returns false if the buffer was generated by a different WebGLRenderingContext than this one.

- Returns false if the buffer's invalidated + Returns false if the buffer's invalidated flag is set. @@ -2523,7 +2539,7 @@

Framebuffer objects

Returns false if the framebuffer was generated by a different WebGLRenderingContext than this one.

- Returns false if the framebuffer's invalidated + Returns false if the framebuffer's invalidated flag is set. @@ -2595,7 +2611,7 @@

Renderbuffer objects

Returns false if the renderbuffer was generated by a different WebGLRenderingContext than this one.

- Returns false if the renderbuffer's invalidated + Returns false if the renderbuffer's invalidated flag is set.
void renderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) @@ -2722,7 +2738,7 @@

Texture objects

Returns false if the texture was generated by a different WebGLRenderingContext than this one.

- Returns false if the texture's invalidated + Returns false if the texture's invalidated flag is set.
void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, @@ -3128,7 +3144,7 @@

Programs and Shaders

Returns false if the program was generated by a different WebGLRenderingContext than this one.

- Returns false if the program's invalidated + Returns false if the program's invalidated flag is set.
[WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader) (OpenGL ES 2.0 §6.1.8, man page) @@ -3138,7 +3154,7 @@

Programs and Shaders

Returns false if the shader was generated by a different WebGLRenderingContext than this one.

- Returns false if the shader's invalidated + Returns false if the shader's invalidated flag is set.
void linkProgram(WebGLProgram program) (OpenGL ES 2.0 §2.10.3, man page) @@ -3255,7 +3271,7 @@

Uniforms and attributes

Returns -1 if the context's webgl context lost flag is set.

- If the invalidated flag of the passed + If the invalidated flag of the passed program is set, generates an INVALID_OPERATION error and returns -1.

@@ -3564,13 +3580,13 @@

Detecting and enabling extensions

Once an extension is enabled, it is only disabled if the WebGL rendering context is lost (see - below), with the exception of the "WEBGL_lose_context" extension which remains active through - any loss of context. Any objects referenced by a disabled extension, such as the object returned + below), with the exception of the "WEBGL_lose_context" extension which remains active through any + loss of context. Any objects referenced by a disabled extension, such as the object returned by getExtension, are no longer associated with the WebGL rendering context. Any - extension objects that derive from WebGLObject have their - invalidated flag set to true. Behavior of - extensions' methods after context loss is defined by the steps in the - section "The WebGL context". + extension objects representing graphics resources have their + invalidated flag set to true. Behavior of extensions' methods after context + loss is defined by the steps in the section "The + WebGL context".

There are no other mechanisms to disable an extension.

@@ -3677,8 +3693,8 @@

The Context Lost Event

  • Set context's webgl context lost flag.
  • -
  • Set the invalidated flag of - each WebGLObject instance created by this context.
  • +
  • Set the invalidated flag of each WebGL resource object instance created by this + context.
  • Disable all extensions except "WEBGL_lose_context".
  • diff --git a/specs/latest/1.0/webgl.idl b/specs/latest/1.0/webgl.idl index 98c08681e5..d9d9edfdb4 100644 --- a/specs/latest/1.0/webgl.idl +++ b/specs/latest/1.0/webgl.idl @@ -3,7 +3,7 @@ // WebGL IDL definitions scraped from the Khronos specification: // https://www.khronos.org/registry/webgl/specs/latest/ -// Copyright (c) 2023 The Khronos Group Inc. +// Copyright (c) 2024 The Khronos Group Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and/or associated documentation files (the @@ -58,31 +58,27 @@ dictionary WebGLContextAttributes { }; [Exposed=(Window,Worker)] -interface WebGLObject { +interface WebGLBuffer { }; [Exposed=(Window,Worker)] -interface WebGLBuffer : WebGLObject { +interface WebGLFramebuffer { }; [Exposed=(Window,Worker)] -interface WebGLFramebuffer : WebGLObject { +interface WebGLProgram { }; [Exposed=(Window,Worker)] -interface WebGLProgram : WebGLObject { +interface WebGLRenderbuffer { }; [Exposed=(Window,Worker)] -interface WebGLRenderbuffer : WebGLObject { +interface WebGLShader { }; [Exposed=(Window,Worker)] -interface WebGLShader : WebGLObject { -}; - -[Exposed=(Window,Worker)] -interface WebGLTexture : WebGLObject { +interface WebGLTexture { }; [Exposed=(Window,Worker)] diff --git a/specs/latest/2.0/index.html b/specs/latest/2.0/index.html index af8f811343..e692b8ddbf 100644 --- a/specs/latest/2.0/index.html +++ b/specs/latest/2.0/index.html @@ -299,8 +299,13 @@

    WebGLQuery

    man page) .

    +

    + Each WebGLQuery has + an invalidated flag, which is initially + unset. +

    [Exposed=(Window,Worker)]
    -interface WebGLQuery : WebGLObject {
    +interface WebGLQuery {
     };
    @@ -325,8 +330,13 @@

    WebGLSampler

    man page) .

    +

    + Each WebGLSampler has + an invalidated flag, which is initially + unset. +

    [Exposed=(Window,Worker)]
    -interface WebGLSampler : WebGLObject {
    +interface WebGLSampler {
     };
    @@ -362,9 +372,12 @@

    WebGLSync

    .

    + Each WebGLSync has + an invalidated flag, which is initially + unset.

    [Exposed=(Window,Worker)]
    -interface WebGLSync : WebGLObject {
    +interface WebGLSync {
     };
    @@ -389,8 +402,13 @@

    WebGLTransformFeedback

    man page) .

    +

    + Each WebGLTransformFeedback has + an invalidated flag, which is initially + unset. +

    [Exposed=(Window,Worker)]
    -interface WebGLTransformFeedback : WebGLObject {
    +interface WebGLTransformFeedback {
     };
    @@ -415,8 +433,13 @@

    WebGLVertexArrayObject

    man page) .

    +

    + Each WebGLVertexArrayObject has + an invalidated flag, which is initially + unset. +

    [Exposed=(Window,Worker)]
    -interface WebGLVertexArrayObject : WebGLObject {
    +interface WebGLVertexArrayObject {
     };
    @@ -2681,7 +2704,7 @@

    Query objects

    Returns false if the query was generated by a different WebGL2RenderingContext than this one.

    - Returns false if the query's invalidated + Returns false if the query's invalidated flag is set.
    @@ -2840,7 +2863,7 @@

    Sampler objects

    Returns false if the sampler was generated by a different WebGL2RenderingContext than this one.

    - Returns false if the sampler's invalidated + Returns false if the sampler's invalidated flag is set.
    @@ -2956,7 +2979,7 @@

    Sync objects

    Returns false if the sync was generated by a different WebGL2RenderingContext than this one.

    - Returns false if the sync's invalidated + Returns false if the sync's invalidated flag is set.
    @@ -3148,7 +3171,7 @@

    Transform feedback

    Returns false if the transform feedback was generated by a different WebGL2RenderingContext than this one.

    - Returns false if the transform feedback's invalidated + Returns false if the transform feedback's invalidated flag is set.
    void bindTransformFeedback (GLenum target, WebGLTransformFeedback? transformFeedback) @@ -3413,7 +3436,7 @@

    Vertex Array objects

    Returns false if the vertex array was generated by a different WebGL2RenderingContext than this one.

    - Returns false if the vertex array's invalidated + Returns false if the vertex array's invalidated flag is set. diff --git a/specs/latest/2.0/webgl2.idl b/specs/latest/2.0/webgl2.idl index 70a514837d..5c0edd4e5e 100644 --- a/specs/latest/2.0/webgl2.idl +++ b/specs/latest/2.0/webgl2.idl @@ -3,7 +3,7 @@ // WebGL IDL definitions scraped from the Khronos specification: // https://www.khronos.org/registry/webgl/specs/latest/ -// Copyright (c) 2023 The Khronos Group Inc. +// Copyright (c) 2024 The Khronos Group Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and/or associated documentation files (the @@ -29,23 +29,23 @@ typedef unsigned long long GLuint64; [Exposed=(Window,Worker)] -interface WebGLQuery : WebGLObject { +interface WebGLQuery { }; [Exposed=(Window,Worker)] -interface WebGLSampler : WebGLObject { +interface WebGLSampler { }; [Exposed=(Window,Worker)] -interface WebGLSync : WebGLObject { +interface WebGLSync { }; [Exposed=(Window,Worker)] -interface WebGLTransformFeedback : WebGLObject { +interface WebGLTransformFeedback { }; [Exposed=(Window,Worker)] -interface WebGLVertexArrayObject : WebGLObject { +interface WebGLVertexArrayObject { }; typedef ([AllowShared] Uint32Array or sequence) Uint32List;