15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_derivative_control 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_derivative_control 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci John Kessenich (cepheus 'at' frii.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Bill Licea-Kane, Qualcomm 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ciNotice 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ci Copyright (c) 2014 The Khronos Group Inc. Copyright terms at 205bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ciSpecification Update Policy 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 255bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 265bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 275bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 285bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 295bd8deadSopenharmony_ci described in more detail at 305bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciStatus 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci Complete. 355bd8deadSopenharmony_ci Approved by the ARB on June 26, 2014. 365bd8deadSopenharmony_ci Ratified by the Khronos Board of Promoters on August 7, 2014. 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ciVersion 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci Last Modified Date: 7-Aug-2014 415bd8deadSopenharmony_ci Revision: 3 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ciNumber 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci ARB Extension #163 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ciDependencies 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ci This extension is written against the GLSL 4.40 Specification. 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ci OpenGL 4.0 and GLSL 4.00 or later are required. 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ciOverview 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ci This extension provides control over the spacial granularity at which the 565bd8deadSopenharmony_ci underlying implementation computes derivatives. 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci For example, for the coarse-granularity derivative, a single x derivative 595bd8deadSopenharmony_ci could be computed for each 2x2 group of pixels, using that same derivative 605bd8deadSopenharmony_ci value for all 4 pixels. For the fine-granularity derivative, two 615bd8deadSopenharmony_ci derivatives could be computed for each 2x2 group of pixels; one for the top 625bd8deadSopenharmony_ci row and one for the bottom row. Implementations vary somewhat on how this 635bd8deadSopenharmony_ci is done. 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci To select the coarse derivative, use: 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ci dFdxCoarse(p) 685bd8deadSopenharmony_ci dFdyCoarse(p) 695bd8deadSopenharmony_ci fwidthCoarse(p) 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci To select the fine derivative, use: 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci dFdxFine(p) 745bd8deadSopenharmony_ci dFdyFine(p) 755bd8deadSopenharmony_ci fwidthFine(p) 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci To select which ever is "better" (based on performance, API hints, or other 785bd8deadSopenharmony_ci factors), use: 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ci dFdx(p) 815bd8deadSopenharmony_ci dFdy(p) 825bd8deadSopenharmony_ci fwidth(p) 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci This last set is the set of previously existing built-ins for derivatives, 855bd8deadSopenharmony_ci and continues to work in a backward compatible way. 865bd8deadSopenharmony_ci 875bd8deadSopenharmony_ciIP Status 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci No known IP claims. 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ciNew Procedures and Functions 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci None. 945bd8deadSopenharmony_ci 955bd8deadSopenharmony_ciNew Tokens 965bd8deadSopenharmony_ci 975bd8deadSopenharmony_ci None. 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ciModifications to the OpenGL Specification 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ci None. 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ciAdditions to the OpenGL Shading Language 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci Including the following line in a shader can be used to control the 1065bd8deadSopenharmony_ci language features described in this extension: 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci #extension GL_ARB_derivative_control : <behavior> 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci where <behavior> is as specified in section 3.3. 1115bd8deadSopenharmony_ci 1125bd8deadSopenharmony_ci New preprocessor #defines are added to the OpenGL Shading Language: 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci #define GL_ARB_derivative_control 1 1155bd8deadSopenharmony_ci 1165bd8deadSopenharmony_ciSection 4.3.3 Constant Expressions 1175bd8deadSopenharmony_ci 1185bd8deadSopenharmony_ci Update the following sentence: 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci "The following built-in functions must return 0 when evaluated with an 1215bd8deadSopenharmony_ci argument that is a constant expression. 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci dFdx 1245bd8deadSopenharmony_ci dFdy 1255bd8deadSopenharmony_ci fwidth 1265bd8deadSopenharmony_ci dFdxCoarse 1275bd8deadSopenharmony_ci dFdyCoarse 1285bd8deadSopenharmony_ci fwidthCoarse 1295bd8deadSopenharmony_ci dFdxFine 1305bd8deadSopenharmony_ci dFdyFine 1315bd8deadSopenharmony_ci fwidthFine" 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ciSection 8.13.1 Derivative Functions 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ci After "dFdy is approximated similarly, with y replacing x.", add the 1365bd8deadSopenharmony_ci following: 1375bd8deadSopenharmony_ci 1385bd8deadSopenharmony_ci "With multi-sample rasterization, for any given fragment or sample, 1395bd8deadSopenharmony_ci either neighboring fragments or samples may be considered. 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci "It is typical to consider a 2x2 square of fragments or samples, and 1425bd8deadSopenharmony_ci compute independent dFdxFine per row and independent dFdyFine per column, 1435bd8deadSopenharmony_ci while computing only a single dFdxCoarse and a single dFdyCoarse for the 1445bd8deadSopenharmony_ci entire 2x2 square.Thus, all second-order coarse derivatives, e.g., 1455bd8deadSopenharmony_ci dFdxCoarse(dFdxCoarse(x)), may be 0, even for non-linear arguments. 1465bd8deadSopenharmony_ci However, second-order fine derivatives, e.g., dFdxFine(dFdxFine(x)) 1475bd8deadSopenharmony_ci will properly reflect the difference between the independent fine 1485bd8deadSopenharmony_ci derivatives computed within the 2x2 square." 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci Remove the following paragraphs: 1515bd8deadSopenharmony_ci 1525bd8deadSopenharmony_ci "A GL implementation may use the above or other methods to perform the 1535bd8deadSopenharmony_ci calculation, subject to the following conditions: 1545bd8deadSopenharmony_ci 1555bd8deadSopenharmony_ci "The method may use piecewise linear approximations. Such linear 1565bd8deadSopenharmony_ci approximations imply that higher order derivatives, dFdx(dFdx(x)) and 1575bd8deadSopenharmony_ci above, are undefined. 1585bd8deadSopenharmony_ci 1595bd8deadSopenharmony_ci "The method may assume that the function evaluated is continuous. Therefore 1605bd8deadSopenharmony_ci derivatives within nonuniform control flow are undefined." 1615bd8deadSopenharmony_ci 1625bd8deadSopenharmony_ci Change the last paragraph before the table to say 1635bd8deadSopenharmony_ci 1645bd8deadSopenharmony_ci "In some implementations, varying degrees of derivative accuracy for dFdx 1655bd8deadSopenharmony_ci and dFdy may be obtained by providing GL hints (section 21.4 "Hints" of the 1665bd8deadSopenharmony_ci OpenGL Graphics System Specification), allowing a user to make an image 1675bd8deadSopenharmony_ci quality versus speed trade off.These hints have no effect on dFdxCoarse, 1685bd8deadSopenharmony_ci dFdyCoarse, dFdxFineand dFdyFine." 1695bd8deadSopenharmony_ci 1705bd8deadSopenharmony_ci Add the following built-in functions to the table: 1715bd8deadSopenharmony_ci 1725bd8deadSopenharmony_ci genType dFdxFine(genType p) 1735bd8deadSopenharmony_ci 1745bd8deadSopenharmony_ci "Returns the partial derivative of p with respect to the window x 1755bd8deadSopenharmony_ci coordinate. Will use local differencing based on the value of p for the 1765bd8deadSopenharmony_ci current fragment and its immediate neighbor(s)." 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci genType dFdyFine(genType p) 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ci "Returns the partial derivative of p with respect to the window y 1815bd8deadSopenharmony_ci coordinate. Will use local differencing based on the value of p for the 1825bd8deadSopenharmony_ci current fragment and its immediate neighbor(s)." 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci genType fwidthFine(genType p) 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci "Return abs(dFdxFine(p)) + abs(dFdyFine(p))." 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ci genType dFdxCoarse(genType p) 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ci "Returns the partial derivative of p with respect to the window x 1915bd8deadSopenharmony_ci coordinate. Will use local differencing based on the value of p for the 1925bd8deadSopenharmony_ci current fragment's neighbors, and will possibly, but not necessarily, 1935bd8deadSopenharmony_ci include the value of p for the current fragment. That is, over a 1945bd8deadSopenharmony_ci given area, the implementation can compute x derivatives in fewer 1955bd8deadSopenharmony_ci unique locations than would be allowed for dFdxFine(p)." 1965bd8deadSopenharmony_ci 1975bd8deadSopenharmony_ci genType dFdyCoarse(genType p) 1985bd8deadSopenharmony_ci 1995bd8deadSopenharmony_ci "Returns the partial derivative of p with respect to the window y 2005bd8deadSopenharmony_ci coordinate. Will use local differencing based on the value of p for the 2015bd8deadSopenharmony_ci current fragment's neighbors, and will possibly, but not necessarily, 2025bd8deadSopenharmony_ci include the value of p for the current fragment. That is, over a 2035bd8deadSopenharmony_ci given area, the implementation can compute y derivatives in fewer 2045bd8deadSopenharmony_ci unique locations than would be allowed for dFdyFine(p)." 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ci genType fwidthCoarse(genType p) 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci "Returns abs(dFdxCoarse(p)) + abs(dFdyCoarse(p))." 2095bd8deadSopenharmony_ci 2105bd8deadSopenharmony_ci Change the existing descriptions to the following: 2115bd8deadSopenharmony_ci 2125bd8deadSopenharmony_ci genType dFdx(genType p) 2135bd8deadSopenharmony_ci 2145bd8deadSopenharmony_ci "Returns either dFdxFine(p) or dFdxCoarse(p), based on implementation 2155bd8deadSopenharmony_ci choice, presumably whichever is the faster, or by whichever is selected 2165bd8deadSopenharmony_ci in the API through quality-versus-speed hints." 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ci genType dFdy(genType p) 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci "Returns either dFdyFine(p) or dFdyCoarse(p), based on implementation 2215bd8deadSopenharmony_ci choice, presumably whichever is the faster, or by whichever is selected 2225bd8deadSopenharmony_ci in the API through quality-versus-speed hints." 2235bd8deadSopenharmony_ci 2245bd8deadSopenharmony_ci Doing the above change would remove: 2255bd8deadSopenharmony_ci 2265bd8deadSopenharmony_ci [Old Language to remove...] 2275bd8deadSopenharmony_ci "These two functions are commonly used to estimate the 2285bd8deadSopenharmony_ci filter width used to anti-alias procedural textures. We 2295bd8deadSopenharmony_ci are assuming that the expression is being evaluated in 2305bd8deadSopenharmony_ci parallel on a SIMD array so that at any given point in 2315bd8deadSopenharmony_ci time the value of the function is known at the grid points 2325bd8deadSopenharmony_ci represented by the SIMD array. Local differencing 2335bd8deadSopenharmony_ci between SIMD array elements can therefore be used to 2345bd8deadSopenharmony_ci derive dFdx, dFdy, etc." 2355bd8deadSopenharmony_ci 2365bd8deadSopenharmony_ci getType fwidth(getType p) 2375bd8deadSopenharmony_ci 2385bd8deadSopenharmony_ci "Returns abs(dFdx(p)) + abs(dFdy(p))." 2395bd8deadSopenharmony_ci 2405bd8deadSopenharmony_ciAdditions to the AGL/EGL/GLX/WGL Specifications 2415bd8deadSopenharmony_ci 2425bd8deadSopenharmony_ci None. 2435bd8deadSopenharmony_ci 2445bd8deadSopenharmony_ciGLX Protocol 2455bd8deadSopenharmony_ci 2465bd8deadSopenharmony_ci None. 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ciErrors 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ci No new API errors. 2515bd8deadSopenharmony_ci 2525bd8deadSopenharmony_ciNew State 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ci None. 2555bd8deadSopenharmony_ci 2565bd8deadSopenharmony_ciNew Implementation Dependent State 2575bd8deadSopenharmony_ci 2585bd8deadSopenharmony_ci None. 2595bd8deadSopenharmony_ci 2605bd8deadSopenharmony_ciConformance Tests 2615bd8deadSopenharmony_ci 2625bd8deadSopenharmony_ci TBD 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ciIssues 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ci 1. Allow support on pre-4.0 versions? 2675bd8deadSopenharmony_ci 2685bd8deadSopenharmony_ci Resolution: No, require 4.0. 2695bd8deadSopenharmony_ci 2705bd8deadSopenharmony_ci 2. Define higher-order derivatives? Currently we say they are undefined, 2715bd8deadSopenharmony_ci but don't see why they can't say more (like coarse is 0, and fine might 2725bd8deadSopenharmony_ci be something you'd expect). 2735bd8deadSopenharmony_ci 2745bd8deadSopenharmony_ci dFdxFine(dFdyFine(a)) should work 2755bd8deadSopenharmony_ci dFdxCoarse(dFdyCoarse(a)) should work or be 0 2765bd8deadSopenharmony_ci 2775bd8deadSopenharmony_ci Generally, the descriptive part of the derivative section may need 2785bd8deadSopenharmony_ci slight tweaking, based on the decisions made. 2795bd8deadSopenharmony_ci 2805bd8deadSopenharmony_ci Resolution: Yes, be more specific about how higher-order derivitives 2815bd8deadSopenharmony_ci behave. See the changes to the descriptive part of section 8.13.1. 2825bd8deadSopenharmony_ci 2835bd8deadSopenharmony_ciRevision History 2845bd8deadSopenharmony_ci 2855bd8deadSopenharmony_ci Revision 1, 17-Apr-2014 (JohnK) 2865bd8deadSopenharmony_ci - Create first version. 2875bd8deadSopenharmony_ci Revision 2, 12-May-2014 (JohnK) 2885bd8deadSopenharmony_ci - Write overview section 2895bd8deadSopenharmony_ci Revision 3, 7-Aug-2014 (JohnK) 2905bd8deadSopenharmony_ci - Match the core specification WRT to Bill's input derivatives, etc. 2915bd8deadSopenharmony_ci - Add Bill as a contributor. 2925bd8deadSopenharmony_ci - Close the issues. 293