15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_shader_texture_lod
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_shader_texture_lod
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContributors
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Bill Licea-Kane
125bd8deadSopenharmony_ci    Evan Hart
135bd8deadSopenharmony_ci
145bd8deadSopenharmony_ci    and contributors to the arb-gl2 working groups, the product
155bd8deadSopenharmony_ci    of which provided the basis for this spec.
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ciContact
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ci    Bill Licea-Kane, ATI Research (bill 'at' ati.com)
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ciNotice
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ci    Copyright (c) 2009-2013 The Khronos Group Inc. Copyright terms at
245bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ciSpecification Update Policy
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
295bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
305bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
315bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
325bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
335bd8deadSopenharmony_ci    described in more detail at
345bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ciIP Status
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ci    No known IP issues.
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ciStatus
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    Complete. Approved by the ARB on May 13, 2009.
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ciVersion
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    Last Modified Date: April 13, 2011
475bd8deadSopenharmony_ci    Revision: 11
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ciNumber
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ci    ARB Extension #60
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ciDependencies
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci    This extension is written against the OpenGL 2.0 Specification.
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    This extension is written against The OpenGL Shading Language,
585bd8deadSopenharmony_ci    Language Version 1.10, Document Revision 59.
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ci    ARB_shader_objects is required.
615bd8deadSopenharmony_ci
625bd8deadSopenharmony_ci    This extension interacts with ATI_shader_texture_lod.
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ci    This extension interacts with ARB_texture_rectangle.
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    This extension interacts with EXT_texture_filter_anisotropic.
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ciOverview
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci    This extension adds additional texture functions to the
715bd8deadSopenharmony_ci    OpenGL Shading Language which provide the shader writer
725bd8deadSopenharmony_ci    with explicit control of LOD.
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci    Mipmap texture fetches and anisotropic texture fetches
755bd8deadSopenharmony_ci    require an implicit derivatives to calculate rho, lambda
765bd8deadSopenharmony_ci    and/or the line of anisotropy.  These implicit derivatives
775bd8deadSopenharmony_ci    will be undefined for texture fetches occurring inside
785bd8deadSopenharmony_ci    non-uniform control flow or for vertex shader texture
795bd8deadSopenharmony_ci    fetches, resulting in undefined texels.
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci    The additional texture functions introduced with
825bd8deadSopenharmony_ci    this extension provide explict control of LOD
835bd8deadSopenharmony_ci    (isotropic texture functions) or provide explicit
845bd8deadSopenharmony_ci    derivatives (anisotropic texture functions).
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ci    Anisotropic texture functions return defined texels
875bd8deadSopenharmony_ci    for mipmap texture fetches or anisotropic texture fetches,
885bd8deadSopenharmony_ci    even inside non-uniform control flow.  Isotropic texture
895bd8deadSopenharmony_ci    functions return defined texels for mipmap texture fetches,
905bd8deadSopenharmony_ci    even inside non-uniform control flow.  However, isotropic
915bd8deadSopenharmony_ci    texture functions return undefined texels for anisotropic
925bd8deadSopenharmony_ci    texture fetches.
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    The existing isotropic vertex texture functions:
955bd8deadSopenharmony_ci
965bd8deadSopenharmony_ci        texture1DLod,   texture1DProjLod,
975bd8deadSopenharmony_ci        texture2DLod,   texture2DProjLod,
985bd8deadSopenharmony_ci        texture3DLod,   texture3DProjLod,
995bd8deadSopenharmony_ci        textureCubeLod,
1005bd8deadSopenharmony_ci        shadow1DLod,    shadow1DProjLod,
1015bd8deadSopenharmony_ci        shadow2DLod,    shadow2DProjLod,
1025bd8deadSopenharmony_ci
1035bd8deadSopenharmony_ci    are added to the built-in functions for fragment shaders.
1045bd8deadSopenharmony_ci
1055bd8deadSopenharmony_ci    New anisotropic texture functions, providing explicit
1065bd8deadSopenharmony_ci    derivatives:
1075bd8deadSopenharmony_ci
1085bd8deadSopenharmony_ci        texture1DGradARB(         sampler1D sampler,
1095bd8deadSopenharmony_ci                                  float P, float dPdx, float dPdy );
1105bd8deadSopenharmony_ci        texture1DProjGradARB(     sampler1D sampler,
1115bd8deadSopenharmony_ci                                  vec2  P, float dPdx, float dPdy );
1125bd8deadSopenharmony_ci        texture1DProjGradARB(     sampler1D sampler,
1135bd8deadSopenharmony_ci                                  vec4  P, float dPdx, float dPdy );
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ci        texture2DGradARB(         sampler2D sampler,
1165bd8deadSopenharmony_ci                                  vec2  P, vec2  dPdx, vec2  dPdy );
1175bd8deadSopenharmony_ci        texture2DProjGradARB(     sampler2D sampler,
1185bd8deadSopenharmony_ci                                  vec3  P, vec2  dPdx, vec2  dPdy );
1195bd8deadSopenharmony_ci        texture2DProjGradARB(     sampler2D sampler,
1205bd8deadSopenharmony_ci                                  vec4  P, vec2  dPdx, vec2  dPdy );
1215bd8deadSopenharmony_ci
1225bd8deadSopenharmony_ci        texture3DGradARB(         sampler3D sampler,
1235bd8deadSopenharmony_ci                                  vec3  P, vec3  dPdx, vec3  dPdy );
1245bd8deadSopenharmony_ci        texture3DProjGradARB(     sampler3D sampler,
1255bd8deadSopenharmony_ci                                  vec4  P, vec3  dPdx, vec3  dPdy );
1265bd8deadSopenharmony_ci
1275bd8deadSopenharmony_ci        textureCubeGradARB(       samplerCube sampler,
1285bd8deadSopenharmony_ci                                  vec3  P, vec3  dPdx, vec3  dPdy );
1295bd8deadSopenharmony_ci
1305bd8deadSopenharmony_ci        shadow1DGradARB(          sampler1DShadow sampler,
1315bd8deadSopenharmony_ci                                  vec3  P, float dPdx, float dPdy );
1325bd8deadSopenharmony_ci        shadow1DProjGradARB(      sampler1DShadow sampler,
1335bd8deadSopenharmony_ci                                  vec4  P, float dPdx, float dPdy );
1345bd8deadSopenharmony_ci
1355bd8deadSopenharmony_ci        shadow2DGradARB(          sampler2DShadow sampler,
1365bd8deadSopenharmony_ci                                  vec3  P, vec2  dPdx, vec2  dPdy );
1375bd8deadSopenharmony_ci        shadow2DProjGradARB(      sampler2DShadow sampler,
1385bd8deadSopenharmony_ci                                  vec4  P, vec2  dPdx, vec2  dPdy );
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci
1415bd8deadSopenharmony_ci        texture2DRectGradARB(     sampler2DRect sampler,
1425bd8deadSopenharmony_ci                                  vec2  P, vec2  dPdx, vec2  dPdy );
1435bd8deadSopenharmony_ci        texture2DRectProjGradARB( sampler2DRect sampler,
1445bd8deadSopenharmony_ci                                  vec3  P, vec2  dPdx, vec2  dPdy );
1455bd8deadSopenharmony_ci        texture2DRectProjGradARB( sampler2DRect sampler,
1465bd8deadSopenharmony_ci                                  vec4  P, vec2  dPdx, vec2  dPdy );
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci        shadow2DRectGradARB(      sampler2DRectShadow sampler,
1495bd8deadSopenharmony_ci                                  vec3  P, vec2  dPdx, vec2  dPdy );
1505bd8deadSopenharmony_ci        shadow2DRectProjGradARB(  sampler2DRectShadow sampler,
1515bd8deadSopenharmony_ci                                  vec4  P, vec2  dPdx, vec2  dPdy );
1525bd8deadSopenharmony_ci
1535bd8deadSopenharmony_ci     are added to the built-in functions for vertex shaders
1545bd8deadSopenharmony_ci     and fragment shaders.
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ciNew Procedures and Functions
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci    None
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ciNew Tokens
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci    None
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation)
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci    None
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ci    In Section 3.8.8, replace the final paragraph on p. 171 with:
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ci    "Let s(x, y) be the function that associates an s texture coordinate
1735bd8deadSopenharmony_ci    with each set of window coordinates (x, y) that lie within a
1745bd8deadSopenharmony_ci    primitive;  define t(x, y) and r(x, y) analogously.  For a
1755bd8deadSopenharmony_ci    one-dimensional texture, define t(x, y) = 0 and r(x, y) = 0; for a
1765bd8deadSopenharmony_ci    two-dimensional texture, define r(x, y) = 0.
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci    Let u(x, y) = wt * s(x, y), v(x, y) = ht * t(x, y), and
1795bd8deadSopenharmony_ci    w(x, y) = dt * r(x, y), where wt, ht, and dt are as defined by equations
1805bd8deadSopenharmony_ci    3.15, 3.16, and 3.17 with ws, hs, and ds equal to the width, height,
1815bd8deadSopenharmony_ci    and depth of the image array whose level is levelbase.  However, for
1825bd8deadSopenharmony_ci    rectangular textures let u(x, y) = s(x, y), v(x, y) = t(x, y), and
1835bd8deadSopenharmony_ci    w(x, y) = r(x, y)."
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci    Let
1865bd8deadSopenharmony_ci        dUdx = wt*dSdx; dUdy = wt*dSdy;
1875bd8deadSopenharmony_ci        dVdx = ht*dTdx; dVdy = ht*dTdy;
1885bd8deadSopenharmony_ci        dWdx = dt*dRdx; dWdy = dt*dRdx;                       (3.21a)
1895bd8deadSopenharmony_ci
1905bd8deadSopenharmony_ci    where dSdx indicates the derivative of s with respect to window x,
1915bd8deadSopenharmony_ci    and similarly for the other derivatives, and
1925bd8deadSopenharmony_ci
1935bd8deadSopenharmony_ci    For a rectangular texture, let
1945bd8deadSopenharmony_ci        dUdx = dSdx; dUdy = dSdy;
1955bd8deadSopenharmony_ci        dVdx = dTdx; dVdy = dTdy;
1965bd8deadSopenharmony_ci        dWdx = 0.0;                                           (3.21b)
1975bd8deadSopenharmony_ci
1985bd8deadSopenharmony_ci    For a polygon, rho is given at a fragment with window coordinates
1995bd8deadSopenharmony_ci    (x, y) by
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci        rho = max (
2025bd8deadSopenharmony_ci              sqrt(dUdx*dUdx + dVdx*dVdx + dWdx*dWdx),
2035bd8deadSopenharmony_ci              sqrt(dUdy*dUdy + dVdy*dVdy + dWdy*dWdy)
2045bd8deadSopenharmony_ci              );                                              (3.21c)"
2055bd8deadSopenharmony_ci
2065bd8deadSopenharmony_ci
2075bd8deadSopenharmony_ci
2085bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment Operations
2095bd8deadSopenharmony_ciand the Frame Buffer)
2105bd8deadSopenharmony_ci
2115bd8deadSopenharmony_ci    None
2125bd8deadSopenharmony_ci
2135bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions)
2145bd8deadSopenharmony_ci
2155bd8deadSopenharmony_ci    None
2165bd8deadSopenharmony_ci
2175bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 2.0 Specification (State and State
2185bd8deadSopenharmony_ciRequests)
2195bd8deadSopenharmony_ci
2205bd8deadSopenharmony_ci    None
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 2.0 Specification (Invariance)
2235bd8deadSopenharmony_ci
2245bd8deadSopenharmony_ci    None
2255bd8deadSopenharmony_ci
2265bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ci    None
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ci
2315bd8deadSopenharmony_ciAdditions to version 1.10.59 of the OpenGL Shading Language Specification
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci    "A new preprocessor #define is added to the OpenGL Shading Language:
2345bd8deadSopenharmony_ci
2355bd8deadSopenharmony_ci        #define GL_ARB_shader_texture_lod 1
2365bd8deadSopenharmony_ci
2375bd8deadSopenharmony_ci    Including the following line in a shader can be used to control the
2385bd8deadSopenharmony_ci    language features described in this extension:
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci        #extension GL_ARB_shader_texture_lod : <behavior>
2415bd8deadSopenharmony_ci
2425bd8deadSopenharmony_ci    Where <behavior> is as specified in section 3.3."
2435bd8deadSopenharmony_ci
2445bd8deadSopenharmony_ci
2455bd8deadSopenharmony_ciAdditions to Chapter 8 of version 1.10.59 of the OpenGL Shading Language
2465bd8deadSopenharmony_ciSpecification
2475bd8deadSopenharmony_ci
2485bd8deadSopenharmony_ci
2495bd8deadSopenharmony_ci    8.7  Texture Lookup Functions
2505bd8deadSopenharmony_ci
2515bd8deadSopenharmony_ci    Delete the last paragraph, and replace with:
2525bd8deadSopenharmony_ci
2535bd8deadSopenharmony_ci    "For the "Lod" functions, lod specifies lambda_base (see equation 3.18 in
2545bd8deadSopenharmony_ci    The OpenGL 2.0 Specification) and specifies dSdx, dTdx, dRdx = 0 and
2555bd8deadSopenharmony_ci    dSdy, dTdy, and dRdy = 0 (see equation 3.21a and 3.21b. in The OpenGL
2565bd8deadSopenharmony_ci    2.0 Specification).  The "Lod" functions are allowed in a vertex shader.
2575bd8deadSopenharmony_ci    If enabled by the preprocessor directive #extension, the "Lod" functions
2585bd8deadSopenharmony_ci    are also allowed in a fragment shader.
2595bd8deadSopenharmony_ci
2605bd8deadSopenharmony_ci    For the "Grad" functions, dPdx is the explicit derivative of P with respect
2615bd8deadSopenharmony_ci    to window x, and similarly dPdy with respect to window y. For the “ProjGrad”
2625bd8deadSopenharmony_ci    functions, dPdx is the explicit derivative of the projected P with respect
2635bd8deadSopenharmony_ci    to window x, and similarly for dPdy with respect to window y.  For a
2645bd8deadSopenharmony_ci    one-dimensional texture, dPdx and dPdy are float.  For a two-dimensional
2655bd8deadSopenharmony_ci    texture, dPdx and dPdy are vec2.  Otherwise, dPdx and dPdy are vec3.
2665bd8deadSopenharmony_ci
2675bd8deadSopenharmony_ci
2685bd8deadSopenharmony_ci
2695bd8deadSopenharmony_ci    Let
2705bd8deadSopenharmony_ci
2715bd8deadSopenharmony_ci        dSdx = dPdx.s;
2725bd8deadSopenharmony_ci        dSdy = dPdy.s;
2735bd8deadSopenharmony_ci
2745bd8deadSopenharmony_ci    and
2755bd8deadSopenharmony_ci
2765bd8deadSopenharmony_ci                / 0.0;    for one-dimensional texture
2775bd8deadSopenharmony_ci        dTdx = (
2785bd8deadSopenharmony_ci                \ dPdx.t; otherwise
2795bd8deadSopenharmony_ci
2805bd8deadSopenharmony_ci                / 0.0;    for one-dimensional texture
2815bd8deadSopenharmony_ci        dTdy = (
2825bd8deadSopenharmony_ci                \ dPdy.t; otherwise
2835bd8deadSopenharmony_ci
2845bd8deadSopenharmony_ci    and
2855bd8deadSopenharmony_ci                / 0.0;    for one-dimenstional or two-dimensional texture
2865bd8deadSopenharmony_ci        dRdx = (          (including rectangular texture)
2875bd8deadSopenharmony_ci                \ dPdx.p; otherwise
2885bd8deadSopenharmony_ci                          (including cubemap texture)
2895bd8deadSopenharmony_ci
2905bd8deadSopenharmony_ci                / 0.0;    for one dimensional or two-dimensional texture
2915bd8deadSopenharmony_ci        dRdy = (          (including rectangular texture)
2925bd8deadSopenharmony_ci                \ dPdy.p; otherwise
2935bd8deadSopenharmony_ci                          (including cubemap texture)
2945bd8deadSopenharmony_ci
2955bd8deadSopenharmony_ci    (See equation 3.21a and 3.21b in  The OpenGL 2.0 Specification).
2965bd8deadSopenharmony_ci
2975bd8deadSopenharmony_ci    If enabled by the preprocessor directive #extension, the "Grad" functions
2985bd8deadSopenharmony_ci    are allowed in vertex and fragment shaders.
2995bd8deadSopenharmony_ci
3005bd8deadSopenharmony_ci    All other texture functions may require implicit derivatives.  Implicit
3015bd8deadSopenharmony_ci    derivatives are undefined within non-uniform control flow or for vertex
3025bd8deadSopenharmony_ci    shader texture fetches."
3035bd8deadSopenharmony_ci
3045bd8deadSopenharmony_ci    Add the following entries to the texture function table:
3055bd8deadSopenharmony_ci
3065bd8deadSopenharmony_ci        texture1DGradARB(         sampler1D sampler,
3075bd8deadSopenharmony_ci                                  float P, float dPdx, float dPdy );
3085bd8deadSopenharmony_ci        texture1DProjGradARB(     sampler1D sampler,
3095bd8deadSopenharmony_ci                                  vec2  P, float dPdx, float dPdy );
3105bd8deadSopenharmony_ci        texture1DProjGradARB(     sampler1D sampler,
3115bd8deadSopenharmony_ci                                  vec4  P, float dPdx, float dPdy );
3125bd8deadSopenharmony_ci
3135bd8deadSopenharmony_ci        texture2DGradARB(         sampler2D sampler,
3145bd8deadSopenharmony_ci                                  vec2  P, vec2  dPdx, vec2  dPdy );
3155bd8deadSopenharmony_ci        texture2DProjGradARB(     sampler2D sampler,
3165bd8deadSopenharmony_ci                                  vec3  P, vec2  dPdx, vec2  dPdy );
3175bd8deadSopenharmony_ci        texture2DProjGradARB(     sampler2D sampler,
3185bd8deadSopenharmony_ci                                  vec4  P, vec2  dPdx, vec2  dPdy );
3195bd8deadSopenharmony_ci
3205bd8deadSopenharmony_ci        texture3DGradARB(         sampler3D sampler,
3215bd8deadSopenharmony_ci                                  vec3  P, vec3  dPdx, vec3  dPdy );
3225bd8deadSopenharmony_ci        texture3DProjGradARB(     sampler3D sampler,
3235bd8deadSopenharmony_ci                                  vec4  P, vec3  dPdx, vec3  dPdy );
3245bd8deadSopenharmony_ci
3255bd8deadSopenharmony_ci        textureCubeGradARB(       samplerCube sampler,
3265bd8deadSopenharmony_ci                                  vec3  P, vec3  dPdx, vec3  dPdy );
3275bd8deadSopenharmony_ci
3285bd8deadSopenharmony_ci        shadow1DGradARB(          sampler1DShadow sampler,
3295bd8deadSopenharmony_ci                                  vec3  P, float dPdx, float dPdy );
3305bd8deadSopenharmony_ci        shadow1DProjGradARB(      sampler1DShadow sampler,
3315bd8deadSopenharmony_ci                                  vec4  P, float dPdx, float dPdy );
3325bd8deadSopenharmony_ci
3335bd8deadSopenharmony_ci        shadow2DGradARB(          sampler2DShadow sampler,
3345bd8deadSopenharmony_ci                                  vec3  P, vec2  dPdx, vec2  dPdy );
3355bd8deadSopenharmony_ci        shadow2DProjGradARB(      sampler2DShadow sampler,
3365bd8deadSopenharmony_ci                                  vec4  P, vec2  dPdx, vec2  dPdy );
3375bd8deadSopenharmony_ci
3385bd8deadSopenharmony_ci
3395bd8deadSopenharmony_ci        texture2DRectGradARB(     sampler2DRect sampler,
3405bd8deadSopenharmony_ci                                  vec2  P, vec2  dPdx, vec2  dPdy );
3415bd8deadSopenharmony_ci        texture2DRectProjGradARB( sampler2DRect sampler,
3425bd8deadSopenharmony_ci                                  vec3  P, vec2  dPdx, vec2  dPdy );
3435bd8deadSopenharmony_ci        texture2DRectProjGradARB( sampler2DRect sampler,
3445bd8deadSopenharmony_ci                                  vec4  P, vec2  dPdx, vec2  dPdy );
3455bd8deadSopenharmony_ci
3465bd8deadSopenharmony_ci        shadow2DRectGradARB(      sampler2DRectShadow sampler,
3475bd8deadSopenharmony_ci                                  vec3  P, vec2  dPdx, vec2  dPdy );
3485bd8deadSopenharmony_ci        shadow2DRectProjGradARB(  sampler2DRectShadow sampler,
3495bd8deadSopenharmony_ci                                  vec4  P, vec2  dPdx, vec2  dPdy );
3505bd8deadSopenharmony_ci
3515bd8deadSopenharmony_ci
3525bd8deadSopenharmony_ciInteractions with ATI_texture_shader_lod
3535bd8deadSopenharmony_ci
3545bd8deadSopenharmony_ci    Each texture function added to the texture function table
3555bd8deadSopenharmony_ci    by ATI_texture_shader_lod is suffixed with "_ATI".
3565bd8deadSopenharmony_ci
3575bd8deadSopenharmony_ci    The equivalent texture functions added to the texture
3585bd8deadSopenharmony_ci    function table by this extension are suffixed with "GradARB".
3595bd8deadSopenharmony_ci
3605bd8deadSopenharmony_ci    It is anticipated that this extension might get promoted
3615bd8deadSopenharmony_ci    to core.  The promoted texture functions added to the
3625bd8deadSopenharmony_ci    texture function table would then be suffixed with "Grad".
3635bd8deadSopenharmony_ci
3645bd8deadSopenharmony_ci    Note that ATI_texture_shader_lod does not contain the
3655bd8deadSopenharmony_ci    interactions with ARB_texture_rectangle and EXT_texture_anisotropic.
3665bd8deadSopenharmony_ci    Nor does it overload the texture2DRect and shadow2DRect functions.
3675bd8deadSopenharmony_ci    This extension is a slight superset of ATI_texture_shader_lod.
3685bd8deadSopenharmony_ci
3695bd8deadSopenharmony_ciInteractions with ARB_texture_rectangle
3705bd8deadSopenharmony_ci
3715bd8deadSopenharmony_ci    If ARB_texture_rectangle is not supported, delete references
3725bd8deadSopenharmony_ci    to rectangular textures and references to equation 3.21b.
3735bd8deadSopenharmony_ci
3745bd8deadSopenharmony_ciInteractions with EXT_texture_anisotropic
3755bd8deadSopenharmony_ci
3765bd8deadSopenharmony_ci    The Lod functions set the derivatives ds/dx, dt/dx, dr/dx,
3775bd8deadSopenharmony_ci    dx/dy, dt/dy, and dr/dy = 0.  Therefore Rhox and Rhoy = 0
3785bd8deadSopenharmony_ci    0, Rhomax and Rhomin = 0.
3795bd8deadSopenharmony_ci
3805bd8deadSopenharmony_ciIssues
3815bd8deadSopenharmony_ci
3825bd8deadSopenharmony_ci    (1) What should this extension be called?
3835bd8deadSopenharmony_ci
3845bd8deadSopenharmony_ci    RESOLVED:  ARB_shader_texture_lod
3855bd8deadSopenharmony_ci
3865bd8deadSopenharmony_ci    (2) There are several existing built-in functions we
3875bd8deadSopenharmony_ci    could use.  Should we use them, and do we need to
3885bd8deadSopenharmony_ci    name decorate them with suffix _ARB?
3895bd8deadSopenharmony_ci
3905bd8deadSopenharmony_ci    It makes sense to use the existing built-ins suffixed
3915bd8deadSopenharmony_ci    with "Lod."  We will simply drop the restriction that
3925bd8deadSopenharmony_ci    they are allowed only in the vertex shader.
3935bd8deadSopenharmony_ci
3945bd8deadSopenharmony_ci    Since this extension simply extends the scope of
3955bd8deadSopenharmony_ci    the functions, I don't think we need to suffix with _ARB.
3965bd8deadSopenharmony_ci
3975bd8deadSopenharmony_ci    RESOLVED:  Yes, use existing "Lod" built-in names without
3985bd8deadSopenharmony_ci    an _ARB suffix.
3995bd8deadSopenharmony_ci
4005bd8deadSopenharmony_ci
4015bd8deadSopenharmony_ci    (3) Should we add additional texture functions with derivative
4025bd8deadSopenharmony_ci    built-ins?
4035bd8deadSopenharmony_ci
4045bd8deadSopenharmony_ci    There are two approaches.
4055bd8deadSopenharmony_ci
4065bd8deadSopenharmony_ci    Existing texture functions could be overloaded to
4075bd8deadSopenharmony_ci    accept optional derivatives.  (Similar to the Lod bias
4085bd8deadSopenharmony_ci    texture functions.)  These names *should* probably
4095bd8deadSopenharmony_ci    be name decorated with the suffix ARB."
4105bd8deadSopenharmony_ci
4115bd8deadSopenharmony_ci    New texture functions suffixed with GradARB
4125bd8deadSopenharmony_ci    could be added.
4135bd8deadSopenharmony_ci
4145bd8deadSopenharmony_ci    The advantage of overloading the existing functions
4155bd8deadSopenharmony_ci    is it reduces the plethora of texture function names.
4165bd8deadSopenharmony_ci
4175bd8deadSopenharmony_ci    The disadvantage of overloading the existing functions
4185bd8deadSopenharmony_ci    is that not all of the existing texture functions
4195bd8deadSopenharmony_ci    make sense with explicit derivatives.  (Example,
4205bd8deadSopenharmony_ci    projective texture fetch with explict derivatives.)
4215bd8deadSopenharmony_ci
4225bd8deadSopenharmony_ci    We have two sets of precedent here.  The existing absolute
4235bd8deadSopenharmony_ci    LOD texture functions use explicit name decoration.
4245bd8deadSopenharmony_ci    The existing LOD bias texture functions use overloading.
4255bd8deadSopenharmony_ci
4265bd8deadSopenharmony_ci    RESOLVED:  We will use existing built-in texture functions
4275bd8deadSopenharmony_ci    suffixed with "Lod" *WITHOUT* name decoration for absolute
4285bd8deadSopenharmony_ci    LOD functions.
4295bd8deadSopenharmony_ci
4305bd8deadSopenharmony_ci    We will use existing built-in texture functions suffixed with
4315bd8deadSopenharmony_ci    GradARB for derivatives.
4325bd8deadSopenharmony_ci
4335bd8deadSopenharmony_ci    We establish a precedent that new texture functions
4345bd8deadSopenharmony_ci    will have explicit names.  The existing LOD bias texture
4355bd8deadSopenharmony_ci    functions are exceptions to the precedent.
4365bd8deadSopenharmony_ci
4375bd8deadSopenharmony_ci    (4) What is done with the vec3 dPdx and vec3 dPdy for
4385bd8deadSopenharmony_ci    cube map texture fetches?
4395bd8deadSopenharmony_ci
4405bd8deadSopenharmony_ci    For cube maps, it is incorrect to simply say "dPdx
4415bd8deadSopenharmony_ci    specificies ds/dx, dt/dx, and dr/dx, and dPdy specifies
4425bd8deadSopenharmony_ci    ds/dy, dt/dy and dr/dy (see equation 3.21a in The
4435bd8deadSopenharmony_ci    OpenGL 2.0 Specification)."
4445bd8deadSopenharmony_ci
4455bd8deadSopenharmony_ci    This is currently tough to specify given the core specification.
4465bd8deadSopenharmony_ci
4475bd8deadSopenharmony_ci    3.8.6 covers cube map face selection and transformation of
4485bd8deadSopenharmony_ci    the incoming rx, ry, rz to s and t.
4495bd8deadSopenharmony_ci
4505bd8deadSopenharmony_ci    3.8.8 covers derivatives, and states:
4515bd8deadSopenharmony_ci
4525bd8deadSopenharmony_ci    "Let s(x, y) be the function that associates an s texture
4535bd8deadSopenharmony_ci    coordinate with each set of window coordinates (x, y) that
4545bd8deadSopenharmony_ci    lie within a primitive; define t(x, y) and r(x, y) analogously."
4555bd8deadSopenharmony_ci
4565bd8deadSopenharmony_ci    Because of the cube mape face selection of 3.8.6, s(x, y)
4575bd8deadSopenharmony_ci    and t(x, y) may be discontinuous within a primitive.  A discontinuous
4585bd8deadSopenharmony_ci    function has undefined derivatives at the discontinuity.  (This
4595bd8deadSopenharmony_ci    discontinuity occurs at the cube map edges.)
4605bd8deadSopenharmony_ci
4615bd8deadSopenharmony_ci    The core spec is silent on how this discontinuity may be resolved.
4625bd8deadSopenharmony_ci    Nor does the core spec provide an alternative method for calculating
4635bd8deadSopenharmony_ci    rho given the continuous original rx, ry, rz, and their well
4645bd8deadSopenharmony_ci    specified derivatives (dPdx and dPdy).
4655bd8deadSopenharmony_ci
4665bd8deadSopenharmony_ci    The changes required to the core spec are substantial and may
4675bd8deadSopenharmony_ci    require much discussion on the tradeoffs between tightly
4685bd8deadSopenharmony_ci    specifying a method and providing sufficient freedom for implementers.
4695bd8deadSopenharmony_ci
4705bd8deadSopenharmony_ci    RESOLVED:  For now, we will leave this as unspecified.
4715bd8deadSopenharmony_ci    Implementors are cautioned to take sufficient steps so
4725bd8deadSopenharmony_ci    that the calculation of rho based on explicit dPdx
4735bd8deadSopenharmony_ci    and dPdy provides comparable quality to the existing
4745bd8deadSopenharmony_ci    implicit derivative methods.
4755bd8deadSopenharmony_ci
4765bd8deadSopenharmony_ci    (5) Should the projective versions of the anisotropic texture
4775bd8deadSopenharmony_ci    functions be added?
4785bd8deadSopenharmony_ci
4795bd8deadSopenharmony_ci    ATI_shader_texture_lod resolved issue 3 to use overloaded
4805bd8deadSopenharmony_ci    functions (opposite of the way issue 3 is resolved here),
4815bd8deadSopenharmony_ci    including overloading the projective texture functions.
4825bd8deadSopenharmony_ci    We have insufficient feedback to permit removing them in this
4835bd8deadSopenharmony_ci    extension.  We err on the side of caution and keep them.
4845bd8deadSopenharmony_ci    This extension is therefore a functional equivalent to
4855bd8deadSopenharmony_ci    ATI_shader_texture_lod.  (Slight superset, see issue 6.)
4865bd8deadSopenharmony_ci
4875bd8deadSopenharmony_ci    RESOLVED:  Add them since ATI_shader_texture_lod introduced
4885bd8deadSopenharmony_ci    overloaded versions.
4895bd8deadSopenharmony_ci
4905bd8deadSopenharmony_ci    (6) Should anisotropic rectangular texture functions be added?
4915bd8deadSopenharmony_ci
4925bd8deadSopenharmony_ci    Even though derivatives are not required for Lod selection
4935bd8deadSopenharmony_ci    for rectangular textures (there is only the baselevel for
4945bd8deadSopenharmony_ci    rectangular textures) the derivatives are required for
4955bd8deadSopenharmony_ci    anisotropic texture fetches.  (Perhaps
4965bd8deadSopenharmony_ci    ARB_texture_rectangle should have an interaction with
4975bd8deadSopenharmony_ci    EXT_texture_anisotropic clarifying this.)
4985bd8deadSopenharmony_ci
4995bd8deadSopenharmony_ci    ATI_shader_texture_lod is silent on these interactions.
5005bd8deadSopenharmony_ci    Adding the interactions and functions makes this extension
5015bd8deadSopenharmony_ci    a slight superset of ATI_shader_texture_lod.
5025bd8deadSopenharmony_ci
5035bd8deadSopenharmony_ci    RESOLVED:  Add them.
5045bd8deadSopenharmony_ci
5055bd8deadSopenharmony_ci    (7) How are ProjGrad functions handled?
5065bd8deadSopenharmony_ci
5075bd8deadSopenharmony_ci    The dPdx and dPdy derivatives are of the projected P.  The shader
5085bd8deadSopenharmony_ci    writer is responsible for this projection.  That is, for a 2D
5095bd8deadSopenharmony_ci    texture, dPdx = dFdx( P.st/P.q );  dPdy = dFdy( P.st/P.q );
5105bd8deadSopenharmony_ci
5115bd8deadSopenharmony_ciRevision History:
5125bd8deadSopenharmony_ci
5135bd8deadSopenharmony_ci10 - 2011-04-13 (Jon Leech)
5145bd8deadSopenharmony_ci    * Remove nonexistent textureCubProjLod from list of existing
5155bd8deadSopenharmony_ci      isotropic vertex texture functions (Khronos Bug 7205).
5165bd8deadSopenharmony_ci
5175bd8deadSopenharmony_ci9 - 2010-12-09 (Jon Leech)
5185bd8deadSopenharmony_ci    * Corrected typos where 1D texture functions were specified
5195bd8deadSopenharmony_ci      as taking sampler2D parameters (Khronos Bug 7008).
5205bd8deadSopenharmony_ci
5215bd8deadSopenharmony_ci8 - 2009-05-24 (Jon Leech)
5225bd8deadSopenharmony_ci    * Added to the Registry
5235bd8deadSopenharmony_ci    * Corrected minor typos
5245bd8deadSopenharmony_ci
5255bd8deadSopenharmony_ci7 - 2007-08-22
5265bd8deadSopenharmony_ci    * Shipping status.
5275bd8deadSopenharmony_ci
5285bd8deadSopenharmony_ci6 - 2006-07-06
5295bd8deadSopenharmony_ci    * Clarified ProjGrad.
5305bd8deadSopenharmony_ci    * Added issue 7.
5315bd8deadSopenharmony_ci    * Clarified cubemap.
5325bd8deadSopenharmony_ci
5335bd8deadSopenharmony_ci5 - 2006-06-08
5345bd8deadSopenharmony_ci    * u(x,y),v(x,y) and w(x,y) are used for wrap calculations.
5355bd8deadSopenharmony_ci      Their definitions (with ARB_texture_rectangle interaction)
5365bd8deadSopenharmony_ci      are restored.
5375bd8deadSopenharmony_ci    * Clean up defined/undefined language of functions in
5385bd8deadSopenharmony_ci      overview.
5395bd8deadSopenharmony_ci
5405bd8deadSopenharmony_ci4 - 2006-05-25
5415bd8deadSopenharmony_ci    * Follow ASCII conventions.  See examples in core
5425bd8deadSopenharmony_ci      spec equations 3.23, 3.24, & 3.25 and EXT_texture_3D.
5435bd8deadSopenharmony_ci
5445bd8deadSopenharmony_ci3 - 2006-05-25
5455bd8deadSopenharmony_ci    * Add #extension and #define
5465bd8deadSopenharmony_ci    * Explicitly reference page/paragraph in core edits.
5475bd8deadSopenharmony_ci    * Rework texture function descriptions.  Add language
5485bd8deadSopenharmony_ci      to shading language spec that makes it clear that the
5495bd8deadSopenharmony_ci      extension must be enabled for the functions to be
5505bd8deadSopenharmony_ci      available.
5515bd8deadSopenharmony_ci
5525bd8deadSopenharmony_ci2 - 2006-05-25
5535bd8deadSopenharmony_ci    * Name changes.
5545bd8deadSopenharmony_ci    * Added interaction with ARB_texture_rectangle.
5555bd8deadSopenharmony_ci    * Added interaction with EXT_texture_anisotropic.
5565bd8deadSopenharmony_ci    * Clarified that implicit derivatives are undefined
5575bd8deadSopenharmony_ci      within non-uniform control flow and the vertex shader.
5585bd8deadSopenharmony_ci    * Relocated issues to the tail of the spec.
5595bd8deadSopenharmony_ci
5605bd8deadSopenharmony_ci1 - 2006-05-17
5615bd8deadSopenharmony_ci    Initial ARB version
562