| 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <ratified href="EXT_shader_texture_lod/"> |
| 3 | <name>EXT_shader_texture_lod</name> |
| 4 | <contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL |
| 5 | working group</a> (public_webgl 'at' khronos.org) </contact> |
| 6 | |
| 7 | <contributors> |
| 8 | <contributor>Vladimir Vukicevic (vladimir 'at' mozilla.com)</contributor> |
| 9 | <contributor>Florian Boesch (pyalot 'at' gmail.com)</contributor> |
| 10 | <contributor>Members of the WebGL working group</contributor> |
| 11 | </contributors> |
| 12 | |
| 13 | <number>27</number> |
| 14 | |
| 15 | <depends> |
| 16 | <api version="1.0"/> |
| 17 | <core version="2.0"> |
| 18 | <glsl version="300 es"/> |
| 19 | </core> |
| 20 | </depends> |
| 21 | |
| 22 | <overview> |
| 23 | <mirrors href="http://www.khronos.org/registry/gles/extensions/EXT/EXT_shader_texture_lod.txt" |
| 24 | name="EXT_shader_texture_lod"> |
| 25 | </mirrors> |
| 26 | |
| 27 | <features> |
| 28 | <feature> |
| 29 | This extension adds additional texture functions to the |
| 30 | OpenGL ES Shading Language which provide the shader writer |
| 31 | with explicit control of LOD. |
| 32 | </feature> |
| 33 | <glsl extname="GL_EXT_shader_texture_lod"> |
| 34 | <stage type="fragment"/> |
| 35 | <function name="texture2DLodEXT" type="vec4"> |
| 36 | <param name="sampler" type="sampler2D" /> |
| 37 | <param name="coord" type="vec2" /> |
| 38 | <param name="lod" type="float" /> |
| 39 | </function> |
| 40 | <function name="texture2DProjLodEXT" type="vec4"> |
| 41 | <param name="sampler" type="sampler2D" /> |
| 42 | <param name="coord" type="vec3" /> |
| 43 | <param name="lod" type="float" /> |
| 44 | </function> |
| 45 | <function name="texture2DProjLodEXT" type="vec4"> |
| 46 | <param name="sampler" type="sampler2D" /> |
| 47 | <param name="coord" type="vec4" /> |
| 48 | <param name="lod" type="float" /> |
| 49 | </function> |
| 50 | <function name="textureCubeLodEXT" type="vec4"> |
| 51 | <param name="sampler" type="samplerCube" /> |
| 52 | <param name="coord" type="vec3" /> |
| 53 | <param name="lod" type="float" /> |
| 54 | </function> |
| 55 | <function name="texture2DGradEXT" type="vec4"> |
| 56 | <param name="sampler" type="sampler2D" /> |
| 57 | <param name="P" type="vec2" /> |
| 58 | <param name="dPdx" type="vec2" /> |
| 59 | <param name="dPdy" type="vec2" /> |
| 60 | </function> |
| 61 | <function name="texture2DProjGradEXT" type="vec4"> |
| 62 | <param name="sampler" type="sampler2D" /> |
| 63 | <param name="P" type="vec3" /> |
| 64 | <param name="dPdx" type="vec2" /> |
| 65 | <param name="dPdy" type="vec2" /> |
| 66 | </function> |
| 67 | <function name="texture2DProjGradEXT" type="vec4"> |
| 68 | <param name="sampler" type="sampler2D" /> |
| 69 | <param name="P" type="vec4" /> |
| 70 | <param name="dPdx" type="vec2" /> |
| 71 | <param name="dPdy" type="vec2" /> |
| 72 | </function> |
| 73 | <function name="textureCubeGradEXT" type="vec4"> |
| 74 | <param name="sampler" type="samplerCube" /> |
| 75 | <param name="P" type="vec3" /> |
| 76 | <param name="dPdx" type="vec3" /> |
| 77 | <param name="dPdy" type="vec3" /> |
| 78 | </function> |
| 79 | </glsl> |
| 80 | </features> |
| 81 | </overview> |
| 82 | |
| 83 | <idl xml:space="preserve"> |
| 84 | [NoInterfaceObject] |
| 85 | interface EXT_shader_texture_lod { |
| 86 | }; |
| 87 | </idl> |
| 88 | |
| 89 | <samplecode xml:space="preserve"> |
| 90 | <pre> |
| 91 | #extension GL_EXT_shader_texture_lod : enable |
| 92 | #extension GL_OES_standard_derivatives : enable |
| 93 | |
| 94 | uniform sampler2D myTexture; |
| 95 | varying vec2 texcoord; |
| 96 | |
| 97 | void main(){ |
| 98 | // avoids artifacts when wrapping texture coordinates |
| 99 | gl_FragColor = texture2DGradEXT(myTexture, mod(texcoord, vec2(0.1, 0.5)), dFdx(texcoord), dFdy(texcoord)); |
| 100 | } |
| 101 | </pre> |
| 102 | </samplecode> |
| 103 | |
| 104 | <history> |
| 105 | <revision date="2014/02/10"> |
| 106 | <change>Initial revision.</change> |
| 107 | </revision> |
| 108 | <revision date="2014/02/18"> |
| 109 | <change>Moved to draft.</change> |
| 110 | </revision> |
| 111 | <revision date="2014/06/27"> |
| 112 | <change>Moved to community approved after discussion on public_webgl list.</change> |
| 113 | </revision> |
| 114 | <revision date="2014/07/15"> |
| 115 | <change>Added NoInterfaceObject extended attribute.</change> |
| 116 | </revision> |
| 117 | <revision date="2014/11/07"> |
| 118 | <change>Corrected extension name to include GL_ prefix.</change> |
| 119 | </revision> |
| 120 | <revision date="2015/05/29"> |
| 121 | <change>Ratified by Khronos Board of Promoters.</change> |
| 122 | </revision> |
| 123 | </history> |
| 124 | </ratified> |