From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../ANGLE_instanced_arrays/extension.xml | 78 ++ .../extensions/EXT_blend_minmax/extension.xml | 70 ++ .../EXT_color_buffer_float/extension.xml | 114 ++ .../EXT_color_buffer_half_float/extension.xml | 155 +++ .../EXT_disjoint_timer_query/extension.xml | 358 ++++++ .../EXT_disjoint_timer_query_webgl2/extension.xml | 243 ++++ .../extensions/EXT_float_blend/extension.xml | 53 + .../extensions/EXT_frag_depth/extension.xml | 70 ++ .../api_webgl/extensions/EXT_sRGB/extension.xml | 87 ++ .../EXT_shader_texture_lod/extension.xml | 124 ++ .../EXT_texture_compression_bptc/extension.xml | 110 ++ .../EXT_texture_compression_rgtc/extension.xml | 126 ++ .../EXT_texture_filter_anisotropic/extension.xml | 52 + .../KHR_parallel_shader_compile/extension.xml | 103 ++ .../OES_element_index_uint/extension.xml | 50 + .../extensions/OES_fbo_render_mipmap/extension.xml | 74 ++ .../OES_standard_derivatives/extension.xml | 62 + .../extensions/OES_texture_float/extension.xml | 91 ++ .../OES_texture_float_linear/extension.xml | 51 + .../OES_texture_half_float/extension.xml | 95 ++ .../OES_texture_half_float_linear/extension.xml | 52 + .../OES_vertex_array_object/extension.xml | 138 ++ .../WEBGL_color_buffer_float/extension.xml | 145 +++ .../WEBGL_compressed_texture_astc/extension.xml | 577 +++++++++ .../WEBGL_compressed_texture_etc/extension.xml | 189 +++ .../WEBGL_compressed_texture_etc1/extension.xml | 91 ++ .../WEBGL_compressed_texture_pvrtc/extension.xml | 100 ++ .../WEBGL_compressed_texture_s3tc/extension.xml | 119 ++ .../extension.xml | 113 ++ .../WEBGL_debug_renderer_info/extension.xml | 95 ++ .../extensions/WEBGL_debug_shaders/extension.xml | 79 ++ .../extensions/WEBGL_depth_texture/extension.xml | 265 ++++ .../extensions/WEBGL_draw_buffers/extension.xml | 185 +++ .../extensions/WEBGL_lose_context/extension.xml | 114 ++ .../extensions/WEBGL_multiview/extension.xml | 285 +++++ .../extension.xml | 200 +++ .../proposals/EXT_clip_cull_distance/extension.xml | 81 ++ .../proposals/EXT_multi_draw_arrays/extension.xml | 102 ++ .../extension.xml | 125 ++ .../extensions/proposals/WEBGL_debug/extension.xml | 359 ++++++ .../proposals/WEBGL_dynamic_texture/extension.xml | 1324 ++++++++++++++++++++ .../proposals/WEBGL_subarray_uploads/extension.xml | 91 ++ .../WEBGL_texture_multisample/extension.xml | 48 + .../WEBGL_texture_source_iframe/extension.xml | 113 ++ .../proposals/WEBGL_video_texture/extension.xml | 139 ++ .../rejected/EXT_texture_storage/extension.xml | 66 + .../extensions/rejected/OES_depth24/extension.xml | 69 + .../WEBGL_compressed_texture_atc/extension.xml | 112 ++ .../WEBGL_debug_shader_precision/extension.xml | 106 ++ .../extension.xml | 83 ++ .../WEBGL_get_buffer_sub_data_async/extension.xml | 141 +++ .../rejected/WEBGL_shared_resources/extension.xml | 381 ++++++ .../rejected/WEBGL_subscribe_uniform/extension.xml | 198 +++ .../WEBGL_texture_from_depth_video/extension.xml | 108 ++ .../api_webgl/extensions/template/extension.xml | 226 ++++ .../api_webgl/specs/latest/1.0/webgl.idl | 760 +++++++++++ .../api_webgl/specs/latest/2.0/webgl2.idl | 604 +++++++++ 57 files changed, 10149 insertions(+) create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/ANGLE_instanced_arrays/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/EXT_blend_minmax/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/EXT_color_buffer_float/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/EXT_color_buffer_half_float/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/EXT_disjoint_timer_query/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/EXT_disjoint_timer_query_webgl2/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/EXT_float_blend/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/EXT_frag_depth/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/EXT_sRGB/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/EXT_shader_texture_lod/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/EXT_texture_compression_bptc/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/EXT_texture_compression_rgtc/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/EXT_texture_filter_anisotropic/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/KHR_parallel_shader_compile/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/OES_element_index_uint/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/OES_fbo_render_mipmap/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/OES_standard_derivatives/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/OES_texture_float/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/OES_texture_float_linear/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/OES_texture_half_float/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/OES_texture_half_float_linear/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/OES_vertex_array_object/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/WEBGL_color_buffer_float/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_astc/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_etc/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_etc1/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_pvrtc/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_s3tc/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/WEBGL_debug_renderer_info/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/WEBGL_debug_shaders/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/WEBGL_depth_texture/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/WEBGL_draw_buffers/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/WEBGL_lose_context/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/WEBGL_multiview/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/WEBGL_security_sensitive_resources/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/proposals/EXT_clip_cull_distance/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/proposals/EXT_multi_draw_arrays/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_blend_equation_advanced_coherent/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_debug/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_dynamic_texture/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_subarray_uploads/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_texture_multisample/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_texture_source_iframe/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_video_texture/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/rejected/EXT_texture_storage/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/rejected/OES_depth24/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_compressed_texture_atc/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_debug_shader_precision/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_draw_elements_no_range_check/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_get_buffer_sub_data_async/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_shared_resources/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_subscribe_uniform/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_texture_from_depth_video/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/extensions/template/extension.xml create mode 100644 third_party/rust/khronos_api/api_webgl/specs/latest/1.0/webgl.idl create mode 100644 third_party/rust/khronos_api/api_webgl/specs/latest/2.0/webgl2.idl (limited to 'third_party/rust/khronos_api/api_webgl') diff --git a/third_party/rust/khronos_api/api_webgl/extensions/ANGLE_instanced_arrays/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/ANGLE_instanced_arrays/extension.xml new file mode 100644 index 0000000000..4962e1fed2 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/ANGLE_instanced_arrays/extension.xml @@ -0,0 +1,78 @@ + + + ANGLE_instanced_arrays + + WebGL working group (public_webgl 'at' khronos.org) + + + Contributors to ANGLE_instanced_arrays + Members of the WebGL working group + + 19 + + + + + + + + The implementation must validate the indices referenced by drawArraysInstancedANGLE and drawElementsInstancedANGLE + similarly to how indices referenced by drawArrays and drawElements are validated according to section + Enabled Vertex Attributes and Range Checking of the + WebGL specification. + + +

+ Although the extension contains ANGLE in the name it may be exposed by any implementation, whether or not the implementation uses the ANGLE library. +

+
+ +[NoInterfaceObject] +interface ANGLE_instanced_arrays { + const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88FE; + void drawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount); + void drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount); + void vertexAttribDivisorANGLE(GLuint index, GLuint divisor); +}; + + +

How does ANGLE_instanced_arrays interact with OES_vertex_array_object?

+
    +
  • +

    RESOLVED: When the ANGLE_instanced_arrays and OES_vertex_array_object + extensions are both enabled, attribute divisors are tracked by the + vertex array objects like any other vertex array state. +

    +
  • +
+
+ + + Initial revision. + + + Moved from proposal to draft. + + + Renumbered to 19 to fix misnumbering problem. + + + Moved to community approved. + + + Clarified non-ANGLE support. + + + Addendum about index validation. + + + Added NoInterfaceObject extended attribute. + + + Ratified by Khronos Board of Promoters. + + + Clarified interaction with OES_vertex_array_object. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/EXT_blend_minmax/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/EXT_blend_minmax/extension.xml new file mode 100644 index 0000000000..6d32712aa5 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/EXT_blend_minmax/extension.xml @@ -0,0 +1,70 @@ + + + EXT_blend_minmax + + WebGL + working group (public_webgl 'at' khronos.org) + + + Florian Boesch (pyalot 'at' gmail.com) + Members of the WebGL working group + + + 25 + + + + + + + + + + + + + The blendEquation and blendEquationSeparate + entry points are extended to accept MIN_EXT and MAX_EXT + + + + + +[NoInterfaceObject] +interface EXT_blend_minmax { + const GLenum MIN_EXT = 0x8007; + const GLenum MAX_EXT = 0x8008; +}; + + + +
+        var ext = gl.getExtension('EXT_blend_minmax');
+        gl.blendEquation(ext.MAX_EXT);
+        gl.getParameter(gl.BLEND_EQUATION) == ext.MAX_EXT;
+    
+
+ + + + Initial revision. + + + Moved to draft. + + + Removed blendEquationEXT function and the BLEND_EQUATION_EXT and + FUNC_ADD_EXT enums, all of which are already have equivalents in WebGL. + + + Moved to community approved after discussion on public_webgl list. + + + Added NoInterfaceObject extended attribute. + + + Ratified by Khronos Board of Promoters. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/EXT_color_buffer_float/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/EXT_color_buffer_float/extension.xml new file mode 100644 index 0000000000..594b3f906a --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/EXT_color_buffer_float/extension.xml @@ -0,0 +1,114 @@ + + + EXT_color_buffer_float + + WebGL + working group (public_webgl 'at' khronos.org) + + + Mark Callow, HI Corporation + + Members of the WebGL working group + + + 31 + + + + + + + + + The sized internal format RGB16F is not color-renderable in this + extension. This is a difference in functionality compared to the EXT_color_buffer_half_float extension. + + + + + +

The following floating-point internal formats become color-renderable: R16F, + RG16F, RGBA16F, R32F, + RG32F, RGBA32F and + R11F_G11F_B10F. A renderbuffer or a texture with a + color-renderable internal format can be used as a rendering target by + attaching it to a framebuffer object as a color attachment.

+
+ + +

Renderbuffers with these internal formats can be created.

+
+ + +

The format and type combination RGBA and + FLOAT becomes valid for reading from a floating-point + color buffer.

+
+
+ +

Notes:

    +
  • Fragment shader outputs to buffers with these internal formats are + not clamped.
  • + +
  • Colors specified with clearColor and + blendColor are not clamped when applied to buffers with + these internal formats.
  • + +
  • The format and type combination RGBA and + UNSIGNED_BYTE cannot be used for reading from a + floating-point color buffer.
  • + +
  • Multi-sample floating-point color renderbuffers may optionally be supported. Limitations + are defined in the EXT_color_buffer_float + extension.
  • + +
  • The sized internal format RGB16F is not color-renderable in this + extension.
  • +

+
+ + +[NoInterfaceObject] +interface EXT_color_buffer_float { +}; // interface EXT_color_buffer_float + + + + + Initial revision. + + + + Added NoInterfaceObject extended attribute. + + + + Moved to draft status. + + + + Moved to community approved status. + + + + Added note about RGB16F not being color-renderable. + + + + Allowed allocation of multi-sample floating-point color renderbuffers as optional functionality. + Changed XML tags to fix incorrect statement that there are no behavioral changes compared to the native extension. + + + + Removed incorrect statement about framebuffer completeness and multi-sampled floating-point color renderbuffers. + + + + Allowed these float formats for CopyTexImage2D. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/EXT_color_buffer_half_float/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/EXT_color_buffer_half_float/extension.xml new file mode 100644 index 0000000000..4385cd6d04 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/EXT_color_buffer_half_float/extension.xml @@ -0,0 +1,155 @@ + + + EXT_color_buffer_half_float + + WebGL + working group (public_webgl 'at' khronos.org) + + + Mark Callow, HI Corporation + + Members of the WebGL working group + + + 14 + + + + + + + + + + + + +

All references to R16F and RG16F types + are ignored.

+
+ +

WebGL implementations supporting this extension are required to + support rendering to RGBA16F format.

+
+
+ + + +

The 16-bit floating-point types RGB16F and + RGBA16F become available as color-renderable formats. + Renderbuffers can be created in these formats. These and textures + created with type = HALF_FLOAT_OES, which will have one + of these internal formats, can be attached to framebuffer object color + attachments for rendering. Implementations supporting this extension are + required to support rendering to RGBA16F format. + Applications must check framebuffer completeness to determine if + RGB16F is supported.

+
+ + +

NOTE: fragment shaders outputs + gl_FragColor and gl_FragData[0] will only be clamped and converted + when the color buffer is fixed-point and blendColor() and + clearColor() will no longer clamp their parameter values + on input. Clamping will be applied as necessary at draw time according + to the type of color buffer in use.

+
+ + +

The format and type combination RGBA and + FLOAT becomes valid for reading from a floating-point + rendering buffer. Note: RGBA and + UNSIGNED_BYTE cannot be used for reading from a + floating-point rendering buffer.

+
+ + +

The component types of framebuffer object attachments can be + queried.

+
+
+
+ + +[NoInterfaceObject] +interface EXT_color_buffer_half_float { + const GLenum RGBA16F_EXT = 0x881A; + const GLenum RGB16F_EXT = 0x881B; + const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211; + const GLenum UNSIGNED_NORMALIZED_EXT = 0x8C17; +}; // interface EXT_color_buffer_half_float + + + +

In section 5.13.12 Reading back pixels, change the allowed + format and types table to:

+ +
+
+ + + + + + + + + + + + + + + + + + + + +
frame buffer type + format + + type +
normalized fixed-pointRGBAUNSIGNED_BYTE
floating-pointRGBAFLOAT
+
+
+ +

Change the paragraph beginning "If pixels is null ..." + to

If frame buffer type is not that indicated in the table for + the format and type combination, an + INVALID_OPERATON error is generated. If pixels is null + ...
+
+ + + + Initial revision. + + + + "Add reading-pixels-as-FLOAT feature to the Overview and related + changes to WebGL section 5.13.12. + + + + Move to draft. + + + + Removed webgl module. Added NoInterfaceObject extended attribute. + + + + Move to community approved. + + + + Subsumed in WebGL 2.0 by EXT_color_buffer_float. + + + + Require RGBA16F to be color-renderable and RGB16F to be optionally color-renderable. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/EXT_disjoint_timer_query/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/EXT_disjoint_timer_query/extension.xml new file mode 100644 index 0000000000..6b630aa8e1 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/EXT_disjoint_timer_query/extension.xml @@ -0,0 +1,358 @@ + + + EXT_disjoint_timer_query + + WebGL + working group (public_webgl 'at' khronos.org) + + + Contributors to ARB_occlusion_query + Contributors to EXT_timer_query + Contributors to ARB_timer_query + Ben Vanik, Google Inc. + Daniel Koch, TransGaming Inc. + Florian Boesch (pyalot 'at' gmail.com) + Members of the WebGL working group + + + 26 + + + + + + + + + Specifies that queries' results only become available at certain well-defined times. + + + + + + This extension provides a query mechanism that can be used to determine + the amount of time it takes to fully complete a set of GL commands, and + without stalling the rendering pipeline. It uses the query object + mechanisms first introduced in the occlusion query extension, which allow + time intervals to be polled asynchronously by the application. + + + This version of the disjoint_timer_query extension is exposed + only on on WebGL 1.0 contexts. See the _webgl2 version of the + extension for how it is exposed on WebGL 2.0 contexts. + + + + + +typedef unsigned long long GLuint64EXT; + +[NoInterfaceObject] +interface WebGLTimerQueryEXT : WebGLObject { +}; + +[NoInterfaceObject] +interface EXT_disjoint_timer_query { + const GLenum QUERY_COUNTER_BITS_EXT = 0x8864; + const GLenum CURRENT_QUERY_EXT = 0x8865; + const GLenum QUERY_RESULT_EXT = 0x8866; + const GLenum QUERY_RESULT_AVAILABLE_EXT = 0x8867; + const GLenum TIME_ELAPSED_EXT = 0x88BF; + const GLenum TIMESTAMP_EXT = 0x8E28; + const GLenum GPU_DISJOINT_EXT = 0x8FBB; + + WebGLTimerQueryEXT? createQueryEXT(); + void deleteQueryEXT(WebGLTimerQueryEXT? query); + [WebGLHandlesContextLoss] boolean isQueryEXT(WebGLTimerQueryEXT? query); + void beginQueryEXT(GLenum target, WebGLTimerQueryEXT query); + void endQueryEXT(GLenum target); + void queryCounterEXT(WebGLTimerQueryEXT query, GLenum target); + any getQueryEXT(GLenum target, GLenum pname); + any getQueryObjectEXT(WebGLTimerQueryEXT query, GLenum pname); +}; + + + + + + + + + + + + + + + + + Returns true if the passed WebGLTimerQueryEXT is valid and false otherwise. Returns false if + the query's invalidated + flag is set. + + + + + + + + target accepts TIME_ELAPSED_EXT. + + + + + + + target accepts TIME_ELAPSED_EXT. + + + + + + + + target accepts TIMESTAMP_EXT. + + + + + + + + target and pname accept the following combinations of + parameters. The return type of this method depends on the parameter queried. +
+ + + + + + +
targetpnamereturned type
TIME_ELAPSED_EXTCURRENT_QUERYWebGLQuery?
TIMESTAMP_EXTCURRENT_QUERYnull
TIME_ELAPSED_EXTQUERY_COUNTER_BITS_EXTGLint
TIMESTAMP_EXTQUERY_COUNTER_BITS_EXTGLint
+
+
+ + + + + + pname accepts QUERY_RESULT_EXT or QUERY_RESULT_AVAILABLE_EXT. +
+ The return type of this method depends on the parameter queried: + + + + +
pnamereturned type
QUERY_RESULT_EXTGLuint64EXT
QUERY_RESULT_AVAILABLE_EXTboolean
+
+ In order to ensure consistent behavior across platforms, queries' results must only be made + available when the user agent's event + loop is not executing a task. In other words: +
    +
  • A query's result must not be made available until control has returned to the user + agent's main loop.
  • +
  • Repeatedly fetching a query's QUERY_RESULT_AVAILABLE_EXT parameter in a loop, without + returning control to the user agent, must always return the same value.
  • +
+ +
+ A query's result may or may not be made available when control returns to the user + agent's event loop. It is not guaranteed that using a single setTimeout callback with a + delay of 0, or a single requestAnimationFrame callback, will allow sufficient time for + the WebGL implementation to supply the query's results. +
+ +
+ This change compared to the original extension specification is enforced in order to prevent + applications from relying on being able to issue a query and fetch its result in the same + frame. In order to ensure best portability among devices and best performance among + implementations, applications must expect that queries' results will become available + asynchronously. +
+
+
+ + + + + pname accepts TIMESTAMP_EXT or GPU_DISJOINT_EXT. +
+ + The return type depends on the parameter queried: + + + + +
pnamereturned type
TIMESTAMP_EXTGLuint64EXT
GPU_DISJOINT_EXTboolean
+
+
+ + +
    +
  1. +

    + Can getQueryObjectEXT be exposed in its current form according to ECMAScript + semantics? ECMAScript's de-facto concurrency + model is "shared nothing" communicating event loops. Is it acceptable for sequential + calls to getQueryObjectEXT to return different answers? Note that Date.now() advances + during script execution, so this may be fine; but if concerns are raised, then the API may + need to be redesigned to use callbacks. +

    +
  2. +
+
+ + +
+        // Example (1) -- uses beginQueryEXT/endQueryEXT.
+        var ext = gl.getExtension('EXT_disjoint_timer_query');
+        var query = ext.createQueryEXT();
+        ext.beginQueryEXT(ext.TIME_ELAPSED_EXT, query);
+
+        // Draw object
+        gl.drawElements(...);
+
+        ext.endQueryEXT(ext.TIME_ELAPSED_EXT);
+
+        // ...at some point in the future, after returning control to the browser and being called again:
+        var available = ext.getQueryObjectEXT(query, ext.QUERY_RESULT_AVAILABLE_EXT);
+        var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
+
+        if (available && !disjoint) {
+          // See how much time the rendering of the object took in nanoseconds.
+          var timeElapsed = ext.getQueryObjectEXT(query, ext.QUERY_RESULT_EXT);
+
+          // Do something useful with the time.  Note that care should be
+          // taken to use all significant bits of the result, not just the
+          // least significant 32 bits.
+          adjustObjectLODBasedOnDrawTime(timeElapsed);
+        }
+
+        //----------------------------------------------------------------------
+
+        // Example (2) -- same as the example above, but uses queryCounterEXT instead.
+        var ext = gl.getExtension('EXT_disjoint_timer_query');
+        var startQuery = ext.createQueryEXT();
+        var endQuery = ext.createQueryEXT();
+        ext.queryCounterEXT(startQuery, ext.TIMESTAMP_EXT);
+
+        // Draw object
+        gl.drawElements(...);
+
+        ext.queryCounterEXT(endQuery, ext.TIMESTAMP_EXT);
+
+        // ...at some point in the future, after returning control to the browser and being called again:
+        var available = ext.getQueryObjectEXT(endQuery, ext.QUERY_RESULT_AVAILABLE_EXT);
+        var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
+
+        if (available && !disjoint) {
+          // See how much time the rendering of the object took in nanoseconds.
+          var timeStart = ext.getQueryObjectEXT(startQuery, ext.QUERY_RESULT_EXT);
+          var timeEnd = ext.getQueryObjectEXT(endQuery, ext.QUERY_RESULT_EXT);
+
+          // Do something useful with the time.  Note that care should be
+          // taken to use all significant bits of the result, not just the
+          // least significant 32 bits.
+          adjustObjectLODBasedOnDrawTime(timeEnd - timeStart);
+        }
+
+        //----------------------------------------------------------------------
+
+        // Example (3) -- check the number of timestamp bits to determine how to best
+        // measure elapsed time.
+        var ext = gl.getExtension('EXT_disjoint_timer_query');
+        var timeElapsedQuery;
+        var startQuery;
+        var endQuery;
+
+        var useTimestamps = false;
+
+        if (ext.getQueryEXT(ext.TIMESTAMP_EXT, ext.QUERY_COUNTER_BITS_EXT) > 0) {
+          useTimestamps = true;
+        }
+
+        // Clear the disjoint state before starting to work with queries to increase
+        // the chances that the results will be valid.
+        gl.getParameter(ext.GPU_DISJOINT_EXT);
+
+        if (useTimestamps) {
+          startQuery = ext.createQueryEXT();
+          endQuery = ext.createQueryEXT();
+          ext.queryCounterEXT(startQuery, ext.TIMESTAMP_EXT);
+        } else {
+          timeElapsedQuery = ext.createQueryEXT();
+          ext.beginQueryEXT(ext.TIME_ELAPSED_EXT, timeElapsedQuery);
+        }
+
+        // Draw object
+        gl.drawElements(...);
+
+        if (useTimestamps) {
+          ext.queryCounterEXT(endQuery, ext.TIMESTAMP_EXT);
+        } else {
+          ext.endQueryEXT(ext.TIME_ELAPSED_EXT);
+        }
+
+        // ...at some point in the future, after returning control to the browser and being called again:
+        var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
+        if (disjoint) {
+          // Have to redo all of the measurements.
+        } else {
+          var available;
+          if (useTimestamps) {
+            available = ext.getQueryObjectEXT(endQuery, ext.QUERY_RESULT_AVAILABLE_EXT);
+          } else {
+            available = ext.getQueryObjectEXT(timeElapsedQuery, ext.QUERY_RESULT_AVAILABLE_EXT);
+          }
+
+          if (available) {
+            var timeElapsed;
+            if (useTimestamps) {
+              // See how much time the rendering of the object took in nanoseconds.
+              var timeStart = ext.getQueryObjectEXT(startQuery, ext.QUERY_RESULT_EXT);
+              var timeEnd = ext.getQueryObjectEXT(endQuery, ext.QUERY_RESULT_EXT);
+              timeElapsed = timeEnd - timeStart;
+            } else {
+              timeElapsed = ext.getQueryObjectEXT(query, ext.QUERY_RESULT_EXT);
+            }
+
+            // Do something useful with the time.  Note that care should be
+            // taken to use all significant bits of the result, not just the
+            // least significant 32 bits.
+            adjustObjectLODBasedOnDrawTime(timeElapsed);
+          }
+        }
+    
+
+ + + + Initial revision. + + + Based on public_webgl discussion, specified that queries' results only become available at well-defined times. + + + Recast as EXT_disjoint_timer_query and harmonized with mirrored extension. + + + Added NoInterfaceObject extended attribute. + + + Revised language regarding queries' availability based on feedback from Jeff Gilbert. + + + Promoted to community approved after discussion on public_webgl. + + + Added example choosing measurement technique based on number of timestamp bits. + + + Added clarifying note that this document only applies to WebGL 1.0. Minor reformatting and typo fixes. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/EXT_disjoint_timer_query_webgl2/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/EXT_disjoint_timer_query_webgl2/extension.xml new file mode 100644 index 0000000000..188bcd4b62 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/EXT_disjoint_timer_query_webgl2/extension.xml @@ -0,0 +1,243 @@ + + + EXT_disjoint_timer_query_webgl2 + + WebGL + working group (public_webgl 'at' khronos.org) + + + Contributors to ARB_occlusion_query + Contributors to EXT_timer_query + Contributors to ARB_timer_query + Ben Vanik, Google Inc. + Daniel Koch, TransGaming Inc. + Florian Boesch (pyalot 'at' gmail.com) + Members of the WebGL working group + + + 33 + + + + + + + + + Specifies that queries' results only become available at certain well-defined times. + + + + + + This extension provides the same functionality as EXT_disjoint_timer_query. The IDL, description, and + extension name are specialized for WebGL 2.0, which incorporates query objects into the core + specification. + + + + + +typedef unsigned long long GLuint64EXT; + +[NoInterfaceObject] +interface EXT_disjoint_timer_query_webgl2 { + const GLenum QUERY_COUNTER_BITS_EXT = 0x8864; + const GLenum TIME_ELAPSED_EXT = 0x88BF; + const GLenum TIMESTAMP_EXT = 0x8E28; + const GLenum GPU_DISJOINT_EXT = 0x8FBB; + + void queryCounterEXT(WebGLQuery query, GLenum target); +}; + + + + + + + target accepts TIME_ELAPSED_EXT. + + + + + + + target accepts TIME_ELAPSED_EXT. + + + + + + + + target accepts TIMESTAMP_EXT. + + + + + + + + target and pname accept the following combinations of + parameters. The return type of this method now depends on the parameter queried. +
+ + + + + + +
targetpnamereturned type
TIME_ELAPSED_EXTCURRENT_QUERYWebGLQuery?
TIMESTAMP_EXTCURRENT_QUERYnull
TIME_ELAPSED_EXTQUERY_COUNTER_BITS_EXTGLint
TIMESTAMP_EXTQUERY_COUNTER_BITS_EXTGLint
+
+
+ + + + + pname accepts TIMESTAMP_EXT or GPU_DISJOINT_EXT. +
+ + The return type depends on the parameter queried: + + + + +
pnamereturned type
TIMESTAMP_EXTGLuint64EXT
GPU_DISJOINT_EXTboolean
+
+
+ + +
+        // Example (1) -- uses beginQuery/endQuery.
+        var ext = gl.getExtension('EXT_disjoint_timer_query_webgl2');
+        var query = gl.createQuery();
+        gl.beginQuery(ext.TIME_ELAPSED_EXT, query);
+
+        // Draw object
+        gl.drawElements(...);
+
+        gl.endQuery(ext.TIME_ELAPSED_EXT);
+
+        // ...at some point in the future, after returning control to the browser and being called again:
+        var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
+        var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
+
+        if (available && !disjoint) {
+          // See how much time the rendering of the object took in nanoseconds.
+          var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT);
+
+          // Do something useful with the time.  Note that care should be
+          // taken to use all significant bits of the result, not just the
+          // least significant 32 bits.
+          adjustObjectLODBasedOnDrawTime(timeElapsed);
+        }
+
+        //----------------------------------------------------------------------
+
+        // Example (2) -- same as the example above, but uses queryCounterEXT instead.
+        var ext = gl.getExtension('EXT_disjoint_timer_query_webgl2');
+        var startQuery = gl.createQuery();
+        var endQuery = gl.createQuery();
+        ext.queryCounterEXT(startQuery, ext.TIMESTAMP_EXT);
+
+        // Draw object
+        gl.drawElements(...);
+
+        ext.queryCounterEXT(endQuery, ext.TIMESTAMP_EXT);
+
+        // ...at some point in the future, after returning control to the browser and being called again:
+        var available = gl.getQueryParameter(endQuery, gl.QUERY_RESULT_AVAILABLE);
+        var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
+
+        if (available && !disjoint) {
+          // See how much time the rendering of the object took in nanoseconds.
+          var timeStart = gl.getQueryParameter(startQuery, gl.QUERY_RESULT);
+          var timeEnd = gl.getQueryParameter(endQuery, gl.QUERY_RESULT);
+
+          // Do something useful with the time.  Note that care should be
+          // taken to use all significant bits of the result, not just the
+          // least significant 32 bits.
+          adjustObjectLODBasedOnDrawTime(timeEnd - timeStart);
+        }
+
+        //----------------------------------------------------------------------
+
+        // Example (3) -- check the number of timestamp bits to determine how to best
+        // measure elapsed time.
+        var ext = gl.getExtension('EXT_disjoint_timer_query_webgl2');
+        var timeElapsedQuery;
+        var startQuery;
+        var endQuery;
+
+        var useTimestamps = false;
+
+        if (gl.getQuery(ext.TIMESTAMP_EXT, ext.QUERY_COUNTER_BITS_EXT) > 0) {
+          useTimestamps = true;
+        }
+
+        // Clear the disjoint state before starting to work with queries to increase
+        // the chances that the results will be valid.
+        gl.getParameter(ext.GPU_DISJOINT_EXT);
+
+        if (useTimestamps) {
+          startQuery = gl.createQuery();
+          endQuery = gl.createQuery();
+          ext.queryCounterEXT(startQuery, ext.TIMESTAMP_EXT);
+        } else {
+          timeElapsedQuery = gl.createQuery();
+          gl.beginQuery(ext.TIME_ELAPSED_EXT, timeElapsedQuery);
+        }
+
+        // Draw object
+        gl.drawElements(...);
+
+        if (useTimestamps) {
+          ext.queryCounterEXT(endQuery, ext.TIMESTAMP_EXT);
+        } else {
+          gl.endQuery(ext.TIME_ELAPSED_EXT);
+        }
+
+        // ...at some point in the future, after returning control to the browser and being called again:
+        var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
+        if (disjoint) {
+          // Have to redo all of the measurements.
+        } else {
+          var available;
+          if (useTimestamps) {
+            available = gl.getQueryParameter(endQuery, gl.QUERY_RESULT_AVAILABLE);
+          } else {
+            available = gl.getQueryParameter(timeElapsedQuery, gl.QUERY_RESULT_AVAILABLE);
+          }
+
+          if (available) {
+            var timeElapsed;
+            if (useTimestamps) {
+              // See how much time the rendering of the object took in nanoseconds.
+              var timeStart = gl.getQueryParameter(startQuery, gl.QUERY_RESULT);
+              var timeEnd = gl.getQueryParameter(endQuery, gl.QUERY_RESULT);
+              timeElapsed = timeEnd - timeStart;
+            } else {
+              timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT);
+            }
+
+            // Do something useful with the time.  Note that care should be
+            // taken to use all significant bits of the result, not just the
+            // least significant 32 bits.
+            adjustObjectLODBasedOnDrawTime(timeElapsed);
+          }
+        }
+    
+
+ + + + Split WebGL 2.0 specification of this extension into its own file + for better comprehensibility. + + + Fixed errors in sample code pointed out by @juj. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/EXT_float_blend/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/EXT_float_blend/extension.xml new file mode 100644 index 0000000000..2836759eab --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/EXT_float_blend/extension.xml @@ -0,0 +1,53 @@ + + + EXT_float_blend + + WebGL + working group (public_webgl 'at' khronos.org) + + + Mark Callow + + Members of the WebGL working group + + + 35 + + + + + + + + + + + +

An INVALID_OPERATION error will no longer be raised by + drawArrays or drawElements when blending is + enabled and the draw buffer has 32-bit floating-point components. Note + that in order to create such a draw buffer the + + EXT_color_buffer_float extension must be enabled.

+
+
+ +
+ + +[NoInterfaceObject] +interface EXT_float_blend { +}; // interface EXT_float_blend + + + + + Initial revision. + + + + Promoted to draft status after discussion on public_webgl. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/EXT_frag_depth/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/EXT_frag_depth/extension.xml new file mode 100644 index 0000000000..08006fb4f1 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/EXT_frag_depth/extension.xml @@ -0,0 +1,70 @@ + + + EXT_frag_depth + WebGL + working group (public_webgl 'at' khronos.org) + + + Florian Boesch (pyalot 'at' gmail.com) + Members of the WebGL working group + + + 16 + + + + + + + + + + + + + + + Adds the ability to set the depth value of a fragment from + within the fragment shader with the built-in output variable gl_FragDepthEXT. + + + + + + + + + + [NoInterfaceObject] + interface EXT_frag_depth { + }; + + + +
+    void main(){
+        gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);
+        gl_FragDepthEXT = 0.5;
+    }
+    
+
+ + + + Initial revision. + + + Moved to draft. + + + Moved to community approved. + + + Added NoInterfaceObject extended attribute. + + + Ratified by Khronos Board of Promoters. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/EXT_sRGB/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/EXT_sRGB/extension.xml new file mode 100644 index 0000000000..b08cfe6983 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/EXT_sRGB/extension.xml @@ -0,0 +1,87 @@ + + + EXT_sRGB + + WebGL + working group (public_webgl 'at' khronos.org) + + + Florian Boesch (pyalot 'at' gmail.com) + Members of the WebGL working group + + + 17 + + + + + Additional format restrictions apply for CopyTexImage2D + + + + + + + + + + Adds the sRGB support to textures and framebuffer objects. + + + + + + [NoInterfaceObject] + interface EXT_sRGB { + const GLenum SRGB_EXT = 0x8C40; + const GLenum SRGB_ALPHA_EXT = 0x8C42; + const GLenum SRGB8_ALPHA8_EXT = 0x8C43; + const GLenum FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT = 0x8210; + }; + + + + + + + Accepted by the format and internalformat parameters: SRGB_EXT and SRGB_ALPHA_EXT + + + + Accepted by the format parameter: SRGB_EXT and SRGB_ALPHA_EXT + + + + Accepted by the internalformat parameter: SRGB_ALPHA8_EXT + + + + Accepted by the pname parameter: FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT + + + + +
+        var ext = gl.getExtension('EXT_sRGB');
+        var texture = gl.createTexture();
+        gl.bindTexture(gl.TEXTURE_2D, texture);
+        texImage2D(gl.TEXTURE_2D, 0, ext.SRGB_EXT, 256, 256, 0, ext.SRGB_EXT, gl.UNSIGNED_BYTE, data);
+    
+
+ + + + Initial revision. + + + Moved from proposal to draft + + + Moved from draft to community approved + + + Added NoInterfaceObject extended attribute. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/EXT_shader_texture_lod/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/EXT_shader_texture_lod/extension.xml new file mode 100644 index 0000000000..7cf8467d41 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/EXT_shader_texture_lod/extension.xml @@ -0,0 +1,124 @@ + + + EXT_shader_texture_lod + WebGL + working group (public_webgl 'at' khronos.org) + + + Vladimir Vukicevic (vladimir 'at' mozilla.com) + Florian Boesch (pyalot 'at' gmail.com) + Members of the WebGL working group + + + 27 + + + + + + + + + + + + + + + This extension adds additional texture functions to the + OpenGL ES Shading Language which provide the shader writer + with explicit control of LOD. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [NoInterfaceObject] + interface EXT_shader_texture_lod { + }; + + + +
+    #extension GL_EXT_shader_texture_lod : enable
+    #extension GL_OES_standard_derivatives : enable
+
+    uniform sampler2D myTexture;
+    varying vec2 texcoord;
+
+    void main(){
+        // avoids artifacts when wrapping texture coordinates
+        gl_FragColor = texture2DGradEXT(myTexture, mod(texcoord, vec2(0.1, 0.5)), dFdx(texcoord), dFdy(texcoord));
+    }
+    
+
+ + + + Initial revision. + + + Moved to draft. + + + Moved to community approved after discussion on public_webgl list. + + + Added NoInterfaceObject extended attribute. + + + Corrected extension name to include GL_ prefix. + + + Ratified by Khronos Board of Promoters. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/EXT_texture_compression_bptc/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/EXT_texture_compression_bptc/extension.xml new file mode 100644 index 0000000000..c08e98b760 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/EXT_texture_compression_bptc/extension.xml @@ -0,0 +1,110 @@ + + + + EXT_texture_compression_bptc + + WebGL working group (public_webgl 'at' khronos.org) + + + Olli Etuaho, NVIDIA + Members of the WebGL working group + + 38 + + + + +

+ This extension exposes the compressed texture format defined in the + + EXT_texture_compression_bptc OpenGL ES extension to WebGL. Consult that extension + specification for behavioral definitions, including error behaviors. +

+

+ Sampling from textures in the COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT format performs a color space + conversion as specified for SRGB textures in the + EXT_sRGB OpenGL ES + extension. +

+ + + Compression format COMPRESSED_RGBA_BPTC_UNORM_EXT, + COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, + COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, + and COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT may be passed to + the compressedTexImage2D and compressedTexSubImage2D entry points. + + + Calling getParameter with the argument COMPRESSED_TEXTURE_FORMATS + will include the formats from this specification. + + +

+ If the internalformat is one of the BPTC internal formats from this specification, + the byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes: +

+
+ ceil(width / 4) * ceil(height / 4) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+ +[NoInterfaceObject] +interface EXT_texture_compression_bptc { + const GLenum COMPRESSED_RGBA_BPTC_UNORM_EXT = 0x8E8C; + const GLenum COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 0x8E8D; + const GLenum COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 0x8E8E; + const GLenum COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 0x8E8F; +}; + + + + + + Accepted by the internalformat parameter: + COMPRESSED_RGBA_BPTC_UNORM_EXT, + COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, + COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, + COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT +
+
+ + + + Accepted by the internalformat parameter: + COMPRESSED_RGBA_BPTC_UNORM_EXT, + COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, + COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, + COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT +
+
+
+ + + + The error INVALID_VALUE is generated by compressedTexImage2D and + compressedTexSubImage2D if the internalformat parameter is one of the BPTC + internal formats from this extension and the byteLength of the ArrayBufferView is not: +
+ ceil(width / 4) * ceil(height / 4) * 16 +
+
+
+ + + + Initial revision. + + + Moved to draft status. + + + Retarget against EXT_texture_compression_bptc instead of ARB_texture_compression_bptc + Rename to EXT_texture_compression_bptc from WEBGL_compressed_texture_bptc + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/EXT_texture_compression_rgtc/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/EXT_texture_compression_rgtc/extension.xml new file mode 100644 index 0000000000..02617fc6fa --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/EXT_texture_compression_rgtc/extension.xml @@ -0,0 +1,126 @@ + + + + EXT_texture_compression_rgtc + + WebGL working group (public_webgl 'at' khronos.org) + + + Olli Etuaho, NVIDIA + Members of the WebGL working group + + 39 + + + + +

+ This extension exposes the compressed texture format defined in the + + EXT_texture_compression_rgtc OpenGL extension to WebGL. Consult that extension + specification for behavioral definitions, including error behaviors. +

+

+ Updates of partial tiles detailed in the "Implementation Note" section of the + EXT_texture_compression_rgtc specification must be supported in an implementation of this + WebGL extension. +

+ + + Compression formats COMPRESSED_RED_RGTC1_EXT, + COMPRESSED_SIGNED_RED_RGTC1_EXT, + COMPRESSED_RED_GREEN_RGTC2_EXT, + and COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT may be passed to + the compressedTexImage2D and compressedTexSubImage2D entry points. + + + Calling getParameter with the argument COMPRESSED_TEXTURE_FORMATS + will include the formats from this specification. + + +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RED_RGTC1_EXT
+
COMPRESSED_SIGNED_RED_RGTC1_EXT
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be equal to the following number of bytes:

+
+ ceil(width / 4) * ceil(height / 4) * 8 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
COMPRESSED_RED_GREEN_RGTC2_EXT
+
COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be equal to the following number of bytes:

+
+ ceil(width / 4) * ceil(height / 4) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+
+
+ +[NoInterfaceObject] +interface EXT_texture_compression_rgtc { + const GLenum COMPRESSED_RED_RGTC1_EXT = 0x8DBB; + const GLenum COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8DBC; + const GLenum COMPRESSED_RED_GREEN_RGTC2_EXT = 0x8DBD; + const GLenum COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 0x8DBE; +}; + + + + + + Accepted by the internalformat parameter: + COMPRESSED_RED_RGTC1_EXT, + COMPRESSED_SIGNED_RED_RGTC1_EXT, + COMPRESSED_RED_GREEN_RGTC2_EXT, + COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT +
+
+ + + + Accepted by the internalformat parameter: + COMPRESSED_RED_RGTC1_EXT, + COMPRESSED_SIGNED_RED_RGTC1_EXT, + COMPRESSED_RED_GREEN_RGTC2_EXT, + COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT +
+
+
+ + + + The error INVALID_VALUE is generated by compressedTexImage2D and + compressedTexSubImage2D if the internalformat parameter is + COMPRESSED_RED_RGTC1_EXT or COMPRESSED_SIGNED_RED_RGTC1_EXT + and the byteLength of the ArrayBufferView is not: +
+ ceil(width / 4) * ceil(height / 4) * 8 +
+
+ + The error INVALID_VALUE is generated by compressedTexImage2D and + compressedTexSubImage2D if the internalformat parameter is + COMPRESSED_RED_GREEN_RGTC2_EXT or COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT + and the byteLength of the ArrayBufferView is not: +
+ ceil(width / 4) * ceil(height / 4) * 16 +
+
+
+ + + + Initial revision. + + + Rename to EXT_texture_compression_rgtc from WEBGL_compressed_texture_rgtc + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/EXT_texture_filter_anisotropic/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/EXT_texture_filter_anisotropic/extension.xml new file mode 100644 index 0000000000..d4e12b9c4f --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/EXT_texture_filter_anisotropic/extension.xml @@ -0,0 +1,52 @@ + + + + EXT_texture_filter_anisotropic + + WebGL working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + Florian Bösch (pyalot 'at' gmail.com) + + 11 + + + + + + + + The getTexParameter, texParameterf and texParameteri entry points' + parameter pname accepts the value TEXTURE_MAX_ANISOTROPY_EXT + + + The getParameter entry point parameter pname accepts the value MAX_TEXTURE_MAX_ANISOTROPY_EXT, returning a value of type float. + + + + +[NoInterfaceObject] +interface EXT_texture_filter_anisotropic { + const GLenum TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE; + const GLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF; +}; + + + + Initial revision. + + + Added the EXT suffix to the enumerants and aliases to the extension name + + + Moved from draft to community approved status + + + Ratified by Khronos Board of Promoters. + + + Added NoInterfaceObject extended attribute. + + + diff --git a/third_party/rust/khronos_api/api_webgl/extensions/KHR_parallel_shader_compile/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/KHR_parallel_shader_compile/extension.xml new file mode 100644 index 0000000000..ca057858a7 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/KHR_parallel_shader_compile/extension.xml @@ -0,0 +1,103 @@ + + + + + KHR_parallel_shader_compile + + WebGL + working group (public_webgl 'at' khronos.org) + + + Jie Chen, (jie.a.chen 'at' intel.com) + Geoff Lang, (geofflang 'at' google.com) + Members of the WebGL working group + + + 37 + + + + + + + + + + + + Shader compilation and program linking may be performed in a separate CPU thread. This extension provides a mechanism for the application to provide a hint to limit the number of threads it wants to be used to compile shaders, as well as a query to determine if the compilation process is complete. + + + + + + [NoInterfaceObject] + interface KHR_parallel_shader_compile { + const GLenum MAX_SHADER_COMPILER_THREADS_KHR = 0x91B0; + const GLenum COMPLETION_STATUS_KHR = 0x91B1; + + void maxShaderCompilerThreadsKHR(GLuint count); + }; + + + +
+    var canvas = document.createElement("canvas");
+    var gl = canvas.getContext("webgl");
+    var ext = gl.getExtension('KHR_parallel_shader_compile');
+    if (ext) {
+      // Just for demo of API usage. Generally it's not needed unless you really
+      // want to override the implementation-specific maximum.
+      var threads = gl.getParameter(ext.MAX_SHADER_COMPILER_THREADS_KHR);
+      ext.maxShaderCompilerThreadsKHR(Math.max(2, threads));
+    }
+
+    var vSource = "attribute vec2 position; void main() { gl_Position = vec4(position, 0, 1); }";
+    var fSource = "precision mediump float; void main() { gl_FragColor = vec4(1,0,0,1); }";
+
+    var vShader = gl.createShader(gl.VERTEX_SHADER);
+    gl.shaderSource(vShader, vSource);
+    gl.compileShader(vShader);
+
+    var fShader = gl.createShader(gl.FRAGMENT_SHADER);
+    gl.shaderSource(fShader, fSource);
+    gl.compileShader(fShader);
+
+    var program = gl.createProgram();
+    gl.attachShader(program, vShader);
+    gl.attachShader(program, fShader);
+    gl.linkProgram(program);
+
+    function checkToUseProgram() {
+      if (gl.getProgramParameter(program, gl.LINK_STATUS) == true) {
+        gl.useProgram(program);
+      } else {
+        // error check.
+      }
+    }
+
+    if (ext) {
+      function checkCompletion() {
+        if (gl.getProgramParameter(program, ext.COMPLETION_STATUS_KHR) == true) {
+          checkToUseProgram();
+        } else {
+          requestAnimationFrame(checkCompletion);
+        }
+      }
+      requestAnimationFrame(checkCompletion);
+    } else {
+      checkToUseProgram();
+    }
+    
+
+ + + + Initial revision. + + + Moved to draft status. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/OES_element_index_uint/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/OES_element_index_uint/extension.xml new file mode 100644 index 0000000000..22e0370414 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/OES_element_index_uint/extension.xml @@ -0,0 +1,50 @@ + + + + OES_element_index_uint + + WebGL working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + Florian Bösch (pyalot 'at' gmail.com) + + 10 + + + + + + + + + The drawElements entry point parameter type accepts the value UNSIGNED_INT + + + + +[NoInterfaceObject] +interface OES_element_index_uint { +}; + + + + Initial revision. + + + Removed the bufferData requirement as this is not checked by webgl + + + Removed the enumerants from the IDL which are contained in the context and added aliases to the extension name + + + Based on feedback on public_webgl, moved from draft to community approved, and removed aliases. + + + Ratified by Khronos Board of Promoters. + + + Added NoInterfaceObject extended attribute. + + + diff --git a/third_party/rust/khronos_api/api_webgl/extensions/OES_fbo_render_mipmap/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/OES_fbo_render_mipmap/extension.xml new file mode 100644 index 0000000000..621b915efc --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/OES_fbo_render_mipmap/extension.xml @@ -0,0 +1,74 @@ + + + OES_fbo_render_mipmap + + WebGL + working group (public_webgl 'at' khronos.org) + + + Florian Boesch (pyalot 'at' gmail.com) + Members of the WebGL working group + + + 28 + + + + + + + + + + + + + Any level of a texture can be attached to a framebuffer object. + + + + + +[NoInterfaceObject] +interface OES_fbo_render_mipmap { +}; + + + +
+        var extension = gl.getExtension('OES_fbo_render_mipmap');
+        if(extension !=== null){
+            var texture = gl.createTexture();
+            gl.bindTexture(gl.TEXTURE_2D, texture);
+            var fbos = [];
+            
+            for(var level=0; level<7; level++){
+                var size = 128/Math.pow(2, level);
+                gl.texImage2D(gl.TEXTURE_2D, level, gl.RGBA, size, size, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
+                var fbo = gl.createFramebuffer();
+                gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
+                gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, level);
+                fbos.push(fbo);
+                
+                var fboStatus = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
+                console.assert(fboStatus == gl.FRAMEBUFFER_COMPLETE, 'Framebuffer is not complete');
+            }
+
+            gl.bindTexture(gl.TEXTURE_2D, null);
+            gl.bindFramebuffer(gl.FRAMEBUFFER, null);
+
+            console.assert(gl.getError() == gl.NO_ERROR, 'A GL error occured');
+        }
+    
+
+ + + + Initial revision. + + + Moved to draft. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/OES_standard_derivatives/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/OES_standard_derivatives/extension.xml new file mode 100644 index 0000000000..ebfb89ee40 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/OES_standard_derivatives/extension.xml @@ -0,0 +1,62 @@ + + + + OES_standard_derivatives + + WebGL working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + + 4 + + + + + + + + + + + The hint entry point accepts FRAGMENT_SHADER_DERIVATIVE_HINT_OES + as a target and the getParameter entry point accepts it as a pname. + + + + + + + + + + + + + + + + +[NoInterfaceObject] +interface OES_standard_derivatives { + const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B; +}; + + + + Initial revision. + + + Added genType argument and return type to function declarations. + + + Removed webgl module per changes to Web IDL spec. + + + Ratified by Khronos Board of Promoters. + + + Added NoInterfaceObject extended attribute. + + + diff --git a/third_party/rust/khronos_api/api_webgl/extensions/OES_texture_float/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/OES_texture_float/extension.xml new file mode 100644 index 0000000000..aa87af975d --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/OES_texture_float/extension.xml @@ -0,0 +1,91 @@ + + + OES_texture_float + + WebGL + working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + + + 1 + + + + + + + + + Optional support for FLOAT textures as FBO + attachments. + + + + The texImage2D and texSubImage2D + entry points taking ArrayBufferView are extended to accept + Float32Array with the pixel type FLOAT. + + + The texImage2D and texSubImage2D + entry points taking ImageData, + HTMLImageElement, HTMLCanvasElement and + HTMLVideoElement are extended to accept the pixel type + FLOAT. + + Upon activation of this extension, implementations supporting + WEBGL_color_buffer_float + shall implicitly enable it. This requirement maintains the historical + behavior prior to the differentiation of float renderability from float + textures, so as to not break existing content. + + + + +[NoInterfaceObject] +interface OES_texture_float { }; + + + + Initial revision. + + + + Extended to support pixel type FLOAT for texImage2D and + texSubImage2D entry points taking ImageData, HTMLImageElement, + HTMLCanvasElement and HTMLVideoElement. + + + + Added optional ability to use a FLOAT type texture as an FBO's + color attachment. + + + + Removed webgl module per changes to Web IDL spec. + + + + Specify that implementations supporting FLOAT color attachments + implicitly enable WEBGL_color_buffer_float. + + + + Ratified by Khronos Board of Promoters. + + + + Added NoInterfaceObject extended attribute. + + + + Corrected link to WEBGL_color_buffer_float. + + + + Clarify behaviors regarding WEBGL_color_buffer_float. + + + diff --git a/third_party/rust/khronos_api/api_webgl/extensions/OES_texture_float_linear/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/OES_texture_float_linear/extension.xml new file mode 100644 index 0000000000..62e9409466 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/OES_texture_float_linear/extension.xml @@ -0,0 +1,51 @@ + + + OES_texture_float_linear + + WebGL + working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + + + 20 + + + + + + + + + + + Expands upon the OES_texture_float extension by allowing support for + LINEAR magnification filter and LINEAR, NEAREST_MIPMAP_LINEAR, + LINEAR_MIPMAP_NEAREST and LINEAR_MIPMAP_NEAREST minification filters. + + + + +[NoInterfaceObject] +interface OES_texture_float_linear { }; + + + + Initial revision. + + + Moved to draft status after discussion on public_webgl. + + + Moved to community approved. + + + Added NoInterfaceObject extended attribute. + + + Ratified by Khronos Board of Promoters. + + + diff --git a/third_party/rust/khronos_api/api_webgl/extensions/OES_texture_half_float/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/OES_texture_half_float/extension.xml new file mode 100644 index 0000000000..27902073d5 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/OES_texture_half_float/extension.xml @@ -0,0 +1,95 @@ + + + OES_texture_half_float + + WebGL + working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + + + 2 + + + + + + + + + Optional support for HALF_FLOAT textures as FBO + attachments. + + + + The texImage2D and texSubImage2D + entry points taking ArrayBufferView are extended to accept + Uint16Array with the pixel type HALF_FLOAT_OES. + + + The texImage2D and texSubImage2D + entry points taking ImageData, + HTMLImageElement, HTMLCanvasElement and + HTMLVideoElement are extended to accept the pixel type + HALF_FLOAT_OES. + + Upon activation of this extension, implementations supporting + EXT_color_buffer_half_float + shall implicitly enable it. This requirement maintains the historical + behavior prior to the differentiation of float renderability from float + textures, so as to not break existing content. + + + + +[NoInterfaceObject] +interface OES_texture_half_float { + const GLenum HALF_FLOAT_OES = 0x8D61; +}; + + + + + Initial revision. + + + + Added similar text about texImage2D and + texSubImage2D as in OES_texture_float spec. + + Added optional ability to use a HALF_FLOAT_OES type texture as + an FBO's color attachment. + + + + Removed webgl module per changes to Web IDL spec. + + + + Specify that implementations supporting HALF_FLOAT_OES color + attachments implicitly enable EXT_color_buffer_half_float. + + + + Ratified by Khronos Board of Promoters. + + + + Allow texture uploads of half-floats via Uint16Arrays. + + + + Added NoInterfaceObject extended attribute. + + + + Corrected link to EXT_color_buffer_half_float. + + + + Clarify behaviors regarding EXT_color_buffer_half_float. + + + diff --git a/third_party/rust/khronos_api/api_webgl/extensions/OES_texture_half_float_linear/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/OES_texture_half_float_linear/extension.xml new file mode 100644 index 0000000000..a17276c87b --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/OES_texture_half_float_linear/extension.xml @@ -0,0 +1,52 @@ + + + OES_texture_half_float_linear + + WebGL + working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + + + 21 + + + + + + + + + + + + Expands upon the OES_texture_half_float extension by allowing support for + LINEAR magnification filter and LINEAR, NEAREST_MIPMAP_LINEAR, + LINEAR_MIPMAP_NEAREST and LINEAR_MIPMAP_NEAREST minification filters. + + + + +[NoInterfaceObject] +interface OES_texture_half_float_linear { }; + + + + Initial revision. + + + Moved to draft status after discussion on public_webgl. + + + Moved to community approved. + + + Added NoInterfaceObject extended attribute. + + + Ratified by Khronos Board of Promoters. + + + diff --git a/third_party/rust/khronos_api/api_webgl/extensions/OES_vertex_array_object/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/OES_vertex_array_object/extension.xml new file mode 100644 index 0000000000..3e1c53f9aa --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/OES_vertex_array_object/extension.xml @@ -0,0 +1,138 @@ + + + + OES_vertex_array_object + + WebGL working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + + 5 + + + + + + + + +[NoInterfaceObject] +interface WebGLVertexArrayObjectOES : WebGLObject { +}; + +[NoInterfaceObject] +interface OES_vertex_array_object { + const GLenum VERTEX_ARRAY_BINDING_OES = 0x85B5; + + WebGLVertexArrayObjectOES? createVertexArrayOES(); + void deleteVertexArrayOES(WebGLVertexArrayObjectOES? arrayObject); + [WebGLHandlesContextLoss] GLboolean isVertexArrayOES(WebGLVertexArrayObjectOES? arrayObject); + void bindVertexArrayOES(WebGLVertexArrayObjectOES? arrayObject); +}; + + + + + + + + + + + + + + + + + Returns false if the vertex array object's invalidated + flag is set. + + + + + + + + + + +

The OES_vertex_array_object spec does not make it clear + what happens to buffers that are deleted when they are referenced + by vertex array objects. It is inferred that all buffers are + reference counted. +

+

Before OES_vertex_array_object there was no way to use a deleted + buffer in a single context as the spec states it would be unbound + from all bind points. After OES_vertex_array_object it is now + possible to use deleted buffers. +

+

Furthermore, the OpenGL ES 2.0 spec specifies that using a + deleted buffer has undefined results including possibly + corrupt rendering and generating GL errors. Undefined behavior + is unacceptable for WebGL. +

+
    +
  • +

    RESOLVED: Buffers should be reference counted when attached to + a vertex array object. This is consistent with the OpenGL ES 3.0 + spec's implementation of Vertex Array Objects and matches the + behavior of other WebGL objects, such as textures that are attached + to framebuffers. +

    +

    This will require that most implementations do not call + glDeleteBuffer when the user calls deleteBuffer on the WebGL context. + Instead the implementation must wait for all references to be released + before calling glDeleteBuffer to prevent undefined behavior. +

    +

    If a buffer object is deleted while it is attached to the currently + bound vertex array object, then it is as if BindBuffer had been called, + with a buffer of 0, for each target to which this buffer was attached + in the currently bound vertex array object. In other words, this buffer + is first detached from all attachment points in the currently bound + vertex array object. Note that the buffer is specifically not detached + from any other vertex array object. Detaching the buffer from any other + vertex array objects is the responsibility of the application. +

    +
  • +
+
+ + + Initial revision. + + + Demotion to draft. + + + Added vendor-specific name strings for draft extension per discussion on WebGL mailing list. + + + Renamed "Name Strings" section to "Alias Name Strings". + Sorted Revision History in ascending order. + + + Removed webgl module per changes to Web IDL spec. + + + Added resolution to deleted buffer issue + + + Based on feedback on public_webgl, moved from draft to community approved, and removed aliases. + + + Made WebGLVertexArrayObjectOES return values and arguments nullable on feedback from Benoit Jacob. + + + Based on pull request from J Kenneth King, added WebGLHandlesContextLoss extended attribute to isVertexArrayOES and added markup for new functions. + + + Ratified by Khronos Board of Promoters. + + + Added NoInterfaceObject extended attribute to extension and WebGLVertexArrayObjectOES interface. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_color_buffer_float/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_color_buffer_float/extension.xml new file mode 100644 index 0000000000..d4ac50ae6a --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_color_buffer_float/extension.xml @@ -0,0 +1,145 @@ + + + WEBGL_color_buffer_float + + WebGL + working group (public_webgl 'at' khronos.org) + + + Mark Callow, HI Corporation + + Members of the WebGL working group + + + 15 + + + + + + + + + + + + +

Adds support for rendering to 32-bit floating-point color buffers.

+ + + +

The 32-bit floating-point type RGBA32F becomes available + as a color-renderable format. Renderbuffers can be created in this + format. These and textures created with format = RGBA and + type = FLOAT as specified in OES_texture_float, + can be attached to framebuffer object color attachments for rendering. +

+
+ + +

The 32-bit floating-point type RGB32F may also optionally + become available as a color-renderable format. These and textures created + with format = RGB and type = FLOAT as specified in + OES_texture_float, + can be attached to framebuffer object color attachments for rendering. + Applications must check framebuffer completeness to determine if an + implementation actually supports this format. +

+
+ + +

NOTE: fragment shaders outputs + gl_FragColor and gl_FragData[0] will only be clamped and converted + when the color buffer is fixed-point and blendColor() and + clearColor() will no longer clamp their parameter values + on input. Clamping will be applied as necessary at draw time according + to the type of color buffer in use.

+
+ + +

The format and type combination RGBA and + FLOAT becomes valid for reading from a floating-point + rendering buffer. Note: RGBA and + UNSIGNED_BYTE cannot be used for reading from a + floating-point rendering buffer.

+
+ + +

The component types of framebuffer object attachments can be + queried.

+
+
+
+ + +[NoInterfaceObject] +interface WEBGL_color_buffer_float { + const GLenum RGBA32F_EXT = 0x8814; + const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211; + const GLenum UNSIGNED_NORMALIZED_EXT = 0x8C17; +}; // interface WEBGL_color_buffer_float + + + + RGBA32F_EXT is accepted as the + internalformat parameter of + renderbufferStorage(). + + + +

The new tokens and the behavioral changes for floating-point color + buffers specified in EXT_color_buffer_half_float + are incorporated into WebGL except for the RGB16F and + RGBA16F types. References to RGB16F are ignored, + and references to RGBA16F are replaced by references to + RGBA32F.

+
+ + + + Initial revision. + + + + Don't mirror EXT_color_buffer_half_float. Mirror has a different + meaning from what is done here. + + + + Add reading-pixels-as-FLOAT feature to the Overview. + + + + Move to draft. + + + + Removed webgl module. Added NoInterfaceObject extended attribute. + + + + Fixed the name of the interface from EXT_color_buffer_float to WEBGL_color_buffer_float. + + + + Removed the support for RGB32F, since it is not natively supported on all platforms where WebGL is implemented. + + + + Move to community approved. + + + + Subsumed in WebGL 2.0 by EXT_color_buffer_float. + + + + Add optional RGB renderability. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_astc/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_astc/extension.xml new file mode 100644 index 0000000000..255e57b07b --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_astc/extension.xml @@ -0,0 +1,577 @@ + + + + WEBGL_compressed_texture_astc + + WebGL working group (public_webgl 'at' khronos.org) + + + Christophe Riccio, Unity + Members of the WebGL working group + + 30 + + + + +

+ This extension exposes the compressed texture format defined in the + + KHR_texture_compression_astc_hdr OpenGL ES extension to WebGL. Consult that extension + specification for behavioral definitions, including error behaviors. +

+

+ ASTC textures may be encoded using either high or low dynamic range, corresponding to an "HDR + profile" and "LDR profile". The compression format is designed to be extended, and for new + profiles to be added in the future. For this reason, enabling the WebGL extension enables all + of the profiles supported by the implementation. The supported profiles may be queried by + calling getSupportedProfiles against the extension object. +

+ + + Compression format COMPRESSED_RGBA_ASTC_4x4_KHR, + COMPRESSED_RGBA_ASTC_5x4_KHR, + COMPRESSED_RGBA_ASTC_5x5_KHR, + COMPRESSED_RGBA_ASTC_6x5_KHR, + COMPRESSED_RGBA_ASTC_6x6_KHR, + COMPRESSED_RGBA_ASTC_8x5_KHR, + COMPRESSED_RGBA_ASTC_8x6_KHR, + COMPRESSED_RGBA_ASTC_8x8_KHR, + COMPRESSED_RGBA_ASTC_10x5_KHR, + COMPRESSED_RGBA_ASTC_10x6_KHR, + COMPRESSED_RGBA_ASTC_10x8_KHR, + COMPRESSED_RGBA_ASTC_10x10_KHR, + COMPRESSED_RGBA_ASTC_12x10_KHR, + COMPRESSED_RGBA_ASTC_12x12_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, + and COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR may be passed to + the compressedTexImage2D and compressedTexSubImage2D entry points. + + + Calling getParameter with the argument COMPRESSED_TEXTURE_FORMATS + will include the format from this specification. + + +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RGBA_ASTC_4x4_KHR
+
COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
+
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes: +

+
+ floor((width + 3) / 4) * floor((height + 3) / 4) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+ +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RGBA_ASTC_5x4_KHR
+
COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
+
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes: +

+
+ floor((width + 4) / 5) * floor((height + 3) / 4) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+ +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RGBA_ASTC_5x5_KHR
+
COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
+
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes: +

+
+ floor((width + 4) / 5) * floor((height + 4) / 5) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+ +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RGBA_ASTC_6x5_KHR
+
COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
+
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes: +

+
+ floor((width + 5) / 6) * floor((height + 4) / 5) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+ +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RGBA_ASTC_6x6_KHR
+
COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
+
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes: +

+
+ floor((width + 5) / 6) * floor((height + 5) / 6) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+ +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RGBA_ASTC_8x5_KHR
+
COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
+
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes: +

+
+ floor((width + 7) / 8) * floor((height + 4) / 5) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+ +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RGBA_ASTC_8x6_KHR
+
COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
+
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes: +

+
+ floor((width + 7) / 8) * floor((height + 5) / 6) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+ +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RGBA_ASTC_8x8_KHR
+
COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
+
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes: +

+
+ floor((width + 7) / 8) * floor((height + 7) / 8) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+ +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RGBA_ASTC_10x5_KHR
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
+
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes: +

+
+ floor((width + 9) / 10) * floor((height + 4) / 5) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+ +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RGBA_ASTC_10x6_KHR
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
+
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes: +

+
+ floor((width + 9) / 10) * floor((height + 5) / 6) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+ +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RGBA_ASTC_10x8_KHR
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
+
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes: +

+
+ floor((width + 9) / 10) * floor((height + 7) / 8) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+ +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RGBA_ASTC_10x10_KHR
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
+
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes: +

+
+ floor((width + 9) / 10) * floor((height + 9) / 10) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+ +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RGBA_ASTC_12x10_KHR
+
COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
+
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes: +

+
+ floor((width + 11) / 12) * floor((height + 9) / 10) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+ +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RGBA_ASTC_12x12_KHR
+
COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
+
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes: +

+
+ floor((width + 11) / 12) * floor((height + 11) / 12) * 16 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+
+
+ +[NoInterfaceObject] +interface WEBGL_compressed_texture_astc { + /* Compressed Texture Format */ + const GLenum COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0; + const GLenum COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1; + const GLenum COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2; + const GLenum COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3; + const GLenum COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4; + const GLenum COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5; + const GLenum COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6; + const GLenum COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7; + const GLenum COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8; + const GLenum COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9; + const GLenum COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA; + const GLenum COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB; + const GLenum COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC; + const GLenum COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD; + + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD; + + // Profile query support. + sequence<DOMString> getSupportedProfiles(); +}; + + + + + Returns the names of the ASTC profiles supported by the implementation. As of this writing, + valid return values will include "ldr", corresponding to the + GL_KHR_texture_compression_astc_ldr extension string; and "hdr", corresponding to the + GL_KHR_texture_compression_astc_hdr extension string. More profiles may be added in the + future. + +
+ The intent of the getSupportedProfiles function is to allow easy reconstruction + of the underlying OpenGL or OpenGL ES extension strings for environments like Emscripten, by + prepending the string GL_KHR_texture_compression_astc_ to the returned profile + names. +
+
+ + + + + Accepted by the internalformat parameter: + COMPRESSED_RGBA_ASTC_4x4_KHR, + COMPRESSED_RGBA_ASTC_5x4_KHR, + COMPRESSED_RGBA_ASTC_5x5_KHR, + COMPRESSED_RGBA_ASTC_6x5_KHR, + COMPRESSED_RGBA_ASTC_6x6_KHR, + COMPRESSED_RGBA_ASTC_8x5_KHR, + COMPRESSED_RGBA_ASTC_8x6_KHR, + COMPRESSED_RGBA_ASTC_8x8_KHR, + COMPRESSED_RGBA_ASTC_10x5_KHR, + COMPRESSED_RGBA_ASTC_10x6_KHR, + COMPRESSED_RGBA_ASTC_10x8_KHR, + COMPRESSED_RGBA_ASTC_10x10_KHR, + COMPRESSED_RGBA_ASTC_12x10_KHR, + COMPRESSED_RGBA_ASTC_12x12_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR +
+
+ + + + Accepted by the internalformat parameter: + COMPRESSED_RGBA_ASTC_4x4_KHR, + COMPRESSED_RGBA_ASTC_5x4_KHR, + COMPRESSED_RGBA_ASTC_5x5_KHR, + COMPRESSED_RGBA_ASTC_6x5_KHR, + COMPRESSED_RGBA_ASTC_6x6_KHR, + COMPRESSED_RGBA_ASTC_8x5_KHR, + COMPRESSED_RGBA_ASTC_8x6_KHR, + COMPRESSED_RGBA_ASTC_8x8_KHR, + COMPRESSED_RGBA_ASTC_10x5_KHR, + COMPRESSED_RGBA_ASTC_10x6_KHR, + COMPRESSED_RGBA_ASTC_10x8_KHR, + COMPRESSED_RGBA_ASTC_10x10_KHR, + COMPRESSED_RGBA_ASTC_12x10_KHR, + COMPRESSED_RGBA_ASTC_12x12_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR +
+
+
+ + + + The error INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D + if the internalformat parameter is + COMPRESSED_RGBA_ASTC_4x4_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR + and the byteLength of the ArrayBufferView is not: +
+ floor((width + 3) / 4) * floor((height + 3) / 4) * 16 +
+
+ + The error INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D + if the internalformat parameter is + COMPRESSED_RGBA_ASTC_5x4_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR + and the byteLength of the ArrayBufferView is not: +
+ floor((width + 4) / 5) * floor((height + 3) / 4) * 16 +
+
+ + The error INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D + if the internalformat parameter is + COMPRESSED_RGBA_ASTC_5x5_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR + and the byteLength of the ArrayBufferView is not: +
+ floor((width + 4) / 5) * floor((height + 4) / 5) * 16 +
+
+ + The error INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D + if the internalformat parameter is + COMPRESSED_RGBA_ASTC_6x5_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR + and the byteLength of the ArrayBufferView is not: +
+ floor((width + 5) / 6) * floor((height + 4) / 5) * 16 +
+
+ + The error INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D + if the internalformat parameter is + COMPRESSED_RGBA_ASTC_6x6_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR + and the byteLength of the ArrayBufferView is not: +
+ floor((width + 5) / 6) * floor((height + 5) / 6) * 16 +
+
+ + The error INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D + if the internalformat parameter is + COMPRESSED_RGBA_ASTC_8x5_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR + and the byteLength of the ArrayBufferView is not: +
+ floor((width + 7) / 8) * floor((height + 4) / 5) * 16 +
+
+ + The error INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D + if the internalformat parameter is + COMPRESSED_RGBA_ASTC_8x6_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR + and the byteLength of the ArrayBufferView is not: +
+ floor((width + 7) / 8) * floor((height + 5) / 6) * 16 +
+
+ + The error INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D + if the internalformat parameter is + COMPRESSED_RGBA_ASTC_8x8_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR + and the byteLength of the ArrayBufferView is not: +
+ floor((width + 7) / 8) * floor((height + 7) / 8) * 16 +
+
+ + The error INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D + if the internalformat parameter is + COMPRESSED_RGBA_ASTC_10x5_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR + and the byteLength of the ArrayBufferView is not: +
+ floor((width + 9) / 10) * floor((height + 4) / 5) * 16 +
+
+ + The error INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D + if the internalformat parameter is + COMPRESSED_RGBA_ASTC_10x6_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR + and the byteLength of the ArrayBufferView is not: +
+ floor((width + 9) / 10) * floor((height + 5) / 6) * 16 +
+
+ + The error INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D + if the internalformat parameter is + COMPRESSED_RGBA_ASTC_10x8_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR + and the byteLength of the ArrayBufferView is not: +
+ floor((width + 9) / 10) * floor((height + 7) / 8) * 16 +
+
+ + The error INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D + if the internalformat parameter is + COMPRESSED_RGBA_ASTC_10x10_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR + and the byteLength of the ArrayBufferView is not: +
+ floor((width + 9) / 10) * floor((height + 9) / 10) * 16 +
+
+ + The error INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D + if the internalformat parameter is + COMPRESSED_RGBA_ASTC_12x10_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR + and the byteLength of the ArrayBufferView is not: +
+ floor((width + 11) / 12) * floor((height + 9) / 10) * 16 +
+
+ + The error INVALID_VALUE is generated by compressedTexImage2D and compressedTexSubImage2D + if the internalformat parameter is + COMPRESSED_RGBA_ASTC_12x12_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR + and the byteLength of the ArrayBufferView is not: +
+ floor((width + 11) / 12) * floor((height + 11) / 12) * 16 +
+
+
+ + + + Initial revision. + + + Added profile string support. Renamed constants back to _KHR. + + + Clarified intent of getSupportedProfiles. Stressed that OpenGL ES extension defines the behavior. + + + Moved to draft status. + + + Moved to community approved after discussion on public_webgl list. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_etc/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_etc/extension.xml new file mode 100644 index 0000000000..c6ad533974 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_etc/extension.xml @@ -0,0 +1,189 @@ + + + + WEBGL_compressed_texture_etc + + WebGL working group (public_webgl 'at' khronos.org) + + + Jeff Gilbert, Mozilla + Members of the WebGL working group + + 29 + + + + +

+ This extension exposes the compressed texture formats defined as core in the + + OpenGL ES 3.0 spec to WebGL. These include the ETC2 and EAC formats, where + ETC2 is a superset of ETC1. ETC1 textures can be loaded using the ETC2 token + value. All of these formats are in the ETC family. +

+

+ Browsers should not advertise this extension when the WebGL implementation, or + graphics driver, supports these formats by decompressing them. +

+ + + Compression formats COMPRESSED_R11_EAC, + COMPRESSED_SIGNED_R11_EAC, + COMPRESSED_RG11_EAC, + COMPRESSED_SIGNED_RG11_EAC, + COMPRESSED_RGB8_ETC2, + COMPRESSED_SRGB8_ETC2, + COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, + COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, + COMPRESSED_RGBA8_ETC2_EAC, + and COMPRESSED_SRGB8_ALPHA8_ETC2_EAC may be passed to the + compressedTexImage2D and compressedTexSubImage2D entry points. In + WebGL 2.0, they may also be passed to the compressedTexImage3D and + compressedTexSubImage3D entry points with the TEXTURE_2D_ARRAY + target. + + + Calling getParameter with the argument COMPRESSED_TEXTURE_FORMATS + will include the formats from this specification. + + + For all of the formats, validatedSize (defined for each specific format + below) is validated in the following ways: +
    +
  • + WebGL 1.0 and 2.0: if the variant of compressedTexImage*D or + compressedTexSubImage*D taking ArrayBufferView pixels is + called, then the byteLength of the view must be equal to + validatedSize, or an INVALID_VALUE error is generated. +
  • +
  • + WebGL 2.0: if the variant of compressedTexImage*D or + compressedTexSubImage*D taking GLintptr offset is called, + and offset + validatedSize is greater than the size of the bound + PIXEL_UNPACK_BUFFER, an INVALID_OPERATION error is + generated. +
  • +
+
+
COMPRESSED_R11_EAC
+
COMPRESSED_SIGNED_R11_EAC
+
COMPRESSED_RGB8_ETC2
+
COMPRESSED_SRGB8_ETC2
+
COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
+
COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
+

validatedSize is computed in the following way:

+
+ floor((width + 3) / 4) * floor((height + 3) / 4) * 8 +
+
+
+
+
COMPRESSED_RG11_EAC
+
COMPRESSED_SIGNED_RG11_EAC
+
COMPRESSED_RGBA8_ETC2_EAC
+
COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
+

validatedSize is computed in the following way:

+
+ floor((width + 3) / 4) * floor((height + 3) / 4) * 16 +
+
+
+
+
+
+ +[NoInterfaceObject] +interface WEBGL_compressed_texture_etc { + /* Compressed Texture Formats */ + const GLenum COMPRESSED_R11_EAC = 0x9270; + const GLenum COMPRESSED_SIGNED_R11_EAC = 0x9271; + const GLenum COMPRESSED_RG11_EAC = 0x9272; + const GLenum COMPRESSED_SIGNED_RG11_EAC = 0x9273; + const GLenum COMPRESSED_RGB8_ETC2 = 0x9274; + const GLenum COMPRESSED_SRGB8_ETC2 = 0x9275; + const GLenum COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276; + const GLenum COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277; + const GLenum COMPRESSED_RGBA8_ETC2_EAC = 0x9278; + const GLenum COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279; +}; + + + + + + Accepted by the internalformat parameter: + COMPRESSED_R11_EAC, + COMPRESSED_SIGNED_R11_EAC, + COMPRESSED_RG11_EAC, + COMPRESSED_SIGNED_RG11_EAC, + COMPRESSED_RGB8_ETC2, + COMPRESSED_SRGB8_ETC2, + COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, + COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, + COMPRESSED_RGBA8_ETC2_EAC or + COMPRESSED_SRGB8_ALPHA8_ETC2_EAC +
+
+ + + + Accepted by the internalformat parameter: + COMPRESSED_R11_EAC, + COMPRESSED_SIGNED_R11_EAC, + COMPRESSED_RG11_EAC, + COMPRESSED_SIGNED_RG11_EAC, + COMPRESSED_RGB8_ETC2, + COMPRESSED_SRGB8_ETC2, + COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, + COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, + COMPRESSED_RGBA8_ETC2_EAC or + COMPRESSED_SRGB8_ALPHA8_ETC2_EAC +
+
+
+ + + + The error INVALID_VALUE is generated by compressedTexImage2D, + compressedTexSubImage2D, compressedTexImage3D, and + compressedTexSubImage3D if the variant taking ArrayBufferView pixels + is called and the size restrictions above are not met. + + + The error INVALID_OPERATION is generated by compressedTexImage2D, + compressedTexSubImage2D, compressedTexImage3D, and + compressedTexSubImage3D if the variant taking GLintptr offset is + called and the size restrictions above are not met. + + + + + Initial revision. + + + Added NoInterfaceObject extended attribute. + + + COMPRESSED_RGB_ETC2 should be COMPRESSED_RGB8_ETC2. + Remove unnecessary language. + + + Moved to draft. + Added issue questions. + Formalized the newtok and error codes. + + + Renamed to WEBGL_compressed_texture_es3_0. + + + Clarifications to the supported formats on suggestion from Mark Callow. + + + Addressed issues regarding 3D entry points, description of interation with WebGL 2.0, + and generation of INVALID_OPERATION and INVALID_VALUE errors. Added note that browsers should + not advertise this extension if these compressed texture formats are decompressed. Renamed to + WEBGL_compressed_texture_etc after further discussion. Promoted to community + approved. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_etc1/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_etc1/extension.xml new file mode 100644 index 0000000000..2ffc7549b0 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_etc1/extension.xml @@ -0,0 +1,91 @@ + + + + WEBGL_compressed_texture_etc1 + + WebGL working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + + 24 + + + + +

+ This extension exposes the compressed texture format defined in the + + OES_compressed_ETC1_RGB8_texture OpenGL ES extension to WebGL. +

+ + + Compression format COMPRESSED_RGB_ETC1_WEBGL may be passed to + the compressedTexImage2D entry point. + + This format correspond to the format defined in the OES_compressed_ETC1_RGB8_texture OpenGL ES + extension. Although the enum name is changed, the numeric value is the same. The correspondence + is given by this table: + + + + + + + + + + + +
WebGL format enumOpenGL format enumNumeric value
COMPRESSED_RGB_ETC1_WEBGLETC1_RGB8_OES0x8D64
+
+ + Calling getParameter with the argument COMPRESSED_TEXTURE_FORMATS + will include the format from this specification. + + +

The following format-specific restrictions must be enforced:

+
+
COMPRESSED_RGB_ETC1_WEBGL
+

The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D must be equal to the following number of bytes:

+
+ floor((width + 3) / 4) * floor((height + 3) / 4) * 8 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+
+
+ +[NoInterfaceObject] +interface WEBGL_compressed_texture_etc1 { + /* Compressed Texture Format */ + const GLenum COMPRESSED_RGB_ETC1_WEBGL = 0x8D64; +}; + + + + Initial revision. + + + Clarified that length of ArrayBufferView is actually byteLength. + + + Moved to draft status. + + + Assigned extension number 24 to WEBGL_compressed_texture_etc1 extension. + + + Remove ability to use the format with compressedTexSubImage2D, as per the GLES extension spec. + + + Moved to community approved after discussion on public_webgl list. + + + Added NoInterfaceObject extended attribute. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_pvrtc/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_pvrtc/extension.xml new file mode 100644 index 0000000000..b67d1881af --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_pvrtc/extension.xml @@ -0,0 +1,100 @@ + + + + WEBGL_compressed_texture_pvrtc + + WebGL working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + + 13 + + + + +

+ This extension exposes the compressed texture formats defined in the + + IMG_texture_compression_pvrtc OpenGL extension to WebGL. +

+ + + Compression formats COMPRESSED_RGB_PVRTC_4BPPV1_IMG, + COMPRESSED_RGB_PVRTC_2BPPV1_IMG, COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, and + COMPRESSED_RGBA_PVRTC_2BPPV1_IMG may be passed to + the compressedTexImage2D and compressedTexSubImage2D entry points. + + + Calling getParameter with the argument COMPRESSED_TEXTURE_FORMATS + will include the 4 formats from this specification. + + +

The following format-specific restrictions apply to all of the formats described + by this extension: +

+ +

In compressedTexImage2D, the width and height + parameters must be powers of two. Otherwise, an INVALID_VALUE error is generated. +

+ +

+ In compressedTexSubImage2D, the width and height + parameters must be equal to the current values of the existing texture image, and the + xoffset and yoffset parameters must be zero. + Otherwise, an INVALID_VALUE error is generated. +

+
+ +

The following format-specific restrictions must also be enforced:

+
+
COMPRESSED_RGB_PVRTC_4BPPV1_IMG
+
COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
+

The byteLength of the ArrayBufferView, pixels, passed to + either compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes:

+
+ max(width, 8) * max(height, 8) / 2 +
+

If it is not, an INVALID_VALUE error is generated.

+
+ +
COMPRESSED_RGB_PVRTC_2BPPV1_IMG
+
COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
+

The byteLength of the ArrayBufferView, pixels, passed to + either compressedTexImage2D or compressedTexSubImage2D must be + equal to the following number of bytes:

+
+ max(width, 16) * max(height, 8) / 4 +
+

If it is not, an INVALID_VALUE error is generated.

+
+
+
+
+
+ +[NoInterfaceObject] +interface WEBGL_compressed_texture_pvrtc { + /* Compressed Texture Formats */ + const GLenum COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00; + const GLenum COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01; + const GLenum COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02; + const GLenum COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03; +}; + + + + Initial revision. + + + Clarified that length of ArrayBufferView is actually byteLength. + + + Moved to community approved after discussion on public_webgl list. + + + Added NoInterfaceObject extended attribute. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_s3tc/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_s3tc/extension.xml new file mode 100644 index 0000000000..579531a174 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_s3tc/extension.xml @@ -0,0 +1,119 @@ + + + + WEBGL_compressed_texture_s3tc + + WebGL working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + + 8 + + + + +

+ This extension exposes the compressed texture formats defined in the + + EXT_texture_compression_s3tc OpenGL extension to WebGL. +

+ + + Compression formats COMPRESSED_RGB_S3TC_DXT1_EXT, + COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT, and + COMPRESSED_RGBA_S3TC_DXT5_EXT may be passed to + the compressedTexImage2D and compressedTexSubImage2D entry points. + + + Calling getParameter with the argument COMPRESSED_TEXTURE_FORMATS + will include the 4 formats from this specification. + + +

The following format specific restrictions must be enforced:

+
+
COMPRESSED_RGB_S3TC_DXT1_EXT
+
COMPRESSED_RGBA_S3TC_DXT1_EXT
+

The byteLength of the ArrayBufferView, pixels, passed to + either compressedTexImage2D or compressedTexSubImage2D + must match the following equation:

+
+ floor((width + 3) / 4) * floor((height + 3) / 4) * 8 +
+

+ If it is not an INVALID_VALUE error is generated. +

+

When level equals zero width and height + must be a multiple of 4. When level is greater than 0 width + and height must be 0, 1, 2 or a multiple of 4.

+

+ If they are not an INVALID_OPERATION error is generated. +

+

+ For compressedTexSubImage2D xoffset and + yoffset must be a multiple of 4 and + width must be a multiple of 4 or equal to the original + width of the level. height must be a multiple of 4 or + equal to the original height of the level. + If they are not an INVALID_OPERATION error is generated. +

+
+ +
COMPRESSED_RGBA_S3TC_DXT3_EXT
+
COMPRESSED_RGBA_S3TC_DXT5_EXT
+

The byteLength of the ArrayBufferView, pixels, passed to + either compressedTexImage2D or compressedTexSubImage2D must + match the following equation:

+
+ floor((width + 3) / 4) * floor((height + 3) / 4) * 16 +
+

+ If it is not an INVALID_VALUE error is generated. +

+

When level equals zero width and height + must be a multiple of 4. When level is greater than 0 width + and height must be 0, 1, 2 or a multiple of 4.

+

+ If they are not an INVALID_OPERATION error is generated. +

+

+ For compressedTexSubImage2D xoffset and + yoffset must be a multiple of 4 and + width must be a multiple of 4 or equal to the original + width of the level. height must be a multiple of 4 or + equal to the original height of the level. + If they are not an INVALID_OPERATION error is generated. +

+
+
+
+
+
+ +[NoInterfaceObject] +interface WEBGL_compressed_texture_s3tc { + /* Compressed Texture Formats */ + const GLenum COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0; + const GLenum COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; + const GLenum COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2; + const GLenum COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; +}; + + + + Initial revision. + + + Moved from draft to community approved status + + + Ratified by Khronos Board of Promoters. + + + Clarified that length of ArrayBufferView is actually byteLength. + + + Added NoInterfaceObject extended attribute. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/extension.xml new file mode 100644 index 0000000000..2e824cc6c6 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/extension.xml @@ -0,0 +1,113 @@ + + + + WEBGL_compressed_texture_s3tc_srgb + + WebGL working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + + 32 + + + + +

+ This extension exposes the sRGB compressed texture formats defined in the + + EXT_texture_sRGB OpenGL extension to WebGL. +

+ + + Compression formats COMPRESSED_SRGB_S3TC_DXT1_EXT, + COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, and + COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT may be passed to + the compressedTexImage2D and compressedTexSubImage2D entry points. + + + Calling getParameter with the argument COMPRESSED_TEXTURE_FORMATS + will include the 4 formats from this specification. + + +

The following format specific restrictions must be enforced:

+
+
COMPRESSED_SRGB_S3TC_DXT1_EXT
+
COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
+

The byteLength of the ArrayBufferView, pixels, passed to + either compressedTexImage2D or compressedTexSubImage2D + must match the following equation:

+
+ floor((width + 3) / 4) * floor((height + 3) / 4) * 8 +
+

+ If it is not an INVALID_VALUE error is generated. +

+

When level equals zero width and height + must be a multiple of 4. When level is greater than 0 width + and height must be 0, 1, 2 or a multiple of 4.

+

+ If they are not an INVALID_OPERATION error is generated. +

+

+ For compressedTexSubImage2D xoffset and + yoffset must be a multiple of 4 and + width must be a multiple of 4 or equal to the original + width of the level. height must be a multiple of 4 or + equal to the original height of the level. + If they are not an INVALID_OPERATION error is generated. +

+
+ +
COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
+
COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
+

The byteLength of the ArrayBufferView, pixels, passed to + either compressedTexImage2D or compressedTexSubImage2D must + match the following equation:

+
+ floor((width + 3) / 4) * floor((height + 3) / 4) * 16 +
+

+ If it is not an INVALID_VALUE error is generated. +

+

When level equals zero width and height + must be a multiple of 4. When level is greater than 0 width + and height must be 0, 1, 2 or a multiple of 4.

+

+ If they are not an INVALID_OPERATION error is generated. +

+

+ For compressedTexSubImage2D xoffset and + yoffset must be a multiple of 4 and + width must be a multiple of 4 or equal to the original + width of the level. height must be a multiple of 4 or + equal to the original height of the level. + If they are not an INVALID_OPERATION error is generated. +

+
+
+
+
+
+ +[NoInterfaceObject] +interface WEBGL_compressed_texture_s3tc_srgb { + /* Compressed Texture Formats */ + const GLenum COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C; + const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D; + const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E; + const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F; +}; + + + + Initial revision. + + + Moved to draft after discussion in working group, and study of possible dependencies. + + + Moved to community approved after Mozilla voiced support. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_debug_renderer_info/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_debug_renderer_info/extension.xml new file mode 100644 index 0000000000..59e60ac02d --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_debug_renderer_info/extension.xml @@ -0,0 +1,95 @@ + + + + WEBGL_debug_renderer_info + zmo@chromium.org + + Members of the WebGL working group + + 6 + + + + +

WebGL implementations might mask the RENDERER and VENDOR strings of the underlying graphics driver for privacy reasons. This extension exposes new tokens to query this information in a guaranteed manner for debugging purposes.

+
+ +[NoInterfaceObject] +interface WEBGL_debug_renderer_info { + + const GLenum UNMASKED_VENDOR_WEBGL = 0x9245; + const GLenum UNMASKED_RENDERER_WEBGL = 0x9246; + +}; + + + + + Two new enums UNMASKED_VENDOR_WEBGL and UNMASKED_RENDERER_WEBGL are accepted by pname parameter in getParameter(). + + + + +
pnamereturned type
UNMASKED_VENDOR_WEBGLDOMString
UNMASKED_RENDERER_WEBGLDOMString
+
+ The following pname arguments return a string describing some aspect of the underlying graphics driver. + + + +
UNMASKED_VENDOR_WEBGLReturn the VENDOR string of the underlying graphics driver.
UNMASKED_RENDERER_WEBGLReturn the RENDERER string of the underlying graphics driver.
+
+
+ +

+ 1) What enum values should be used for UNMASKED_VENDOR_WEBGL and UNMASKED_RENDERER_WEBGL?

+
    +
  • RESOLVED: The first draft used temporary enum values. They have been replaced with enums allocated from the WEBGL range of GL enums.
  • +
+

+ 2) Should this extension be made available on ordinary web pages?

+
    +
  • Earlier versions of this extension noted the following concerns: +
      +
    1. Identifying the precise graphics card in the user's computer may yield certain personally-identifiable information to the web page; for example, if the user has a unique graphics card.
    2. +
    3. Identifying the precise graphics card to JavaScript might encourage developers to target their WebGL applications to run only on a particular type of graphics card. This is similar to the User-Agent "sniffing" or "spoofing" problem which has historically been pervasive and problematic on the web.
    4. +
    + + User agents (web browsers) should carefully consider whether or not to expose this extension in non-privileged settings due to these concerns.
  • + +
  • On the other hand, benefits of exposing this information to general web pages include: + +
      +
    1. The WebGL application can tune its rendering techniques based on previously observed performance characteristics on the same graphics card.
    2. +
    3. The WebGL application can gather useful information for debugging; for example, if it is running slowly, it can gather data for reproducing and fixing the problem.
    4. +
    + +
  • +
+
+ + + Initial revision. + + + Assigned enums; assigned webgl extension number. + + + Clarify the meaning of "privileged". + + + Fixed mistake where extension still indicated draft status. + + + Removed webgl module per changes to Web IDL spec. + + + Ratified by Khronos Board of Promoters. + + + Added issue on privacy and user agent sniffing considerations, replacing security section. + + + Added NoInterfaceObject extended attribute. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_debug_shaders/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_debug_shaders/extension.xml new file mode 100644 index 0000000000..1b5f5d3be6 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_debug_shaders/extension.xml @@ -0,0 +1,79 @@ + + + + WEBGL_debug_shaders + zmo@chromium.org + + Members of the WebGL working group + + 7 + + + + +

+ WebGL uses the GLSL ES 2.0 spec on all platforms, and translates these shaders to the host platform's native language (HLSL, GLSL, and even GLSL ES). For debugging purpose, it is useful to be able to examine the shader after translation. This extension exposes a new function getTranslatedShaderSource for such purposes. +

+
+ +[NoInterfaceObject] +interface WEBGL_debug_shaders { + + DOMString getTranslatedShaderSource(WebGLShader shader); + +}; + + + + + If no source has been defined, compileShader() has not been called, or the translation has failed for shader, an empty string is returned; otherwise, return the translated source. + + + +

+ 1) Should this extension be made available on ordinary web pages?

+
    +
  • Earlier versions of this extension noted the following concerns: +
      +
    1. The precise pattern of how the original shader is translated may yield personally-identifiable information to the web page about the kind of graphics card in the user's computer.
    2. +
    + + User agents (web browsers) should carefully consider whether or not to expose this extension in non-privileged settings due to these concerns.
  • + +
  • On the other hand, benefits of exposing this information to general web pages include: + +
      +
    1. Tools for WebGL developers can provide more detailed information about how the input shader is translated to run on the graphics card, potentially helping the developers make their applications run faster.
    2. +
    + +
  • +
+
+ + + Initial revision. + + + Assigned WebGL extension number. + + + Clarify the meaning of "privileged". + + + Fixed mistake where extension still indicated draft status. + Renamed "New Functions and Methods" section to "New Functions". + + + Removed webgl module per changes to Web IDL spec. + + + Ratified by Khronos Board of Promoters. + + + Added issue on privacy considerations, replacing security section. + + + Added NoInterfaceObject extended attribute. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_depth_texture/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_depth_texture/extension.xml new file mode 100644 index 0000000000..f23dca9e5c --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_depth_texture/extension.xml @@ -0,0 +1,265 @@ + + + + WEBGL_depth_texture + + WEBKIT_WEBGL_depth_texture + MOZ_WEBGL_depth_texture + + + WebGL working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + Florian Bösch (pyalot 'at' gmail.com) + + 9 + + + + + +

This extension exposes the + ANGLE_depth_texture + functionality to WebGL. ANGLE_depth_texture provides a subset of the + functionality from the OpenGL ES 2.0 extensions + OES_depth_texture + and + OES_packed_depth_stencil, with certain restrictions added for portability reasons. Specifically:

+ +
    +
  • ANGLE_depth_texture provides both depth and depth/stencil textures.
  • +
  • ANGLE_depth_texture does not provide the DEPTH24_STENCIL8_OES renderbuffer internal format from the OES_packed_depth_stencil extension. The core WebGL specification already supports allocation of depth/stencil renderbuffers.
  • +
  • ANGLE_depth_texture does not support loading image data via the TexImage or TexSubImage commands. Depth and depth/stencil textures created via this extension can only have their contents specified by rendering to them.
  • +
+ +

Consult the Errors section below for specific restrictions. +

+ + + + The texImage2D entry point is extended to accept the + format parameter DEPTH_COMPONENT and + DEPTH_STENCIL + + + The texImage2D entry point is extended to accept the + internalFormat parameter DEPTH_COMPONENT + and DEPTH_STENCIL + + + The texImage2D entry point is extended to accept + the type parameter UNSIGNED_SHORT, + UNSIGNED_INT, and + UNSIGNED_INT_24_8_WEBGL + + + The framebufferTexture2D entry point is extended to + accept the target parameter + DEPTH_ATTACHMENT and + DEPTH_STENCIL_ATTACHMENT + + + The texImage2D entry point is extended to accept + ArrayBufferView of type Uint16Array and + Uint32Array + + +

+ The WebGL-specific constraints about Framebuffer Object Attachments are extended:

+ +
    +
  • A texture attached to an FBO's DEPTH_ATTACHMENT attachment point must be allocated with the DEPTH_COMPONENT internal format.
  • +
  • A texture attached to the DEPTH_STENCIL_ATTACHMENT attachment point must be allocated with the DEPTH_STENCIL internal format.
  • +
+ +

+ In the WebGL API, it is an error to concurrently attach either + renderbuffers or textures to the following combinations of + attachment points:

+ +
    +
  • DEPTH_ATTACHMENT + DEPTH_STENCIL_ATTACHMENT
  • +
  • STENCIL_ATTACHMENT + DEPTH_STENCIL_ATTACHMENT
  • +
  • DEPTH_ATTACHMENT + STENCIL_ATTACHMENT
  • +
+ +

+ See the section + Framebuffer Object Attachments + in the WebGL specification for the behavior if these + constraints are violated. +

+
+ +

+ As per the OpenGL ES spec, there is no guarantee that the OpenGL ES implementation + will use the texture type to determine how to store the depth texture internally. + It may choose to downsample the 32-bit depth values to 16-bit or even 24-bit. + When a depth or depth/stencil texture is attached to a framebuffer object, calls to getParameter + with the DEPTH_BITS and STENCIL_BITS enums return the following: + + + + + + + + + + + + + + + + + + + + + +
Texture TypeDEPTH_BITS (GLint)STENCIL_BITS (GLint)
UNSIGNED_SHORT>= 160
UNSIGNED_INT>= 160
UNSIGNED_INT_24_8_WEBGL>= 24>= 8
+

+
+
+
+ +[NoInterfaceObject] +interface WEBGL_depth_texture { + const GLenum UNSIGNED_INT_24_8_WEBGL = 0x84FA; +}; + + + + The error INVALID_OPERATION is generated by + texImage2D if the format parameter is + DEPTH_COMPONENT or DEPTH_STENCIL and the + target is + TEXTURE_CUBE_MAP_{POSITIVE,NEGATIVE}_{X,Y,Z}. + + + The error INVALID_OPERATION is generated by + texImage2D if format and + internalformat are DEPTH_COMPONENT and + type is not UNSIGNED_SHORT or + UNSIGNED_INT. + + + The error INVALID_OPERATION is generated by + texImage2D if format and + internalformat are not DEPTH_COMPONENT + and type is UNSIGNED_SHORT or + UNSIGNED_INT. + + + The error INVALID_OPERATION is generated by + texImage2D if format and + internalformat are DEPTH_STENCIL and + type is not UNSIGNED_INT_24_8_WEBGL. + + + The error INVALID_OPERATION is generated by + texImage2D if format and + internalformat are not DEPTH_STENCIL and + type is UNSIGNED_INT_24_8_WEBGL. + + + The error INVALID_OPERATION is generated in the following situations: +
    +
  • + texImage2D is called with format and + internalformat of DEPTH_COMPONENT or + DEPTH_STENCIL and +
      +
    • target is not TEXTURE_2D,
    • +
    • data is not NULL, or
    • +
    • level is not zero.
    • +
    +
  • +
  • + texSubImage2D is called with format of + DEPTH_COMPONENT or DEPTH_STENCIL. +
  • +
  • + copyTexImage2D is called with an + internalformat that has a base internal format of + DEPTH_COMPONENT or DEPTH_STENCIL. +
  • +
  • + copyTexSubImage2D is called with a target texture + that has a base internal format of DEPTH_COMPONENT + or DEPTH_STENCIL. +
  • +
  • + generateMipmap is called on a texture that has a + base internal format of DEPTH_COMPONENT or + DEPTH_STENCIL. +
  • +
+
+
+ +

+ As per the ANGLE_depth_texture specification, when a depth + texture is sampled, the value is stored into the RED channel. + The contents of the GREEN, BLUE and ALPHA channels are + implementation dependent. It is therefore recommended to use + only the r component of variables in GLSL shaders + that are used to reference depth textures. +

+
+ + + Initial revision. + + + Added provisions to exclude cube depth textures. + + + Changed referenced WebGL API version from 2.0 to 1.0 + + + Removed the enumerants from the IDL which are contained in the context and added aliases to the extension name + + + + Renamed with OES prefix and removed the addendum due to expected harmonization between OES_depth_texture and ARB_depth_texture + (depth cube maps). + + + + + Renamed to WEBGL prefix, and changed to reference ANGLE_depth_texture, because of + limitations preventing the current ANGLE library from loading of image data to depth + textures. Incorporated errors from ANGLE_depth_texure extension specification. + + + + + Incorporated depth/stencil support and UNSIGNED_INT_24_8_WEBGL enum after discussion on + public_webgl mailing list, including supported behavior and additional error behavior. + Extended rules in Section 6.5 ("Framebuffer Object Attachments") to handle texture + attachments. + + + + + Updated references to texSubImage2D. Added + DEPTH_STENCIL_ATTACHMENT to framebufferTexture2D. + + + + Moved from draft to community approved status + + + Updated to track ANGLE_depth_texture, indicating that only red channel is guaranteed. + + + Ratified by Khronos Board of Promoters. + + + Added NoInterfaceObject extended attribute. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_draw_buffers/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_draw_buffers/extension.xml new file mode 100644 index 0000000000..106ebce4fb --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_draw_buffers/extension.xml @@ -0,0 +1,185 @@ + + + + WEBGL_draw_buffers + + WebGL working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + + 18 + + + + + + + + + + The implementation must support a minimum of 4 color attachments. + + + The value of the MAX_COLOR_ATTACHMENTS_WEBGL parameter must be greater than or + equal to that of the MAX_DRAW_BUFFERS_WEBGL parameter. + + + If: +
    +
  • A framebuffer's color attachments are all textures allocated with format RGBA + and type UNSIGNED_BYTE, and
  • +
  • The framebuffer has either: +
      +
    • No depth or stencil attachment
    • +
    • A valid DEPTH or DEPTH_STENCIL attachment
    • +
  • +
+ Then a call to checkFramebufferStatus against this framebuffer must not return + FRAMEBUFFER_UNSUPPORTED. (In other words, the implementation must support the + use of RGBA/UNSIGNED_BYTE textures as color attachments, plus either a + DEPTH or DEPTH_STENCIL attachment.) +
+ + Attaching n consecutive color attachments starting at COLOR_ATTACHMENT0_WEBGL, + where n is between 1 and MAX_DRAW_BUFFERS_WEBGL, must not return + FRAMEBUFFER_UNSUPPORTED from a call to checkFramebufferStatus. In + other words, if MAX_DRAW_BUFFERS_WEBGL is 4, then the implementation is + required to support the following combinations of color attachments: + +
    +
  • COLOR_ATTACHMENT0_WEBGL = RGBA/UNSIGNED_BYTE
  • +
  • COLOR_ATTACHMENT0_WEBGL = RGBA/UNSIGNED_BYTE
    + COLOR_ATTACHMENT1_WEBGL = RGBA/UNSIGNED_BYTE
  • +
  • COLOR_ATTACHMENT0_WEBGL = RGBA/UNSIGNED_BYTE
    + COLOR_ATTACHMENT1_WEBGL = RGBA/UNSIGNED_BYTE
    + COLOR_ATTACHMENT2_WEBGL = RGBA/UNSIGNED_BYTE
  • +
  • COLOR_ATTACHMENT0_WEBGL = RGBA/UNSIGNED_BYTE
    + COLOR_ATTACHMENT1_WEBGL = RGBA/UNSIGNED_BYTE
    + COLOR_ATTACHMENT2_WEBGL = RGBA/UNSIGNED_BYTE
    + COLOR_ATTACHMENT3_WEBGL = RGBA/UNSIGNED_BYTE
  • +
+
+ + Although the extension name is prefixed with WEBGL the extension must be enabled with the + #extension GL_EXT_draw_buffers directive, as shown in the sample code, to use + the extension in a shader. + + Likewise the shading language preprocessor #define GL_EXT_draw_buffers, will be defined to 1 if the extension is supported. + + + The value of gl_MaxDrawBuffers must match MAX_DRAW_BUFFERS_WEBGL from the API if the extension is enabled in a WebGL context; otherwise, the value must be 1. Whether or not the extension is enabled with the #extension GL_EXT_draw_buffers directive in a shader does not affect the value of gl_MaxDrawBuffers. The value of gl_MaxDrawBuffers is a constant in the shader, and is guaranteed to be frozen at program link time. It is implementation-dependent whether it is frozen at shader compile time. (A consequence is that if a program is linked, and later the WEBGL_draw_buffers extension is enabled, the value of gl_MaxDrawBuffers seen by that program will still be 1.) + + + If the WEBGL_draw_buffers extension is enabled, but the fragment shader does not contain the #extension GL_EXT_draw_buffers directive to enable it, then writes to gl_FragColor are only written to COLOR_ATTACHMENT0_WEBGL, and not broadcast to all color attachments. In this scenario, other color attachments are guaranteed to remain untouched. + + + If a fragment shader writes to neither gl_FragColor nor gl_FragData, the values of + the fragment colors following shader execution are untouched. + + If a fragment shader contains the #extension GL_EXT_draw_buffers directive, all + gl_FragData variables (from gl_FragData[0] to gl_FragData[MAX_DRAW_BUFFERS_WEBGL - 1]) + default to zero if no values are written to them during a shader execution. + + + If an image is attached to more than one color attachment point in a framebuffer, checkFramebufferStatus + returns FRAMEBUFFER_UNSUPPORTED. An image can be an individual mip level, or a face of cube map. + +
+ + + Adds support for multiple color buffers and color outputs from fragment shaders. + + +
+ +[NoInterfaceObject] +interface WEBGL_draw_buffers { + const GLenum COLOR_ATTACHMENT0_WEBGL = 0x8CE0; + const GLenum COLOR_ATTACHMENT1_WEBGL = 0x8CE1; + const GLenum COLOR_ATTACHMENT2_WEBGL = 0x8CE2; + const GLenum COLOR_ATTACHMENT3_WEBGL = 0x8CE3; + const GLenum COLOR_ATTACHMENT4_WEBGL = 0x8CE4; + const GLenum COLOR_ATTACHMENT5_WEBGL = 0x8CE5; + const GLenum COLOR_ATTACHMENT6_WEBGL = 0x8CE6; + const GLenum COLOR_ATTACHMENT7_WEBGL = 0x8CE7; + const GLenum COLOR_ATTACHMENT8_WEBGL = 0x8CE8; + const GLenum COLOR_ATTACHMENT9_WEBGL = 0x8CE9; + const GLenum COLOR_ATTACHMENT10_WEBGL = 0x8CEA; + const GLenum COLOR_ATTACHMENT11_WEBGL = 0x8CEB; + const GLenum COLOR_ATTACHMENT12_WEBGL = 0x8CEC; + const GLenum COLOR_ATTACHMENT13_WEBGL = 0x8CED; + const GLenum COLOR_ATTACHMENT14_WEBGL = 0x8CEE; + const GLenum COLOR_ATTACHMENT15_WEBGL = 0x8CEF; + + const GLenum DRAW_BUFFER0_WEBGL = 0x8825; + const GLenum DRAW_BUFFER1_WEBGL = 0x8826; + const GLenum DRAW_BUFFER2_WEBGL = 0x8827; + const GLenum DRAW_BUFFER3_WEBGL = 0x8828; + const GLenum DRAW_BUFFER4_WEBGL = 0x8829; + const GLenum DRAW_BUFFER5_WEBGL = 0x882A; + const GLenum DRAW_BUFFER6_WEBGL = 0x882B; + const GLenum DRAW_BUFFER7_WEBGL = 0x882C; + const GLenum DRAW_BUFFER8_WEBGL = 0x882D; + const GLenum DRAW_BUFFER9_WEBGL = 0x882E; + const GLenum DRAW_BUFFER10_WEBGL = 0x882F; + const GLenum DRAW_BUFFER11_WEBGL = 0x8830; + const GLenum DRAW_BUFFER12_WEBGL = 0x8831; + const GLenum DRAW_BUFFER13_WEBGL = 0x8832; + const GLenum DRAW_BUFFER14_WEBGL = 0x8833; + const GLenum DRAW_BUFFER15_WEBGL = 0x8834; + + const GLenum MAX_COLOR_ATTACHMENTS_WEBGL = 0x8CDF; + const GLenum MAX_DRAW_BUFFERS_WEBGL = 0x8824; + + void drawBuffersWEBGL(sequence<GLenum> buffers); +}; + + +
+    #extension GL_EXT_draw_buffers : require
+    precision mediump float;
+    void main() {
+        gl_FragData[0] = vec4(1.0, 0.0, 0.0, 1.0);
+        gl_FragData[1] = vec4(0.0, 1.0, 0.0, 1.0);
+        gl_FragData[2] = vec4(0.0, 0.0, 1.0, 1.0);
+        gl_FragData[3] = vec4(1.0, 1.0, 1.0, 1.0);
+    }
+    
+
+ + + Initial revision. + + + Corrected typo in drawBuffersWEBGL. Changed referenced spec version to 1.0 to fix broken link. + + + Renamed to EXT_draw_buffers per plan of OpenGL ES working group. Moved to draft status. Assigned number. + + + Renamed to WEBGL_draw_buffers per discussion on public_webgl list. Added guarantees to make it easier for developers to use the extension. + + + Clarified naming of shader directives. + + + Added NoInterfaceObject extended attribute. + + + Ratified by Khronos Board of Promoters. + + + Revised behavior of gl_MaxDrawBuffers and gl_FragColor broadcasting, to avoid significant performance impact for WebGL 1.0 implementations running on top of the desktop OpenGL API. + + + Removed undefined behaviors. + + + Revised user-defined variable behavior to default to zero. + + + Revised behavior of the same image is attached to more than one color attachment point. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_lose_context/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_lose_context/extension.xml new file mode 100644 index 0000000000..8c7d0f1636 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_lose_context/extension.xml @@ -0,0 +1,114 @@ + + + + WEBGL_lose_context + + WEBKIT_WEBGL_lose_context + MOZ_WEBGL_lose_context + + enne@chromium.org + + Members of the WebGL working group + Glenn Maynard + + 3 + + + + +

This extension exposes new functions which simulate losing and restoring the WebGL context, even on platforms where the context can never be lost. Consult the WebGL specification for documentation about the webglcontextlost and webglcontextrestored events.

+

When this extension is enabled: +

    +
  • loseContext and restoreContext are allowed to generate INVALID_OPERATION errors even when the context is lost.
  • +
+

+

+ Note that this extension is not disconnected from the WebGLRenderingContext if that + object loses its context as described in "The Context Lost Event" of the WebGL specification, either + through use of this API or via actual circumstances such as a system failure. +

+
+ +[NoInterfaceObject] +interface WEBGL_lose_context { + void loseContext(); + void restoreContext(); +}; + + + +

When this function is called and the context is not lost, simulate + losing the context so as to trigger the steps described in the WebGL + spec for handling context lost. The context will remain in the lost + state according to the WebGL specification until + restoreContext() is called. If the context is already + lost when this function is called, generate an + INVALID_OPERATION error.

+ +

Implementations should destroy the underlying graphics context and + all graphics resources when this method is called. This is the + recommended mechanism for applications to programmatically halt their + use of the WebGL API.

+ +
+ + When this function is called while the context is lost, and the conditions + defined by the WebGL specification for restoring the context are + met, simulate the context being restored so as to trigger the steps + described in the WebGL spec for handling the context being restored. + If the context is already restored when this function is called, or if + the conditions in the WebGL specification for restoring the + context are not satisfied, or if the context was not lost via loseContext(), + generate an INVALID_OPERATION error. + +
+ + + Initial revision. + + + Added explicit restoreContext() method based on discussion on public_webgl list, to enable testing of scenario where context stays lost for a period of time. + + + Renamed from WEBKIT_lose_context to WEBGL_EXT_lose_context + + + Changed to make it clear this extension should follow the WebGL spec for the steps involved in handling losing and restoring the context rather than just fire events. + + + Added vendor-specific name strings for draft extension per discussion on WebGL mailing list + Renamed from WEBGL_EXT_lose_context to WEBGL_lose_context + + + Renamed "Name Strings" section to "Alias Name Strings". + + + Removed webgl module per changes to Web IDL spec. + + + Moved from draft to community approved status + + + Ratified by Khronos Board of Promoters. + + + Clarified error generation that conflicted with WebGL spec. + + + + Indicated that this extension is not disconnected from the WebGLRenderingContext + when that object loses its drawing buffer (i.e. when it performs the steps + outlined in "The Context Lost Event" of the WebGL specification). + + + Added INVALID_OPERATION for restoreContext() without loseContext() + + + Added NoInterfaceObject extended attribute. + + + Per discussion in working group, document that this extension + should destroy the underlying context and all graphics resources. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_multiview/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_multiview/extension.xml new file mode 100644 index 0000000000..fb22e01b60 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_multiview/extension.xml @@ -0,0 +1,285 @@ + + + + WEBGL_multiview + + WebGL working group (public_webgl 'at' khronos.org) + + + Olli Etuaho, NVIDIA + Members of the WebGL working group + + 36 + + + + + + + Calling framebufferTextureMultiviewWEBGL with a non-null texture parameter that does not identify a 2D array texture generates an INVALID_OPERATION error. + + + The values of baseViewIndex and numViews can result in an error only if the texture parameter is non-null. + + + If baseViewIndex is not the same for all framebuffer attachment points where the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is not NONE the framebuffer is considered incomplete. Calling getFramebufferStatus for a framebuffer in this state returns FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR. Other rules for framebuffer completeness from the OVR_multiview specification also apply. + + + Other web APIs may expose opaque multiview framebuffers. Opaque multiview framebuffers are WebGLFramebuffer objects that act as if they have multi-view attachments, but their attachments are not exposed as textures or renderbuffers and can not be changed. Opaque multiview framebuffers may have any combination of color, depth and stencil attachments. + + + Calling framebufferRenderbuffer, framebufferTexture2D, framebufferTextureLayer, framebufferTextureMultiviewWEBGL, or any other call that could change framebuffer attachments with an opaque multiview framebuffer bound to target generates an INVALID_OPERATION error. + + + If an opaque framebuffer is bound to target when calling getFramebufferAttachmentParameter, then attachment must be BACK, DEPTH, or STENCIL. + + + If an opaque framebuffer is bound to target when calling getFramebufferAttachmentParameter, then pname must not be FRAMEBUFFER_ATTACHMENT_OBJECT_NAME. + + + Querying FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR on an opaque multiview framebuffer attachment point that has attachments must return the number of views in the opaque multiview framebuffer. + + + Querying FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR on an opaque multiview framebuffer must return 0. + + + Querying FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE on an opaque multiview framebuffer must return FRAMEBUFFER_DEFAULT. + + + The number of views in an opaque multiview framebuffer may be greater than the maximum number of texture array views (the value of MAX_VIEWS_OVR). + + + Passing an opaque multiview framebuffer to deleteFramebuffer generates an INVALID_OPERATION error. + + + Although the extension name is prefixed with WEBGL the extension must be enabled with the + #extension GL_OVR_multiview directive, as shown in the sample code, to use + the extension in a shader. + + Likewise the shading language preprocessor #define GL_OVR_multiview, will be defined to 1 if the extension is supported. + + + This extension relaxes the restriction in OVR_multiview that only gl_Position can depend on ViewID in the vertex shader. With this change, view-dependent outputs like reflection vectors and similar are allowed. + + + When the number of views specified in the active program is one, gl_ViewID_OVR will always evaluate to zero. + + + When a shader written in OpenGL ES shading language version 1.00 enables or requires GL_OVR_multiview with an extension directive, layout is treated as a keyword rather than an identifier, and using a layout qualifier to specify num_views is allowed. Other uses of layout qualifiers are not allowed in OpenGL ES shading language 1.00. + + + In OpenGL ES shading language version 1.00 gl_ViewID_OVR has the type int as opposed to uint. + + + When a timer query is active and the number of views in the current draw framebuffer is greater than one, attempting to draw or calling clear generates an INVALID_OPERATION error. + + + When the number of views in the current draw framebuffer is greater than one and the active program does not declare a number of views, attempting to draw generates an INVALID_OPERATION error. + + + + + Adds support for rendering into multiple views simultaneously. This is supported for opaque multiview framebuffers starting from WebGL 1.0, and 2D texture arrays starting from WebGL 2.0. + + + When a shader enables, requires, or warns GL_OVR_multiview with an extension directive: +
    +
  • gl_ViewID_OVR is a built-in input of the type uint.
  • +
+
+ + The GLSL macro GL_OVR_multiview is defined as 1. + +
+
+ +[NoInterfaceObject] +interface WEBGL_multiview { + const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR = 0x9630; + const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR = 0x9632; + const GLenum MAX_VIEWS_OVR = 0x9631; + const GLenum FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR = 0x9633; + + void framebufferTextureMultiviewWEBGL(GLenum target, GLenum attachment, WebGLTexture? texture, GLint level, GLint baseViewIndex, GLsizei numViews); +}; + + + + + + + + + + + + + + + Calling with the pname set to MAX_VIEWS_OVR returns the maximum number of views. The implementation must support at least 2 views. +
+ + The return type depends on the parameter queried: + + + +
pnamereturned type
MAX_VIEWS_OVRGLint
+
+
+ + + + + + Calling with the pname parameter set to FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR returns the number of views of the framebuffer object attachment. + Calling with the pname parameter set to FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR returns the base view index of the framebuffer object attachment. +
+ + The return type depends on the parameter queried: + + + + +
pnamereturned type
FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVRGLsizei
FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVRGLint
+
+
+ + + The error INVALID_OPERATION is generated by calling framebufferTextureMultiviewWEBGL with a texture parameter that does not identify a 2D array texture. + + + The error INVALID_OPERATION is generated by calling framebufferRenderbuffer, framebufferTexture2D, framebufferTextureLayer, or framebufferTextureMultiviewWEBGL with a target parameter that identifies an opaque multiview framebuffer. + + + The error INVALID_OPERATION is generated by calling deleteFramebuffer with a buffer parameter that identifies an opaque multiview framebuffer. + + + The error INVALID_ENUM is generated by calling getFramebufferAttachmentParameter with an attachment parameter other than BACK, DEPTH or STENCIL when the target parameter identifies an opaque multiview framebuffer. + + + The error INVALID_ENUM is generated by calling getFramebufferAttachmentParameter with the pname parameter set to FRAMEBUFFER_ATTACHMENT_OBJECT_NAME when the target parameter identifies an opaque multiview framebuffer. + + + The error INVALID_VALUE is generated by calling framebufferTextureMultiviewWEBGL with a non-null texture in the following cases: +
    +
  • if numViews is less than one
  • +
  • if numViews is more than MAX_VIEWS_OVR
  • +
  • with the parameters set so that baseViewIndex + numViews is larger than the value of MAX_ARRAY_TEXTURE_LAYERS
  • +
  • if baseViewIndex is negative
  • +
+
+ + The error INVALID_FRAMEBUFFER_OPERATION is generated by commands that read from the framebuffer such as BlitFramebuffer, ReadPixels, CopyTexImage*, and CopyTexSubImage*, if the number of views in the current read framebuffer is greater than one. + + + The error INVALID_OPERATION is generated by attempting to draw if the active program declares a number of views and the number of views in the draw framebuffer does not match the number of views declared in the active program. + + + The error INVALID_OPERATION is generated by attempting to draw if the number of views in the current draw framebuffer is greater than one and the active program does not declare a number of views. + + + The error INVALID_OPERATION is generated by attempting to draw if the number of views in the current draw framebuffer is greater than one and transform feedback is active. + + + The error INVALID_OPERATION is generated by attempting to draw or calling clear if the number of views in the current draw framebuffer is greater than one and a timer query is active. + +
+ +
+    var gl = document.createElement('canvas').getContext('webgl2');
+    var ext = gl.getExtension('WEBGL_multiview');
+    var fb = gl.createFramebuffer();
+    gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, fb);
+    var colorTex = gl.createTexture();
+    gl.bindTexture(gl.TEXTURE_2D_ARRAY, colorTex);
+    gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 1, gl.RGBA8, 512, 512, 2);
+    ext.framebufferTextureMultiviewWEBGL(gl.DRAW_FRAMEBUFFER, gl.COLOR_ATTACHMENT0, colorTex, 0, 0, 2);
+    var depthStencilTex = gl.createTexture();
+    gl.bindTexture(gl.TEXTURE_2D_ARRAY, depthStencilTex);
+    gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 1, gl.DEPTH32F_STENCIL8, 512, 512, 2);
+    ext.framebufferTextureMultiviewWEBGL(gl.DRAW_FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, depthStencilTex, 0, 0, 2);
+    gl.drawElements(...);  // draw will be broadcasted to the layers of colorTex and depthStencilTex.
+    
+
+ +
+    var gl = document.createElement('canvas').getContext('webgl');
+    var ext = gl.getExtension('WEBGL_multiview');
+    // ... obtain opaque multiview framebuffer "fb" from another web API here ...
+    gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
+    gl.drawElements(...);  // draw will be broadcasted to the views of the opaque multiview framebuffer.
+    // You can not call framebufferTextureMultiviewWEBGL to change the attachments of "fb", only draw to it.
+    
+
+ +
+    #version 300 es
+    #extension GL_OVR_multiview : require
+    precision mediump float;
+    layout (num_views = 2) in;
+    in vec4 inPos;
+    uniform mat4 u_viewMatrix0;
+    uniform mat4 u_viewMatrix1;
+    void main() {
+      if (gl_ViewID_OVR == 0u) {
+        gl_Position = u_viewMatrix0 * inPos;
+      } else {
+        gl_Position = u_viewMatrix1 * inPos;
+      }
+    }
+    
+
+ + + Initial revision. + + + + Specified what happens when the number of views doesn't match or if the number of views is one. + + ´ + + Specified what happens on invalid num_views declarations and if assignment to gl_Position.x is inside a larger expression. + + + + Filled in getFramebufferAttachmentParameter and extension macro specs, formatted the documentation better, and added a simple API usage example. + + + + Removed the core spec changes and made the specification follow the OVR_multiview specification more closely. + + + + Introduced the concept of an opaque multiview framebuffer and fixed example code. + + + + Made the extension compatible with WebGL 1.0 and fixed example shader code. + + + + Specified some errors to be generated at draw time and made the extension compatible with emscripten. + + + + Rolled back shader restrictions. + + + + Required a multiview program to draw to a multiview framebuffer. + + + + Took changes in the native OVR_multiview specification into account, added a more elaborate example including a depth/stencil texture, and an explicit mention that texture arrays are only supported in WebGL 2.0. + + + + Moved to draft status. + + + + Fixed off-by-one issue in validating baseViewIndex + numViews. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_security_sensitive_resources/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_security_sensitive_resources/extension.xml new file mode 100644 index 0000000000..de81d178d3 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/WEBGL_security_sensitive_resources/extension.xml @@ -0,0 +1,200 @@ + + + + WEBGL_security_sensitive_resources + + + WebGL working group (public_webgl 'at' khronos.org) + + + + Max Vujovic (mvujovic 'at' adobe.com) + Members of the WebGL working group + + + 23 + + + + + + + + + +

In the WebGL API 1.0 specification, section 4.2 Origin Restrictions restricts the following sources for texture upload:

+

+

    +
  • An image or video element whose origin is not the same as the origin of the Document that contains the WebGLRenderingContext's canvas element.
  • +
  • A canvas element whose origin-clean flag is set to false.
  • +
+

+

This extension allows these sources for texture uploads, with some restrictions regarding their uploading and use.

+ +
+

Motivation:

+

This extension enables the processing of cross-origin resources in WebGL. Additionally, it defines a foundation of concepts that can be used in future extensions to process other types of security sensitive content, including arbitrary HTML content.

+

For an example of security sensitive content, consider the rendering of an HTML link. The color of the link can indicate its visited or unvisited state. Third parties must not be able to access or infer this information.

+

Specifically, third parties must not be able read the pixel data of security sensitive content through WebGL or other APIs. Additionally, third parties must not be able to divulge or approximate the pixel data of security sensitive content by timing WebGL operations.

+

Prior to this extension, WebGL restricted the upload of security sensitive content as a texture for graphical processing. This extension enables the uploading and processing of security sensitive content, with some restrictions. Note that this extension imposes no restrictions on the processing of regular, non-security sensitive content.

+

To secure a user’s privacy, a WebGL implementation must not leak information about the contents of security sensitive textures through the execution time of its commands. To achieve this, no part of the underlying graphics pipeline may vary in execution time based on the contents of a security sensitive texture. For example, primitive assembly and depth testing must not vary based on the contents of a security sensitive texture.

+

The vertex shading and fragment shading stages of the graphics pipeline require particular restrictions to keep their execution time independent of the contents of security sensitive textures. Specifically, the contents of a security sensitive texture must only appear in constant-time GLSL operations. A constant-time GLSL operation is an operation whose execution time does not vary based on the values of its operands. This extension will describe how a WebGL implementation can enforce this requirement.

+

Additionally, this extension attempts to identify non-constant-time GLSL operations. All other GLSL operations are assumed to be constant time in both the WebGL implementation and the underlying GPU implementation. If this assumption is false on a particular implementation, then this extension must be disabled for that implementation. In the future, GPU vendors may be able to provide a mechanism to guarantee that the assumed GLSL operations are in fact constant-time.

+
+ +

Definitions

+

This extension relies on the definition of several constructs in GLSL. These constructs are determined statically, after preprocessing.

+ +

Regular Sampler Variables and Secure Sampler Variables

+

S is a regular sampler if an expression dependent on S appears in one or more of the following constructs:

+

+

    +
  • if statement condition
  • +
  • selection operator (?) condition
  • +
  • loop condition
  • +
  • logical and operator (&&)
  • +
  • logical or operator (||)
  • +
  • coord, bias, or lod argument in a texture lookup function call
  • +
  • assignment to gl_Position
  • +
  • assignment to gl_FragDepth
  • +
+

+

Otherwise, S is a secure sampler.

+ +

Sampler-Dependent Expressions

+

An expression is dependent on the sampler S if:

+

+

    +
  • It contains a texture lookup function call with S as the sampler argument.
  • +
  • It contains an expression that is dependent on the sampler S.
  • +
  • It contains a variable that is dependent on the sampler S.
  • +
+

+ +

Sampler-Dependent Variables

+

A variable is dependent on the sampler S if:

+

+

    +
  • It is assigned to an expression dependent on the sampler S. (e.g. If a = b and b is dependent on sampler S, then a is dependent on sampler S.)
  • +
  • It is addressed using a sampler-dependent expression in an assignment. (e.g. If a[b] = c and b is dependent on the sampler S, then a is dependent on sampler S.)
  • +
  • It is a fragment shader varying and the corresponding vertex shader varying is dependent on the sampler S.
  • +
+

+ +
+ A WebGL implementation can create a dependency graph in its GLSL compiler to implement these GLSL constructs. One closely related implementation is described in a wiki page. +
+ +

Features

+ + The WebGLRenderingContext's canvas's origin-clean flag is set to false if the context is created with a WebGLContextAttributes dictionary with securitySensitiveDrawingBuffer set to true. + +
+ + +[NoInterfaceObject] +interface WEBGL_security_sensitive_resources { + WebGLFramebuffer? createSecuritySensitiveFramebuffer(); + WebGLTexture? createSecuritySensitiveTexture(); +}; + +dictionary WebGLContextAttributes { + GLboolean securitySensitiveDrawingBuffer = false; +}; + + + + Behaves like createFramebuffer, except framebuffers created with this function are referred to as security sensitive framebuffers. Framebuffers created with createFramebuffer are referred to as regular framebuffers. + Behaves like createTexture, except textures created with this function are known as security sensitive textures. Textures created with createTexture are known as regular textures. + + + + +
+

In summary, an author cannot:

+
    +
  • draw a security sensitive resource into a regular resource,
  • +
  • copy from a security sensitive resource into a regular resource,
  • +
  • read a security sensitive resource using readPixels,
  • +
  • use a security sensitive resource for depth testing or stencil testing,
  • +
  • share security sensitive resources with a context that cannot recognize them as security sensitive,
  • +
  • use a security sensitive resource to influence geometry, since this can affect the depth buffer.
  • +
+
+

The error INVALID_OPERATION is generated in the following situations:

+
    +
  • drawArrays or drawElements is called and a security sensitive texture is bound to a regular sampler.
  • +
  • +

    drawArrays or drawElements is called and:

    +
      +
    • a security sensitive texture is bound to a secure sampler,
    • +
    • a color output variable gl_FragColor or gl_FragData[i] is dependent on the secure sampler,
    • +
    • +

      the output variable writes to either:

      +
        +
      • a regular texture,
      • +
      • a regular renderbuffer,
      • +
      • the default framebuffer with securitySensitiveDrawingBuffer set to false in the WebGLContextAttributes dictionary used to create the context.
      • +
      +
    • +
    +
  • +
  • +

    copyTexImage2D or copyTexSubImage2D is called and:

    +
      +
    • the default framebuffer is bound,
    • +
    • securitySensitiveDrawingBuffer was set to true in the WebGLContextAttributes dictionary used to create the context.
    • +
    • a regular texture is bound as the destination.
    • +
    +
  • +
  • +

    copyTexImage2D or copyTexSubImage2D is called and:

    +
      +
    • a security sensitive renderbuffer is selected as the source,
    • +
    • a regular texture is bound as the destination.
    • +
    +
  • +
  • +

    readPixels is called and:

    +
      +
    • the default framebuffer is bound,
    • +
    • securitySensitiveDrawingBuffer was set to true in the WebGLContextAttributes dictionary used to create the context.
    • +
    +
  • +
  • readPixels is called and a security sensitive renderbuffer is selected as the source.
  • +
  • +

    framebufferRenderbuffer is called and:

    +
      +
    • attachment is DEPTH_ATTACHMENT, STENCIL_ATTACHMENT, or DEPTH_STENCIL_ATTACHMENT,
    • +
    • renderbuffer is a security sensitive renderbuffer.
    • +
    +
  • +
  • +

    acquireSharedResource is called and:

    +
      +
    • resource is a security sensitive texture or a security sensitive renderbuffer,
    • +
    • the context acquiring the resource does not have this extension enabled.
    • +
    +
  • +
+
+
+ + +
    +
  • +
    Q: Why not mark textures and renderbuffers as security sensitive automatically in the WebGL implementation instead of exposing createSecuritySensitive* to the API consumer?
    +
    A: This approach could make it difficult for API consumers to determine what operation caused a resource to become security sensitive because a related error could occur much later.
    +
  • +
+
+ + + + Initial revision. + + + Added NoInterfaceObject extended attribute. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/proposals/EXT_clip_cull_distance/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/proposals/EXT_clip_cull_distance/extension.xml new file mode 100644 index 0000000000..5fc51d3796 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/proposals/EXT_clip_cull_distance/extension.xml @@ -0,0 +1,81 @@ + + + + + EXT_clip_cull_distance + + WebGL + working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + + + XYZ + + + + + + + + + + + + Adds support for hardware clip planes and cull distances to OpenGL ES. + + + + + + + + + + + + + + [NoInterfaceObject] + interface EXT_clip_cull_distance { + const GLenum MAX_CLIP_DISTANCES_EXT = 0x0D32; + const GLenum MAX_CULL_DISTANCES_EXT = 0x82F9; + const GLenum MAX_COMBINED_CLIP_AND_CULL_DISTANCES_EXT = 0x82FA; + + const GLenum CLIP_DISTANCE0_EXT = 0x3000; + const GLenum CLIP_DISTANCE1_EXT = 0x3001; + const GLenum CLIP_DISTANCE2_EXT = 0x3002; + const GLenum CLIP_DISTANCE3_EXT = 0x3003; + const GLenum CLIP_DISTANCE4_EXT = 0x3004; + const GLenum CLIP_DISTANCE5_EXT = 0x3005; + const GLenum CLIP_DISTANCE6_EXT = 0x3006; + const GLenum CLIP_DISTANCE7_EXT = 0x3007; + }; + + + +
+    #extension GL_EXT_clip_cull_distance : enable
+
+    // Vertex shader
+    out highp float gl_ClipDistance[2];
+    out highp float gl_CullDistance[2];
+
+    void main(){
+        // Compute the clip and cull distances for this vertex
+        gl_ClipDistance[0] = ...;
+        gl_CullDistance[0] = ...;
+        gl_ClipDistance[1] = ...;
+        gl_CullDistance[1] = ...;
+    }
+    
+
+ + + + Initial revision. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/proposals/EXT_multi_draw_arrays/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/proposals/EXT_multi_draw_arrays/extension.xml new file mode 100644 index 0000000000..b520e8d781 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/proposals/EXT_multi_draw_arrays/extension.xml @@ -0,0 +1,102 @@ + + + EXT_multi_draw_arrays + + WebGL + working group (public_webgl 'at' khronos.org) + + + Contributors to the EXT_multi_draw_arrays specification + Members of the WebGL working group + + + NN + + + + + + + + + +
+

This extension exposes the EXT_multi_draw_arrays functionality to WebGL.

+ +

CAD vendors rendering large models comprised of many individual parts face scalability issues issuing large numbers of draw calls from WebGL. This extension reduces draw call overhead by allowing better batching.

+
+ + + The multiDrawArraysEXT and multiDrawElementsEXT entry points are added. These provide a counterpoint to instanced rendering and are more flexible for certain scenarios. + + The offset arguments to multiDrawArraysEXT and multiDrawElementsEXT choose the starting offset into their respective typed arrays or sequences. This primarily avoids allocation of temporary typed array views. + +
+ + +[NoInterfaceObject] +interface EXT_multi_draw_arrays { + void multiDrawArraysEXT(GLenum mode, + (Int32Array or sequence<GLint>) firstsList, GLuint firstsOffset, + (Int32Array or sequence<GLsizei>) countsList, GLuint countsOffset, + GLsizei drawcount); + void multiDrawElementsEXT(GLenum mode, + (Int32Array or sequence<GLint>) countsList, GLuint countsOffset, + GLenum type, + (Int32Array or sequence<GLsizei>) offsetsList, GLuint offsetsOffset, + GLsizei drawcount); +}; + + + + The multi-draw APIs are subject to all of the same rules regarding out-of-range array accesses as the core WebGL APIs. + + + + + + + + + + + + + + + + + + +
+var ext = gl.getExtension("EXT_multi_draw_arrays");
+{
+  // multiDrawArrays variant.
+  let firsts = new Int32Array(...);
+  let counts = new Int32Array(...);
+  ext.multiDrawArraysEXT(gl.TRIANGLES, firsts, 0, counts, 0, firsts.length);
+}
+
+{
+  // multiDrawElements variant.
+  // Assumes that the indices which have been previously uploaded to the
+  // ELEMENT_ARRAY_BUFFER are to be treated as UNSIGNED_SHORT.
+  let counts = new Int32Array(...);
+  let offsets = new Int32Array(...);
+  ext.multiDrawElementsEXT(gl.TRIANGLES, counts, 0, gl.UNSIGNED_SHORT, offsets, 0,
+                           counts.length);
+}
+    
+
+ + + + + + + + Initial version. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_blend_equation_advanced_coherent/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_blend_equation_advanced_coherent/extension.xml new file mode 100644 index 0000000000..b08bb8f553 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_blend_equation_advanced_coherent/extension.xml @@ -0,0 +1,125 @@ + + + WEBGL_blend_equation_advanced_coherent + + WebGL + working group (public_webgl 'at' khronos.org) + + + Ashley Gullen (ashley at scirra dot com) + Members of the WebGL working group + + + NN + + + + + + + + + +
+

This extension exposes the KHR_blend_equation_advanced_coherent functionality to WebGL.

+ +

CanvasRenderingContext2D provides a series of common blend functions with globalComposeOperation, such as "multiply" and "screen". KHR_blend_equation_advanced_coherent provides, with the exception of "xor", exactly the same list of blend functions for WebGL, as detailed below:

+ +
    +
  • "multiply": MULTIPLY_KHR
  • +
  • "screen": SCREEN_KHR
  • +
  • "overlay": OVERLAY_KHR
  • +
  • "darken": DARKEN_KHR
  • +
  • "lighten": LIGHTEN_KHR
  • +
  • "color-dodge": COLORDODGE_KHR
  • +
  • "color-burn": COLORBURN_KHR
  • +
  • "hard-light": HARDLIGHT_KHR
  • +
  • "soft-light": SOFTLIGHT_KHR
  • +
  • "difference": DIFFERENCE_KHR
  • +
  • "exclusion": EXCLUSION_KHR
  • +
  • "hue": HSL_HUE_KHR
  • +
  • "saturation": HSL_SATURATION_KHR
  • +
  • "color": HSL_COLOR_KHR
  • +
  • "luminosity": HSL_LUMINOSITY_KHR
  • +
+ +

These effects are useful for high-quality artistic blends. They can be implemented using shaders and rendering via an intermediate texture. However this has a high performance overhead both in draw calls and GPU bandwidth. Advanced blend modes allow a much simpler, high-performance way of implementing these blends. Using shaders rendering to an intermediate texture can be used as a fallback if this extension is not supported.

+ +

Note only the coherent variant of this extension is exposed in order to eliminate the possibility of undefined behavior in KHR_blend_equation_advanced. This also simplifies the extension and removes the need to insert blend barriers during rendering.

+
+ + + The blendEquation entry point is extended to accept the enums in the IDL below + +
+ + +[NoInterfaceObject] +interface WEBGL_blend_equation_advanced_coherent { + const GLenum MULTIPLY = 0x9294; + const GLenum SCREEN = 0x9295; + const GLenum OVERLAY = 0x9296; + const GLenum DARKEN = 0x9297; + const GLenum LIGHTEN = 0x9298; + const GLenum COLORDODGE = 0x9299; + const GLenum COLORBURN = 0x929A; + const GLenum HARDLIGHT = 0x929B; + const GLenum SOFTLIGHT = 0x929C; + const GLenum DIFFERENCE = 0x929E; + const GLenum EXCLUSION = 0x92A0; + const GLenum HSL_HUE = 0x92AD; + const GLenum HSL_SATURATION = 0x92AE; + const GLenum HSL_COLOR = 0x92AF; + const GLenum HSL_LUMINOSITY = 0x92B0; +}; + + + + + + + + + + + + + + + + + + + + +
+var ext = gl.getExtension("WEBGL_blend_equation_advanced_coherent");
+gl.blendEquation(ext.MULTIPLY);
+gl.getParameter(gl.BLEND_EQUATION) == ext.MULTIPLY;
+    
+
+ + + + + + + + + Forked from WEBGL_blend_equation_advanced to specify only the coherent variant + + + + Converted to extension XML format + + + + Revised description + + + + Original draft as a TXT file + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_debug/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_debug/extension.xml new file mode 100644 index 0000000000..3daa9e0c70 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_debug/extension.xml @@ -0,0 +1,359 @@ + + + WEBGL_debug + + WebGL + working group (public_webgl 'at' khronos.org) + + + Emmanuel Gil Peyrot, Collabora Ltd. + Members of the WebGL working group + + + NN + + + + + + +

+ This extension allows the GL to notify applications when various events + occur that may be useful during application development, debugging and + profiling. +

+ + + + References to debug contexts are deleted. + + + + References to the debug message log and callback are deleted, replaced + with DOM events. + + + + The ObjectPtrLabel and GetObjectPtrLabel + functions are replaced with ObjectLabel and + GetObjectLabel. + + + + The count and ids arguments of + DebugMessageControl are replaced with a + sequence<GLuint> ids argument. + + + + The length and buf arguments of + DebugMessageInsert and PushDebugGroup are + replaced with a DOMString message argument. + + + + The identifier and name arguments of + ObjectLabel and GetObjectLabel are replaced + with a WebGLObject object argument. + + + + The length and label arguments of + ObjectLabel are replaced with a DOMString + label argument. + + + + The bufSize, length and label + arguments of GetObjectLabel are replaced with a + DOMString return type. + + + + As per the usual WebGL binding rules, functions don’t keep the KHR + suffix they have in the GLES version, but tokens do. + + + + + + The WEBGL_debug extension object is a DOM + EventTarget, obeying the rules of the DOM Level 3 Events, + with a new WebGLDebugMessage event that gets fired + whenever the driver, browser or application emits a debug message. + + + + debugMessageInsertKHR is exposed to allow the application + to insert debug messages into the WebGL stream. + + + + objectLabelKHR and getObjectLabelKHR are + exposed, to assign a label to a WebGLObject and retrieve + it. + + + + pushDebugGroupKHR and popDebugGroupKHR make + it possible to group a list of WebGL calls together. + + + + debugMessageControlKHR allows the application to enable + and disable the debug messages which emit a + WebGLDebugMessage event. This state is part of the debug + group they are part of, and gets poped on + popDebugGroupKHR. + + +
+ + ids, boolean enabled); + void debugMessageInsertKHR(GLenum source, GLenum type, GLuint id, GLenum severity, DOMString buf); + + void pushDebugGroupKHR(GLenum source, GLuint id, DOMString message); + void popDebugGroupKHR(); + + void objectLabelKHR(WebGLObject? object, DOMString label); + DOMString getObjectLabelKHR(WebGLObject? object); +}; // interface WEBGL_debug + +[NoInterfaceObject] +interface WebGLDebugMessage : Event { + readonly attribute GLenum source; + readonly attribute GLenum type; + readonly attribute GLuint id; + readonly attribute GLenum severity; + readonly attribute DOMString message; +}; // interface WebGLDebugMessage + ]]> + + +

On WEBGL_debug:

+ + + + + + + + Enables or disables the reporting of WebGLDebugMessage + events for the specified messages. + + + + + + + + + Inserts a custom message into the debug log. + + + + + + + Pushes a debug group on the stack. + + + + Closes a group opened with pushDebugGroupKHR. + + + + + + Assigns a label to a WebGLObject. + + + + + Retrieves the label associated with a WebGLObject. + + + + + + Register an event handler of a specific event type on the EventTarget. + + + + + + Removes an event listener from the EventTarget. + + + + + Dispatch an event to this EventTarget. + + +
+ +
+ Common initialization of the extension, with an example of debug message + reporting. + +
+ +
+ Skip a section of the code. + +
+ +
+ Only output a subsection of the code and disable some messages for the + entire application. + +
+ + + + Initial revision. + + +
diff --git a/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_dynamic_texture/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_dynamic_texture/extension.xml new file mode 100644 index 0000000000..c300876096 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_dynamic_texture/extension.xml @@ -0,0 +1,1324 @@ + + + + + WEBGL_dynamic_texture + + WebGL + working group (public_webgl 'at' khronos.org) + + + Mark Callow, HI Corporation + + Acorn Pooley, while at NVIDIA + + Ken Russell, Google + + David Sheets, Ashima Arts + + William Hennebois, STMicroelectronics + + Members of the WebGL working group + + + NN + + + + + + +

A dynamic texture is a texture whose image changes frequently. The + source of the stream of images may be a producer outside the control of + the WebGL application. The classic example is using a playing video to + texture geometry. Texturing with video is currently achieved by using the + TEXTURE2D target and passing an HTMLVideoElement + to texImage2D. It is difficult, if not impossible to + implement video texturing with zero-copy efficiency via this API and much + of the behavior is underspecified.

+ +

This extension provides a mechanism for streaming image frames from an + HTMLVideoElement, HTMLCanvasElement or + HTMLImageElement (having multiple frames such those created + from animated GIF, APNG and MNG files) into a WebGL texture. This is done + via a new texture target, TEXTURE_EXTERNAL_OES which can only + be specified as being the consumer of an image stream from a new + WDTStream object which provides commands for connecting to a + producer element.

+ +

There is no support for most of the functions that manipulate other + texture targets (e.g. you cannot use *[Tt]ex*Image*() + functions with TEXTURE_EXTERNAL_OES). Also, + TEXTURE_EXTERNAL_OES targets never have more than a single + level of detail. These restrictions enable dynamic texturing with maximum + efficiency. They remove the need for a copy of the image data manipulable + via the WebGL API and allow sources which have internal formats not + otherwise supported by WebGL, such as planar or interleaved YUV data, to + be WebGL texture target siblings.

+ +

The extension extends GLSL ES with a new + samplerExternalOES type and matching sampling functions that + provide a place for an implementation to inject code for sampling non-RGB + data when necessary without degrading performance for other texture + targets. Sampling a TEXTURE_EXTERNAL_OES via a sampler of + type samplerExternalOES always returns RGBA data. This allows + the implementation to decide the most efficient format to use whether it + be RGB or YUV data. If the underlying format was exposed, the application + would have to query the format in use and provide shaders to handle both + cases.

+ +

WDTStream provides a command for latching an + image frame into the consuming texture as its contents. This is equivalent + to copying the image into the texture but, due to the restrictions + outlined above a copy is not necessary. Most implementations will be able + to avoid one so this can be much faster than using + texImage2D. Latching can and should be implemented in a way + that allows the producer to run independently of 3D rendering.

+ +

Terminology note: throughout this specification + opaque black refers to the RGBA value (0,0,0,1).

+ + + + + +

An HTMLVideoElement, HTMLCanvasElement or + HTMLImageElement is the producer of the stream of images + being consumed by the dynamic texture rather than the unspecified + external producer referred to in the extension.

+
+ + +

A WDTStream is the deliverer of the stream of images + being consumed by the dynamic texture rather an + EGLStream.

+
+ + +

References to EGLImage and associated state are + deleted.

+
+ + +

WDTStream.connectSource is used to connect a texture + to the image stream from an HTML element instead of the command + eglStreamConsumerGLTextureNV or its equivalent + eglStreamConsumerGLTextureExternalKHR referenced by the + extension.

+
+ + +

WDTStream.acquireImage and + WDTStream.releaseImage are used to latch and unlatch + image frames instead of the commands + eglStreamConsumerAcquireNV or its equivalent + eglStreamConsumerAcquireKHR and + eglStreamConsumerReleaseNV or its equivalent + eglStreamConsumerReleaseKHR referenced by the + extension.

+
+ +

For ease of reading, this specification briefly describes the new + functions and enumerants of NV_EGL_stream_consumer_external. + Consult that extension for detailed documentation of their meaning and + behavior. Changes to the language of that extension are given later in this specification.

+
+ + + +

The createStream function is available. This command + is used for creating WDTStream objects for streaming + external data to texture objects. WDTStream objects have + a number of functions and attributes, the most important of which are + listed below.

+
+ + +

The functions ustnow, + getLastDrawingBufferPresentTime and + setDrawingBufferPresentTime are available. These commands + are used for accurate timing and specifying when the drawing buffer + should next be presented.

+
+ + +

The functions WDTStream.connectSource and + WDTStream.disconnect() are available for binding and + unbinding the stream to HTML{Canvas,Image,Video}Elements + as is the WDTStream.getSource function for querying the + current stream source.

+
+ + +

The functions WDTStream.acquireImage and + WDTStream.releaseImage are available. These commands are + used before 3D rendering to latch an image that will not change during + sampling and after to unlatch the image.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +[NoInterfaceObject] +interface WEBGL_dynamic_texture { + typedef double WDTNanoTime; + + const GLenum TEXTURE_EXTERNAL_OES = 0x8D65; + const GLenum SAMPLER_EXTERNAL_OES = 0x8D66; + const GLenum TEXTURE_BINDING_EXTERNAL_OES = 0x8D67; + const GLenum REQUIRED_TEXTURE_IMAGE_UNITS_OES = 0x8D68; + + WDTStream? createStream(); + + WDTNanoTime getLastDrawingBufferPresentTime(); + void setDrawingBufferPresentTime(WDTNanoTime pt); + WDTNanoTime ustnow(); +}; // interface WEBGL_dynamic_texture + + + + + +

On WEBGL_dynamic_texture:

+ + Creates and returns a + WDTStream object whose consumer is the + WebGLTexture bound to the TEXTURE_EXTERNAL_OES + target of the active texture unit at the time of the call. + + Returns the + duration of the shortest frame of the currently connected dynamic source + when playbackRate of the associated + MediaController is 1.0. + + + + Returns the UST + the last time the DrawingBuffer was presented to the screen, i.e., after + the last return of the script to the browser. + + Sets the UST at which the drawing + buffer should be presented after the script returns to the + browser. + + Returns the current + UST. +
+ + +

On WDTStream:

+ + Connects the StreamSource specified by + source as the producer for the stream. StreamSource + can be an HTMLCanvasElement, HTMLImageElement or + HTMLVideoElement. + + Returns the + HTML{Canvas,Image,Video}Element that is connected to the + WDTStream as the producer of images. + + Latches + an image frame. Sampling the WebGLTexture, that is the + WDTStream's consumer, will return values from the + latched image. The image data is guaranteed not to change as long as the + image is latched. WDTStream returns true when an + image is successfully latched, false otherwise. + + Releases the latched + image. Subsequent samping of the WebGLTexture, that was bound + to the TEXTURE_EXTERNAL_OES target of the active texture unit + when the WDTStream was created, will return opaque black. +
+ + + + +

The meaning and use of these tokens is exactly as described in NV_EGL_stream_consumer_external.

+ + TEXTURE_EXTERNAL_OES is accepted as a + target by the target parameter of + bindTexture() + + SAMPLER_EXTERNAL_OES can be returned in the + type field of the WebGLActiveInfo returned by + getActiveUniform() + + TEXTURE_BINDING_EXTERNAL_OES is accepted by + the pname parameter of + getParameter(). + + REQUIRED_TEXTURE_IMAGE_UNITS_OES is accepted + as the pname parameter of + GetTexParameter*() +
+ + + + + + + + No known IP claims. + + + + double + +

This type is used for nanosecond time stamps and time periods.

+
+ + + double frameTime; + + WDTNanoTime presentTime + +

This interface is used to obtain information about the latched + frame.

+
+ + + ... + +

This interface is used to manage the image stream between the + producer and consumer.

+
+
+ + + + +

In section 4.3 Supported GLSL Constructs, replace the + paragraph beginning A WebGL implementation must ... with the + following paragraph:

A WebGL implementation must only accept + shaders which conform to The OpenGL ES Shading Language, Version 1.00 [GLES20GLSL], + as extended by NV_EGL_stream_consumer_external, + and which do not exceed the minimum functionality mandated in Sections 4 + and 5 of Appendix A. In particular, a shader referencing state variables + or commands that are available in other versions of GLSL (such as that + found in versions of OpenGL for the desktop), must not be allowed to + load.

+ +

In section 5.14 The WebGL Context , add the following to + the WebGLRenderingContext interface. Note that until such time as this + extension enters core WebGL the tokens and commands mentioned below will + be located on the WebGL_dynamic_texture extension interface shown + above.

  • In the list following /* GetPName */:
    TEXTURE_BINDING_EXTERNAL = 0x8D67;
  • In + the list following /* TextureParameterName */:
    REQUIRED_TEXTURE_IMAGE_UNITS = 0x8D68;
  • In + the list following /* TextureTarget */:
    TEXTURE_EXTERNAL = 0x8D65;
  • In the list + following /* Uniform Types */:
    SAMPLER_EXTERNAL = 0x8D66;
  • In the + alphabetical list of commands add the following :
    WDTStream? createStream(); 
    +WDTNanoTime getLastDrawingBufferPresentTime();
    +void setDrawingBufferPresentationTime(WDTNanoTime pt);
    +WDTNanoTime ustnow();
  • + +

    In section 5.14.3 Setting and getting state, add the + following to the table under getParameter.

    + +
    +
    +
    + + + + + + +
    TEXTURE_BINDING_EXTERNALint
    +
    + +
    + +

    + +

    In section 5.14.8Texture objects, add the following to the + table under getTexParameter.

    + +
    +
    +
    + + + + + + +
    REQUIRED_TEXTURE_IMAGE_UNITSint
    +
    + +
    + +

    + +

    Add a new section 5.14.8.1 External textures.

    + +
    +

    5.14.8.1 External textures

    + +

    External textures are texture objects which receive image data from + outside of the GL. They enable texturing with rapidly changing image + data, e.g, a video, at low overhead and are used in conjunction with + WDTStream + objects to create dynamic textures. See Dynamic Textures for more information. An + external texture object is created by binding an unused + WebGLTexture to the target + TEXTURE_EXTERNAL_OES. Note that only unused WebGLTextures + or those previously used as external textures can be bound to + TEXTURE_EXTERNAL_OES. Binding a WebGLTexture + previously used with a different target or binding a WebGLTexture + previously used with TEXTURE_EXTERNAL_OES to a different target + generates a GL_INVALID_OPERATION error as documented in GL_NV_EGL_stream_consumer_external.txt.

    +
    + +

    In section 5.14.10 Uniforms and attributes, add the + following to the table under getUniform.

    + +
    +
    +
    + + + + + + +
    samplerExternallong
    +
    + +
    + +

    + +

    Add a new section 5.16 Dynamic Textures

    + +
    +

    5.16 Dynamic Textures

    + +

    Dynamic textures are texture objects that display a stream of images + coming from a producer outside the WebGL application, the + classic example ibeing using a playing video to texture geometry from. A + WDTStream object mediates between the producer and the + consumer, the texture consuming the images.

    + +

    The command

    WDTStream? createStream();
    creates + a WGTStream object whose consumer is the + texture object currently bound to the TEXTURE_EXTERNAL_OES + target in the active texture unit. The initial state of the + newly created stream will be STREAM_CONNECTING. If the + texture object is already the consumer of a stream, createStream + generates an INVALID_OPERATION error and returns null. When a texture + object that is the consumer of a stream is deleted, the stream is also + deleted.

    + +

    In order to maintain synchronization with other tracks of an + HTMLVideoElement's media group, most notably audio, the application must + be able to measure how long it takes to draw the scene containing the + dynamic texture and how long it takes the browser to compose and present + the canvas.

    + +

    The command

    WDTNanoTime ustnow();
    + returns the unadjusted system time, a monotonically increasing + clock, in units of nanoseconds. The zero time of this clock is not + important. It could start at system boot, browser start or navigation + start.

    + +

    The command

    WDTNanoTime getLastDrawingBufferPresentTime();
    + returns the UST the last time the composited page containing the drawing + buffer's content was presented to the user.

    + +

    To ensure accurate synchronization of the textured image with other + tracks of an HTMLVideoElement's media group, the application must be + able to specify the presentation time of the drawing + buffer.

    + +

    The command

    void setDrawingBufferPresentTime(WDTNanoTime pt);
    + tells the browser the UST when the drawing buffer must be presented + after the application returns to the browser. The browser must present + the composited page containing the canvas to the user at the specified + UST. If the specified time has already passed when control returns, the + browser should present the drawing buffer as soon as possible. Should an + explicit drawing buffer present function be added to WebGL, the + presentation time will become one of its parameters.

    + +

    5.16.1 WDTStreamFrameInfo

    + +

    The WDTStreamFrameInfo interface represents information + about a frame acquired from a WDTStream.

    + +
    [NoInterfaceObject] interface WDTStreamFrameInfo {
    +  readonly attribute double frameTime;
    +  readonly attribute WDTNanoTime presentTime;
    +};
    + +

    5.16.1.1 Attributes

    + +

    The following attributes are available:

    + +
    +
    frameTime of type + double
    + +
    The time of the frame relative to the start of the producer's + MediaController timeline in seconds. Equivalent to + currentTime in an HTMLMediaElement.
    + +
    presentTime of type + WDTNanoTime
    + +
    The time the frame must be presented in order to sync with other + tracks in the element's mediagroup, particularly audio.
    +
    + +

    5.16.2 WDTStream

    + +

    The WDTStream interface represents a stream object used + for controlling an image stream being fed to a dynamic texture + object.

    + +
    [NoInterfaceObject] interface WDTStream {
    +  typedef (HTMLCanvasElement or
    +           HTMLImageElement or
    +           HTMLVideoElement) StreamSource;
    +
    +  const GLenum STREAM_CONNECTING = 0;
    +  const GLenum STREAM_EMPTY = 1;
    +  const GLenum STREAM_NEW_FRAME_AVAILABLE = 2;
    +  const GLenum STREAM_OLD_FRAME_AVAILABLE = 3;
    +  const GLenum STREAM_DISCONNECTED = 4;
    +
    +  readonly attribute WebGLTexture consumer;
    +
    +  readonly attribute WDTStreamFrameInfo consumerFrame;
    +  readonly attribute WDTStreamFrameInfo producerFrame;
    +
    +  readonly attribute WDTNanoTime minFrameDuration;
    +
    +  readonly attribute GLenum state;  
    +
    +  attribute WDTNanotime acquireTimeout;
    +  attribute WDTNanoTime consumerLatency;
    +
    +  void connectSource(StreamSource source);
    +  void disconnect();
    +  StreamSource? getSource();
    +
    +  boolean acquireImage();
    +  void releaseImage();
    +};
    + +

    5.16.2.1 Attributes

    + +
    +
    consumer of type + WebGLTexture
    + +
    The WebGLTexture that was bound to the + TEXTURE_EXTERNAL_OES target of the active texture unit at the time the + stream was created. Sampling this texture in a shader will return + samples from the image latched by acquireImage.
    + +
    consumerFrame of type + WDTStreamFrameInfo
    + +
    Information about the last frame latched by the consumer via + acquireImage.
    + +
    producerFrame of type + WDTStreamFrameInfo
    + +
    Information about the frame most recently inserted into the stream + by the producer.
    + +
    minFrameDuration of type + WDTNanoTime
    + +
    The minimum duration of a frame in the producer. Ideally this + should be an attribute on HTMLVideoElement. Most video container + formats have metadata that can be used to calculate this. It can only + reflect the actual value once the stream is connected to a producer + and the producer's READY_STATE is at least + HAVE_METADATA. The initial value is + Number.MAX_VALUE (i.e., infinity). Applications need this + information to determine how complex their drawing can be while + maintaining the video's frame rate.
    + +
    state of type + GLenum
    + +
    The state of the stream. Possible states are + STREAM_CONNECTING, STREAM_EMPTY, + STREAM_NEW_FRAME_AVAILABLE, + STREAM_OLD_FRAME_AVAILABLE and + STREAM_DISCONNECTED.
    + +
    consumerLatency of type + WDTNanoTime
    + +
    The time between the application latching an image from the stream + and the drawing buffer being presented. This is the time by which the + producer should delay playback of any synchronized tracks such as + audio. The initial value is an implementation-dependent constant + value, possibly zero. This should only be changed when the video is + paused as producers will not be able to change the playback delay on, + e.g. audio, without glitches. It may only be possible to set this + prior to starting playback. Implementation experience is needed.
    + +
    acquireTimeout of type + WDTNanoTime
    + +
    The maximum time to block in acquireImage waiting for + a new frame. The initial value is 0.
    +
    + +

    5.16.2.2 commands

    + +

    The command

    void connectSource(StreamSource source);
    connects + the stream to the specified StreamSource element. If + StreamSource is an HTMLMediaElement, the + element's autoPlay attribute is set to false + to prevent playback starting before the application is ready. If + state is not STREAM_CONNECTING, an + InvalidStateError exception is thrown. After connecting + state becomes STREAM_EMPTY.

    + +

    The command

    void disconnect();
    disconnects + the stream from its source. Subsequent sampling of the associated + texture will return opaque black. state is set to + STREAM_DISCONNECTED.

    + +

    The command

    StreamSource? getSource();
    returns + the HTML element that is the producer for this stream.

    + +

    The command

    boolean acquireImage();
    causes + consumer to latch the most recent image frame from the + currently connected source. The rules for selecting the image to be + latched mirror those for selecting the image drawn by the + drawImage method of CanvasRenderingContext2D.

    + +

    For HTMLVideoElements, it latches the frame of video that will + correspond to the current + playback position of the audio channel, as defined in the HTML Living + Standard, at least latency nanoseconds from the call + returning, where latency is the consumerLatency + attribute of the stream. If the element's readyState + attribute is either HAVE_NOTHING or + HAVE_METADATA, the command returns without latching + anything and the texture remains incomplete. The effective size + of the texture will be the element's intrinsic + width and height.

    + +

    For animated HTMLImageElements it will latch the first frame of the + animation. The effective size of the texture will be the element's + intrinsic width and height.

    + +

    For HTMLCanvasElements it will latch the current content of the + canvas as would be returned by a call to toDataURL.

    + +

    acquireImage will block until either the timeout + specified by acquireTimeout expires or state is neither + STREAM_EMPTY nor STREAM_OLD_FRAME_AVAILABLE, + whichever comes first.

    + +

    The model is a stream of images between the producer and the + WebGLTexture consumer. acquireImage latches the most recent + image. If the producer has not inserted any new images since the last + call to acquireImage then acquireImage will + latch the same image it latched last time it was called. If the producer + has inserted one new image since the last call then + acquireImage will "latch" the newly inserted image. If the + producer has inserted more than one new image since the last call then + all but the most recently inserted image are discarded and + acquireImage will "latch" the most recently inserted image. + For HTMLVideoElements, the application can use the value of + the frameTime attribute in the consumerFrame + attribute to identify which image frame was actually latched.

    + +

    acquireImage returns true if an image has + been acquired, and false if the timeout fired. It throws + the following exceptions:

      +
    • InvalidStateError, if no dynamic source is + connected to the stream.
    • +
    XXX Complete after resolving issue 22. XXX

    + +

    The command

    void releaseImage();
    releases + the latched image. releaseImage will prevent the producer + from re-using and/or modifying the image until all preceding WebGL + commands that use the image as a texture have completed. If + acquireImage is called twice without an intervening call to + releaseImage then releaseImage is implicitly + called at the start of acquireImage.

    + +

    After successfully calling releaseImage the texture + becomes "incomplete".

    + +

    If releaseImage is called twice without a successful + intervening call to acquireImage, or called with no + previous call to acquireImage, then the call does nothing + and the texture remains in "incomplete" state. This is not an error

    + +

    It throws the following exceptions:

      +
    • InvalidStateError, if no dynamic source is + connected to the stream.
    • +
    XXX Complete after resolving issue 22. XXX

    + +

    To sample a dynamic texture, the texture object must be bound to the + target TEXTURE_EXTERNAL_OES and the sampler uniform must be + of type samplerExternal. If the texture object bound to + TEXTURE_EXTERNAL_OES is not bound to a dynamic source then + the texture is "incomplete" and the sampler will return opaque + black.

    +
    + +

    At the end of section 6 Differences between + WebGL and OpenGL ES, add the following new sections. Note that + differences are considered with respect to the OpenGL ES 2.0 specification + as extended by NV_EGL_stream_consumer_external + in the absence of OES_EGL_image_external.

    + +
    +

    6.25 External Texture Support

    + +

    WebGL supports external textures but provides its own + WDTStream interface instead of EGLStream. + WDTStream connects an HTMLCanvasElement, HTMLImageElement + or HTMLVideoElement as the producer for an external texture. Specific + language changes follow.

    + +

    Section 3.7.14.1 External Textures as Stream Consumers + is replaced with the following.

    +

    To use a TEXTURE_EXTERNAL_OES texture as the consumer of images + from a dynamic HTML element, bind the texture to the active texture + unit, and call createStream to create a + WDTStream. Use the stream's connectSource + command to connect the stream to the desired producer HTML element. + The width, height, format, type, internalformat, border and image + data of the TEXTURE_EXTERNAL_OES texture will all be determined + based on the specified dynamic HTML element. If the element does not + have any source or the source is not yet loaded, the width, height + & border will be zero, the format and internal format will be + undefined. Once the element's source has been loaded and one (or + more) images have been decoded these attributes are determined + (internally by the implementation), but they are not exposed to the + WebGL application and there is no way to query their values.

    + +

    The TEXTURE_EXTERNAL_OES texture remains the consumer of the + dynamic HTML element's image frames until the first of any of these + events occur:

      +
    1. The texture is associated with a different dynamic HTML + element (with a later call to + WDTStream.connectSource).
    2. + +
    3. The texture is deleted in a call to + deleteTextures.
    4. +

    + +

    Sampling an external texture which is not connected to a dynamic + HTML element will return opaque black. Sampling an external texture + which is connected to a dynamic HTML element will return opaque + black unless an image frame has been 'latched' into the texture by a + successful call to WDTStream.acquireImage.

    +

    +
    +
    + + + + + + + + + + +

    XXX IGNORE THIS SAMPLE CODE. IT HAS NOT YET BEEN UPDATED TO MATCH THE + NEW SPEC TEXT. XXX

    + +
    This a fragment shader that samples a video texture. + Note that the surrounding <script> tag is not + essential; it is merely one way to include shader text in an HTML + file.
    <script id="fshader" type="x-shader/x-fragment">
    +  #extension OES_EGL_image_external : enable 
    +  precision mediump float;
    +
    +  uniform samplerExternalOES videoSampler;
    +
    +  varying float v_Dot;
    +  varying vec2 v_texCoord;
    +
    +  void main()
    +  {
    +    vec2 texCoord = vec2(v_texCoord.s, 1.0 - v_texCoord.t);
    +    vec4 color = texture2D(videoSampler, texCoord);
    +    color += vec4(0.1, 0.1, 0.1, 1);
    +    gl_FragColor = vec4(color.xyz * v_Dot, color.a);
    +  }
    +</script>
    + +
    This shows fragments from an application that renders + a spinning cube textured with a live video.
    <html>
    +<script type="text/javascript">
    +
    +  ///////////////////////////////////////////////////////////////////////
    +  // Create a video texture and bind a source to it.
    +  ///////////////////////////////////////////////////////////////////////
    +
    +  // Array of files currently loading
    +  g_loadingFiles = [];
    +
    +  // Clears all the files currently loading.
    +  // This is used to handle context lost events.
    +  function clearLoadingFiles() {
    +    for (var ii = 0; ii < g_loadingFiles.length; ++ii) {
    +      g_loadingFiles[ii].onload = undefined;
    +    }
    +    g_loadingFiles = [];
    +  }
    +
    +  //
    +  // createVideoTexture
    +  //
    +  // Load video from the passed HTMLVideoElement id, bind it to a new WebGLTexture object
    +  // and return the WebGLTexture.
    +  //
    +  // Is there a constructor for an HTMLVideoElement so you can do like "new Image()?"
    +  //
    +  function createVideoTexture(ctx, videoId)
    +  {
    +    var texture = ctx.createTexture();
    +    var video = document.getElementById(videoId);
    +    g_loadingFiles.push(video);
    +    video.onload = function() { doBindVideo(ctx, video, texture) }
    +    return texture;
    +  }
    +
    +  function doBindVideo(ctx, video, texture)
    +  {
    +    g_loadingFiles.splice(g_loadingFiles.indexOf(image), 1);
    +    ctx.bindTexture(ctx.TEXTURE_EXTERNAL_OES, texture);
    +    ctx.dynamicTextureSetSource(video);
    +    // These are the default values of these properties so the following
    +    // 4 lines are not necessary.
    +    ctx.texParameteri(ctx.TEXTURE_EXTERNAL_OES, ctx.TEXTURE_MAG_FILTER, ctx.LINEAR);
    +    ctx.texParameteri(ctx.TEXTURE_EXTERNAL_OES, ctx.TEXTURE_MIN_FILTER, ctx.LINEAR);
    +    ctx.texParameteri(ctx.TEXTURE_EXTERNAL_OES, ctx.TEXTURE_WRAP_S, ctx.CLAMP_TO_EDGE);
    +    ctx.texParameteri(ctx.TEXTURE_EXTERNAL_OES, ctx.TEXTURE_WRAP_T, ctx.CLAMP_TO_EDGE);
    +    ctx.bindTexture(ctx.TEXTURE_EXTERNAL_OES, null);
    +  }
    +
    +  ///////////////////////////////////////////////////////////////////////
    +  // Initialize the application.
    +  ///////////////////////////////////////////////////////////////////////
    +
    +  var g = {};
    +  var videoTexture;
    +
    +  function init()
    +  {
    +    // Initialize
    +    var gl = initWebGL(
    +        // The id of the Canvas Element
    +        "example");
    +    if (!gl) {
    +      return;
    +    }
    +    var program = simpleSetup(
    +        gl,
    +        // The ids of the vertex and fragment shaders
    +        "vshader", "fshader",
    +        // The vertex attribute names used by the shaders.
    +        // The order they appear here corresponds to their index
    +        // used later.
    +        [ "vNormal", "vColor", "vPosition"],
    +        // The clear color and depth values
    +        [ 0, 0, 0.5, 1 ], 10000);
    +
    +    // Set some uniform variables for the shaders
    +    gl.uniform3f(gl.getUniformLocation(program, "lightDir"), 0, 0, 1);
    +    // Use the default texture unit 0 for the video
    +    gl.uniform1i(gl.getUniformLocation(program, "samplerExternal"), 0);
    +
    +    // Create a box. On return 'gl' contains a 'box' property with
    +    // the BufferObjects containing the arrays for vertices,
    +    // normals, texture coords, and indices.
    +    g.box = makeBox(gl);
    +
    +    // Load an image to use. Returns a WebGLTexture object
    +    videoTexture = createVideoTexture(gl, "video");
    +    // Bind the video texture
    +    gl.bindTexture(gl.TEXTURE_EXTERNAL_OES, videoTexture);
    +
    +    // Create some matrices to use later and save their locations in the shaders
    +    g.mvMatrix = new J3DIMatrix4();
    +    g.u_normalMatrixLoc = gl.getUniformLocation(program, "u_normalMatrix");
    +    g.normalMatrix = new J3DIMatrix4();
    +    g.u_modelViewProjMatrixLoc =
    +            gl.getUniformLocation(program, "u_modelViewProjMatrix");
    +    g.mvpMatrix = new J3DIMatrix4();
    +
    +    // Enable all of the vertex attribute arrays.
    +    gl.enableVertexAttribArray(0);
    +    gl.enableVertexAttribArray(1);
    +    gl.enableVertexAttribArray(2);
    +
    +    // Set up all the vertex attributes for vertices, normals and texCoords
    +    gl.bindBuffer(gl.ARRAY_BUFFER, g.box.vertexObject);
    +    gl.vertexAttribPointer(2, 3, gl.FLOAT, false, 0, 0);
    +
    +    gl.bindBuffer(gl.ARRAY_BUFFER, g.box.normalObject);
    +    gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
    +
    +    gl.bindBuffer(gl.ARRAY_BUFFER, g.box.texCoordObject);
    +    gl.vertexAttribPointer(1, 2, gl.FLOAT, false, 0, 0);
    +
    +    // Bind the index array
    +    gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, g.box.indexObject);
    +
    +    return gl;
    +  }
    +
    +  // ...
    +
    +  ///////////////////////////////////////////////////////////////////////
    +  // Draw a frame
    +  ///////////////////////////////////////////////////////////////////////
    +  function draw(gl)
    +  {
    +    // Make sure the canvas is sized correctly.
    +    reshape(gl);
    +
    +    // Clear the canvas
    +    gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
    +
    +    // Make a model/view matrix.
    +    g.mvMatrix.makeIdentity();
    +    g.mvMatrix.rotate(20, 1,0,0);
    +    g.mvMatrix.rotate(currentAngle, 0,1,0);
    +
    +    // Construct the normal matrix from the model-view matrix and pass it in
    +    g.normalMatrix.load(g.mvMatrix);
    +    g.normalMatrix.invert();
    +    g.normalMatrix.transpose();
    +    g.normalMatrix.setUniform(gl, g.u_normalMatrixLoc, false);
    +
    +    // Construct the model-view * projection matrix and pass it in
    +    g.mvpMatrix.load(g.perspectiveMatrix);
    +    g.mvpMatrix.multiply(g.mvMatrix);
    +    g.mvpMatrix.setUniform(gl, g.u_modelViewProjMatrixLoc, false);
    +
    +    // Acquire the latest video image
    +    gl.dynamicTextureAcquireImage();
    +
    +    // Draw the cube
    +    gl.drawElements(gl.TRIANGLES, g.box.numIndices, gl.UNSIGNED_BYTE, 0);
    +
    +    // Allow updates to the image again
    +    gl.dynamicTextureReleaseImage();
    +
    +    // Show the framerate
    +    framerate.snapshot();
    +
    +    currentAngle += incAngle;
    +    if (currentAngle > 360)
    +      currentAngle -= 360;
    +  }
    +</script>
    +
    +<body onload="start()">
    +<video id="video" src="resources/video.ogv" autoplay="true" style="visibility: hidden">
    +</video>
    +<canvas id="example">
    +    If you're seeing this your web browser doesn't support the &lt;canvas&gt; element. Ouch!
    +</canvas>
    +<div id="framerate"></div>
    +</body>
    +
    +</html>
    + + +
    + + + + +

    Statistical fingerprinting is a privacy concern where a malicious web + site may determine whether a user has visited a third-party web site by + measuring the timing of cache hits and misses of resources in the + third-party web site. Though the ustnow method of this extension returns + time data to a greater accuracy than before, it does not make this privacy + concern significantly worse than it was already.

    +
    + + +
      +
    1. +

      What do applications need to be able to determine about the + source?

      + +

      RESOLVED. Two things

        +
      • the minimum inter-frame interval. This is needed to determine + a rendering budget.
      • + +
      • whether a frame has been missed.
      • +

      +
    2. + +
    3. +

      Neither the minimum inter-frame interval nor frame rate is exposed + by HTMLMediaElements. How can it be determined?

      + +

      RESOLVED. Although there have been requests to expose the frame + rate, in connection with non-linear editing and frame + accurate seeks to SMPTE time-code positions, there has been no + resolution. Therefore the stream object interface will have to provide + a query for the minimum inter-frame interval. It can easily be derived + from the frame-rate of fixed-rate videos or from information that is + commonly stored in the container metadata for variable-rate formats. + For example the Matroska and + WebM + containers provide a FrameRate item, albeit listed as "information + only." Note that there is a tracking + bug for this feature at WHATWG/W3C where browser vendors can + express interest in implementing it.

      +
    4. + +
    5. +

      How can the application determine whether it has missed a + frame?

      + +

      RESOLVED. If a frame's presentTime is earlier than + ustnow() + consumerLatency then the application will have to drop the + frame and acquire the next one.

      +
    6. + +
    7. +

      Why not use the TEXTURE2D target and + texImage2D?

      + +

      RESOLVED. Use a new texture target and new commands. A new texture + target makes it easy to specify, implement and conformance test the + restrictions that enable a zero-copy implementation of dynamic + textures as described in the Overview. Given + that one of those restriction is not allowing modification of the + texture data, which is normally done via texImage2D using + a new command will make the usage model clearer.

      +
    8. + +
    9. +

      Why not use sampler2D uniforms?

      + +

      RESOLVED. Use a new sampler type. Many zero-copy implementations + will need special shader code when sampling YUV format dynamic + textures. Implementations may choose to (a) re-compile at run time or + (b) inject conditional code which branches at run time according to + the format of the texture bound to TEXTURE_EXTERNAL_OES in the texture + unit to which the sampler variable is set. Without a new sampler type, + such conditional code would have to be injected for every sampler + fetch increasing the size of the shader and slowing sampling of other + texture targets. In order to preserve the possibility of using + approach (b), a new sampler type will be used.

      +
    10. + +
    11. +

      Should the API be implemented as methods on the texture object or + as commands taking a texture object as a parameter?

      + +

      RESOLVED. Neither. The WebGLTexture object represents + an OpenGL texture name. No object is created until the name is bound + to a texture target. Therefore the new commands should operate on a + the currently bound texture object.

      +
    12. + +
    13. +

      Should dynamic textures be a new texture type or can + WebGLTexture be reused?

      + +

      RESOLVED. WebGLTexture can be reused. As noted in the + previous issue a WebGLTexture represents a texture name + and is a handle to multiple texture types. The type of texture is set + according to the target to which the name is initially bound.

      +
    14. + +
    15. +

      Should this extension use direct texture access commands or should + it use texParameter and getTexParameter?

      + +

      RESOLVED. Use the latter. There is no directly accessible texture + object to which such commands can be added. Changing the API to have + such objects is outside the scope of this extension.

      +
    16. + +
    17. +

      Should we re-use #extension + NV_EGL_stream_consumer_external, create our own GLSL extension + name or have both this and a WebGL-specific name?

      + +

      RESOLVED. Any of WEBGL_dynamic_texture or the aliases + GL_NV_EGL_stream_consumer_external or + GL_OES_EGL_image_external can be used to enable this + extension's features in the shader. This permits the same shader to be + used with both WebGL and OpenGL ES 2.0.

      +
    18. + +
    19. +

      What should happen when an object of type + HTMLCanvasElement, HTMLImageElement or + HTMLVideoElementis passed to the existing + tex*Image2D commands?

      + +

      UNRESOLVED. This behavior is outside the scope of this extension + but handling of these objects is very underspecified in the WebGL + specification and needs to be clarified. Suggestion: for single-frame + HTMLImageElement set the texture image to the HTMLImageElement; for an + animated HTMLImageElement set the texture image to the first frame of + the animation; for an HTMLCanvasElement, set the texture image to the + current canvas image that would be returned by toDataURL; for an + HTMLVideoElement, set the texture image to the current frame. In all + cases, the texture image does not change until a subsequent call to a + tex*Image2D command. Is this a change from the way + any of these elements are handled today?

      +
    20. + +
    21. +

      Should acquireImage and releaseImage + generate errors if called when the stream is already in the state to + be set or ignore those extra calls?

      + +

      RESOLVED. They should not generate errors. + acquireImage will be defined to implicitly call + releaseImage if there has not been an intervening + call.

      +
    22. + +
    23. +

      This API is implementable on any platform at varying levels of + efficiency. Should it therefore move directly to core rather than + being an extension?

      + +

      RESOLVED. No, unless doing so would result in implementations + appearing sooner.

      +
    24. + +
    25. +

      Should this extension support HTMLImageElement?

      + +

      UNRESOLVED. The HTML 5 Living Standard provides virtually no rules + for handling of animated HTMLImageElements and specifically no + definition of a current frame. In order to texture the animations from + such elements, this specification will need to provide rules. If we + are tracking the behavior of CanvasRenderingContext2D.drawImage + then there is no point supporting HTMLImageElement as the + specification says to draw the first frame of animated + HTMLImageElements.

      +
    26. + +
    27. +

      Should this extension extend HTMLMediaElement with an + acquireImage/releaseImage API?

      + +

      RESOLVED. No. The API would have no purpose and would require + HTML{Video,Canvas,Image}Element becoming aware of WebGLTexture or, + even worse, aware of texture binding within WebGL. No similar API was + exposed to support CanvasRenderingContext2D.drawImage. The HTMLElement + is simply passed to drawImage.

      +
    28. + +
    29. +

      Should DOMHighResolutionTime + and window.performance.now() from the W3C High-Resolution + Time draft be used for the timestamps and as UST?

      + +

      RESOLVED. No. The specified unit is milliseconds and, although the + preferred accuracy is microseconds, the required accuracy is only + milliseconds. At millisecond accuracy it is not possible to + distinguish between 29.97 fps and 30 fps which means sound for a 29.97 + fps video will be ~3.5 seconds out of sync after 1 hour. Also + fractional double values must be used to represent times + < 1 ms with the attendant issues of variable time steps as the + exponent changes. Feedback has been provided. Hopefully the draft + specification will be updated.

      +
    30. + +
    31. +

      Should UST 0 be system start-up, browser start-up or navigationStart + as defined in the W3C Navigation + Timing proposed recommendation?

      + +

      RESOLVED. If DOMHighResolutionTime is used, then + navigationStart makes sense otherwise it can be left to the + implementation.

      +
    32. + +
    33. +

      Should UST wrap rather then increment the exponent, so as to + maintain precision?

      + +

      UNRESOLVED. The exponent will need to be incremented after 2**53 + nanoseconds (~ 41 days). UST could wrap to 0 after that or just keep + counting. If it keeps counting, the precision will be halved so each + tick will be 2 nanoseconds. The next precision change will occur after + a further ~82 days.

      +
    34. + +
    35. +

      Should WDTStream.state be a proper idl enum?

      + +

      UNRESOLVED.

      +
    36. + +
    37. +

      Does the application need to be able to find out if it has missed a + potential renderAnimationFrame callback, i.e, it has taken longer than + the browser's natural rAF period? If so, how?

      + +

      UNRESOLVED.

      +
    38. + +
    39. +

      What are the base and units of a renderbuffer's present time on + iOS?

      + +

      UNRESOLVED.

      +
    40. + +
    41. +

      CanvasRenderingContext2D.drawImage requires an + InvalidStateError be thrown if either width or height of the source + canvas is 0? Do we need to do mirror this?

      + +

      RESOLVED. Treating this situation as failing to acquire an image + and so returning opaque black when sampled provides more consistent + handling across StreamSource types and is more consistent with OpenGL + ES.

      +
    42. + +
    43. +

      Should exceptions be used for errors on WDTStreams or should + GL-style error handling be used?

      + +

      UNRESOLVED.

      +
    44. +
    +
    + + + + Initial revision. + + + + Fixed incorrect dependency and minor naming inconsistencies. + Fixed missing parameter error and moved the location of the bindTexture + call in the sample code. + + + + Significant rewrite that bases the extension on + GL_NV_EGL_stream_consumer_external and which uses semantics and + concepts" from EGLStream rather than EGLImage. + + + + Change #extension aliases to match bug fixes in mirrored + extensions. + + + + Update contributors list. Reorder issues to put all texture + object related issues together and modify them for consistency. Fix + small typos. + + + + Major revamp. Expose stream objects and provide commands for + measuring time to render and present the drawing buffer. + + + + Added NoInterfaceObject extended attribute. + + + + Used updated XSL to properly show interfaces add by this + extension under New Types. + + + + Updated link to GL_NV_EGL_stream_consumer_external + extension. + + +
    diff --git a/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_subarray_uploads/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_subarray_uploads/extension.xml new file mode 100644 index 0000000000..995e0dbe5d --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_subarray_uploads/extension.xml @@ -0,0 +1,91 @@ + + + WEBGL_subarray_uploads + + WebGL + working group (public_webgl 'at' khronos.org) + + + Jeff Gilbert (jgilbert 'at' mozilla.com) + + + k + + + + + + + + + Though no-copy slicing of TypedArrays is already possible, it can still generate + considerable garbage, incuring GC load. Allowing for specification of subarray + offset and size can eliminate this source of garbage. + + + + + +[NoInterfaceObject] +interface WEBGL_subarray_uploads { + void bufferSubData(GLenum target, GLsizeiptr bufferOffset, GLsizeiptr subarrayOffset, + GLsizeiptr subarraySize, (ArrayBuffer or SharedArrayBuffer) data); + + void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLenum sizedFormat, + GLsizeiptr subarrayOffset, GLsizeiptr subarraySize, + (ArrayBuffer or SharedArrayBuffer) data); + + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLenum format, GLenum type, + GLsizeiptr subarrayOffset, GLsizeiptr subarraySize, + (ArrayBuffer or SharedArrayBuffer) data); +}; + + + + + + + + + + Upload data from a subarray of an ArrayBuffer or SharedArrayBuffer. + + + + + + + + + + + + + + Upload data from a subarray of an ArrayBuffer or SharedArrayBuffer. + + + + + + + + + + + + + + + Upload data from a subarray of an ArrayBuffer or SharedArrayBuffer. + + + + + + Initial revision + + + diff --git a/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_texture_multisample/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_texture_multisample/extension.xml new file mode 100644 index 0000000000..e1230d82e6 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_texture_multisample/extension.xml @@ -0,0 +1,48 @@ + + + + + WEBGL_texture_multisample + + WebGL + working group (public_webgl 'at' khronos.org) + + + Jeff Gilbert, Mozilla + + + XYZ + + + + + + + + + Adds texStorage2DMultisample() and the TEXTURE_2D_MULTISAMPLE + target from OpenGL ES 3.1. + + + + + + [NoInterfaceObject] + interface WEBGL_texture_storage_multisample { + const GLenum TEXTURE_2D_MULTISAMPLE = 0x9100; + + void texStorage2DMultisample(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLboolean fixedsamplelocations); + }; + + + + + Initial revision. + + + diff --git a/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_texture_source_iframe/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_texture_source_iframe/extension.xml new file mode 100644 index 0000000000..1484a49ad1 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_texture_source_iframe/extension.xml @@ -0,0 +1,113 @@ + + + + + + WEBGL_texture_source_iframe + WebGL + working group (public_webgl 'at' khronos.org) + + Zhenyao Mo, Google Inc + Members of the WebGL working group + + NN + + + + + +

    This extension enables WebGL implementations to bind an HTMLIFrameElement object as the data source + to a texture. While bound, the extension provides an API to allow applications to request the latest + iframe rendering results to be blitted to the texture. The extension also provides an API to allow + applications to transform and forward related user input events from WebGL canvas to the bound iframe, + thus enabling the bound iframe to be interative inside a WebGL scene.

    +

    Due to security concerns, currently this extension only supports same origin iframes. This + limitaion may be lifted in the future.

    +
    + bindTextureSource(GLenum target, HTMLIFrameElement iframe); + Promise requestFrame(GLenum target); + void setEventForwarding(function(Event)); +}; + ]]> + + + + +

    + This function connects an iframe to the texture currently bound to target and returns a promise + that will be fulfilled once the iframe is rendered and ready to be blitted to the texture. If the iframe + is null, any existing binding between the texture and an iframe is broken. + If there are any errors, generate the GL error synchronously and the returned promise is + rejected + with an InvalidStateError. +

    +

    + Once the function returns successfully, the texture is defined as following: its effective + internal format becomes RGBA8; its width and height becomes iframe element's + width and height. +

    +

    Error cases are listed below: +

      +
    • target must be TEXTURE_2D; otherwise an INVALID_ENUM + error is generated.
    • +
    • If no texture is bound to the target, an INVALID_OPERATION is + generated.
    • +
    • If iframe is not the same origin, an INVALID_OPERATION is + generated.
    • +
    +

    +

    Note this function returns a promise asynchronously because wiring an iframe rendering results + to a WebGL texture could take multiple frames. The iframe could be invisible, therefore not part of + the rendering pipeline and needs to be inserted into it. The iframe could also be in a seperate + process from the one where WebGL is in, although this is likely not the case right now because we + currently limit iframe to be same origin only.

    +
    + + +

    + This function instructs implementations to update the texture with the latest iframe rendering + results. The function returns a promise that will be fulfilled when the iframe rendering results from the same animation frame + when this function is called has been blitted to the texture. +

    +

    + If an application uses requestAnimationFrame, implementations must guarantee once + this function is called, the iframe rendering results from the same frame has been blitted to the + texture when entering the next animation frame. Therefore, it is not necessary for an + application to depend on the state of the returned promise. The promise is for applications that do not + use requestAnimationFrame. +

    +

    + Once this function called, it is not recommended to read from the texture until the returns promise is + fulfilled. The content of the texture during this period is undefined. +

    +
    + + +

    + This function allows an application to define an event forwarding + function that decides whether to forward user input events received on + the WebGL canvas to the iframe. If yes, this function needs to transform + event locations and displacements as needed. With this, an application + can allow users to interact the iframe rendered inside the WebGL scene. +

    +

    + The event forwarding function takes an event as input, and output a + bool. If returning true, the event is forwarded to the iframe and event + data might have been modified to transform the event from WebGL canvas + coordinates to iframe coordinates. +

    +

    + TODO(zmo@chromium.org): need some help how to define the forwarding function + signature. +

    +
    +
    + + + Initial revision. + + +
    diff --git a/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_video_texture/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_video_texture/extension.xml new file mode 100644 index 0000000000..764e6044af --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/proposals/WEBGL_video_texture/extension.xml @@ -0,0 +1,139 @@ + + + WEBGL_video_texture + + WebGL + working group (public_webgl 'at' khronos.org) + + + Byungseon Shin (sun.shin 'at' lge.com) + Andrey Volykhin (andrey.volykhin 'at' lge.com) + Members of the WebGL working group + + + NN + + + + + + + + Defines a new texture target TEXTURE_VIDEO_IMAGE. + Provides a mechanism for binding HTMLVideoElement stream to video texture targets. + Provides time of frame, texture width and height of HTMLVideoElement's texture binding. + + + + Add support for WEBGL_video_texture + binding of HTMLVideoElement. + + + + + + + + + + + + + + + + +[NoInterfaceObject] +interface WebGLVideoFrameInfo { + readonly attribute double currentTime; + readonly attribute unsigned long textureWidth; + readonly attribute unsigned long textureHeight; +}; + +[NoInterfaceObject] +interface WEBGL_video_texture { + const GLenum TEXTURE_VIDEO_IMAGE = 0x851D; + const GLenum SAMPLER_VIDEO_IMAGE = 0x8B61; + + [RaisesException] WebGLVideoFrameInfo VideoElementTargetVideoTexture( + GLenum target, HTMLVideoElement video); +}; + + + + +

    This a fragment shader that samples a video texture.

    +
    +    #extension GL_WEBGL_video_texture : require
    +    precision mediump float;
    +    varying vec2 v_texCoord;
    +
    +    uniform samplerVideoWEBGL uSampler;
    +
    +    void main(void) {
    +      gl_FragColor = texture2D(uSampler, v_texCoord);
    +    }
    +    
    + +

    This shows application that renders video using proposed extension.

    +
    +    var videoElement = document.getElementById("video");
    +    var videoTexture = gl.createTexture();
    +
    +    function update() {
    +        var ext = gl.getExtension('WEBGL_video_texture');
    +        if(ext !=== null){
    +            gl.bindTexture(ext.TEXTURE_VIDEO_IMAGE, videoTexture);
    +            ext.VideoElementTargetVideoTexture(ext.TEXTURE_VIDEO_IMAGE, videoElement);
    +            gl.bindTexture(ext.TEXTURE_VIDEO_IMAGE, null);
    +        }
    +    }
    +
    +    function render() {
    +        gl.clearColor(0.0, 0.0, 1.0, 1.0);
    +        gl.clear(gl.COLOR_BUFFER_BIT);
    +
    +        gl.bindBuffer(gl.ARRAY_BUFFER, squareVerticesBuffer);
    +        gl.vertexAttribPointer(vertexPositionAttribute, 3, gl.FLOAT, false, 0, 0);
    +
    +        gl.activeTexture(gl.TEXTURE0);
    +        gl.bindTexture(ext.TEXTURE_VIDEO_IMAGE, videoTexture);
    +        gl.uniform1i(gl.getUniformLocation(shaderProgram, "uSampler"), 0);
    +
    +        gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
    +    }
    +    
    + +

    Application renders each video frames into WebGL canvas based on game-loop pattern.

    +
    +
    +    while (true) {
    +       update();
    +       processInput();
    +       render();
    +    }
    +    
    + +
    + + + + + + + + Initial revision. + + + Change EGLImageTargetTexture2DOES to be called at every WebGL rendering cycle. + Add VideoFrameInfo interface. + Change EGLImageTargetTexture2DOES to return VideoFrameInfo as a currently mapped frame. + + + Change Extension name to WEBGL_video_texture for abstracion of OES_EGL_image_external extension. + Define new sampler and texture type, TEXTURE_VIDEO_IMAGE and SAMPLER_VIDEO_IMAGE. + Change EGLImageTargetTexture2DOES to VideoElementTargetVideoTexture. + + +
    diff --git a/third_party/rust/khronos_api/api_webgl/extensions/rejected/EXT_texture_storage/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/rejected/EXT_texture_storage/extension.xml new file mode 100644 index 0000000000..e1c434ef4e --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/rejected/EXT_texture_storage/extension.xml @@ -0,0 +1,66 @@ + + + EXT_texture_storage + + WebGL + working group (public_webgl 'at' khronos.org) + + + Kirill Dmitrenko (dmikis 'at' yandex-team.ru) + Members of the WebGL working group + + + k + + + + + + + + + + + + + The behaviour of texImage2D, + compressedTexImage2D and copyTexImage2D + methods of a WebGL context is changed. After a successful call to texStorage2DEXT, + the value of TEXTURE_IMMUTABLE_FORMAT_EXT for this texture + object is set to TRUE, and no further changes to the dimensions + or format of the texture may be made. Using texImage2D, + compressedTexImage2D, copyTexImage2D or + texStorage2DEXT with the same texture will result + in the error INVALID_OPERATION being generated. + + + + + +interface EXT_texture_storage { + const GLenum TEXTURE_IMMUTABLE_FORMAT_EXT = 0x912F; + void texStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +} + + + + + + + + + + Simultaneously specify storage for all levels of a two-dimensional texture. + + + + + + Initial revision + + + Moved to rejected now that initial WebGL 2.0 implementations are shipping imminently. + + + diff --git a/third_party/rust/khronos_api/api_webgl/extensions/rejected/OES_depth24/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/rejected/OES_depth24/extension.xml new file mode 100644 index 0000000000..05fd2a39fb --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/rejected/OES_depth24/extension.xml @@ -0,0 +1,69 @@ + + + OES_depth24 + + WebGL + working group (public_webgl 'at' khronos.org) + + + Florian Boesch (pyalot 'at' gmail.com) + Members of the WebGL working group + + + NN + + + + + + + + + + + + + Allows 24-bit depth components as a valid render buffer storage format. + + + + + +[NoInterfaceObject] +interface OES_depth24 { + const GLenum DEPTH_COMPONENT24_OES = 0x81A6; +}; + + + +
    +        var extension = gl.getExtension('OES_depth24');
    +        if(extension !=== null){
    +            var depth = gl.createRenderbuffer();
    +            gl.bindRenderbuffer(gl.RENDERBUFFER, depth);
    +            gl.renderbufferStorage(gl.RENDERBUFFER, extension.DEPTH_COMPONENT24_OES, 128, 128);
    +            gl.bindRenderbuffer(gl.RENDERBUFFER, null);
    +
    +            var fbo = gl.createFramebuffer();
    +            gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
    +            gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, depth);
    +            
    +            var fboStatus = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
    +            console.assert(fboStatus == gl.FRAMEBUFFER_COMPLETE, 'Framebuffer is not complete');
    +
    +            gl.bindFramebuffer(gl.FRAMEBUFFER, null);
    +            console.assert(gl.getError() == gl.NO_ERROR, 'A GL error occured');
    +        }
    +    
    +
    + + + + Initial revision. + + + Moved to rejected because WEBGL_depth_texture can be used as a workaround for 24-bit depth for FBOs. + + +
    diff --git a/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_compressed_texture_atc/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_compressed_texture_atc/extension.xml new file mode 100644 index 0000000000..a08906974c --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_compressed_texture_atc/extension.xml @@ -0,0 +1,112 @@ + + + + WEBGL_compressed_texture_atc + + WebGL working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + + 12 + + + + +

    + This extension exposes the compressed texture formats defined in the + + AMD_compressed_ATC_texture OpenGL extension to WebGL. +

    + + + Compression formats COMPRESSED_RGB_ATC_WEBGL, + COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL, and + COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL may be passed to + the compressedTexImage2D and compressedTexSubImage2D entry points. + + These formats correspond to the 3 formats defined in the AMD_compressed_ATC_texture OpenGL + extension. Although the enum names are changed, their numeric values are the same. The correspondence + is given by this table: + + + + + + + + + + + + + + + + + + + + + +
    WebGL format enumOpenGL format enumNumeric value
    COMPRESSED_RGB_ATC_WEBGLATC_RGB_AMD0x8C92
    COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGLATC_RGBA_EXPLICIT_ALPHA_AMD0x8C93
    COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGLATC_RGBA_INTERPOLATED_ALPHA_AMD0x87EE
    +
    + + Calling getParameter with the argument COMPRESSED_TEXTURE_FORMATS + will include the 3 formats from this specification. + + +

    The following format-specific restrictions must be enforced:

    +
    +
    COMPRESSED_RGB_ATC_WEBGL
    +

    The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D, must be equal to the following number of bytes:

    +
    + floor((width + 3) / 4) * floor((height + 3) / 4) * 8 +
    +

    If it is not, an INVALID_VALUE error is generated.

    +
    + +
    COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL
    +
    COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL
    +

    The byteLength of the ArrayBufferView, pixels, passed to + compressedTexImage2D, must be equal to the following number of bytes:

    +
    + floor((width + 3) / 4) * floor((height + 3) / 4) * 16 +
    +

    If it is not, an INVALID_VALUE error is generated.

    +
    +
    +
    +
    +
    + +[NoInterfaceObject] +interface WEBGL_compressed_texture_atc { + /* Compressed Texture Formats */ + const GLenum COMPRESSED_RGB_ATC_WEBGL = 0x8C92; + const GLenum COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 0x8C93; + const GLenum COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 0x87EE; +}; + + + + Initial revision. + + + Clarified that length of ArrayBufferView is actually byteLength. + + + Removed reference to compressedTexSubImage2D. This format can only be used with compressedTexImage2D. + + + Moved to community approved after discussion on public_webgl list. + + + Added NoInterfaceObject extended attribute. + + + Moved to rejected status at Khronos Montreal face-to-face meeting. + + +
    diff --git a/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_debug_shader_precision/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_debug_shader_precision/extension.xml new file mode 100644 index 0000000000..f017bca85d --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_debug_shader_precision/extension.xml @@ -0,0 +1,106 @@ + + + + WEBGL_debug_shader_precision + + WebGL + working group (public_webgl 'at' khronos.org) + + + Olli Etuaho, NVIDIA + + Members of the WebGL working group + + + NN + + + + + +

    + This extension enables software emulation of mediump and lowp floating point arithmetic in GLSL shaders for the purposes of shader testing. The emulation is enabled for shaders that are compiled after the extension has been enabled. Shaders compiled before the extension is enabled are not subject to emulation. The emulation does not model any specific device, but hypothetical shader units that implement IEEE half-precision floating point and the minimum requirements for lowp in The OpenGL ES Shading Language specification version 1.00.17. It is suggested that the software emulation is implemented in shader code, but a large performance cost on the order of one magnitude is still expected on all operations subject to emulation. +

    +
    + Many varieties of PC GPUs only implement one precision for floating point operations that corresponds to highp in The OpenGL ES Shading Language, so errors in shader code which uses mediump or lowp precision may be undetectable on these GPUs. Testing shaders with this extension enabled is recommended to ensure compatibility with a wide variety of hardware. Due to the large performance cost of emulation, this extension should only be used for testing and not in a production environment. +
    +

    + The emulation applies to: +

    +
      +
    • accesses to variables in r-value expressions (not on the left side of an assignment operator, includes passing in parameters to a function)
    • +
    • return values of built-in functions
    • +
    • return values of binary math operators, including assignment and compound assignment
    • +
    • results of binary math operations evaluated as a part of compound assignment
    • +
    +
    +

    + Examples of operations not subject to emulation: +

    +
      +
    • The math operator is unary, so storing the result and the return value are not subject to emulation: my_float++;
    • +
    +
    + + +

    + Operations listed above resulting in a mediump precision floating point scalar, vector or matrix must perform the following steps on the resulting scalar value or each of the components of the vector or matrix: +

    +
      +
    1. Clamp the value to the range [-65504.0, 65504.0].
    2. +
    3. Determine the floating-point exponent e of the clamped value.
    4. +
    5. If e < -15, return 0.0, skipping steps 4-6. The sign bit of the return value is undefined in this case.
    6. +
    7. Let x be the clamped value multiplied by 2^(-e + 10.0).
    8. +
    9. Let y be sign(x) * floor(abs(x)).
    10. +
    11. Return y * 2^(e - 10.0).
    12. +
    +
    + +

    + Operations listed above resulting in a lowp precision floating point scalar, vector or matrix must perform the following steps on the resulting scalar value or each of the components of the vector or matrix: +

    +
      +
    1. Clamp the value to the range [-2.0, 2.0].
    2. +
    3. Let x be the clamped value multiplied by 2^8.
    4. +
    5. Let y be sign(x) * floor(abs(x)).
    6. +
    7. Return y * 2^(-8).
    8. +
    +
    + +

    + sign, floor, and abs in the above steps refer to built-in functions in The OpenGL ES Shading Language. +

    +

    + The handling of positive and negative infinity and NaN by the above steps is undefined. +

    +
    + +

    + The #pragma webgl_debug_shader_precision directive is accepted by the shader compiler, and can be used to disable the emulation for specific shaders. By default, emulation is enabled by all shaders, but including #pragma webgl_debug_shader_precision(off) in a shader must disable emulation for that shader. +

    +
    +
    +

    + Due to hardware limitations, it is allowed that some shaders which compile and link successfully when the extension is disabled do not compile or link when the extension is enabled. +

    +
    + +[NoInterfaceObject] +interface WEBGL_debug_shader_precision { +}; + + + + Initial revision. + + + Added a #pragma directive to use in shaders and did minor clarifications. + + + Lifted restrictions concerning math operations evaluated as a part of compound assignment. + + + Moved to rejected on grounds of it being easy to provide as a library (with emscripten). + + +
    diff --git a/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_draw_elements_no_range_check/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_draw_elements_no_range_check/extension.xml new file mode 100644 index 0000000000..c38a127262 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_draw_elements_no_range_check/extension.xml @@ -0,0 +1,83 @@ + + + WEBGL_draw_elements_no_range_check + + WebGL + working group (public_webgl 'at' khronos.org) + + + Olli Etuaho, NVIDIA + + Jeff Gilbert, Mozilla + + Members of the WebGL working group + + + NN + + + + + + +

    drawElements robustness is currently ensured by checking + indices in the element array buffer against the size of the array buffer + they are indexing. These checks are undesirable from a performance + perspective, since they introduce CPU overhead to the API and require index + buffers to have a copy in CPU-accessible memory.

    + +

    This extension changes the behavior of drawElements to use + security features built into hardware, bypassing the CPU-side range check + and improving performance. The drawback is that if out-of-range indices are + referenced by drawElements, no error is generated and the + rendering results of that call will be undefined. However, supplying + out-of-range indices to drawElements will not result in + reading vertex data from outside the enabled vertex buffer objects, nor + abnormal program termination, as specified in the OpenGL extension + ARB_robust_buffer_access_behavior.

    + +

    It is suggested that this extension is left disabled when debugging. Any + INVALID_OPERATION errors from drawElements seen + while the extension is off mean that the application is supplying incorrect + indices to the API, even if rendering results would seem correct when this + extension is enabled.

    + +

    This extension interacts with + ANGLE_instanced_arrays.

    + + + + Calling drawElements will not produce an INVALID_OPERATION + error if a referenced index lies outside the storage of the bound buffer. Instead, + rendering is performed and attribute indices that are outside the valid range will produce + undefined rendering results. + + + Interaction with ANGLE_instanced_arrays: calling drawElementsInstancedANGLE + will not produce an INVALID_OPERATION error if a referenced index + lies outside the storage of the bound buffer, but will instead produce undefined + rendering results similarly to drawElements. + + +
    + + +[NoInterfaceObject] +interface WEBGL_draw_elements_no_range_check { +}; + + + + + + + Initial revision. + + + Added NoInterfaceObject extended attribute. + + + Moved to rejected. + + +
    diff --git a/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_get_buffer_sub_data_async/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_get_buffer_sub_data_async/extension.xml new file mode 100644 index 0000000000..b224f6dbc3 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_get_buffer_sub_data_async/extension.xml @@ -0,0 +1,141 @@ + + + + WEBGL_get_buffer_sub_data_async + + WebGL working group (public_webgl 'at' khronos.org) + + + Kai Ninomiya, Google Inc. + Members of the WebGL working group + + 34 + + + + +

    + This extension allows asynchronous buffer readback in WebGL 2.0. +

    + + + This extension exposes an asynchronous buffer readback entry point for + non-blocking readbacks from WebGL buffers. It is equivalent to + getBufferSubData but returns a Promise + instead of an immediate readback result. + + +
    + + +[NoInterfaceObject] +interface WEBGL_get_buffer_sub_data_async { + // Asynchronous version of getBufferSubData which fulfills the returned promise when the data becomes available. + Promise<ArrayBuffer> getBufferSubDataAsync(GLenum target, GLintptr srcByteOffset, ArrayBufferView dstBuffer, + optional GLuint dstOffset = 0, optional GLuint length = 0); // May throw DOMException +}; + + + + + + + + + + Reads back data asynchronously from the bound WebGLBuffer into dstBuffer. +

    + Let buf be the buffer bound to target at the time + getBufferSubDataAsync is called. + If length is 0, let copyLength be + dstBuffer.length - dstOffset; otherwise, let + copyLength be length. +

    + If copyLength is greater than zero, + copy copyLength typed elements (each of size dstBuffer.BYTES_PER_ELEMENT) + from buf into dstBuffer, + reading buf starting at byte index srcByteOffset and + writing into dstBuffer starting at element index dstOffset. + If copyLength is 0, no data is written to dstBuffer, but + this does not cause a GL error to be generated. +
      +
    • If no WebGLBuffer is bound to target, + an INVALID_OPERATION error is generated. +
    • +
    • If target is TRANSFORM_FEEDBACK_BUFFER, + and any transform feedback object is currently active, + an INVALID_OPERATION error is generated. +
    • +
    • If dstOffset is greater than dstBuffer.length, + an INVALID_VALUE error is generated. +
    • +
    • If dstOffset + copyLength is greater than dstBuffer.length, + an INVALID_VALUE error is generated. +
    • +
    • If srcByteOffset is less than zero, + an INVALID_VALUE error is generated. +
    • +
    • If srcByteOffset + copyLength*dstBuffer.BYTES_PER_ELEMENT + is larger than the length of buf, + an INVALID_OPERATION is generated. +
    • +
    + When invoked, getBufferSubDataAsync must run these steps: +
      +
    • Let promise be a Promise to be returned. +
    • +
    • Check for the errors defined above. If there are any errors, generate the GL error + synchronously and + reject + promise with an InvalidStateError. +
    • +
    • Insert a readback of buf into the GL command stream, using the range + defined above. +
    • +
    • Return promise, but continue running these steps in parallel. +
    • +
    • Upon completion of the readback, queue a task performing the following steps: +
        +
      • If the context has been lost, or if dstBuffer has been neutered, + reject + promise with an InvalidStateError. In this case, no GL + error is generated. +
      • +
      • Write the readback result into dstBuffer, using the range defined + above. +
      • +
      • Resolve + promise with dstBuffer. +
      • +
      + The task source for this task is the WebGL task source. +
    • +
    + If the returned Promise is rejected, no data is written to dstBuffer. + +
    + Even if getBufferSubDataAsync is called multiple times in a row with the same + dstBuffer, then callbacks added synchronously will never see + results of subsequent getBufferSubDataAsync calls. +
    + +
    + Compared to the synchronous version of getBufferSubData, this version may + impose less overhead on applications. Intended use cases include reading pixels into a + pixel buffer object and examining that data on the CPU. It does not force the graphics + pipeline to be stalled as getBufferSubData does. +
    +
    +
    + + + + Initial revision. + + + Set status to rejected following the working group's decision to + allow optimizations of the existing getBufferSubData API instead of + exposing a new one. + + +
    diff --git a/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_shared_resources/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_shared_resources/extension.xml new file mode 100644 index 0000000000..c512f89b67 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_shared_resources/extension.xml @@ -0,0 +1,381 @@ + + + + WEBGL_shared_resources + + WebGL working group (public_webgl 'at' khronos.org) + + + Members of the WebGL working group + + 22 + + + + +

    + This extension exposes the ability to share WebGL resources with multiple WebGLRenderingContexts. +

    +

    + Background: +

    +

    + The OpenGL ES spec defines that you can share a resource (texture, buffer, shader, program, + renderbuffer) with 2 or more GL contexts but with some caveats. To guarantee you'll see a + change made in one context in other context requires calling glFinish on the context that + made the change and call glBind on the context that wants to see the change. +

    +

    + Not calling glFinish and/or glBind does not guarantee you won't see the results which means + that users may do neither and their app might just happen to work on some platforms and + mysteriously have glitches, rendering corruption, gl errors or program failure on others. +

    +

    + WebGL must present consistent behavior for sharing and so this extension provides + an API so that implementions can enforce and optimize these requirements. +

    + + +

    Adds a new context creation parameter:

    +
    +
    shareGroup
    +
    + Default: undefined. If the value is set to the group + attribute from the WEBGL_shared_resources object from an existing context + then resources from the existing context are shared with the newly created context. +
    +
    +
    +var canvas1 = document.createElement("canvas");
    +var canvas2 = document.createElement("canvas");
    +var ctx1 = canvas1.getContext("webgl");
    +var sharedResourcesExtension = ctx1.getExtension("WEBGL_shared_resources");
    +var ctx2 = canvas2.getContext("webgl", {
    +    shareGroup: sharedResourcesExtension.group
    +});
    +        
    +
    + +

    + In order for a context to use a resouce it must first acquire it. + Contexts can make a request to acquire a resource by calling acquireSharedResource + in one of 2 modes, EXCLUSIVE or READ_ONLY. A resource may be acquired by multiple + contexts in READ_ONLY mode. The resource may only be acquired by one context + if the mode is EXCLUSIVE. acquireSharedResource returns an id you can use to cancel the acquire + by calling cancelAcquireSharedResource. + When the resource is available in the requested mode the callback + will be invoked. Resources start their life as acquired in EXCLUSIVE mode in the context + in which they are created. +

    +

    + To release a resource so it may be acquired by another context call releaseSharedResource and + pass it the resource to be released. +

    +
    + +

    + After a resource is acquired it must be bound before it is used. Binding + means for buffers calling bindBuffer, for textures either bindTexture or + framebufferTexture2D, for renderbuffers either bindRenderbuffer or framebufferRenderbuffer, + for shaders attachShader, for programs useProgram. Binding once is sufficient to satisfy + this requirement. In other words, if you have a texture attached to more than one texture + unit the texture only needs to be re-bound to 1 texture unit. Attemping to use a resource + which has not been bound since it was acquired generates INVALID_OPERATION. +

    +

    + Bind Requirement Algorithm: +

    +

    + Each resource has a per-context bound flag. When a resource is acquired in a context its + bound flag for that context is set to false. If one of the functions listed above + is called the bound flag for that context is set to true. Drawing and reading functions, + clear, drawArrays, drawElements, readPixels, that would access a resource whose bound flag + for that context is false generate INVALID_FRAMEBUFFER_OPERATION. All other functions that + use a resource whose bound flag for that context is false generate INVALID_OPERATION. +

    +

    + Note: In the specific case of programs, it is not an error to call draw with a program + or call useProgram for a program which has shaders that have + been acquired but not re-attached. Nor it is an error to draw with or call useProgram + for a program which has shaders that have not been acquired. It is an error to call linkProgram + for a program that is using shaders that have been acquired but not re-attached. +

    +
    + +

    + When an attempt is made to use a resource that is not acquired in the current context + the implementation must generate the error INVALID_OPERATION or INVALID_FRAMEBUFFER_OPRATION. + This includes all gl calls + that would access the given resource directly or indirectly. For example, a + draw call must fail if any of the resources it would access is not acquired in the + correct mode for the call. In other words, if the draw call would read from a buffer + or texture and that buffer or texture is not acquired for READ_ONLY or EXCLUSIVE mode the draw + must fail with INVALID_FRAMEBUFFER_OPERATION. If the draw would render to a texture or renderbuffer + that is not acquired for EXCLUSIVE mode the draw must fail and generate INVALID_FRAMEBUFFER_OPERATION. + If a program used in the draw is not acquired for READ_ONLY or EXCLUSIVE mode the draw or clear must fail + and generate INVALID_FRAMEBUFFER_OPERATION. +

    +

    + For buffers not acquired this includes but is not limited to +

    +
    +          bindBuffer
    +          bufferData
    +          bufferSubData
    +          deleteBuffer
    +          drawArrays
    +          drawElements
    +          getParameter with parameter (BUFFER_SIZE or BUFFER_USAGE)
    +          isBuffer
    +          vertexAttribPointer
    +        
    +

    + For a buffer acquired in READ_ONLY mode this includes but is not limited to +

    +
    +          bufferData
    +          bufferSubData
    +        
    +

    + For programs not acquired this includes but is not limited to +

    +
    +          attachShader
    +          bindAttribLocation
    +          drawArrays
    +          drawElements
    +          deleteProgram
    +          getActiveAttrib
    +          getActiveUniform
    +          getAttribLocation
    +          getUniformLocation
    +          getProgramParameter
    +          getProgramInfoLog
    +          isProgram
    +          linkProgram
    +          useProgram
    +          validateProgram
    +        
    +

    + For programs acquired in READ_ONLY mode includes but is not limited to +

    +
    +          bindAttribLocation
    +          deleteProgram
    +          linkProgram
    +        
    +

    + For renderbuffers not acquired this includes but is not limited to +

    +
    +          bindRenderbuffer
    +          clear
    +          deleteRenderbuffer
    +          drawArrays
    +          drawElements
    +          framebufferRenderbuffer
    +          isRenderbuffer
    +          renderbufferStorage
    +        
    +

    + For renderbuffers acquired in READ_ONLY mode this includes +

    +
    +          clear
    +          deleteRenderbuffer
    +          drawArrays
    +          drawElements
    +          renderbufferStorage
    +        
    +

    + For shaders not acquired this includes but is not limited to +

    +
    +          attachShader
    +          compileShader
    +          deleteShader
    +          getShaderSource
    +          getShaderParameter
    +          isShader
    +          shaderSource
    +        
    +

    + For shaders acquired in READ_ONLY mode this includes but is not limited to +

    +
    +          deleteShader
    +          compileShader
    +          shaderSource
    +        
    +

    + For textures not acquired this includes but is not limited to +

    +
    +          bindTexture
    +          clear
    +          compressedTexImage2D
    +          compressedTexSubImage2D
    +          copyTexImage2D
    +          copyTexSubImage2D
    +          drawArrays
    +          drawElements
    +          deleteTexture
    +          framebufferTexture2D
    +          getTexParameter
    +          isTexture
    +          texImage2D
    +          texParameter
    +          texSubImage2D
    +        
    +

    + For textures acquired in READ_ONLY mode this includes but is not limited to +

    +
    +          clear
    +          compressedTexImage2D
    +          compressedTexSubImage2D
    +          copyTexImage2D
    +          copyTexSubImage2D
    +          drawArrays
    +          drawElements
    +          deleteTexture
    +          texImage2D
    +          texParameter
    +          texSubImage2D
    +        
    +

    + The term "not limited to" is intended to point out that extension may enable + other functions to which these rule should apply. For example drawArraysInstancedANGLE + must follow the same rules as drawArrays. +

    +
    + +

    + Calling checkFramebufferStatus with the argument FRAMEBUFFER or DRAW_FRAMEBUFFER must + return FRAMEBUFFER_INCOMPLETE_ATTACHMENT if any of the resources referenced by the currently + bound framebuffer are not acquired for EXCLUSIVE access. + Calling checkFramebufferStatus with the argument READ_FRAMEBUFFER will return + FRAMEBUFFER_INCOMPLETE_ATTACHMENT if any of the resources referenced by the currently bound + framebuffer are not acquired for EXCLUSIVE or READ_ONLY access. +

    +

    + Note: This extension exposes the constants READ_FRAMEBUFFER and DRAW_FRAMEBUFFER only for + the purpose of calling checkFramebufferStatus. In particular, this extension does not enable + calling bindFramebuffer with either constant. +

    +
    + +

    + A context that is deleted automatically releases all resources it has acquired. Note that + currently there is no way to explicitly delete a context. Contexts are deleted through + garbage collection. +

    +
    + +

    + Note that implementing this extension changes the base class of the sharable resources. + Specifically: WebGLBuffer, WebGLProgram, WebGLRenderbuffer, WebGLShader, and WebGLTexture + change their base class from WebGLObject to WebGLSharedObject. +

    +
    +
    +
    + +
      +
    • +
      + Q: What happens if one context deletes a resource another context is attempting to acquire? +
      +
      + A: Nothing special. The acquire will succeed when the context that currently has the resource + releases it. The context that acquires the resource can use the WebGLSharedObject + (buffer, texture, etc...) and will get the normal WebGL behavior associated with using + a deleted resource. +
      +
    • +
    • +
      + Q: Can you attach a resources that you have not acquired to a container? +
      +
      + A: No. An attachment can remain attached while it is released but it must be acquired + when attaching. + In particular a framebuffer attachment may not be attached to a framebuffer unless + the attachment is acquired. A shader may not be attached to a program unless the + shader is acquired. A buffer may not be attached to an attibute, vertexAttribPointer, + unless the buffer is acquired. +
      +
    • +
    • +
      + Q: What happens if you try to acquire a resource you already have acquired? +
      +
      + A: It will generate INVALID_OPERATION +
      +
    • +
    +
    + +[NoInterfaceObject] +interface WEBGL_shared_resources { + const GLenum READ_ONLY = 0x0001; + const GLenum EXCLUSIVE = 0x0004; + + const GLenum READ_FRAMEBUFFER = 0x8CA8; + const GLenum DRAW_FRAMEBUFFER = 0x8CA9; + + readonly attribute WebGLShareGroup group; + + long acquireSharedResource( + WebGLSharedObject resource, + GLenum mode, + AcquireSharedResourcesCallback callback); + void releaseSharedResource( + WebGLSharedObject resource); + void cancelAcquireSharedResource(long id); +}; + +callback AcquireSharedResourcesCallback = void (); + +[NoInterfaceObject] +interface WebGLShareGroup { +}; + +interface WebGLSharedObject : WebGLObject { +}; + +interface WebGLBuffer : WebGLSharedObject { +}; + +interface WebGLProgram : WebGLSharedObject { +}; + +interface WebGLRenderbuffer : WebGLSharedObject { +}; + +interface WebGLShader : WebGLSharedObject { +}; + +interface WebGLTexture : WebGLSharedObject { +}; + + + + Initial revision. + + + Moved to draft after agreement in working group. + + + Added NoInterfaceObject extended attribute to extension interface and WebGLShareGroup. + + + Rejected after discussion on public_webgl and no strong objections. At this point in + the WebGL API's development it is not profitable to invest the time to implement this + extension. Alternatives: CanvasRenderingContext2D.drawImage taking a WebGL-rendered canvas as + argument, or using OffscreenCanvas.transferToImageBitmap with a WebGL-rendered canvas, + combined with ImageBitmapRenderingContext.transferFromImageBitmap. + + +
    diff --git a/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_subscribe_uniform/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_subscribe_uniform/extension.xml new file mode 100644 index 0000000000..ee85cdd4bd --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_subscribe_uniform/extension.xml @@ -0,0 +1,198 @@ + + + WEBGL_subscribe_uniform + + WebGL + working group (public_webgl 'at' khronos.org) + + + Owen Glofcheski, Google + Members of the WebGL working group + + + NN + + + + + + + +

    This extension exposes the ability to subscribe to a set of uniform targets + which can be used to populate uniforms within shader programs. This extension + is generic, but currently only supports mouse position as a subscription target. +

    Background: +

    The depth of the web pipeline makes it difficult to support low latency + interaction as event information retrieved via javascript + is outdated by the time it's displayed to clients. By populating event + information later in the pipeline one can reduce perceived input latency. +

    This extension creates a new buffer type 'Valuebuffer' to + maintain the active state for predefined subscription targets. Since a + mechanism for buffering uniform information isn't available pre 2.0 (UBOs) + an additional data type was needed. See 'New Types' for additional + information.

    +

    When this extension is enabled:

    +
      +
    • This extension provides a mechanism to store mouse positional information + in buffers and defer modification of uniform variables which use mouse + positional information until the WebGL commands are executed. +
    • +
    • This extension provides a mechanism to explicitly update mouse + positional information to maintain per frame consistency. +
    • +
    +
    + + +[NoInterfaceObject] +interface WEBGL_subscribe_uniform { + const GLenum SUBSCRIBED_VALUES_BUFFER = 0x924B; + + // subscription targets + const GLenum MOUSE_POSITION = 0x924C; + + WebGLValuebuffer? createValuebuffer(); + void deleteValuebuffer(WebGLValuebuffer? buffer); + void isValuebuffer(WebGLValuebuffer? buffer); + void bindValuebuffer(GLenum target, WebGLValuebuffer? buffer); + + void subscribeValue(GLenum traget, GLenum subscription); + void populateSubscribedValues(GLenum target); + void uniformValuebuffer(WebGLUniformLocation? location, GLenum target, GLenum subscription); +}; // interface WEBGL_subscribe_uniform + + + + + Creates and returns a Valuebuffer object. + + Deletes a Valuebuffer + object. + + Returns whether an object is a + Valuebuffer object. + + Lets you use a named + Valuebuffer object. + + Subscribes the currently bound + Valuebuffer object to a subscription target. + + Populates the currently bound + Valuebuffer object with the state of the subscriptions to + which it is subscribed. + + Modifies the value of a uniform variable + or uniform variable array using the state of the subscription target in the + currently bound Valuebuffer object. + + + + +

    This interface is used to maintain a reference to internal + Valuebuffer subscription states.

    +
    +

    A Valuebuffer abstracts the mapping of subscription targets to internal + state and acts as a single storage object for subscription information (e.g. current + mouse position). Clients can then use the objects data to populate uniform variables.

    +

    Post WebGL API 2.0, this abstraction could exist as a layer ontop of UBOs + which managers the mapping of subscription targets to internal state and the mapping + of subscription targets to offsets within the buffer. The UBO would be used to store the + active buffer state as well as the uniform location mapping. Clients would be required to + state all their subscription targets at once to allocate the appropriate amount of memory. + Aside from this small change the implementation is essentially the same, with UBOs replacing + Valuebuffers and relevant create, delete, bind methods being replaced. + Additionally, the inclusion of UBOs would replace the need for + uniformValueBuffer(...).

    +
    + + + +

    SUBSCRIBED_VALUES_BUFFER + is accepted as the target parameter to bindValuebuffer

    + + +

    SUBSCRIBED_VALUES_BUFFER + is accepted as the target parameter to subscribeValuebuffer

    +

    MOUSE_POSITION + is accepted as the subscription parameter to subscribeValuebuffer

    + + +

    SUBSCRIBED_VALUES_BUFFER + is accepted as the target parameter to populateSubscribedValues

    + + +

    SUBSCRIBED_VALUES_BUFFER + is accepted as the target parameter to uniformValuebuffer

    +

    MOUSE_POSITION + is accepted as the subscription parameter to uniformValuebuffer

    +
    + +
    +<script id="vshader" type="x-shader/x-vertex">
    +  uniform ivec2 uMousePosition;
    +
    +  void main()
    +  {
    +    gl_Position = vec4(uMousePosition, 0, 1);
    +  }
    +</script>
    +
    +function init(gl) {
    +  shader.uMousePosition = gl.getUniformLocation(shader, "uMousePosition");
    +  ...
    +
    +  var ext = gl.getExtension('WEBGL_subscribe_uniform');
    +    
    +  // Create the value buffer and subscribe.
    +  var valuebuffer = ext.createValuebuffer();
    +  ext.bindValuebuffer(SUBSCRIBED_VALUES_BUFFER, valuebuffer);
    +  ext.subscribeValue(MOUSE_POSITION);
    +  ...
    +}
    +     
    +function draw(gl) {   
    +  // Populate buffer and populate uniform
    +  ext.bindValuebuffer(SUBSCRIBED_VALUES_BUFFER, valuebuffer);
    +  ext.populateSubscribedValues(SUBSCRIBED_VALUES_BUFFER);
    +  ext.uniformValuebuffer(shader.uMousePosition,
    +                         SUBSCRIBED_VALUES_BUFFER,
    +                         MOUSE_POSITION);
    +
    +  gl.drawElements(...);
    +}
    +  
    + + + + + + Initial revision. + + + + Moved to rejected state. Does not have a champion at this point. Was difficult to + reason about how to use the extension, given that the on-screen rendering would be farther + ahead than the application's state. Seems that the best solution is to focus on reducing the + depth, and therefore latency, of the browser's rendering pipeline. + + +
    diff --git a/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_texture_from_depth_video/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_texture_from_depth_video/extension.xml new file mode 100644 index 0000000000..da3cf2b595 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/rejected/WEBGL_texture_from_depth_video/extension.xml @@ -0,0 +1,108 @@ + + + WEBGL_texture_from_depth_video + + WebGL + working group (public_webgl 'at' khronos.org) + + + Ningxin Hu, Intel + Anssi Kostiainen, Intel + Rob Manson, buildAR + Members of the WebGL working group + + + NN + + + + + + + +

    This extension provides support for the Media + Capture Depth Stream Extensions. Specifically, it supports + uploading to a WebGL texture a video element whose + source is a MediaStream object containing a + depth track.

    + + + + A video element whose source is a MediaStream + object containing a + depth track may be uploaded to a WebGL + texture of format RGB and type + UNSIGNED_SHORT_5_6_5. + + +
    + + +[NoInterfaceObject] +interface WEBGL_texture_from_depth_video { +}; + + + +
    + + This code sets up a video element from a depth stream, uploads + it to a WebGL texture, and samples that texture in the fragment + shader, reconstructing the 16-bit depth values from the red, + green and blue channels. + +
    var ext = gl.getExtension("WEBGL_texture_from_depth_video");
    +if (ext) {
    +  navigator.getUserMedia({ video: true }, successVideo, failureVideo);
    +}
    +
    +var depthVideo;
    +
    +function successVideo(s) {
    +  // wire the stream into a <video> element for playback
    +  depthVideo = document.querySelector('#video');
    +  depthVideo.src = URL.createObjectURL(s);
    +  depthVideo.play();
    +}
    +
    +// ... later, in the rendering loop ...
    +
    +if (ext) {
    + gl.texImage2D(
    +     gl.TEXTURE_2D,
    +     0,
    +     gl.RGB,
    +     gl.RGB,
    +     gl.UNSIGNED_SHORT_5_6_5,
    +     depthVideo
    +   );  
    +}
    +
    +<script id="fragment-shader" type="x-shader/x-fragment">
    +  varying vec2 v_texCoord;
    +  // u_tex points to the texture unit containing the depth texture.
    +  uniform sampler2D u_tex;
    +  void main() {
    +    vec4 floatColor = texture2D(u_tex, v_texCoord);
    +    vec3 rgb = floatColor.rgb;
    +    ...
    +    float depth = 63488. * rgb.r + 2016. * rgb.g + 31. * rgb.b;
    +    ...
    +  }
    +</script>
    +
    + + + + + + Initial revision. + + + Moved to rejected on the grounds that it can be done without an extension. + + +
    diff --git a/third_party/rust/khronos_api/api_webgl/extensions/template/extension.xml b/third_party/rust/khronos_api/api_webgl/extensions/template/extension.xml new file mode 100644 index 0000000000..b80d3cad88 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/extensions/template/extension.xml @@ -0,0 +1,226 @@ + + + + + + + + + template + + + + + VENDOR_EXT_NAME + + VENDOR_EXT_NAME + + + + + + + WebGL + working group (public_webgl 'at' khronos.org) + + + + + Members of the WebGL working group + + + k + + + + + + + + + + + + + + Difference in core spec from extension. + + + + + + + + + + + + + + + + + + + + Optional support for FLOAT textures as FBO + attachments. + + + + + + +
    +

    This template for WebGL extensions is derived from the OpenGL extension + template. Refer to the OpenGL extension template for full + documentation of the content that should be contained in the sections + below. Because WebGL is fundamentally a Web API, its extensions are + specified in XML transformed with XSLT into HTML for easier + hyperlinking.

    + +

    Because most WebGL extensions are expected to simply mirror existing + OpenGL and OpenGL ES extensions, it is desirable to keep the WebGL + extension specifications as small as possible and simply refer to the + other specifications for the behavioral definitions.

    +
    + + + + + Frobs the baz + + + + + + + + + + + + + + + + + +
    + + + +module webgl { + +interface OES_foo_bar { + const GLenum NEW_ENUM = 0xF00; + + void doSomethingNew(GLenum state, GLuint value); +}; // interface OES_foo_bar + +}; // module webgl + + + + + + XHTML description + + + + + + unsigned long long XHTML + + unsigned long long XHTML + + + Plumber work(in_pipe,out_pipe); + +

    After attempting a connection, the plumber is no longer the same.

    +
    + + void + register(Plumber); Plumber find(); XHTML + +
    + + + + + XHTML + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Quuxed the bar + + Fooed the frob + + +
    diff --git a/third_party/rust/khronos_api/api_webgl/specs/latest/1.0/webgl.idl b/third_party/rust/khronos_api/api_webgl/specs/latest/1.0/webgl.idl new file mode 100644 index 0000000000..826dfff0c5 --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/specs/latest/1.0/webgl.idl @@ -0,0 +1,760 @@ +// AUTOGENERATED FILE -- DO NOT EDIT -- SEE Makefile +// +// WebGL IDL definitions scraped from the Khronos specification: +// https://www.khronos.org/registry/webgl/specs/latest/ + +// Copyright (c) 2018 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 +// "Materials"), to deal in the Materials without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Materials, and to +// permit persons to whom the Materials are furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Materials. +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + +typedef unsigned long GLenum; +typedef boolean GLboolean; +typedef unsigned long GLbitfield; +typedef byte GLbyte; /* 'byte' should be a signed 8 bit type. */ +typedef short GLshort; +typedef long GLint; +typedef long GLsizei; +typedef long long GLintptr; +typedef long long GLsizeiptr; +// Ideally the typedef below would use 'unsigned byte', but that doesn't currently exist in Web IDL. +typedef octet GLubyte; /* 'octet' should be an unsigned 8 bit type. */ +typedef unsigned short GLushort; +typedef unsigned long GLuint; +typedef unrestricted float GLfloat; +typedef unrestricted float GLclampf; + +// The power preference settings are documented in the WebGLContextAttributes +// section of the specification. +enum WebGLPowerPreference { "default", "low-power", "high-performance" }; + + +dictionary WebGLContextAttributes { + GLboolean alpha = true; + GLboolean depth = true; + GLboolean stencil = false; + GLboolean antialias = true; + GLboolean premultipliedAlpha = true; + GLboolean preserveDrawingBuffer = false; + WebGLPowerPreference powerPreference = "default"; + GLboolean failIfMajorPerformanceCaveat = false; +}; + +[Exposed=(Window,Worker)] +interface WebGLObject { +}; + +[Exposed=(Window,Worker)] +interface WebGLBuffer : WebGLObject { +}; + +[Exposed=(Window,Worker)] +interface WebGLFramebuffer : WebGLObject { +}; + +[Exposed=(Window,Worker)] +interface WebGLProgram : WebGLObject { +}; + +[Exposed=(Window,Worker)] +interface WebGLRenderbuffer : WebGLObject { +}; + +[Exposed=(Window,Worker)] +interface WebGLShader : WebGLObject { +}; + +[Exposed=(Window,Worker)] +interface WebGLTexture : WebGLObject { +}; + +[Exposed=(Window,Worker)] +interface WebGLUniformLocation { +}; + +[Exposed=(Window,Worker)] +interface WebGLActiveInfo { + readonly attribute GLint size; + readonly attribute GLenum type; + readonly attribute DOMString name; +}; + +[Exposed=(Window,Worker)] +interface WebGLShaderPrecisionFormat { + readonly attribute GLint rangeMin; + readonly attribute GLint rangeMax; + readonly attribute GLint precision; +}; + +typedef (ImageBitmap or + ImageData or + HTMLImageElement or + HTMLCanvasElement or + HTMLVideoElement) TexImageSource; + +typedef ([AllowShared] Float32Array or sequence) Float32List; +typedef ([AllowShared] Int32Array or sequence) Int32List; + +interface mixin WebGLRenderingContextBase +{ + + /* ClearBufferMask */ + const GLenum DEPTH_BUFFER_BIT = 0x00000100; + const GLenum STENCIL_BUFFER_BIT = 0x00000400; + const GLenum COLOR_BUFFER_BIT = 0x00004000; + + /* BeginMode */ + const GLenum POINTS = 0x0000; + const GLenum LINES = 0x0001; + const GLenum LINE_LOOP = 0x0002; + const GLenum LINE_STRIP = 0x0003; + const GLenum TRIANGLES = 0x0004; + const GLenum TRIANGLE_STRIP = 0x0005; + const GLenum TRIANGLE_FAN = 0x0006; + + /* AlphaFunction (not supported in ES20) */ + /* NEVER */ + /* LESS */ + /* EQUAL */ + /* LEQUAL */ + /* GREATER */ + /* NOTEQUAL */ + /* GEQUAL */ + /* ALWAYS */ + + /* BlendingFactorDest */ + const GLenum ZERO = 0; + const GLenum ONE = 1; + const GLenum SRC_COLOR = 0x0300; + const GLenum ONE_MINUS_SRC_COLOR = 0x0301; + const GLenum SRC_ALPHA = 0x0302; + const GLenum ONE_MINUS_SRC_ALPHA = 0x0303; + const GLenum DST_ALPHA = 0x0304; + const GLenum ONE_MINUS_DST_ALPHA = 0x0305; + + /* BlendingFactorSrc */ + /* ZERO */ + /* ONE */ + const GLenum DST_COLOR = 0x0306; + const GLenum ONE_MINUS_DST_COLOR = 0x0307; + const GLenum SRC_ALPHA_SATURATE = 0x0308; + /* SRC_ALPHA */ + /* ONE_MINUS_SRC_ALPHA */ + /* DST_ALPHA */ + /* ONE_MINUS_DST_ALPHA */ + + /* BlendEquationSeparate */ + const GLenum FUNC_ADD = 0x8006; + const GLenum BLEND_EQUATION = 0x8009; + const GLenum BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */ + const GLenum BLEND_EQUATION_ALPHA = 0x883D; + + /* BlendSubtract */ + const GLenum FUNC_SUBTRACT = 0x800A; + const GLenum FUNC_REVERSE_SUBTRACT = 0x800B; + + /* Separate Blend Functions */ + const GLenum BLEND_DST_RGB = 0x80C8; + const GLenum BLEND_SRC_RGB = 0x80C9; + const GLenum BLEND_DST_ALPHA = 0x80CA; + const GLenum BLEND_SRC_ALPHA = 0x80CB; + const GLenum CONSTANT_COLOR = 0x8001; + const GLenum ONE_MINUS_CONSTANT_COLOR = 0x8002; + const GLenum CONSTANT_ALPHA = 0x8003; + const GLenum ONE_MINUS_CONSTANT_ALPHA = 0x8004; + const GLenum BLEND_COLOR = 0x8005; + + /* Buffer Objects */ + const GLenum ARRAY_BUFFER = 0x8892; + const GLenum ELEMENT_ARRAY_BUFFER = 0x8893; + const GLenum ARRAY_BUFFER_BINDING = 0x8894; + const GLenum ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; + + const GLenum STREAM_DRAW = 0x88E0; + const GLenum STATIC_DRAW = 0x88E4; + const GLenum DYNAMIC_DRAW = 0x88E8; + + const GLenum BUFFER_SIZE = 0x8764; + const GLenum BUFFER_USAGE = 0x8765; + + const GLenum CURRENT_VERTEX_ATTRIB = 0x8626; + + /* CullFaceMode */ + const GLenum FRONT = 0x0404; + const GLenum BACK = 0x0405; + const GLenum FRONT_AND_BACK = 0x0408; + + /* DepthFunction */ + /* NEVER */ + /* LESS */ + /* EQUAL */ + /* LEQUAL */ + /* GREATER */ + /* NOTEQUAL */ + /* GEQUAL */ + /* ALWAYS */ + + /* EnableCap */ + /* TEXTURE_2D */ + const GLenum CULL_FACE = 0x0B44; + const GLenum BLEND = 0x0BE2; + const GLenum DITHER = 0x0BD0; + const GLenum STENCIL_TEST = 0x0B90; + const GLenum DEPTH_TEST = 0x0B71; + const GLenum SCISSOR_TEST = 0x0C11; + const GLenum POLYGON_OFFSET_FILL = 0x8037; + const GLenum SAMPLE_ALPHA_TO_COVERAGE = 0x809E; + const GLenum SAMPLE_COVERAGE = 0x80A0; + + /* ErrorCode */ + const GLenum NO_ERROR = 0; + const GLenum INVALID_ENUM = 0x0500; + const GLenum INVALID_VALUE = 0x0501; + const GLenum INVALID_OPERATION = 0x0502; + const GLenum OUT_OF_MEMORY = 0x0505; + + /* FrontFaceDirection */ + const GLenum CW = 0x0900; + const GLenum CCW = 0x0901; + + /* GetPName */ + const GLenum LINE_WIDTH = 0x0B21; + const GLenum ALIASED_POINT_SIZE_RANGE = 0x846D; + const GLenum ALIASED_LINE_WIDTH_RANGE = 0x846E; + const GLenum CULL_FACE_MODE = 0x0B45; + const GLenum FRONT_FACE = 0x0B46; + const GLenum DEPTH_RANGE = 0x0B70; + const GLenum DEPTH_WRITEMASK = 0x0B72; + const GLenum DEPTH_CLEAR_VALUE = 0x0B73; + const GLenum DEPTH_FUNC = 0x0B74; + const GLenum STENCIL_CLEAR_VALUE = 0x0B91; + const GLenum STENCIL_FUNC = 0x0B92; + const GLenum STENCIL_FAIL = 0x0B94; + const GLenum STENCIL_PASS_DEPTH_FAIL = 0x0B95; + const GLenum STENCIL_PASS_DEPTH_PASS = 0x0B96; + const GLenum STENCIL_REF = 0x0B97; + const GLenum STENCIL_VALUE_MASK = 0x0B93; + const GLenum STENCIL_WRITEMASK = 0x0B98; + const GLenum STENCIL_BACK_FUNC = 0x8800; + const GLenum STENCIL_BACK_FAIL = 0x8801; + const GLenum STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; + const GLenum STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; + const GLenum STENCIL_BACK_REF = 0x8CA3; + const GLenum STENCIL_BACK_VALUE_MASK = 0x8CA4; + const GLenum STENCIL_BACK_WRITEMASK = 0x8CA5; + const GLenum VIEWPORT = 0x0BA2; + const GLenum SCISSOR_BOX = 0x0C10; + /* SCISSOR_TEST */ + const GLenum COLOR_CLEAR_VALUE = 0x0C22; + const GLenum COLOR_WRITEMASK = 0x0C23; + const GLenum UNPACK_ALIGNMENT = 0x0CF5; + const GLenum PACK_ALIGNMENT = 0x0D05; + const GLenum MAX_TEXTURE_SIZE = 0x0D33; + const GLenum MAX_VIEWPORT_DIMS = 0x0D3A; + const GLenum SUBPIXEL_BITS = 0x0D50; + const GLenum RED_BITS = 0x0D52; + const GLenum GREEN_BITS = 0x0D53; + const GLenum BLUE_BITS = 0x0D54; + const GLenum ALPHA_BITS = 0x0D55; + const GLenum DEPTH_BITS = 0x0D56; + const GLenum STENCIL_BITS = 0x0D57; + const GLenum POLYGON_OFFSET_UNITS = 0x2A00; + /* POLYGON_OFFSET_FILL */ + const GLenum POLYGON_OFFSET_FACTOR = 0x8038; + const GLenum TEXTURE_BINDING_2D = 0x8069; + const GLenum SAMPLE_BUFFERS = 0x80A8; + const GLenum SAMPLES = 0x80A9; + const GLenum SAMPLE_COVERAGE_VALUE = 0x80AA; + const GLenum SAMPLE_COVERAGE_INVERT = 0x80AB; + + /* GetTextureParameter */ + /* TEXTURE_MAG_FILTER */ + /* TEXTURE_MIN_FILTER */ + /* TEXTURE_WRAP_S */ + /* TEXTURE_WRAP_T */ + + const GLenum COMPRESSED_TEXTURE_FORMATS = 0x86A3; + + /* HintMode */ + const GLenum DONT_CARE = 0x1100; + const GLenum FASTEST = 0x1101; + const GLenum NICEST = 0x1102; + + /* HintTarget */ + const GLenum GENERATE_MIPMAP_HINT = 0x8192; + + /* DataType */ + const GLenum BYTE = 0x1400; + const GLenum UNSIGNED_BYTE = 0x1401; + const GLenum SHORT = 0x1402; + const GLenum UNSIGNED_SHORT = 0x1403; + const GLenum INT = 0x1404; + const GLenum UNSIGNED_INT = 0x1405; + const GLenum FLOAT = 0x1406; + + /* PixelFormat */ + const GLenum DEPTH_COMPONENT = 0x1902; + const GLenum ALPHA = 0x1906; + const GLenum RGB = 0x1907; + const GLenum RGBA = 0x1908; + const GLenum LUMINANCE = 0x1909; + const GLenum LUMINANCE_ALPHA = 0x190A; + + /* PixelType */ + /* UNSIGNED_BYTE */ + const GLenum UNSIGNED_SHORT_4_4_4_4 = 0x8033; + const GLenum UNSIGNED_SHORT_5_5_5_1 = 0x8034; + const GLenum UNSIGNED_SHORT_5_6_5 = 0x8363; + + /* Shaders */ + const GLenum FRAGMENT_SHADER = 0x8B30; + const GLenum VERTEX_SHADER = 0x8B31; + const GLenum MAX_VERTEX_ATTRIBS = 0x8869; + const GLenum MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; + const GLenum MAX_VARYING_VECTORS = 0x8DFC; + const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; + const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; + const GLenum MAX_TEXTURE_IMAGE_UNITS = 0x8872; + const GLenum MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; + const GLenum SHADER_TYPE = 0x8B4F; + const GLenum DELETE_STATUS = 0x8B80; + const GLenum LINK_STATUS = 0x8B82; + const GLenum VALIDATE_STATUS = 0x8B83; + const GLenum ATTACHED_SHADERS = 0x8B85; + const GLenum ACTIVE_UNIFORMS = 0x8B86; + const GLenum ACTIVE_ATTRIBUTES = 0x8B89; + const GLenum SHADING_LANGUAGE_VERSION = 0x8B8C; + const GLenum CURRENT_PROGRAM = 0x8B8D; + + /* StencilFunction */ + const GLenum NEVER = 0x0200; + const GLenum LESS = 0x0201; + const GLenum EQUAL = 0x0202; + const GLenum LEQUAL = 0x0203; + const GLenum GREATER = 0x0204; + const GLenum NOTEQUAL = 0x0205; + const GLenum GEQUAL = 0x0206; + const GLenum ALWAYS = 0x0207; + + /* StencilOp */ + /* ZERO */ + const GLenum KEEP = 0x1E00; + const GLenum REPLACE = 0x1E01; + const GLenum INCR = 0x1E02; + const GLenum DECR = 0x1E03; + const GLenum INVERT = 0x150A; + const GLenum INCR_WRAP = 0x8507; + const GLenum DECR_WRAP = 0x8508; + + /* StringName */ + const GLenum VENDOR = 0x1F00; + const GLenum RENDERER = 0x1F01; + const GLenum VERSION = 0x1F02; + + /* TextureMagFilter */ + const GLenum NEAREST = 0x2600; + const GLenum LINEAR = 0x2601; + + /* TextureMinFilter */ + /* NEAREST */ + /* LINEAR */ + const GLenum NEAREST_MIPMAP_NEAREST = 0x2700; + const GLenum LINEAR_MIPMAP_NEAREST = 0x2701; + const GLenum NEAREST_MIPMAP_LINEAR = 0x2702; + const GLenum LINEAR_MIPMAP_LINEAR = 0x2703; + + /* TextureParameterName */ + const GLenum TEXTURE_MAG_FILTER = 0x2800; + const GLenum TEXTURE_MIN_FILTER = 0x2801; + const GLenum TEXTURE_WRAP_S = 0x2802; + const GLenum TEXTURE_WRAP_T = 0x2803; + + /* TextureTarget */ + const GLenum TEXTURE_2D = 0x0DE1; + const GLenum TEXTURE = 0x1702; + + const GLenum TEXTURE_CUBE_MAP = 0x8513; + const GLenum TEXTURE_BINDING_CUBE_MAP = 0x8514; + const GLenum TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; + const GLenum TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; + const GLenum TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; + const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; + const GLenum TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; + const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; + const GLenum MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; + + /* TextureUnit */ + const GLenum TEXTURE0 = 0x84C0; + const GLenum TEXTURE1 = 0x84C1; + const GLenum TEXTURE2 = 0x84C2; + const GLenum TEXTURE3 = 0x84C3; + const GLenum TEXTURE4 = 0x84C4; + const GLenum TEXTURE5 = 0x84C5; + const GLenum TEXTURE6 = 0x84C6; + const GLenum TEXTURE7 = 0x84C7; + const GLenum TEXTURE8 = 0x84C8; + const GLenum TEXTURE9 = 0x84C9; + const GLenum TEXTURE10 = 0x84CA; + const GLenum TEXTURE11 = 0x84CB; + const GLenum TEXTURE12 = 0x84CC; + const GLenum TEXTURE13 = 0x84CD; + const GLenum TEXTURE14 = 0x84CE; + const GLenum TEXTURE15 = 0x84CF; + const GLenum TEXTURE16 = 0x84D0; + const GLenum TEXTURE17 = 0x84D1; + const GLenum TEXTURE18 = 0x84D2; + const GLenum TEXTURE19 = 0x84D3; + const GLenum TEXTURE20 = 0x84D4; + const GLenum TEXTURE21 = 0x84D5; + const GLenum TEXTURE22 = 0x84D6; + const GLenum TEXTURE23 = 0x84D7; + const GLenum TEXTURE24 = 0x84D8; + const GLenum TEXTURE25 = 0x84D9; + const GLenum TEXTURE26 = 0x84DA; + const GLenum TEXTURE27 = 0x84DB; + const GLenum TEXTURE28 = 0x84DC; + const GLenum TEXTURE29 = 0x84DD; + const GLenum TEXTURE30 = 0x84DE; + const GLenum TEXTURE31 = 0x84DF; + const GLenum ACTIVE_TEXTURE = 0x84E0; + + /* TextureWrapMode */ + const GLenum REPEAT = 0x2901; + const GLenum CLAMP_TO_EDGE = 0x812F; + const GLenum MIRRORED_REPEAT = 0x8370; + + /* Uniform Types */ + const GLenum FLOAT_VEC2 = 0x8B50; + const GLenum FLOAT_VEC3 = 0x8B51; + const GLenum FLOAT_VEC4 = 0x8B52; + const GLenum INT_VEC2 = 0x8B53; + const GLenum INT_VEC3 = 0x8B54; + const GLenum INT_VEC4 = 0x8B55; + const GLenum BOOL = 0x8B56; + const GLenum BOOL_VEC2 = 0x8B57; + const GLenum BOOL_VEC3 = 0x8B58; + const GLenum BOOL_VEC4 = 0x8B59; + const GLenum FLOAT_MAT2 = 0x8B5A; + const GLenum FLOAT_MAT3 = 0x8B5B; + const GLenum FLOAT_MAT4 = 0x8B5C; + const GLenum SAMPLER_2D = 0x8B5E; + const GLenum SAMPLER_CUBE = 0x8B60; + + /* Vertex Arrays */ + const GLenum VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; + const GLenum VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; + const GLenum VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; + const GLenum VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; + const GLenum VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; + const GLenum VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; + const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; + + /* Read Format */ + const GLenum IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A; + const GLenum IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; + + /* Shader Source */ + const GLenum COMPILE_STATUS = 0x8B81; + + /* Shader Precision-Specified Types */ + const GLenum LOW_FLOAT = 0x8DF0; + const GLenum MEDIUM_FLOAT = 0x8DF1; + const GLenum HIGH_FLOAT = 0x8DF2; + const GLenum LOW_INT = 0x8DF3; + const GLenum MEDIUM_INT = 0x8DF4; + const GLenum HIGH_INT = 0x8DF5; + + /* Framebuffer Object. */ + const GLenum FRAMEBUFFER = 0x8D40; + const GLenum RENDERBUFFER = 0x8D41; + + const GLenum RGBA4 = 0x8056; + const GLenum RGB5_A1 = 0x8057; + const GLenum RGB565 = 0x8D62; + const GLenum DEPTH_COMPONENT16 = 0x81A5; + const GLenum STENCIL_INDEX8 = 0x8D48; + const GLenum DEPTH_STENCIL = 0x84F9; + + const GLenum RENDERBUFFER_WIDTH = 0x8D42; + const GLenum RENDERBUFFER_HEIGHT = 0x8D43; + const GLenum RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; + const GLenum RENDERBUFFER_RED_SIZE = 0x8D50; + const GLenum RENDERBUFFER_GREEN_SIZE = 0x8D51; + const GLenum RENDERBUFFER_BLUE_SIZE = 0x8D52; + const GLenum RENDERBUFFER_ALPHA_SIZE = 0x8D53; + const GLenum RENDERBUFFER_DEPTH_SIZE = 0x8D54; + const GLenum RENDERBUFFER_STENCIL_SIZE = 0x8D55; + + const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; + const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; + const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; + const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; + + const GLenum COLOR_ATTACHMENT0 = 0x8CE0; + const GLenum DEPTH_ATTACHMENT = 0x8D00; + const GLenum STENCIL_ATTACHMENT = 0x8D20; + const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A; + + const GLenum NONE = 0; + + const GLenum FRAMEBUFFER_COMPLETE = 0x8CD5; + const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; + const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; + const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9; + const GLenum FRAMEBUFFER_UNSUPPORTED = 0x8CDD; + + const GLenum FRAMEBUFFER_BINDING = 0x8CA6; + const GLenum RENDERBUFFER_BINDING = 0x8CA7; + const GLenum MAX_RENDERBUFFER_SIZE = 0x84E8; + + const GLenum INVALID_FRAMEBUFFER_OPERATION = 0x0506; + + /* WebGL-specific enums */ + const GLenum UNPACK_FLIP_Y_WEBGL = 0x9240; + const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241; + const GLenum CONTEXT_LOST_WEBGL = 0x9242; + const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243; + const GLenum BROWSER_DEFAULT_WEBGL = 0x9244; + + [Exposed=Window] readonly attribute HTMLCanvasElement canvas; + readonly attribute GLsizei drawingBufferWidth; + readonly attribute GLsizei drawingBufferHeight; + + [WebGLHandlesContextLoss] WebGLContextAttributes? getContextAttributes(); + [WebGLHandlesContextLoss] boolean isContextLost(); + + sequence? getSupportedExtensions(); + object? getExtension(DOMString name); + + void activeTexture(GLenum texture); + void attachShader(WebGLProgram program, WebGLShader shader); + void bindAttribLocation(WebGLProgram program, GLuint index, DOMString name); + void bindBuffer(GLenum target, WebGLBuffer? buffer); + void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer); + void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer); + void bindTexture(GLenum target, WebGLTexture? texture); + void blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + void blendEquation(GLenum mode); + void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); + void blendFunc(GLenum sfactor, GLenum dfactor); + void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, + GLenum srcAlpha, GLenum dstAlpha); + + void bufferData(GLenum target, GLsizeiptr size, GLenum usage); + void bufferData(GLenum target, [AllowShared] BufferSource? data, GLenum usage); + void bufferSubData(GLenum target, GLintptr offset, [AllowShared] BufferSource data); + + [WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target); + void clear(GLbitfield mask); + void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + void clearDepth(GLclampf depth); + void clearStencil(GLint s); + void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); + void compileShader(WebGLShader shader); + + void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, + GLsizei width, GLsizei height, GLint border, + [AllowShared] ArrayBufferView data); + void compressedTexSubImage2D(GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLenum format, + [AllowShared] ArrayBufferView data); + + void copyTexImage2D(GLenum target, GLint level, GLenum internalformat, + GLint x, GLint y, GLsizei width, GLsizei height, + GLint border); + void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLint x, GLint y, GLsizei width, GLsizei height); + + WebGLBuffer? createBuffer(); + WebGLFramebuffer? createFramebuffer(); + WebGLProgram? createProgram(); + WebGLRenderbuffer? createRenderbuffer(); + WebGLShader? createShader(GLenum type); + WebGLTexture? createTexture(); + + void cullFace(GLenum mode); + + void deleteBuffer(WebGLBuffer? buffer); + void deleteFramebuffer(WebGLFramebuffer? framebuffer); + void deleteProgram(WebGLProgram? program); + void deleteRenderbuffer(WebGLRenderbuffer? renderbuffer); + void deleteShader(WebGLShader? shader); + void deleteTexture(WebGLTexture? texture); + + void depthFunc(GLenum func); + void depthMask(GLboolean flag); + void depthRange(GLclampf zNear, GLclampf zFar); + void detachShader(WebGLProgram program, WebGLShader shader); + void disable(GLenum cap); + void disableVertexAttribArray(GLuint index); + void drawArrays(GLenum mode, GLint first, GLsizei count); + void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset); + + void enable(GLenum cap); + void enableVertexAttribArray(GLuint index); + void finish(); + void flush(); + void framebufferRenderbuffer(GLenum target, GLenum attachment, + GLenum renderbuffertarget, + WebGLRenderbuffer? renderbuffer); + void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, + WebGLTexture? texture, GLint level); + void frontFace(GLenum mode); + + void generateMipmap(GLenum target); + + WebGLActiveInfo? getActiveAttrib(WebGLProgram program, GLuint index); + WebGLActiveInfo? getActiveUniform(WebGLProgram program, GLuint index); + sequence? getAttachedShaders(WebGLProgram program); + + [WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram program, DOMString name); + + any getBufferParameter(GLenum target, GLenum pname); + any getParameter(GLenum pname); + + [WebGLHandlesContextLoss] GLenum getError(); + + any getFramebufferAttachmentParameter(GLenum target, GLenum attachment, + GLenum pname); + any getProgramParameter(WebGLProgram program, GLenum pname); + DOMString? getProgramInfoLog(WebGLProgram program); + any getRenderbufferParameter(GLenum target, GLenum pname); + any getShaderParameter(WebGLShader shader, GLenum pname); + WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype); + DOMString? getShaderInfoLog(WebGLShader shader); + + DOMString? getShaderSource(WebGLShader shader); + + any getTexParameter(GLenum target, GLenum pname); + + any getUniform(WebGLProgram program, WebGLUniformLocation location); + + WebGLUniformLocation? getUniformLocation(WebGLProgram program, DOMString name); + + any getVertexAttrib(GLuint index, GLenum pname); + + [WebGLHandlesContextLoss] GLintptr getVertexAttribOffset(GLuint index, GLenum pname); + + void hint(GLenum target, GLenum mode); + [WebGLHandlesContextLoss] GLboolean isBuffer(WebGLBuffer? buffer); + [WebGLHandlesContextLoss] GLboolean isEnabled(GLenum cap); + [WebGLHandlesContextLoss] GLboolean isFramebuffer(WebGLFramebuffer? framebuffer); + [WebGLHandlesContextLoss] GLboolean isProgram(WebGLProgram? program); + [WebGLHandlesContextLoss] GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer); + [WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader); + [WebGLHandlesContextLoss] GLboolean isTexture(WebGLTexture? texture); + void lineWidth(GLfloat width); + void linkProgram(WebGLProgram program); + void pixelStorei(GLenum pname, GLint param); + void polygonOffset(GLfloat factor, GLfloat units); + + void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels); + + void renderbufferStorage(GLenum target, GLenum internalformat, + GLsizei width, GLsizei height); + void sampleCoverage(GLclampf value, GLboolean invert); + void scissor(GLint x, GLint y, GLsizei width, GLsizei height); + + void shaderSource(WebGLShader shader, DOMString source); + + void stencilFunc(GLenum func, GLint ref, GLuint mask); + void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); + void stencilMask(GLuint mask); + void stencilMaskSeparate(GLenum face, GLuint mask); + void stencilOp(GLenum fail, GLenum zfail, GLenum zpass); + void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); + + void texImage2D(GLenum target, GLint level, GLint internalformat, + GLsizei width, GLsizei height, GLint border, GLenum format, + GLenum type, [AllowShared] ArrayBufferView? pixels); + void texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, TexImageSource source); // May throw DOMException + + void texParameterf(GLenum target, GLenum pname, GLfloat param); + void texParameteri(GLenum target, GLenum pname, GLint param); + + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels); + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, TexImageSource source); // May throw DOMException + + void uniform1f(WebGLUniformLocation? location, GLfloat x); + void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y); + void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z); + void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + + void uniform1i(WebGLUniformLocation? location, GLint x); + void uniform2i(WebGLUniformLocation? location, GLint x, GLint y); + void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z); + void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w); + + void uniform1fv(WebGLUniformLocation? location, Float32List v); + void uniform2fv(WebGLUniformLocation? location, Float32List v); + void uniform3fv(WebGLUniformLocation? location, Float32List v); + void uniform4fv(WebGLUniformLocation? location, Float32List v); + + void uniform1iv(WebGLUniformLocation? location, Int32List v); + void uniform2iv(WebGLUniformLocation? location, Int32List v); + void uniform3iv(WebGLUniformLocation? location, Int32List v); + void uniform4iv(WebGLUniformLocation? location, Int32List v); + + void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value); + void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value); + void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value); + + void useProgram(WebGLProgram? program); + void validateProgram(WebGLProgram program); + + void vertexAttrib1f(GLuint index, GLfloat x); + void vertexAttrib2f(GLuint index, GLfloat x, GLfloat y); + void vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z); + void vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + + void vertexAttrib1fv(GLuint index, Float32List values); + void vertexAttrib2fv(GLuint index, Float32List values); + void vertexAttrib3fv(GLuint index, Float32List values); + void vertexAttrib4fv(GLuint index, Float32List values); + + void vertexAttribPointer(GLuint index, GLint size, GLenum type, + GLboolean normalized, GLsizei stride, GLintptr offset); + + void viewport(GLint x, GLint y, GLsizei width, GLsizei height); +}; + +[Exposed=(Window,Worker)] +interface WebGLRenderingContext +{ +}; +WebGLRenderingContext includes WebGLRenderingContextBase; + + +[Exposed=(Window,Worker), + Constructor(DOMString type, + optional WebGLContextEventInit eventInit)] +interface WebGLContextEvent : Event { + readonly attribute DOMString statusMessage; +}; + +// EventInit is defined in the DOM4 specification. +dictionary WebGLContextEventInit : EventInit { + DOMString statusMessage = ""; +}; diff --git a/third_party/rust/khronos_api/api_webgl/specs/latest/2.0/webgl2.idl b/third_party/rust/khronos_api/api_webgl/specs/latest/2.0/webgl2.idl new file mode 100644 index 0000000000..8c565276de --- /dev/null +++ b/third_party/rust/khronos_api/api_webgl/specs/latest/2.0/webgl2.idl @@ -0,0 +1,604 @@ +// AUTOGENERATED FILE -- DO NOT EDIT -- SEE Makefile +// +// WebGL IDL definitions scraped from the Khronos specification: +// https://www.khronos.org/registry/webgl/specs/latest/ + +// Copyright (c) 2018 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 +// "Materials"), to deal in the Materials without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Materials, and to +// permit persons to whom the Materials are furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Materials. +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + +typedef long long GLint64; +typedef unsigned long long GLuint64; + + +[Exposed=(Window,Worker)] +interface WebGLQuery : WebGLObject { +}; + +[Exposed=(Window,Worker)] +interface WebGLSampler : WebGLObject { +}; + +[Exposed=(Window,Worker)] +interface WebGLSync : WebGLObject { +}; + +[Exposed=(Window,Worker)] +interface WebGLTransformFeedback : WebGLObject { +}; + +[Exposed=(Window,Worker)] +interface WebGLVertexArrayObject : WebGLObject { +}; + +typedef ([AllowShared] Uint32Array or sequence) Uint32List; + +interface mixin WebGL2RenderingContextBase +{ + const GLenum READ_BUFFER = 0x0C02; + const GLenum UNPACK_ROW_LENGTH = 0x0CF2; + const GLenum UNPACK_SKIP_ROWS = 0x0CF3; + const GLenum UNPACK_SKIP_PIXELS = 0x0CF4; + const GLenum PACK_ROW_LENGTH = 0x0D02; + const GLenum PACK_SKIP_ROWS = 0x0D03; + const GLenum PACK_SKIP_PIXELS = 0x0D04; + const GLenum COLOR = 0x1800; + const GLenum DEPTH = 0x1801; + const GLenum STENCIL = 0x1802; + const GLenum RED = 0x1903; + const GLenum RGB8 = 0x8051; + const GLenum RGBA8 = 0x8058; + const GLenum RGB10_A2 = 0x8059; + const GLenum TEXTURE_BINDING_3D = 0x806A; + const GLenum UNPACK_SKIP_IMAGES = 0x806D; + const GLenum UNPACK_IMAGE_HEIGHT = 0x806E; + const GLenum TEXTURE_3D = 0x806F; + const GLenum TEXTURE_WRAP_R = 0x8072; + const GLenum MAX_3D_TEXTURE_SIZE = 0x8073; + const GLenum UNSIGNED_INT_2_10_10_10_REV = 0x8368; + const GLenum MAX_ELEMENTS_VERTICES = 0x80E8; + const GLenum MAX_ELEMENTS_INDICES = 0x80E9; + const GLenum TEXTURE_MIN_LOD = 0x813A; + const GLenum TEXTURE_MAX_LOD = 0x813B; + const GLenum TEXTURE_BASE_LEVEL = 0x813C; + const GLenum TEXTURE_MAX_LEVEL = 0x813D; + const GLenum MIN = 0x8007; + const GLenum MAX = 0x8008; + const GLenum DEPTH_COMPONENT24 = 0x81A6; + const GLenum MAX_TEXTURE_LOD_BIAS = 0x84FD; + const GLenum TEXTURE_COMPARE_MODE = 0x884C; + const GLenum TEXTURE_COMPARE_FUNC = 0x884D; + const GLenum CURRENT_QUERY = 0x8865; + const GLenum QUERY_RESULT = 0x8866; + const GLenum QUERY_RESULT_AVAILABLE = 0x8867; + const GLenum STREAM_READ = 0x88E1; + const GLenum STREAM_COPY = 0x88E2; + const GLenum STATIC_READ = 0x88E5; + const GLenum STATIC_COPY = 0x88E6; + const GLenum DYNAMIC_READ = 0x88E9; + const GLenum DYNAMIC_COPY = 0x88EA; + const GLenum MAX_DRAW_BUFFERS = 0x8824; + const GLenum DRAW_BUFFER0 = 0x8825; + const GLenum DRAW_BUFFER1 = 0x8826; + const GLenum DRAW_BUFFER2 = 0x8827; + const GLenum DRAW_BUFFER3 = 0x8828; + const GLenum DRAW_BUFFER4 = 0x8829; + const GLenum DRAW_BUFFER5 = 0x882A; + const GLenum DRAW_BUFFER6 = 0x882B; + const GLenum DRAW_BUFFER7 = 0x882C; + const GLenum DRAW_BUFFER8 = 0x882D; + const GLenum DRAW_BUFFER9 = 0x882E; + const GLenum DRAW_BUFFER10 = 0x882F; + const GLenum DRAW_BUFFER11 = 0x8830; + const GLenum DRAW_BUFFER12 = 0x8831; + const GLenum DRAW_BUFFER13 = 0x8832; + const GLenum DRAW_BUFFER14 = 0x8833; + const GLenum DRAW_BUFFER15 = 0x8834; + const GLenum MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49; + const GLenum MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A; + const GLenum SAMPLER_3D = 0x8B5F; + const GLenum SAMPLER_2D_SHADOW = 0x8B62; + const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B; + const GLenum PIXEL_PACK_BUFFER = 0x88EB; + const GLenum PIXEL_UNPACK_BUFFER = 0x88EC; + const GLenum PIXEL_PACK_BUFFER_BINDING = 0x88ED; + const GLenum PIXEL_UNPACK_BUFFER_BINDING = 0x88EF; + const GLenum FLOAT_MAT2x3 = 0x8B65; + const GLenum FLOAT_MAT2x4 = 0x8B66; + const GLenum FLOAT_MAT3x2 = 0x8B67; + const GLenum FLOAT_MAT3x4 = 0x8B68; + const GLenum FLOAT_MAT4x2 = 0x8B69; + const GLenum FLOAT_MAT4x3 = 0x8B6A; + const GLenum SRGB = 0x8C40; + const GLenum SRGB8 = 0x8C41; + const GLenum SRGB8_ALPHA8 = 0x8C43; + const GLenum COMPARE_REF_TO_TEXTURE = 0x884E; + const GLenum RGBA32F = 0x8814; + const GLenum RGB32F = 0x8815; + const GLenum RGBA16F = 0x881A; + const GLenum RGB16F = 0x881B; + const GLenum VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD; + const GLenum MAX_ARRAY_TEXTURE_LAYERS = 0x88FF; + const GLenum MIN_PROGRAM_TEXEL_OFFSET = 0x8904; + const GLenum MAX_PROGRAM_TEXEL_OFFSET = 0x8905; + const GLenum MAX_VARYING_COMPONENTS = 0x8B4B; + const GLenum TEXTURE_2D_ARRAY = 0x8C1A; + const GLenum TEXTURE_BINDING_2D_ARRAY = 0x8C1D; + const GLenum R11F_G11F_B10F = 0x8C3A; + const GLenum UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B; + const GLenum RGB9_E5 = 0x8C3D; + const GLenum UNSIGNED_INT_5_9_9_9_REV = 0x8C3E; + const GLenum TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F; + const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80; + const GLenum TRANSFORM_FEEDBACK_VARYINGS = 0x8C83; + const GLenum TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84; + const GLenum TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85; + const GLenum TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88; + const GLenum RASTERIZER_DISCARD = 0x8C89; + const GLenum MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A; + const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B; + const GLenum INTERLEAVED_ATTRIBS = 0x8C8C; + const GLenum SEPARATE_ATTRIBS = 0x8C8D; + const GLenum TRANSFORM_FEEDBACK_BUFFER = 0x8C8E; + const GLenum TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F; + const GLenum RGBA32UI = 0x8D70; + const GLenum RGB32UI = 0x8D71; + const GLenum RGBA16UI = 0x8D76; + const GLenum RGB16UI = 0x8D77; + const GLenum RGBA8UI = 0x8D7C; + const GLenum RGB8UI = 0x8D7D; + const GLenum RGBA32I = 0x8D82; + const GLenum RGB32I = 0x8D83; + const GLenum RGBA16I = 0x8D88; + const GLenum RGB16I = 0x8D89; + const GLenum RGBA8I = 0x8D8E; + const GLenum RGB8I = 0x8D8F; + const GLenum RED_INTEGER = 0x8D94; + const GLenum RGB_INTEGER = 0x8D98; + const GLenum RGBA_INTEGER = 0x8D99; + const GLenum SAMPLER_2D_ARRAY = 0x8DC1; + const GLenum SAMPLER_2D_ARRAY_SHADOW = 0x8DC4; + const GLenum SAMPLER_CUBE_SHADOW = 0x8DC5; + const GLenum UNSIGNED_INT_VEC2 = 0x8DC6; + const GLenum UNSIGNED_INT_VEC3 = 0x8DC7; + const GLenum UNSIGNED_INT_VEC4 = 0x8DC8; + const GLenum INT_SAMPLER_2D = 0x8DCA; + const GLenum INT_SAMPLER_3D = 0x8DCB; + const GLenum INT_SAMPLER_CUBE = 0x8DCC; + const GLenum INT_SAMPLER_2D_ARRAY = 0x8DCF; + const GLenum UNSIGNED_INT_SAMPLER_2D = 0x8DD2; + const GLenum UNSIGNED_INT_SAMPLER_3D = 0x8DD3; + const GLenum UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4; + const GLenum UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7; + const GLenum DEPTH_COMPONENT32F = 0x8CAC; + const GLenum DEPTH32F_STENCIL8 = 0x8CAD; + const GLenum FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD; + const GLenum FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210; + const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211; + const GLenum FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212; + const GLenum FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213; + const GLenum FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214; + const GLenum FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215; + const GLenum FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216; + const GLenum FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217; + const GLenum FRAMEBUFFER_DEFAULT = 0x8218; + const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A; + const GLenum DEPTH_STENCIL = 0x84F9; + const GLenum UNSIGNED_INT_24_8 = 0x84FA; + const GLenum DEPTH24_STENCIL8 = 0x88F0; + const GLenum UNSIGNED_NORMALIZED = 0x8C17; + const GLenum DRAW_FRAMEBUFFER_BINDING = 0x8CA6; /* Same as FRAMEBUFFER_BINDING */ + const GLenum READ_FRAMEBUFFER = 0x8CA8; + const GLenum DRAW_FRAMEBUFFER = 0x8CA9; + const GLenum READ_FRAMEBUFFER_BINDING = 0x8CAA; + const GLenum RENDERBUFFER_SAMPLES = 0x8CAB; + const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4; + const GLenum MAX_COLOR_ATTACHMENTS = 0x8CDF; + const GLenum COLOR_ATTACHMENT1 = 0x8CE1; + const GLenum COLOR_ATTACHMENT2 = 0x8CE2; + const GLenum COLOR_ATTACHMENT3 = 0x8CE3; + const GLenum COLOR_ATTACHMENT4 = 0x8CE4; + const GLenum COLOR_ATTACHMENT5 = 0x8CE5; + const GLenum COLOR_ATTACHMENT6 = 0x8CE6; + const GLenum COLOR_ATTACHMENT7 = 0x8CE7; + const GLenum COLOR_ATTACHMENT8 = 0x8CE8; + const GLenum COLOR_ATTACHMENT9 = 0x8CE9; + const GLenum COLOR_ATTACHMENT10 = 0x8CEA; + const GLenum COLOR_ATTACHMENT11 = 0x8CEB; + const GLenum COLOR_ATTACHMENT12 = 0x8CEC; + const GLenum COLOR_ATTACHMENT13 = 0x8CED; + const GLenum COLOR_ATTACHMENT14 = 0x8CEE; + const GLenum COLOR_ATTACHMENT15 = 0x8CEF; + const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56; + const GLenum MAX_SAMPLES = 0x8D57; + const GLenum HALF_FLOAT = 0x140B; + const GLenum RG = 0x8227; + const GLenum RG_INTEGER = 0x8228; + const GLenum R8 = 0x8229; + const GLenum RG8 = 0x822B; + const GLenum R16F = 0x822D; + const GLenum R32F = 0x822E; + const GLenum RG16F = 0x822F; + const GLenum RG32F = 0x8230; + const GLenum R8I = 0x8231; + const GLenum R8UI = 0x8232; + const GLenum R16I = 0x8233; + const GLenum R16UI = 0x8234; + const GLenum R32I = 0x8235; + const GLenum R32UI = 0x8236; + const GLenum RG8I = 0x8237; + const GLenum RG8UI = 0x8238; + const GLenum RG16I = 0x8239; + const GLenum RG16UI = 0x823A; + const GLenum RG32I = 0x823B; + const GLenum RG32UI = 0x823C; + const GLenum VERTEX_ARRAY_BINDING = 0x85B5; + const GLenum R8_SNORM = 0x8F94; + const GLenum RG8_SNORM = 0x8F95; + const GLenum RGB8_SNORM = 0x8F96; + const GLenum RGBA8_SNORM = 0x8F97; + const GLenum SIGNED_NORMALIZED = 0x8F9C; + const GLenum COPY_READ_BUFFER = 0x8F36; + const GLenum COPY_WRITE_BUFFER = 0x8F37; + const GLenum COPY_READ_BUFFER_BINDING = 0x8F36; /* Same as COPY_READ_BUFFER */ + const GLenum COPY_WRITE_BUFFER_BINDING = 0x8F37; /* Same as COPY_WRITE_BUFFER */ + const GLenum UNIFORM_BUFFER = 0x8A11; + const GLenum UNIFORM_BUFFER_BINDING = 0x8A28; + const GLenum UNIFORM_BUFFER_START = 0x8A29; + const GLenum UNIFORM_BUFFER_SIZE = 0x8A2A; + const GLenum MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B; + const GLenum MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D; + const GLenum MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E; + const GLenum MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F; + const GLenum MAX_UNIFORM_BLOCK_SIZE = 0x8A30; + const GLenum MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31; + const GLenum MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33; + const GLenum UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34; + const GLenum ACTIVE_UNIFORM_BLOCKS = 0x8A36; + const GLenum UNIFORM_TYPE = 0x8A37; + const GLenum UNIFORM_SIZE = 0x8A38; + const GLenum UNIFORM_BLOCK_INDEX = 0x8A3A; + const GLenum UNIFORM_OFFSET = 0x8A3B; + const GLenum UNIFORM_ARRAY_STRIDE = 0x8A3C; + const GLenum UNIFORM_MATRIX_STRIDE = 0x8A3D; + const GLenum UNIFORM_IS_ROW_MAJOR = 0x8A3E; + const GLenum UNIFORM_BLOCK_BINDING = 0x8A3F; + const GLenum UNIFORM_BLOCK_DATA_SIZE = 0x8A40; + const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42; + const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43; + const GLenum UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44; + const GLenum UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46; + const GLenum INVALID_INDEX = 0xFFFFFFFF; + const GLenum MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122; + const GLenum MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125; + const GLenum MAX_SERVER_WAIT_TIMEOUT = 0x9111; + const GLenum OBJECT_TYPE = 0x9112; + const GLenum SYNC_CONDITION = 0x9113; + const GLenum SYNC_STATUS = 0x9114; + const GLenum SYNC_FLAGS = 0x9115; + const GLenum SYNC_FENCE = 0x9116; + const GLenum SYNC_GPU_COMMANDS_COMPLETE = 0x9117; + const GLenum UNSIGNALED = 0x9118; + const GLenum SIGNALED = 0x9119; + const GLenum ALREADY_SIGNALED = 0x911A; + const GLenum TIMEOUT_EXPIRED = 0x911B; + const GLenum CONDITION_SATISFIED = 0x911C; + const GLenum WAIT_FAILED = 0x911D; + const GLenum SYNC_FLUSH_COMMANDS_BIT = 0x00000001; + const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE; + const GLenum ANY_SAMPLES_PASSED = 0x8C2F; + const GLenum ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A; + const GLenum SAMPLER_BINDING = 0x8919; + const GLenum RGB10_A2UI = 0x906F; + const GLenum INT_2_10_10_10_REV = 0x8D9F; + const GLenum TRANSFORM_FEEDBACK = 0x8E22; + const GLenum TRANSFORM_FEEDBACK_PAUSED = 0x8E23; + const GLenum TRANSFORM_FEEDBACK_ACTIVE = 0x8E24; + const GLenum TRANSFORM_FEEDBACK_BINDING = 0x8E25; + const GLenum TEXTURE_IMMUTABLE_FORMAT = 0x912F; + const GLenum MAX_ELEMENT_INDEX = 0x8D6B; + const GLenum TEXTURE_IMMUTABLE_LEVELS = 0x82DF; + + const GLint64 TIMEOUT_IGNORED = -1; + + /* WebGL-specific enums */ + const GLenum MAX_CLIENT_WAIT_TIMEOUT_WEBGL = 0x9247; + + /* Buffer objects */ + // WebGL1: + void bufferData(GLenum target, GLsizeiptr size, GLenum usage); + void bufferData(GLenum target, [AllowShared] BufferSource? srcData, GLenum usage); + void bufferSubData(GLenum target, GLintptr dstByteOffset, [AllowShared] BufferSource srcData); + // WebGL2: + void bufferData(GLenum target, [AllowShared] ArrayBufferView srcData, GLenum usage, GLuint srcOffset, + optional GLuint length = 0); + void bufferSubData(GLenum target, GLintptr dstByteOffset, [AllowShared] ArrayBufferView srcData, + GLuint srcOffset, optional GLuint length = 0); + + void copyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, + GLintptr writeOffset, GLsizeiptr size); + // MapBufferRange, in particular its read-only and write-only modes, + // can not be exposed safely to JavaScript. GetBufferSubData + // replaces it for the purpose of fetching data back from the GPU. + void getBufferSubData(GLenum target, GLintptr srcByteOffset, [AllowShared] ArrayBufferView dstBuffer, + optional GLuint dstOffset = 0, optional GLuint length = 0); + + /* Framebuffer objects */ + void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, + GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); + void framebufferTextureLayer(GLenum target, GLenum attachment, WebGLTexture? texture, GLint level, + GLint layer); + void invalidateFramebuffer(GLenum target, sequence attachments); + void invalidateSubFramebuffer(GLenum target, sequence attachments, + GLint x, GLint y, GLsizei width, GLsizei height); + void readBuffer(GLenum src); + + /* Renderbuffer objects */ + any getInternalformatParameter(GLenum target, GLenum internalformat, GLenum pname); + void renderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, + GLsizei width, GLsizei height); + + /* Texture objects */ + void texStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, + GLsizei height); + void texStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth); + + // WebGL1 legacy entrypoints: + void texImage2D(GLenum target, GLint level, GLint internalformat, + GLsizei width, GLsizei height, GLint border, GLenum format, + GLenum type, [AllowShared] ArrayBufferView? pixels); + void texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, TexImageSource source); // May throw DOMException + + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels); + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, TexImageSource source); // May throw DOMException + + // WebGL2 entrypoints: + void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, GLintptr pboOffset); + void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + TexImageSource source); // May throw DOMException + void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData, + GLuint srcOffset); + + void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr pboOffset); + void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, + TexImageSource source); // May throw DOMException + void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView? srcData); + void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData, + GLuint srcOffset); + + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, GLintptr pboOffset); + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, + TexImageSource source); // May throw DOMException + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData, + GLuint srcOffset); + + void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + GLintptr pboOffset); + void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + TexImageSource source); // May throw DOMException + void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + [AllowShared] ArrayBufferView? srcData, optional GLuint srcOffset = 0); + + void copyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLint x, GLint y, GLsizei width, GLsizei height); + + void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, GLintptr offset); + void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLint border, [AllowShared] ArrayBufferView srcData, + optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0); + + void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLintptr offset); + void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, [AllowShared] ArrayBufferView srcData, + optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0); + + void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLintptr offset); + void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLenum format, + [AllowShared] ArrayBufferView srcData, + optional GLuint srcOffset = 0, + optional GLuint srcLengthOverride = 0); + + void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLsizei imageSize, GLintptr offset); + void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, + GLenum format, [AllowShared] ArrayBufferView srcData, + optional GLuint srcOffset = 0, + optional GLuint srcLengthOverride = 0); + + /* Programs and shaders */ + [WebGLHandlesContextLoss] GLint getFragDataLocation(WebGLProgram program, DOMString name); + + /* Uniforms */ + void uniform1ui(WebGLUniformLocation? location, GLuint v0); + void uniform2ui(WebGLUniformLocation? location, GLuint v0, GLuint v1); + void uniform3ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2); + void uniform4ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); + + void uniform1fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform2fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform3fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform4fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + + void uniform1iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform2iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform3iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform4iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + + void uniform1uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform2uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform3uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform4uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + + void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + + void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + + void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + + /* Vertex attribs */ + void vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w); + void vertexAttribI4iv(GLuint index, Int32List values); + void vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); + void vertexAttribI4uiv(GLuint index, Uint32List values); + void vertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); + + /* Writing to the drawing buffer */ + void vertexAttribDivisor(GLuint index, GLuint divisor); + void drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount); + void drawElementsInstanced(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei instanceCount); + void drawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLintptr offset); + + /* Reading back pixels */ + // WebGL1: + void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, + [AllowShared] ArrayBufferView? dstData); + // WebGL2: + void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, + GLintptr offset); + void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, + [AllowShared] ArrayBufferView dstData, GLuint dstOffset); + + /* Multiple Render Targets */ + void drawBuffers(sequence buffers); + + void clearBufferfv(GLenum buffer, GLint drawbuffer, Float32List values, + optional GLuint srcOffset = 0); + void clearBufferiv(GLenum buffer, GLint drawbuffer, Int32List values, + optional GLuint srcOffset = 0); + void clearBufferuiv(GLenum buffer, GLint drawbuffer, Uint32List values, + optional GLuint srcOffset = 0); + + void clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); + + /* Query Objects */ + WebGLQuery? createQuery(); + void deleteQuery(WebGLQuery? query); + [WebGLHandlesContextLoss] GLboolean isQuery(WebGLQuery? query); + void beginQuery(GLenum target, WebGLQuery query); + void endQuery(GLenum target); + WebGLQuery? getQuery(GLenum target, GLenum pname); + any getQueryParameter(WebGLQuery query, GLenum pname); + + /* Sampler Objects */ + WebGLSampler? createSampler(); + void deleteSampler(WebGLSampler? sampler); + [WebGLHandlesContextLoss] GLboolean isSampler(WebGLSampler? sampler); + void bindSampler(GLuint unit, WebGLSampler? sampler); + void samplerParameteri(WebGLSampler sampler, GLenum pname, GLint param); + void samplerParameterf(WebGLSampler sampler, GLenum pname, GLfloat param); + any getSamplerParameter(WebGLSampler sampler, GLenum pname); + + /* Sync objects */ + WebGLSync? fenceSync(GLenum condition, GLbitfield flags); + [WebGLHandlesContextLoss] GLboolean isSync(WebGLSync? sync); + void deleteSync(WebGLSync? sync); + GLenum clientWaitSync(WebGLSync sync, GLbitfield flags, GLuint64 timeout); + void waitSync(WebGLSync sync, GLbitfield flags, GLint64 timeout); + any getSyncParameter(WebGLSync sync, GLenum pname); + + /* Transform Feedback */ + WebGLTransformFeedback? createTransformFeedback(); + void deleteTransformFeedback(WebGLTransformFeedback? tf); + [WebGLHandlesContextLoss] GLboolean isTransformFeedback(WebGLTransformFeedback? tf); + void bindTransformFeedback (GLenum target, WebGLTransformFeedback? tf); + void beginTransformFeedback(GLenum primitiveMode); + void endTransformFeedback(); + void transformFeedbackVaryings(WebGLProgram program, sequence varyings, GLenum bufferMode); + WebGLActiveInfo? getTransformFeedbackVarying(WebGLProgram program, GLuint index); + void pauseTransformFeedback(); + void resumeTransformFeedback(); + + /* Uniform Buffer Objects and Transform Feedback Buffers */ + void bindBufferBase(GLenum target, GLuint index, WebGLBuffer? buffer); + void bindBufferRange(GLenum target, GLuint index, WebGLBuffer? buffer, GLintptr offset, GLsizeiptr size); + any getIndexedParameter(GLenum target, GLuint index); + sequence? getUniformIndices(WebGLProgram program, sequence uniformNames); + any getActiveUniforms(WebGLProgram program, sequence uniformIndices, GLenum pname); + GLuint getUniformBlockIndex(WebGLProgram program, DOMString uniformBlockName); + any getActiveUniformBlockParameter(WebGLProgram program, GLuint uniformBlockIndex, GLenum pname); + DOMString? getActiveUniformBlockName(WebGLProgram program, GLuint uniformBlockIndex); + void uniformBlockBinding(WebGLProgram program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); + + /* Vertex Array Objects */ + WebGLVertexArrayObject? createVertexArray(); + void deleteVertexArray(WebGLVertexArrayObject? vertexArray); + [WebGLHandlesContextLoss] GLboolean isVertexArray(WebGLVertexArrayObject? vertexArray); + void bindVertexArray(WebGLVertexArrayObject? array); +}; + +[Exposed=(Window,Worker)] +interface WebGL2RenderingContext +{ +}; +WebGL2RenderingContext includes WebGLRenderingContextBase; +WebGL2RenderingContext includes WebGL2RenderingContextBase; + + -- cgit v1.2.3