15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_sparse_texture_clamp 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_sparse_texture_clamp 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Eric Werness, NVIDIA Corporation (ewerness 'at' nvidia.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Pat Brown, NVIDIA Corporation 165bd8deadSopenharmony_ci Piers Daniell, NVIDIA Corporation 175bd8deadSopenharmony_ci Jeff Bolz, NVIDIA Corporation 185bd8deadSopenharmony_ci Mathias Heyer, NVIDIA Corporation 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ciNotice 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ci Copyright (c) 2015 The Khronos Group Inc. Copyright terms at 235bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ciSpecification Update Policy 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 285bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 295bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 305bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 315bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 325bd8deadSopenharmony_ci described in more detail at 335bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ciStatus 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci Complete. Approved by the ARB on June 26, 2015. 385bd8deadSopenharmony_ci Ratified by the Khronos Board of Promoters on August 7, 2015. 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ciVersion 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ci Last Modified Date: April 30, 2015 435bd8deadSopenharmony_ci Revision: 2 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ciNumber 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ci ARB Extension #187 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ciDependencies 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ci This extension is written against the OpenGL 4.5 Specification 525bd8deadSopenharmony_ci (Compatibility Profile), dated February 2, 2015. 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ci This extension is written against the OpenGL Shading Language 555bd8deadSopenharmony_ci Specification, version 4.50, revision 5. 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ci This extension requires and extends ARB_sparse_texture2. 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ci This extension interacts with NV_gpu_program4 and NV_gpu_program5. 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ciOverview 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ci This extension builds on the ARB_sparse_texture2 extension, providing the 645bd8deadSopenharmony_ci following new functionality: 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci * New built-in GLSL texture lookup functions are provided that specify a 675bd8deadSopenharmony_ci minimum level of detail to use for lookups where the level of detail 685bd8deadSopenharmony_ci is computed automatically. This allows shaders to avoid accessing 695bd8deadSopenharmony_ci unpopulated portions of high-resolution levels of detail when it knows 705bd8deadSopenharmony_ci that the memory accessed is unpopulated, either from a priori 715bd8deadSopenharmony_ci knowledge or from feedback provided by the return value of previously 725bd8deadSopenharmony_ci executed "sparse" texture lookup functions. 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ciNew Procedures and Functions 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ci None. 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ciNew Tokens 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ci None. 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ciModifications to the OpenGL 4.5 Specification (Compatibility Profile) 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci Modify Section 8.14.1, Scale Factor and Level of Detail, p. 280 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ci (move the third paragraph, p. 281, describing lod_min and lod_max 875bd8deadSopenharmony_ci in equation 8.6, up one paragraph and modify it to read as follows) 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci lod_min and lod_max indicate minimum and maximum clamps on the computed 905bd8deadSopenharmony_ci level of detail. lod_max is taken directly from the TEXTURE_MAX_LOD 915bd8deadSopenharmony_ci texture or sampler parameter. If a texture access is performed in a 925bd8deadSopenharmony_ci fragment shader with a minimum level of detail clamp specified in the 935bd8deadSopenharmony_ci built-in texture lookup function, lod_min is the larger of the 945bd8deadSopenharmony_ci TEXTURE_MIN_LOD texture or sampler parameter and the minimum level of 955bd8deadSopenharmony_ci detail provided by the shader. Otherwise, lod_min is taken directly from 965bd8deadSopenharmony_ci the TEXTURE_MIN_LOD texture or sampler parameter. The initial values of 975bd8deadSopenharmony_ci the TEXTURE_MIN_LOD and TEXTURE_MAX_LOD texture and sampler parameters are 985bd8deadSopenharmony_ci chosen so as to never clamp the range of lambda values. 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ciModifications to the OpenGL Shading Language Specification, Version 4.50 1015bd8deadSopenharmony_ci 1025bd8deadSopenharmony_ci Including the following line in a shader can be used to control the 1035bd8deadSopenharmony_ci language features described in this extension: 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci #extension GL_ARB_sparse_texture_clamp : <behavior> 1065bd8deadSopenharmony_ci 1075bd8deadSopenharmony_ci where <behavior> is as specified in section 3.3. 1085bd8deadSopenharmony_ci 1095bd8deadSopenharmony_ci New preprocessor #defines are added to the OpenGL Shading Language: 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci #define GL_ARB_sparse_texture_clamp 1 1125bd8deadSopenharmony_ci 1135bd8deadSopenharmony_ci Modify Section 8.9, Texture Functions, p. 158 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci (insert after first paragraph, p. 159) 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci The texture lookup functions with an <lodClamp> parameter specify a 1185bd8deadSopenharmony_ci minimum clamp applied to the automatic level of detail computations. 1195bd8deadSopenharmony_ci Since automatic level of detail calculations are only supported by 1205bd8deadSopenharmony_ci fragment shaders, these lookup functions are also only available in 1215bd8deadSopenharmony_ci fragment shaders. No functions with the <lodClamp> parameter are provided 1225bd8deadSopenharmony_ci for rectangle textures, multisample textures, and texture buffers because 1235bd8deadSopenharmony_ci mipmaps are not allowed for these types of textures. 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci 1265bd8deadSopenharmony_ci Modify Section 8.9.2, Texel Lookup Functions, p. 162 1275bd8deadSopenharmony_ci 1285bd8deadSopenharmony_ci (The combination of this extension and ARB_sparse_texture2 adds two new 1295bd8deadSopenharmony_ci variants of texture lookup functions. The "sparse" functions are like 1305bd8deadSopenharmony_ci normal texture lookup functions, except that they return a sparse texture 1315bd8deadSopenharmony_ci residency status to the caller and return the actual filtered texel value in 1325bd8deadSopenharmony_ci an "out" parameter. The "Clamp" variants are functions adding a new 1335bd8deadSopenharmony_ci parameter specifying a minimum LOD to use for texture lookup functions where 1345bd8deadSopenharmony_ci level of detail is computed automatically. 1355bd8deadSopenharmony_ci 1365bd8deadSopenharmony_ci For each set of texture functions, we provide one to three new variants 1375bd8deadSopenharmony_ci based on whether sparse and LOD clamping functionality are desired. These 1385bd8deadSopenharmony_ci new variants copy the existing functions, add suffixes to the function 1395bd8deadSopenharmony_ci names, and add one or more new parameters. 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci We create new variants only for the targets for which sparse storage is 1425bd8deadSopenharmony_ci supported -- no new functions are added for the following sampler types: 1435bd8deadSopenharmony_ci gsampler1D, sampler1DShadow, gsampler1DArray, sampler1DArrayShadow. 1445bd8deadSopenharmony_ci Additionally, to reduce the number of new functions added, we are not 1455bd8deadSopenharmony_ci including any new variants for textureProj*() built-ins. To use the new 1465bd8deadSopenharmony_ci features with projective texture lookups, shaders can divide through by q 1475bd8deadSopenharmony_ci and use non-projective variants. We also chose not to provide "Clamp" 1485bd8deadSopenharmony_ci variants of functions like textureLod() expecting an explicit 1495bd8deadSopenharmony_ci level-of-detail.) 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ci (insert new lookup function table cells, at the end of the section, 1525bd8deadSopenharmony_ci p. 168) 1535bd8deadSopenharmony_ci 1545bd8deadSopenharmony_ci Syntax: 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ci int sparseTextureClampARB(gsampler2D sampler, vec2 P, 1575bd8deadSopenharmony_ci float lodClamp, out gvec4 texel 1585bd8deadSopenharmony_ci [, float bias]); 1595bd8deadSopenharmony_ci int sparseTextureClampARB(gsampler3D sampler, vec3 P, 1605bd8deadSopenharmony_ci float lodClamp, out gvec4 texel 1615bd8deadSopenharmony_ci [, float bias]); 1625bd8deadSopenharmony_ci int sparseTextureClampARB(gsamplerCube sampler, vec3 P, 1635bd8deadSopenharmony_ci float lodClamp, out gvec4 texel 1645bd8deadSopenharmony_ci [, float bias]); 1655bd8deadSopenharmony_ci int sparseTextureClampARB(sampler2DShadow sampler, vec3 P, 1665bd8deadSopenharmony_ci float lodClamp, out float texel 1675bd8deadSopenharmony_ci [, float bias]); 1685bd8deadSopenharmony_ci int sparseTextureClampARB(samplerCubeShadow sampler, vec4 P, 1695bd8deadSopenharmony_ci float lodClamp, out float texel 1705bd8deadSopenharmony_ci [, float bias]); 1715bd8deadSopenharmony_ci int sparseTextureClampARB(gsampler2DArray sampler, vec3 P, 1725bd8deadSopenharmony_ci float lodClamp, out gvec4 texel 1735bd8deadSopenharmony_ci [, float bias]); 1745bd8deadSopenharmony_ci int sparseTextureClampARB(gsamplerCubeArray sampler, vec4 P, 1755bd8deadSopenharmony_ci float lodClamp, out gvec4 texel 1765bd8deadSopenharmony_ci [, float bias]); 1775bd8deadSopenharmony_ci int sparseTextureClampARB(sampler2DArrayShadow sampler, vec4 P, 1785bd8deadSopenharmony_ci float lodClamp, out float texel); 1795bd8deadSopenharmony_ci int sparseTextureClampARB(samplerCubeArrayShadow sampler, vec4 P, 1805bd8deadSopenharmony_ci float compare, float lodClamp, 1815bd8deadSopenharmony_ci out float texel); 1825bd8deadSopenharmony_ci 1835bd8deadSopenharmony_ci Description: 1845bd8deadSopenharmony_ci 1855bd8deadSopenharmony_ci Do a filtered texture lookup as in texture(), but return texture access 1865bd8deadSopenharmony_ci residency information from the function and the filtered lookup result in 1875bd8deadSopenharmony_ci the out parameter <texel>. Additionally, clamp the automatically computed 1885bd8deadSopenharmony_ci level of detail to be greater than or equal to <lodClamp>. 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ci -- 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ci Syntax: 1935bd8deadSopenharmony_ci 1945bd8deadSopenharmony_ci gvec4 textureClampARB(gsampler1D sampler, float P, 1955bd8deadSopenharmony_ci float lodClamp [, float bias]); 1965bd8deadSopenharmony_ci gvec4 textureClampARB(gsampler2D sampler, vec2 P, 1975bd8deadSopenharmony_ci float lodClamp [, float bias]); 1985bd8deadSopenharmony_ci gvec4 textureClampARB(gsampler3D sampler, vec3 P, 1995bd8deadSopenharmony_ci float lodClamp [, float bias]); 2005bd8deadSopenharmony_ci gvec4 textureClampARB(gsamplerCube sampler, vec3 P, 2015bd8deadSopenharmony_ci float lodClamp [, float bias]); 2025bd8deadSopenharmony_ci float textureClampARB(sampler1DShadow sampler, vec3 P, 2035bd8deadSopenharmony_ci float lodClamp [, float bias]); 2045bd8deadSopenharmony_ci float textureClampARB(sampler2DShadow sampler, vec3 P, 2055bd8deadSopenharmony_ci float lodClamp [, float bias]); 2065bd8deadSopenharmony_ci float textureClampARB(samplerCubeShadow sampler, vec4 P, 2075bd8deadSopenharmony_ci float lodClamp [, float bias]); 2085bd8deadSopenharmony_ci gvec4 textureClampARB(gsampler1DArray sampler, vec2 P, 2095bd8deadSopenharmony_ci float lodClamp [, float bias]); 2105bd8deadSopenharmony_ci gvec4 textureClampARB(gsampler2DArray sampler, vec3 P, 2115bd8deadSopenharmony_ci float lodClamp [, float bias]); 2125bd8deadSopenharmony_ci gvec4 textureClampARB(gsamplerCubeArray sampler, vec4 P, 2135bd8deadSopenharmony_ci float lodClamp [, float bias]); 2145bd8deadSopenharmony_ci float textureClampARB(sampler1DArrayShadow sampler, vec3 P, 2155bd8deadSopenharmony_ci float lodClamp [, float bias]); 2165bd8deadSopenharmony_ci float textureClampARB(sampler2DArrayShadow sampler, vec4 P, 2175bd8deadSopenharmony_ci float lodClamp); 2185bd8deadSopenharmony_ci float textureClampARB(samplerCubeArrayShadow sampler, vec4 P, 2195bd8deadSopenharmony_ci float compare, float lodClamp); 2205bd8deadSopenharmony_ci 2215bd8deadSopenharmony_ci Description: 2225bd8deadSopenharmony_ci 2235bd8deadSopenharmony_ci Do a filtered texture lookup as in texture(), but clamp the automatically 2245bd8deadSopenharmony_ci computed level of detail to be greater than or equal to <lodClamp>. 2255bd8deadSopenharmony_ci 2265bd8deadSopenharmony_ci -- 2275bd8deadSopenharmony_ci 2285bd8deadSopenharmony_ci Syntax: 2295bd8deadSopenharmony_ci 2305bd8deadSopenharmony_ci int sparseTextureOffsetClampARB(gsampler2D sampler, vec2 P, 2315bd8deadSopenharmony_ci ivec2 offset, float lodClamp, 2325bd8deadSopenharmony_ci out gvec4 texel [, float bias]); 2335bd8deadSopenharmony_ci int sparseTextureOffsetClampARB(gsampler3D sampler, vec3 P, 2345bd8deadSopenharmony_ci ivec3 offset, float lodClamp, 2355bd8deadSopenharmony_ci out gvec4 texel [, float bias]); 2365bd8deadSopenharmony_ci int sparseTextureOffsetClampARB(sampler2DShadow sampler, vec3 P, 2375bd8deadSopenharmony_ci ivec2 offset, float lodClamp, 2385bd8deadSopenharmony_ci out float texel [, float bias]); 2395bd8deadSopenharmony_ci int sparseTextureOffsetClampARB(gsampler2DArray sampler, vec3 P, 2405bd8deadSopenharmony_ci ivec2 offset, float lodClamp, 2415bd8deadSopenharmony_ci out gvec4 texel [, float bias]); 2425bd8deadSopenharmony_ci int sparseTextureOffsetClampARB(sampler2DArrayShadow sampler, vec4 P, 2435bd8deadSopenharmony_ci ivec2 offset, float lodClamp, 2445bd8deadSopenharmony_ci out float texel); 2455bd8deadSopenharmony_ci 2465bd8deadSopenharmony_ci Description: 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ci Do a filtered texture lookup as in textureOffset(), but return texture 2495bd8deadSopenharmony_ci access residency information from the function and the filtered lookup 2505bd8deadSopenharmony_ci result in the out parameter <texel>. Additionally, clamp the 2515bd8deadSopenharmony_ci automatically computed level of detail to be greater than or equal to 2525bd8deadSopenharmony_ci <lodClamp>. 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ci -- 2555bd8deadSopenharmony_ci 2565bd8deadSopenharmony_ci Syntax: 2575bd8deadSopenharmony_ci 2585bd8deadSopenharmony_ci gvec4 textureOffsetClampARB(gsampler1D sampler, float P, 2595bd8deadSopenharmony_ci int offset, float lodClamp [, float bias]); 2605bd8deadSopenharmony_ci gvec4 textureOffsetClampARB(gsampler2D sampler, vec2 P, 2615bd8deadSopenharmony_ci ivec2 offset, float lodClamp [, float bias]); 2625bd8deadSopenharmony_ci gvec4 textureOffsetClampARB(gsampler3D sampler, vec3 P, 2635bd8deadSopenharmony_ci ivec3 offset, float lodClamp [, float bias]); 2645bd8deadSopenharmony_ci float textureOffsetClampARB(sampler1DShadow sampler, vec3 P, 2655bd8deadSopenharmony_ci int offset, float lodClamp [, float bias]); 2665bd8deadSopenharmony_ci float textureOffsetClampARB(sampler2DShadow sampler, vec3 P, 2675bd8deadSopenharmony_ci ivec2 offset, float lodClamp [, float bias]); 2685bd8deadSopenharmony_ci gvec4 textureOffsetClampARB(gsampler1DArray sampler, vec2 P, 2695bd8deadSopenharmony_ci int offset, float lodClamp [, float bias]); 2705bd8deadSopenharmony_ci gvec4 textureOffsetClampARB(gsampler2DArray sampler, vec3 P, 2715bd8deadSopenharmony_ci ivec2 offset, float lodClamp [, float bias]); 2725bd8deadSopenharmony_ci float textureOffsetClampARB(sampler1DArrayShadow sampler, vec3 P, 2735bd8deadSopenharmony_ci int offset, float lodClamp [, float bias]); 2745bd8deadSopenharmony_ci float textureOffsetClampARB(sampler2DArrayShadow sampler, vec4 P, 2755bd8deadSopenharmony_ci ivec2 offset, float lodClamp); 2765bd8deadSopenharmony_ci 2775bd8deadSopenharmony_ci Description: 2785bd8deadSopenharmony_ci 2795bd8deadSopenharmony_ci Do a filtered texture lookup as in textureOffset(), but clamp the 2805bd8deadSopenharmony_ci automatically computed level of detail to be greater than or equal to 2815bd8deadSopenharmony_ci <lodClamp>. 2825bd8deadSopenharmony_ci 2835bd8deadSopenharmony_ci -- 2845bd8deadSopenharmony_ci 2855bd8deadSopenharmony_ci Syntax: 2865bd8deadSopenharmony_ci 2875bd8deadSopenharmony_ci int sparseTextureGradClampARB(gsampler2D sampler, vec2 P, 2885bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, float lodClamp, 2895bd8deadSopenharmony_ci out gvec4 texel); 2905bd8deadSopenharmony_ci int sparseTextureGradClampARB(gsampler3D sampler, vec3 P, 2915bd8deadSopenharmony_ci vec3 dPdx, vec3 dPdy, float lodClamp, 2925bd8deadSopenharmony_ci out gvec4 texel); 2935bd8deadSopenharmony_ci int sparseTextureGradClampARB(gsamplerCube sampler, vec3 P, 2945bd8deadSopenharmony_ci vec3 dPdx, vec3 dPdy, float lodClamp, 2955bd8deadSopenharmony_ci out gvec4 texel); 2965bd8deadSopenharmony_ci int sparseTextureGradClampARB(sampler2DShadow sampler, vec3 P, 2975bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, float lodClamp, 2985bd8deadSopenharmony_ci out float texel); 2995bd8deadSopenharmony_ci int sparseTextureGradClampARB(samplerCubeShadow sampler, vec4 P, 3005bd8deadSopenharmony_ci vec3 dPdx, vec3 dPdy, float lodClamp, 3015bd8deadSopenharmony_ci out float texel); 3025bd8deadSopenharmony_ci int sparseTextureGradClampARB(gsampler2DArray sampler, vec3 P, 3035bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, float lodClamp, 3045bd8deadSopenharmony_ci out gvec4 texel); 3055bd8deadSopenharmony_ci int sparseTextureGradClampARB(sampler2DArrayShadow sampler, vec4 P, 3065bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, float lodClamp, 3075bd8deadSopenharmony_ci out float texel); 3085bd8deadSopenharmony_ci int sparseTextureGradClampARB(gsamplerCubeArray sampler, vec4 P, 3095bd8deadSopenharmony_ci vec3 dPdx, vec3 dPdy, float lodClamp, 3105bd8deadSopenharmony_ci out gvec4 texel); 3115bd8deadSopenharmony_ci 3125bd8deadSopenharmony_ci Description: 3135bd8deadSopenharmony_ci 3145bd8deadSopenharmony_ci Do a filtered texture lookup as in textureGrad(), but return texture 3155bd8deadSopenharmony_ci access residency information from the function and the filtered lookup 3165bd8deadSopenharmony_ci result in the out parameter <texel>. Additionally, clamp the 3175bd8deadSopenharmony_ci automatically computed level of detail to be greater than or equal to 3185bd8deadSopenharmony_ci <lodClamp>. 3195bd8deadSopenharmony_ci 3205bd8deadSopenharmony_ci -- 3215bd8deadSopenharmony_ci 3225bd8deadSopenharmony_ci Syntax: 3235bd8deadSopenharmony_ci 3245bd8deadSopenharmony_ci gvec4 textureGradClampARB(gsampler1D sampler, float P, 3255bd8deadSopenharmony_ci float dPdx, float dPdy, float lodClamp); 3265bd8deadSopenharmony_ci gvec4 textureGradClampARB(gsampler2D sampler, vec2 P, 3275bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, float lodClamp); 3285bd8deadSopenharmony_ci gvec4 textureGradClampARB(gsampler3D sampler, vec3 P, 3295bd8deadSopenharmony_ci vec3 dPdx, vec3 dPdy, float lodClamp); 3305bd8deadSopenharmony_ci gvec4 textureGradClampARB(gsamplerCube sampler, vec3 P, 3315bd8deadSopenharmony_ci vec3 dPdx, vec3 dPdy, float lodClamp); 3325bd8deadSopenharmony_ci float textureGradClampARB(sampler1DShadow sampler, vec3 P, 3335bd8deadSopenharmony_ci float dPdx, float dPdy, float lodClamp); 3345bd8deadSopenharmony_ci float textureGradClampARB(sampler2DShadow sampler, vec3 P, 3355bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, float lodClamp); 3365bd8deadSopenharmony_ci float textureGradClampARB(samplerCubeShadow sampler, vec4 P, 3375bd8deadSopenharmony_ci vec3 dPdx, vec3 dPdy, float lodClamp); 3385bd8deadSopenharmony_ci gvec4 textureGradClampARB(gsampler1DArray sampler, vec2 P, 3395bd8deadSopenharmony_ci float dPdx, float dPdy, float lodClamp); 3405bd8deadSopenharmony_ci gvec4 textureGradClampARB(gsampler2DArray sampler, vec3 P, 3415bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, float lodClamp); 3425bd8deadSopenharmony_ci float textureGradClampARB(sampler1DArrayShadow sampler, vec3 P, 3435bd8deadSopenharmony_ci float dPdx, float dPdy, float lodClamp); 3445bd8deadSopenharmony_ci float textureGradClampARB(sampler2DArrayShadow sampler, vec4 P, 3455bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, float lodClamp); 3465bd8deadSopenharmony_ci gvec4 textureGradClampARB(gsamplerCubeArray sampler, vec4 P, 3475bd8deadSopenharmony_ci vec3 dPdx, vec3 dPdy, float lodClamp); 3485bd8deadSopenharmony_ci 3495bd8deadSopenharmony_ci Description: 3505bd8deadSopenharmony_ci 3515bd8deadSopenharmony_ci Do a filtered texture lookup as in textureGrad(), but clamp the 3525bd8deadSopenharmony_ci automatically computed level of detail to be greater than or equal to 3535bd8deadSopenharmony_ci <lodClamp>. 3545bd8deadSopenharmony_ci 3555bd8deadSopenharmony_ci -- 3565bd8deadSopenharmony_ci 3575bd8deadSopenharmony_ci Syntax: 3585bd8deadSopenharmony_ci 3595bd8deadSopenharmony_ci int sparseTextureGradOffsetClampARB(gsampler2D sampler, vec2 P, 3605bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, ivec2 offset, 3615bd8deadSopenharmony_ci float lodClamp, out gvec4 texel); 3625bd8deadSopenharmony_ci int sparseTextureGradOffsetClampARB(gsampler3D sampler, vec3 P, 3635bd8deadSopenharmony_ci vec3 dPdx, vec3 dPdy, ivec3 offset, 3645bd8deadSopenharmony_ci float lodClamp, out gvec4 texel); 3655bd8deadSopenharmony_ci int sparseTextureGradOffsetClampARB(sampler2DShadow sampler, vec3 P, 3665bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, ivec2 offset, 3675bd8deadSopenharmony_ci float lodClamp, out float texel); 3685bd8deadSopenharmony_ci int sparseTextureGradOffsetClampARB(gsampler2DArray sampler, vec3 P, 3695bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, ivec2 offset, 3705bd8deadSopenharmony_ci float lodClamp, out gvec4 texel); 3715bd8deadSopenharmony_ci int sparseTextureGradOffsetClampARB(sampler2DArrayShadow sampler, vec4 P, 3725bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, ivec2 offset, 3735bd8deadSopenharmony_ci float lodClamp, out float texel); 3745bd8deadSopenharmony_ci 3755bd8deadSopenharmony_ci Description: 3765bd8deadSopenharmony_ci 3775bd8deadSopenharmony_ci Do a filtered texture lookup as in textureGradOffset(), but return texture 3785bd8deadSopenharmony_ci access residency information from the function and the filtered lookup 3795bd8deadSopenharmony_ci result in the out parameter <texel>. Additionally, clamp the 3805bd8deadSopenharmony_ci automatically computed level of detail to be greater than or equal to 3815bd8deadSopenharmony_ci <lodClamp>. 3825bd8deadSopenharmony_ci 3835bd8deadSopenharmony_ci -- 3845bd8deadSopenharmony_ci 3855bd8deadSopenharmony_ci Syntax: 3865bd8deadSopenharmony_ci 3875bd8deadSopenharmony_ci gvec4 textureGradOffsetClampARB(gsampler1D sampler, float P, 3885bd8deadSopenharmony_ci float dPdx, float dPdy, int offset, 3895bd8deadSopenharmony_ci float lodClamp); 3905bd8deadSopenharmony_ci gvec4 textureGradOffsetClampARB(gsampler2D sampler, vec2 P, 3915bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, ivec2 offset, 3925bd8deadSopenharmony_ci float lodClamp); 3935bd8deadSopenharmony_ci gvec4 textureGradOffsetClampARB(gsampler3D sampler, vec3 P, 3945bd8deadSopenharmony_ci vec3 dPdx, vec3 dPdy, ivec3 offset, 3955bd8deadSopenharmony_ci float lodClamp); 3965bd8deadSopenharmony_ci float textureGradOffsetClampARB(sampler1DShadow sampler, vec3 P, 3975bd8deadSopenharmony_ci float dPdx, float dPdy, int offset, 3985bd8deadSopenharmony_ci float lodClamp); 3995bd8deadSopenharmony_ci float textureGradOffsetClampARB(sampler2DShadow sampler, vec3 P, 4005bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, ivec2 offset, 4015bd8deadSopenharmony_ci float lodClamp); 4025bd8deadSopenharmony_ci gvec4 textureGradOffsetClampARB(gsampler1DArray sampler, vec2 P, 4035bd8deadSopenharmony_ci float dPdx, float dPdy, int offset, 4045bd8deadSopenharmony_ci float lodClamp); 4055bd8deadSopenharmony_ci gvec4 textureGradOffsetClampARB(gsampler2DArray sampler, vec3 P, 4065bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, ivec2 offset, 4075bd8deadSopenharmony_ci float lodClamp); 4085bd8deadSopenharmony_ci float textureGradOffsetClampARB(sampler1DArrayShadow sampler, vec3 P, 4095bd8deadSopenharmony_ci float dPdx, float dPdy, int offset, 4105bd8deadSopenharmony_ci float lodClamp); 4115bd8deadSopenharmony_ci float textureGradOffsetClampARB(sampler2DArrayShadow sampler, vec4 P, 4125bd8deadSopenharmony_ci vec2 dPdx, vec2 dPdy, ivec2 offset, 4135bd8deadSopenharmony_ci float lodClamp); 4145bd8deadSopenharmony_ci 4155bd8deadSopenharmony_ci Description: 4165bd8deadSopenharmony_ci 4175bd8deadSopenharmony_ci Do a filtered texture lookup as in textureGrad(), but clamp the 4185bd8deadSopenharmony_ci automatically computed level of detail to be greater than or equal to 4195bd8deadSopenharmony_ci <lodClamp>. 4205bd8deadSopenharmony_ci 4215bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications 4225bd8deadSopenharmony_ci 4235bd8deadSopenharmony_ci None. 4245bd8deadSopenharmony_ci 4255bd8deadSopenharmony_ciErrors 4265bd8deadSopenharmony_ci 4275bd8deadSopenharmony_ci None. 4285bd8deadSopenharmony_ci 4295bd8deadSopenharmony_ciNew State 4305bd8deadSopenharmony_ci 4315bd8deadSopenharmony_ci None. 4325bd8deadSopenharmony_ci 4335bd8deadSopenharmony_ciNew Implementation Dependent State 4345bd8deadSopenharmony_ci 4355bd8deadSopenharmony_ci None. 4365bd8deadSopenharmony_ci 4375bd8deadSopenharmony_ciDependencies on NV_gpu_program4 and NV_gpu_program5 4385bd8deadSopenharmony_ci 4395bd8deadSopenharmony_ci Modify Section 2.X.2, Program Grammar 4405bd8deadSopenharmony_ci 4415bd8deadSopenharmony_ci <opModifier> ::= "LODCLAMP" 4425bd8deadSopenharmony_ci 4435bd8deadSopenharmony_ci Modify Section 2.X.4.1, Program Instruction Modifiers 4445bd8deadSopenharmony_ci 4455bd8deadSopenharmony_ci (Update the discussion of instruction precision modifiers. If 4465bd8deadSopenharmony_ci GL_NV_gpu_program_fp64 is not found in the extension string, the "F64" 4475bd8deadSopenharmony_ci instruction modifier described below is not supported.) 4485bd8deadSopenharmony_ci 4495bd8deadSopenharmony_ci (add to Table X.14 of the NV_gpu_program4 specification.) 4505bd8deadSopenharmony_ci 4515bd8deadSopenharmony_ci Modifier Description 4525bd8deadSopenharmony_ci -------- ------------------------------------------------------ 4535bd8deadSopenharmony_ci LODCLAMP Clamp the LOD used by texture lookups to a specified 4545bd8deadSopenharmony_ci value 4555bd8deadSopenharmony_ci 4565bd8deadSopenharmony_ci For texture fetch instructions with implicit LOD calcuations (TEX, TXB, 4575bd8deadSopenharmony_ci TXD), the "LODCLAMP" modifier specifies that the instruction includes an 4585bd8deadSopenharmony_ci extra floating-point component indicating a minimum level of detail to be 4595bd8deadSopenharmony_ci used for the texture lookup. If the implicitly computed level of detail 4605bd8deadSopenharmony_ci is less than the level of detail provided in the instruction data, that 4615bd8deadSopenharmony_ci level should be used instead. 4625bd8deadSopenharmony_ci 4635bd8deadSopenharmony_ci Modify Section 2.X.4.4, Program Texture Access 4645bd8deadSopenharmony_ci 4655bd8deadSopenharmony_ci (modify the prototype of the TextureSample utility function, adding 4665bd8deadSopenharmony_ci <coord2> and removing <lod>) 4675bd8deadSopenharmony_ci 4685bd8deadSopenharmony_ci result_t_vec 4695bd8deadSopenharmony_ci TextureSample(float_vec coord, float_vec coord2, 4705bd8deadSopenharmony_ci float_vec ddx, float_vec ddy, int_vec offset); 4715bd8deadSopenharmony_ci 4725bd8deadSopenharmony_ci (modify the description of <coord> to add <coord2>) 4735bd8deadSopenharmony_ci 4745bd8deadSopenharmony_ci <coord> and <coord2> are two four-component floating-point vectors from 4755bd8deadSopenharmony_ci which the (s,t,r) texture coordinates used for the texture access, the 4765bd8deadSopenharmony_ci layer used for array textures, and the reference value used for depth 4775bd8deadSopenharmony_ci comparisons (section 3.8.14) are extracted according to Table X.17. ... 4785bd8deadSopenharmony_ci 4795bd8deadSopenharmony_ci (replace the paragraph discussing <lod>) 4805bd8deadSopenharmony_ci 4815bd8deadSopenharmony_ci <ddx> and <ddy> specify partial derivatives (ds/dx, dt/dx, dr/dx, ds/dy, 4825bd8deadSopenharmony_ci dt/dy, and dr/dy) for the texture coordinates, and may be used for level 4835bd8deadSopenharmony_ci of detail calculations and to derive footprint shapes for anisotropic 4845bd8deadSopenharmony_ci texture filtering. 4855bd8deadSopenharmony_ci 4865bd8deadSopenharmony_ci The level of detail used for the texture lookup is a function of the 4875bd8deadSopenharmony_ci texture instruction type, texture target, LODCLAMP qualifier, and the 4885bd8deadSopenharmony_ci inputs <ddx> and <ddy>. For TEX, TXB, TXD, and TXP instructions in a base 4895bd8deadSopenharmony_ci level of detail is computed based on the partial derivatives <ddx> and 4905bd8deadSopenharmony_ci <ddy>. For the TXB and TXL instruction, an additional level of detail 4915bd8deadSopenharmony_ci value is taken from the component in <coord> or <coord2> identified by the 4925bd8deadSopenharmony_ci first entry in the "lod" column of Table X.17. For TXB, this value is 4935bd8deadSopenharmony_ci added to the computed base level of detail; for TXL, it specifies the base 4945bd8deadSopenharmony_ci level of detail. After that, per-texture and per-texture unit LOD biases 4955bd8deadSopenharmony_ci are added to the level of detail. Finally, if the LODCLAMP opcode 4965bd8deadSopenharmony_ci modifier is specified, an LOD clamp value is extracted from <coord> or 4975bd8deadSopenharmony_ci <coord2> according to the second entry in the "lod" column of Table X.17. 4985bd8deadSopenharmony_ci The computed level of detail is clamped to be greater than or equal to 4995bd8deadSopenharmony_ci this LOD clamp value. 5005bd8deadSopenharmony_ci 5015bd8deadSopenharmony_ci coordinates used 5025bd8deadSopenharmony_ci texTarget Texture Type s t r lay shd lod 5035bd8deadSopenharmony_ci ---------------- --------------------- ----- --- --- ----- 5045bd8deadSopenharmony_ci 1D TEXTURE_1D x - - - - w,x2 5055bd8deadSopenharmony_ci 2D TEXTURE_2D x y - - - w,x2 5065bd8deadSopenharmony_ci 3D TEXTURE_3D x y z - - w,x2 5075bd8deadSopenharmony_ci CUBE TEXTURE_CUBE_MAP x y z - - w,x2 5085bd8deadSopenharmony_ci RECT TEXTURE_RECTANGLE_ARB x y - - - -,- 5095bd8deadSopenharmony_ci ARRAY1D TEXTURE_1D_ARRAY_EXT x - - y - w,x2 5105bd8deadSopenharmony_ci ARRAY2D TEXTURE_2D_ARRAY_EXT x y - z - w,x2 5115bd8deadSopenharmony_ci ARRAYCUBE TEXTURE_CUBE_MAP_ARRAY x y z w - x2,y2 5125bd8deadSopenharmony_ci SHADOW1D TEXTURE_1D x - - - z w,x2 5135bd8deadSopenharmony_ci SHADOW2D TEXTURE_2D x y - - z w,x2 5145bd8deadSopenharmony_ci SHADOWRECT TEXTURE_RECTANGLE_ARB x y - - z -,- 5155bd8deadSopenharmony_ci SHADOWCUBE TEXTURE_CUBE_MAP x y z - w x2,y2 5165bd8deadSopenharmony_ci SHADOWARRAY1D TEXTURE_1D_ARRAY_EXT x - - y z w,x2 5175bd8deadSopenharmony_ci SHADOWARRAY2D TEXTURE_2D_ARRAY_EXT x y - z w -,x2 5185bd8deadSopenharmony_ci SHADOWARRAYCUBE TEXTURE_CUBE_MAP_ARRAY x y z w x2 -,y2 5195bd8deadSopenharmony_ci BUFFER TEXTURE_BUFFER_EXT <not supported> 5205bd8deadSopenharmony_ci RENDERBUFFER TEXTURE_RENDERBUFFER <not supported> 5215bd8deadSopenharmony_ci 2DMS TEXTURE_2D_MULTISAMPLE <not supported> 5225bd8deadSopenharmony_ci ARRAY2DMS TEXTURE_2D_MULTISAMPLE_ <not supported> 5235bd8deadSopenharmony_ci ARRAY 5245bd8deadSopenharmony_ci 5255bd8deadSopenharmony_ci Table X.17: Texture types accessed for each of the <texTarget>, and 5265bd8deadSopenharmony_ci coordinate mappings. Components "x", "y", "z", and "w" are taken from 5275bd8deadSopenharmony_ci the first coordinate vector <coord>; "x2" and "y2" are taken from the 5285bd8deadSopenharmony_ci second vector <coord2>. The "SHADOW" and "ARRAY" targets are special 5295bd8deadSopenharmony_ci pseudo-targets described below. The "coordinates used" column indicate 5305bd8deadSopenharmony_ci the input values used for each coordinate of the texture lookup, the 5315bd8deadSopenharmony_ci layer selector for array textures, the reference value for texture 5325bd8deadSopenharmony_ci comparisons, and up to two components of level-of-detail information. 5335bd8deadSopenharmony_ci Buffer textures are not supported by normal texture lookup functions, 5345bd8deadSopenharmony_ci but are supported by TXF and TXQ, described below. Renderbuffer and 5355bd8deadSopenharmony_ci multisample textures are not supported by normal texture lookup 5365bd8deadSopenharmony_ci functions, but are supported by TXFMS. The TXB and TXL instructions are 5375bd8deadSopenharmony_ci not supported for the targets SHADOWARRAY2D and SHADOWARRAYCUBE, so the 5385bd8deadSopenharmony_ci first column of "lod" is ignored. 5395bd8deadSopenharmony_ci 5405bd8deadSopenharmony_ci Modify Section 2.X.8.Z, TXD: Texture Sample with Partials 5415bd8deadSopenharmony_ci 5425bd8deadSopenharmony_ci ... The partial derivatives of the texture coordinates with respect to X 5435bd8deadSopenharmony_ci and Y are specified by the second and third floating-point source vectors. 5445bd8deadSopenharmony_ci If the LODCLAMP instruction modifier is specified, floating-point 5455bd8deadSopenharmony_ci level-of-detail clamp value is specified in the <w> component of the third 5465bd8deadSopenharmony_ci floating-point source vector. The level of detail is computed 5475bd8deadSopenharmony_ci automatically using the provided partial derivatives. 5485bd8deadSopenharmony_ci 5495bd8deadSopenharmony_ci 5505bd8deadSopenharmony_ciIssues 5515bd8deadSopenharmony_ci 5525bd8deadSopenharmony_ci (1) How does this extension compare to the ARB_sparse_texture2 extension? 5535bd8deadSopenharmony_ci 5545bd8deadSopenharmony_ci RESOLVED: We extend the mechanisms provided by ARB_sparse_texture2 in 5555bd8deadSopenharmony_ci adding built-in texture and image lookup functions clamping the final 5565bd8deadSopenharmony_ci level of detail computed based on texture coordinates, derivatives, and 5575bd8deadSopenharmony_ci LOD bias to a minimum LOD specified in the shader. 5585bd8deadSopenharmony_ci 5595bd8deadSopenharmony_ci (2) The combination of this extension and GL_ARB_sparse_texture2 add a 5605bd8deadSopenharmony_ci *large* number of new built-in functions. 5615bd8deadSopenharmony_ci What can we do to control this? 5625bd8deadSopenharmony_ci 5635bd8deadSopenharmony_ci RESOLVED: We chose not to add any "sparse" or "LOD clamp" variants of 5645bd8deadSopenharmony_ci projective texture lookups (e.g., textureProj). If required, you can 5655bd8deadSopenharmony_ci divide through by the "q" texture coordinate and use an equivalent 5665bd8deadSopenharmony_ci non-projective lookup. 5675bd8deadSopenharmony_ci 5685bd8deadSopenharmony_ci We obviously don't support features that make no sense -- for example, 5695bd8deadSopenharmony_ci LOD clamp on single-level rectangle textures. 5705bd8deadSopenharmony_ci 5715bd8deadSopenharmony_ci We considered the possibility of more significant GLSL syntax changes to 5725bd8deadSopenharmony_ci reduce the cross-product of different features. For example, the AMD 5735bd8deadSopenharmony_ci extension has a function: 5745bd8deadSopenharmony_ci 5755bd8deadSopenharmony_ci int sparseTextureProjGradOffset(...); 5765bd8deadSopenharmony_ci 5775bd8deadSopenharmony_ci that combines four separate "optional" features (sparse, projection, 5785bd8deadSopenharmony_ci explicitly specified gradients, and texel offsets) and is supported for 5795bd8deadSopenharmony_ci six separate texture targets. One might consider an approach like: 5805bd8deadSopenharmony_ci 5815bd8deadSopenharmony_ci #define TEX_IS_PROJECTIVE 0x1 5825bd8deadSopenharmony_ci #define TEX_HAS_GRADIENTS 0x2 5835bd8deadSopenharmony_ci #define TEX_HAS_TEXEL_OFFSET 0x4 5845bd8deadSopenharmony_ci #define TEX_WANTS_SPARSE_STATUS 0x8 5855bd8deadSopenharmony_ci struct TexLookup3D { 5865bd8deadSopenharmony_ci uint flags; /* in */ 5875bd8deadSopenharmony_ci float q; /* in */ 5885bd8deadSopenharmony_ci vec3 ddx, ddy; /* in */ 5895bd8deadSopenharmony_ci ivec3 texelOffset; /* in */ 5905bd8deadSopenharmony_ci int sparseStatus; /* out */ 5915bd8deadSopenharmony_ci }; 5925bd8deadSopenharmony_ci ... 5935bd8deadSopenharmony_ci TexLookup3D lookup; 5945bd8deadSopenharmony_ci lookup.flags = (TEX_IS_PROJECTIVE | TEX_HAS_GRADIENTS | 5955bd8deadSopenharmony_ci TEX_HAS_TEXEL_OFFSET | TEX_WANTS_SPARSE_STATUS); 5965bd8deadSopenharmony_ci lookup.q = coords.w; 5975bd8deadSopenharmony_ci lookup.ddx = ddx; 5985bd8deadSopenharmony_ci lookup.ddy = ddy; 5995bd8deadSopenharmony_ci lookup.texelOffset = ivec3(-1,+1,+2); 6005bd8deadSopenharmony_ci texture(sampler, lookup); 6015bd8deadSopenharmony_ci 6025bd8deadSopenharmony_ci to handle all possible cases in one interface. Alternately, a 6035bd8deadSopenharmony_ci "prettier" C++-style approach with methods on sampler classes could be 6045bd8deadSopenharmony_ci used. 6055bd8deadSopenharmony_ci 6065bd8deadSopenharmony_ci Given that either such feature might involve a large change to the 6075bd8deadSopenharmony_ci shading language, it seems more appropriate to address this issue in a 6085bd8deadSopenharmony_ci future core version of a shading language rather than an extension. 6095bd8deadSopenharmony_ci 6105bd8deadSopenharmony_ci (3) For new "LOD clamp" functions, how does the LOD clamp interact with 6115bd8deadSopenharmony_ci the LOD bias? 6125bd8deadSopenharmony_ci 6135bd8deadSopenharmony_ci RESOLVED: The LOD clamp is applied after the LOD bias. Clamping to the 6145bd8deadSopenharmony_ci LOD provided in the shader is logically applied at the same point in the 6155bd8deadSopenharmony_ci pipeline where the LOD clamps based on the texture/sampler parameters 6165bd8deadSopenharmony_ci TEXTURE_{MIN,MAX}_LOD are applied. 6175bd8deadSopenharmony_ci 6185bd8deadSopenharmony_ciRevision History 6195bd8deadSopenharmony_ci 6205bd8deadSopenharmony_ci Revision 1 6215bd8deadSopenharmony_ci - Split clamp functions from ARB_sparse_texture2 622