Skip to content

Commit

Permalink
Promote WEBGL_blend_func_extended to community approved
Browse files Browse the repository at this point in the history
  • Loading branch information
lexaknyazev committed Jan 11, 2024
1 parent 6277e99 commit a1a6152
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 54 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<draft href="EXT_blend_func_extended/">
<name>EXT_blend_func_extended</name>
<extension href="WEBGL_blend_func_extended/">
<name>WEBGL_blend_func_extended</name>

<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
Expand All @@ -19,7 +19,15 @@
<mirrors href="https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_blend_func_extended.txt"
name="EXT_blend_func_extended">
<addendum>
None of the new functions are supported.
Although the extension name is WEBGL_blend_func_extended, the extension
must be enabled with the <code>#extension GL_EXT_blend_func_extended</code>
directive to use its functionality in shaders.

Likewise the shading language preprocessor <code>#define GL_EXT_blend_func_extended</code>,
will be defined to 1 if the extension is supported.
</addendum>
<addendum>
None of the new API functions are supported.
</addendum>
<addendum>
Automatic location assignment of fragment outputs is not supported.
Expand Down Expand Up @@ -60,12 +68,12 @@

<idl xml:space="preserve">
[Exposed=(Window,Worker), LegacyNoInterfaceObject]
interface EXT_blend_func_extended {
const GLenum SRC1_COLOR_EXT = 0x88F9;
const GLenum SRC1_ALPHA_EXT = 0x8589;
const GLenum ONE_MINUS_SRC1_COLOR_EXT = 0x88FA;
const GLenum ONE_MINUS_SRC1_ALPHA_EXT = 0x88FB;
const GLenum MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT = 0x88FC;
interface WEBGL_blend_func_extended {
const GLenum SRC1_COLOR_WEBGL = 0x88F9;
const GLenum SRC1_ALPHA_WEBGL = 0x8589;
const GLenum ONE_MINUS_SRC1_COLOR_WEBGL = 0x88FA;
const GLenum ONE_MINUS_SRC1_ALPHA_WEBGL = 0x88FB;
const GLenum MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL = 0x88FC;
};
</idl>

Expand All @@ -74,8 +82,8 @@ interface EXT_blend_func_extended {
<param name="src" type="GLenum"/>
<param name="dst" type="GLenum"/>
<p>
New enums <code>SRC1_COLOR_EXT</code>, <code>SRC1_ALPHA_EXT</code>,
<code>ONE_MINUS_SRC1_COLOR_EXT</code>, and <code>ONE_MINUS_SRC1_ALPHA_EXT</code> are accepted
New enums <code>SRC1_COLOR_WEBGL</code>, <code>SRC1_ALPHA_WEBGL</code>,
<code>ONE_MINUS_SRC1_COLOR_WEBGL</code>, and <code>ONE_MINUS_SRC1_ALPHA_WEBGL</code> are accepted
as the <code>src</code> and <code>dst</code> parameters.
</p>
<p>
Expand All @@ -90,8 +98,8 @@ interface EXT_blend_func_extended {
<param name="srcAlpha" type="GLenum"/>
<param name="dstAlpha" type="GLenum"/>
<p>
New enums <code>SRC1_COLOR_EXT</code>, <code>SRC1_ALPHA_EXT</code>,
<code>ONE_MINUS_SRC1_COLOR_EXT</code>, and <code>ONE_MINUS_SRC1_ALPHA_EXT</code>
New enums <code>SRC1_COLOR_WEBGL</code>, <code>SRC1_ALPHA_WEBGL</code>,
<code>ONE_MINUS_SRC1_COLOR_WEBGL</code>, and <code>ONE_MINUS_SRC1_ALPHA_WEBGL</code>
are accepted as the <code>srcRGB</code>, <code>dstRGB</code>, <code>srcAlpha</code>,
and <code>dstAlpha</code> parameters.
</p>
Expand All @@ -106,9 +114,9 @@ interface EXT_blend_func_extended {
<param name="src" type="GLenum"/>
<param name="dst" type="GLenum"/>
When <a href="../../OES_draw_buffers_indexed/">OES_draw_buffers_indexed</a> is enabled,
new enums <code>SRC1_COLOR_EXT</code>,
<code>SRC1_ALPHA_EXT</code>, <code>ONE_MINUS_SRC1_COLOR_EXT</code>, and
<code>ONE_MINUS_SRC1_ALPHA_EXT</code> are accepted as the <code>src</code> and <code>dst</code>
new enums <code>SRC1_COLOR_WEBGL</code>,
<code>SRC1_ALPHA_WEBGL</code>, <code>ONE_MINUS_SRC1_COLOR_WEBGL</code>, and
<code>ONE_MINUS_SRC1_ALPHA_WEBGL</code> are accepted as the <code>src</code> and <code>dst</code>
parameters.
</function>

Expand All @@ -119,23 +127,23 @@ interface EXT_blend_func_extended {
<param name="srcAlpha" type="GLenum"/>
<param name="dstAlpha" type="GLenum"/>
When <a href="../../OES_draw_buffers_indexed/">OES_draw_buffers_indexed</a> is enabled,
new enums <code>SRC1_COLOR_EXT</code>,
<code>SRC1_ALPHA_EXT</code>, <code>ONE_MINUS_SRC1_COLOR_EXT</code>, and
<code>ONE_MINUS_SRC1_ALPHA_EXT</code> are accepted as the <code>srcRGB</code>,
new enums <code>SRC1_COLOR_WEBGL</code>,
<code>SRC1_ALPHA_WEBGL</code>, <code>ONE_MINUS_SRC1_COLOR_WEBGL</code>, and
<code>ONE_MINUS_SRC1_ALPHA_WEBGL</code> are accepted as the <code>srcRGB</code>,
<code>dstRGB</code>, <code>srcAlpha</code>, and <code>dstAlpha</code> parameters.
</function>

<function name="getParameter" type="any">
<param name="pname" type="GLenum"/>
<p>
New <code>MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT</code> enum is accepted as the <code>pname</code> parameter.
New <code>MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL</code> enum is accepted as the <code>pname</code> parameter.
</p>
<p>
The return type of this method depends on the parameter queried:
</p>
<table class="foo">
<tr><th>pname</th><th>returned type</th></tr>
<tr><td>MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT</td><td>GLint</td></tr>
<tr><td>MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL</td><td>GLint</td></tr>
</table>
</function>
</newtok>
Expand All @@ -144,5 +152,8 @@ interface EXT_blend_func_extended {
<revision date="2023/06/01">
<change>Initial Draft.</change>
</revision>
<revision date="2024/01/11">
<change>Changed prefix to WEBGL and promoted to Community Approved.</change>
</revision>
</history>
</draft>
</extension>
2 changes: 1 addition & 1 deletion sdk/tests/conformance/extensions/00_test_list.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
--min-version 1.0.3 --max-version 1.9.9 angle-instanced-arrays.html
--min-version 1.0.3 --max-version 1.9.9 angle-instanced-arrays-out-of-bounds.html
--min-version 1.0.4 --max-version 1.9.9 ext-blend-func-extended.html
--min-version 1.0.3 --max-version 1.9.9 ext-blend-minmax.html
--min-version 1.0.4 ext-clip-control.html
--min-version 1.0.4 ext-color-buffer-half-float.html
Expand Down Expand Up @@ -34,6 +33,7 @@
--min-version 1.0.3 --max-version 1.9.9 oes-texture-half-float-with-video.html
--min-version 1.0.2 --max-version 1.9.9 oes-element-index-uint.html
--min-version 1.0.4 --max-version 1.9.9 oes-fbo-render-mipmap.html
--min-version 1.0.4 --max-version 1.9.9 webgl-blend-func-extended.html
webgl-debug-renderer-info.html
webgl-debug-shaders.html
--min-version 1.0.4 webgl-compressed-texture-astc.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<html>
<head>
<meta charset="utf-8">
<title>WebGL 1.0 EXT_blend_func_extended Conformance Tests</title>
<title>WebGL 1.0 WEBGL_blend_func_extended Conformance Tests</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../js/js-test-pre.js"></script>
<script src="../../js/webgl-test-utils.js"></script>
Expand All @@ -20,7 +20,7 @@
<script>
var contextVersion = 1;
</script>
<script src="../../js/tests/ext-blend-func-extended.js"></script>
<script src="../../js/tests/webgl-blend-func-extended.js"></script>
<script src="../../js/js-test-post.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion sdk/tests/conformance2/extensions/00_test_list.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
--min-version 2.0.1 ext-blend-func-extended.html
ext-color-buffer-float.html
--min-version 2.0.1 ext-color-buffer-half-float.html
--min-version 2.0.1 ext-conservative-depth.html
Expand All @@ -22,6 +21,7 @@ promoted-extensions-in-shaders.html
--min-version 2.0.1 ovr_multiview2_timer_query.html
--min-version 2.0.1 ovr_multiview2_transform_feedback.html
--min-version 2.0.1 required-extensions.html
--min-version 2.0.1 webgl-blend-func-extended.html
--min-version 2.0.1 webgl-clip-cull-distance.html
--min-version 2.0.1 webgl-multi-draw-instanced-base-vertex-base-instance.html
--min-version 2.0.1 webgl-provoking-vertex.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<html>
<head>
<meta charset="utf-8">
<title>WebGL 2.0 EXT_blend_func_extended Conformance Tests</title>
<title>WebGL 2.0 WEBGL_blend_func_extended Conformance Tests</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../js/js-test-pre.js"></script>
<script src="../../js/webgl-test-utils.js"></script>
Expand All @@ -20,7 +20,7 @@
<script>
var contextVersion = 2;
</script>
<script src="../../js/tests/ext-blend-func-extended.js"></script>
<script src="../../js/tests/webgl-blend-func-extended.js"></script>
<script src="../../js/js-test-post.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use strict";
description("This test verifies the functionality of the EXT_blend_func_extended extension, if it is available.");
description("This test verifies the functionality of the WEBGL_blend_func_extended extension, if it is available.");

debug("");

Expand All @@ -10,7 +10,7 @@ var ext;
function runTestNoExtension() {
debug("");
debug("Testing getParameter without the extension");
shouldBeNull("gl.getParameter(0x88FC /* MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT */)");
shouldBeNull("gl.getParameter(0x88FC /* MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL */)");
wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "parameter unknown");
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be no errors");

Expand All @@ -31,10 +31,10 @@ function runTestNoExtension() {
debug("Testing SRC1 blend funcs without the extension");

const extFuncs = {
SRC1_COLOR_EXT: 0x88F9,
SRC1_ALPHA_EXT: 0x8589,
ONE_MINUS_SRC1_COLOR_EXT: 0x88FA,
ONE_MINUS_SRC1_ALPHA_EXT: 0x88FB
SRC1_COLOR_WEBGL: 0x88F9,
SRC1_ALPHA_WEBGL: 0x8589,
ONE_MINUS_SRC1_COLOR_WEBGL: 0x88FA,
ONE_MINUS_SRC1_ALPHA_WEBGL: 0x88FB
};

for (const func in extFuncs) {
Expand Down Expand Up @@ -78,17 +78,17 @@ function runTestNoExtension() {
function runEnumTests() {
debug("");
debug("Testing enums");
shouldBe("ext.SRC1_COLOR_EXT", "0x88F9");
shouldBe("ext.SRC1_ALPHA_EXT", "0x8589");
shouldBe("ext.ONE_MINUS_SRC1_COLOR_EXT", "0x88FA");
shouldBe("ext.ONE_MINUS_SRC1_ALPHA_EXT", "0x88FB");
shouldBe("ext.MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT", "0x88FC");
shouldBe("ext.SRC1_COLOR_WEBGL", "0x88F9");
shouldBe("ext.SRC1_ALPHA_WEBGL", "0x8589");
shouldBe("ext.ONE_MINUS_SRC1_COLOR_WEBGL", "0x88FA");
shouldBe("ext.ONE_MINUS_SRC1_ALPHA_WEBGL", "0x88FB");
shouldBe("ext.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL", "0x88FC");
}

function runQueryTests() {
debug("");
debug("Testing getParameter");
shouldBeGreaterThanOrEqual("gl.getParameter(ext.MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT)", "1");
shouldBeGreaterThanOrEqual("gl.getParameter(ext.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL)", "1");
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be no errors");

if (contextVersion == 1) {
Expand All @@ -109,10 +109,10 @@ function runQueryTests() {
}

const extFuncs = [
"SRC1_COLOR_EXT",
"SRC1_ALPHA_EXT",
"ONE_MINUS_SRC1_COLOR_EXT",
"ONE_MINUS_SRC1_ALPHA_EXT"
"SRC1_COLOR_WEBGL",
"SRC1_ALPHA_WEBGL",
"ONE_MINUS_SRC1_COLOR_WEBGL",
"ONE_MINUS_SRC1_ALPHA_WEBGL"
];

debug("");
Expand Down Expand Up @@ -306,7 +306,7 @@ function runMissingOutputsTests() {
debug("Test draw calls with missing fragment outputs");

wtu.setupUnitQuad(gl);
gl.blendFunc(gl.ONE, ext.SRC1_COLOR_EXT);
gl.blendFunc(gl.ONE, ext.SRC1_COLOR_WEBGL);

for (const enabled of [false, true]) {
if (enabled) {
Expand Down Expand Up @@ -437,10 +437,10 @@ function runDrawBuffersLimitTests() {
dbi.colorMaskiOES(1, false, false, false, false);

const extFuncs = [
"SRC1_COLOR_EXT",
"SRC1_ALPHA_EXT",
"ONE_MINUS_SRC1_COLOR_EXT",
"ONE_MINUS_SRC1_ALPHA_EXT"
"SRC1_COLOR_WEBGL",
"SRC1_ALPHA_WEBGL",
"ONE_MINUS_SRC1_COLOR_WEBGL",
"ONE_MINUS_SRC1_ALPHA_WEBGL"
];

for (const func of extFuncs) {
Expand Down Expand Up @@ -504,14 +504,14 @@ function runBlendingTests() {
gl.clearColor(1.0, 1.0, 1.0, 1.0);

gl.clear(gl.COLOR_BUFFER_BIT);
gl.blendFunc(gl.ONE, ext.SRC1_COLOR_EXT);
gl.blendFunc(gl.ONE, ext.SRC1_COLOR_WEBGL);
gl.uniform4f(uSrc0, 0.250, 0.375, 0.500, 0.625);
gl.uniform4f(uSrc1, 0.125, 0.125, 0.125, 0.125);
wtu.drawUnitQuad(gl);
wtu.checkCanvas(gl, [96, 128, 159, 191], "Multiply destination by SRC1 and add SRC0", 2);

gl.clear(gl.COLOR_BUFFER_BIT);
gl.blendFunc(ext.SRC1_COLOR_EXT, ext.ONE_MINUS_SRC1_COLOR_EXT);
gl.blendFunc(ext.SRC1_COLOR_WEBGL, ext.ONE_MINUS_SRC1_COLOR_WEBGL);
gl.uniform4f(uSrc0, 0.125, 0.125, 0.125, 0.125);
gl.uniform4f(uSrc1, 0.500, 0.375, 0.250, 0.125);
wtu.drawUnitQuad(gl);
Expand All @@ -528,8 +528,8 @@ function runTest() {
runTestNoExtension();
runShaderTests(false);

ext = gl.getExtension("EXT_blend_func_extended");
wtu.runExtensionSupportedTest(gl, "EXT_blend_func_extended", ext !== null);
ext = gl.getExtension("WEBGL_blend_func_extended");
wtu.runExtensionSupportedTest(gl, "WEBGL_blend_func_extended", ext !== null);

if (ext !== null) {
runEnumTests();
Expand All @@ -539,7 +539,7 @@ function runTest() {
runDrawBuffersLimitTests();
runBlendingTests();
} else {
testPassed("No EXT_blend_func_extended support -- this is legal");
testPassed("No WEBGL_blend_func_extended support -- this is legal");
}
}

Expand Down

0 comments on commit a1a6152

Please sign in to comment.