15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    EXT_texture_query_lod
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_EXT_texture_query_lod
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Gert Wollny (gert wollny 'at' collabora.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Pat Brown, NVIDIA
165bd8deadSopenharmony_ci    Greg Roth, NVIDIA
175bd8deadSopenharmony_ci    Eric Werness, NVIDIA
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ciNotice
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ci    Copyright (c) 2019 Collabora LTD 
225bd8deadSopenharmony_ci    Copyright (c) 2009-2013 The Khronos Group Inc. Copyright terms at
235bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ciStatus
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ci    Complete
285bd8deadSopenharmony_ci
295bd8deadSopenharmony_ciVersion
305bd8deadSopenharmony_ci
315bd8deadSopenharmony_ci    Last Modified Date:         04/02/2019
325bd8deadSopenharmony_ci    Revision:                   1
335bd8deadSopenharmony_ci    Based on ARB_texture_query_lod version 4, modified 2013/10/04.
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ciNumber
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ci    OpenGL ES extension #310
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ciDependencies
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ci    OpenGL ES 3.0 is required.
425bd8deadSopenharmony_ci
435bd8deadSopenharmony_ci    OpenGL Shading Language 3.00 ES is required
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ci    This extension interacts trivially with EXT_texture_cube_map_array
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ci    This extension is written against the OpenGL ES 3.2 specification and
485bd8deadSopenharmony_ci    version 3.20 ES of the OpenGL Shading Language Specification.
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ciOverview
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci    This extension adds a new set of fragment shader texture functions
535bd8deadSopenharmony_ci    (textureLOD) that return the results of automatic level-of-detail
545bd8deadSopenharmony_ci    computations that would be performed if a texture lookup were performed.
555bd8deadSopenharmony_ci
565bd8deadSopenharmony_ciNew Procedures and Functions
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci    None.
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ciNew Tokens
615bd8deadSopenharmony_ci
625bd8deadSopenharmony_ci    None.
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ciAdditions to the OpenGL ES 3.2 Specification
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    None.
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ciErrors
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci    None.
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ciNew State
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci    None.
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ciNew Implementation Dependent State
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci    None.
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ciModifications to The OpenGL Shading Language Specification, Version 3.20.5
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci    Including the following line in a shader can be used to control the
835bd8deadSopenharmony_ci    language features described in this extension:
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ci      #extension GL_EXT_texture_query_lod
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ci    A new preprocessor #define is added to the OpenGL Shading Language:
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ci      #define GL_EXT_texture_query_lod 1
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ci    Change section 8.9.1 "Texture Query Functions"
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    Remove the first paragraph and add to the table:
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci    Syntax:
965bd8deadSopenharmony_ci
975bd8deadSopenharmony_ci      vec2 textureQueryLOD(gsampler2D sampler, vec2 coord)
985bd8deadSopenharmony_ci      vec2 textureQueryLOD(gsampler3D sampler, vec3 coord)
995bd8deadSopenharmony_ci      vec2 textureQueryLOD(gsamplerCube sampler, vec3 coord)
1005bd8deadSopenharmony_ci      vec2 textureQueryLOD(gsampler2DArray sampler, vec2 coord)
1015bd8deadSopenharmony_ci      vec2 textureQueryLOD(gsamplerCubeArray sampler, vec3 coord)
1025bd8deadSopenharmony_ci      vec2 textureQueryLOD(sampler2DShadow sampler, vec2 coord)
1035bd8deadSopenharmony_ci      vec2 textureQueryLOD(samplerCubeShadow sampler, vec3 coord)
1045bd8deadSopenharmony_ci      vec2 textureQueryLOD(sampler2DArrayShadow sampler, vec2 coord)
1055bd8deadSopenharmony_ci      vec2 textureQueryLOD(samplerCubeArrayShadow sampler, vec3 coord)
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci    Description:
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ci      The textureQueryLOD function takes the components of <coord> and
1105bd8deadSopenharmony_ci      computes the LOD information that the texture pipe would use to
1115bd8deadSopenharmony_ci      make an access of that texture. The computed level of detail
1125bd8deadSopenharmony_ci      lambda_prime (equation 8.7), relative to the base level, is
1135bd8deadSopenharmony_ci      returned in the y component of the result vector. The level of
1145bd8deadSopenharmony_ci      detail is obtained after any LOD bias, but prior to clamping to
1155bd8deadSopenharmony_ci      [TEXTURE_MIN_LOD, TEXTURE_MAX_LOD]. The x component of the result
1165bd8deadSopenharmony_ci      vector contains information on the mipmap array(s) that would be
1175bd8deadSopenharmony_ci      accessed by a normal texture lookup using the same coordinates. If
1185bd8deadSopenharmony_ci      a single level of detail would be accessed, the level-of-detail
1195bd8deadSopenharmony_ci      number relative to the base level is returned. If multiple levels
1205bd8deadSopenharmony_ci      of detail are accessed, a floating-point number between the two
1215bd8deadSopenharmony_ci      levels is returned, with the fractional part equal to the
1225bd8deadSopenharmony_ci      fractional part of the computed and clamped level of detail. The
1235bd8deadSopenharmony_ci      algorithm used is given by the following pseudo-code:
1245bd8deadSopenharmony_ci
1255bd8deadSopenharmony_ci      float ComputeAccessedLod(float computedLod)
1265bd8deadSopenharmony_ci      {
1275bd8deadSopenharmony_ci        // Clamp the computed LOD according to the texture LOD clamps.
1285bd8deadSopenharmony_ci        if (computedLod < TEXTURE_MIN_LOD) computedLod = TEXTURE_MIN_LOD;
1295bd8deadSopenharmony_ci        if (computedLod > TEXTURE_MAX_LOD) computedLod = TEXTURE_MAX_LOD;
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci        // Clamp the computed LOD to the range of accessible levels.
1325bd8deadSopenharmony_ci        if (computedLod < 0)
1335bd8deadSopenharmony_ci            computedLod = 0.0;
1345bd8deadSopenharmony_ci        if (computedLod > (float)
1355bd8deadSopenharmony_ci            maxAccessibleLevel) computedLod = (float) maxAccessibleLevel;
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci        // Return a value according to the min filter.
1385bd8deadSopenharmony_ci        if (TEXTURE_MIN_FILTER is LINEAR or NEAREST) {
1395bd8deadSopenharmony_ci          return 0.0;
1405bd8deadSopenharmony_ci        } else if (TEXTURE_MIN_FILTER is NEAREST_MIPMAP_NEAREST
1415bd8deadSopenharmony_ci                   or LINEAR_MIPMAP_NEAREST) {
1425bd8deadSopenharmony_ci          return ceil(computedLod + 0.5) - 1.0;
1435bd8deadSopenharmony_ci        } else {
1445bd8deadSopenharmony_ci          return computedLod;
1455bd8deadSopenharmony_ci        }
1465bd8deadSopenharmony_ci      }
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci      The value <maxAccessibleLevel> is the level number of the smallest
1495bd8deadSopenharmony_ci      accessible level of the mipmap array (the value q in section
1505bd8deadSopenharmony_ci      8.14.3) minus the base level.
1515bd8deadSopenharmony_ci
1525bd8deadSopenharmony_ci      The returned value is then:
1535bd8deadSopenharmony_ci
1545bd8deadSopenharmony_ci        vec2(ComputeAccessedLod(lambda_prime), lambda_prime);
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci      If textureQueryLOD is called on an incomplete texture, the results
1575bd8deadSopenharmony_ci      are undefined. textureQueryLOD is only available fragment shaders.
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ciDependencies on EXT_texture_cube_map_array
1605bd8deadSopenharmony_ci
1615bd8deadSopenharmony_ci      If EXT_texture_cube_map_array is not supported, remove the
1625bd8deadSopenharmony_ci      textureQueryLOD lookup functions taking cube map array samplers.
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ciIssues
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci    See the issue list in GL_ARB_texture_query_lod.
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ciRevision History
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ci    Rev.    Date      Author      Changes
1715bd8deadSopenharmony_ci    ----  ----------  --------    -----------------------------------------
1725bd8deadSopenharmony_ci    2     20/02/2019  Gert Wollny remove references to 1D textures and non-GLES
1735bd8deadSopenharmony_ci                                  extensions
1745bd8deadSopenharmony_ci
1755bd8deadSopenharmony_ci    1     19/02/2019  Gert Wollny Initial EXT version based on ARB.
1765bd8deadSopenharmony_ci                                  No functional changes.
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci
179