| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<proposal href="proposals/WEBGL_blend_equation_advanced_coherent/"> |
| 3 |
<name>WEBGL_blend_equation_advanced_coherent</name> |
| 4 |
|
| 5 |
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL |
| 6 |
working group</a> (public_webgl 'at' khronos.org) </contact> |
| 7 |
|
| 8 |
<contributors> |
| 9 |
<contributor>Ashley Gullen (ashley at scirra dot com)</contributor> |
| 10 |
<contributor>Members of the WebGL working group</contributor> |
| 11 |
</contributors> |
| 12 |
|
| 13 |
<number>NN</number> |
| 14 |
|
| 15 |
<depends> |
| 16 |
<api version="1.0"/> |
| 17 |
</depends> |
| 18 |
|
| 19 |
<overview> |
| 20 |
<mirrors href="https://www.opengl.org/registry/specs/KHR/blend_equation_advanced.txt" |
| 21 |
name="KHR_blend_equation_advanced_coherent"> |
| 22 |
</mirrors> |
| 23 |
|
| 24 |
<div class="nonnormative"> |
| 25 |
<p>This extension exposes the KHR_blend_equation_advanced_coherent functionality to WebGL.</p> |
| 26 |
|
| 27 |
<p>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:</p> |
| 28 |
|
| 29 |
<ul> |
| 30 |
<li>"multiply": MULTIPLY_KHR</li> |
| 31 |
<li>"screen": SCREEN_KHR</li> |
| 32 |
<li>"overlay": OVERLAY_KHR</li> |
| 33 |
<li>"darken": DARKEN_KHR</li> |
| 34 |
<li>"lighten": LIGHTEN_KHR</li> |
| 35 |
<li>"color-dodge": COLORDODGE_KHR</li> |
| 36 |
<li>"color-burn": COLORBURN_KHR</li> |
| 37 |
<li>"hard-light": HARDLIGHT_KHR</li> |
| 38 |
<li>"soft-light": SOFTLIGHT_KHR</li> |
| 39 |
<li>"difference": DIFFERENCE_KHR</li> |
| 40 |
<li>"exclusion": EXCLUSION_KHR</li> |
| 41 |
<li>"hue": HSL_HUE_KHR</li> |
| 42 |
<li>"saturation": HSL_SATURATION_KHR</li> |
| 43 |
<li>"color": HSL_COLOR_KHR</li> |
| 44 |
<li>"luminosity": HSL_LUMINOSITY_KHR</li> |
| 45 |
</ul> |
| 46 |
|
| 47 |
<p>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.</p> |
| 48 |
|
| 49 |
<p>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.</p> |
| 50 |
</div> |
| 51 |
|
| 52 |
<features> |
| 53 |
<feature>The <code>blendEquation</code> entry point is extended to accept the enums in the IDL below</feature> |
| 54 |
</features> |
| 55 |
</overview> |
| 56 |
|
| 57 |
<idl xml:space="preserve"> |
| 58 |
[NoInterfaceObject] |
| 59 |
interface WEBGL_blend_equation_advanced_coherent { |
| 60 |
const GLenum MULTIPLY = 0x9294; |
| 61 |
const GLenum SCREEN = 0x9295; |
| 62 |
const GLenum OVERLAY = 0x9296; |
| 63 |
const GLenum DARKEN = 0x9297; |
| 64 |
const GLenum LIGHTEN = 0x9298; |
| 65 |
const GLenum COLORDODGE = 0x9299; |
| 66 |
const GLenum COLORBURN = 0x929A; |
| 67 |
const GLenum HARDLIGHT = 0x929B; |
| 68 |
const GLenum SOFTLIGHT = 0x929C; |
| 69 |
const GLenum DIFFERENCE = 0x929E; |
| 70 |
const GLenum EXCLUSION = 0x92A0; |
| 71 |
const GLenum HSL_HUE = 0x92AD; |
| 72 |
const GLenum HSL_SATURATION = 0x92AE; |
| 73 |
const GLenum HSL_COLOR = 0x92AF; |
| 74 |
const GLenum HSL_LUMINOSITY = 0x92B0; |
| 75 |
}; |
| 76 |
</idl> |
| 77 |
|
| 78 |
<security/> |
| 79 |
|
| 80 |
<ipstatus/> |
| 81 |
|
| 82 |
<additions/> |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
<errors/> |
| 87 |
|
| 88 |
<newstate/> |
| 89 |
|
| 90 |
<newimplstate/> |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
<samplecode xml:space="preserve"> |
| 95 |
|
| 96 |
<pre> |
| 97 |
var ext = gl.getExtension("WEBGL_blend_equation_advanced_coherent"); |
| 98 |
gl.blendEquation(ext.MULTIPLY); |
| 99 |
gl.getParameter(gl.BLEND_EQUATION) == ext.MULTIPLY; |
| 100 |
</pre> |
| 101 |
</samplecode> |
| 102 |
|
| 103 |
<tests/> |
| 104 |
|
| 105 |
<issues/> |
| 106 |
|
| 107 |
<history> |
| 108 |
|
| 109 |
<revision date="2018/09/13"> |
| 110 |
<change>Forked from WEBGL_blend_equation_advanced to specify only the coherent variant</change> |
| 111 |
</revision> |
| 112 |
|
| 113 |
<revision date="2018/08/23"> |
| 114 |
<change>Converted to extension XML format</change> |
| 115 |
</revision> |
| 116 |
|
| 117 |
<revision date="2018/08/21"> |
| 118 |
<change>Revised description</change> |
| 119 |
</revision> |
| 120 |
|
| 121 |
<revision date="2015/05/26"> |
| 122 |
<change>Original draft as a TXT file</change> |
| 123 |
</revision> |
| 124 |
</history> |
| 125 |
</proposal> |