• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    EXT_texture_query_lod
4
5Name Strings
6
7    GL_EXT_texture_query_lod
8
9Contact
10
11    Gert Wollny (gert wollny 'at' collabora.com)
12
13Contributors
14
15    Pat Brown, NVIDIA
16    Greg Roth, NVIDIA
17    Eric Werness, NVIDIA
18
19Notice
20
21    Copyright (c) 2019 Collabora LTD
22    Copyright (c) 2009-2013 The Khronos Group Inc. Copyright terms at
23        http://www.khronos.org/registry/speccopyright.html
24
25Status
26
27    Complete
28
29Version
30
31    Last Modified Date:         04/02/2019
32    Revision:                   1
33    Based on ARB_texture_query_lod version 4, modified 2013/10/04.
34
35Number
36
37    OpenGL ES extension #310
38
39Dependencies
40
41    OpenGL ES 3.0 is required.
42
43    OpenGL Shading Language 3.00 ES is required
44
45    This extension interacts trivially with EXT_texture_cube_map_array
46
47    This extension is written against the OpenGL ES 3.2 specification and
48    version 3.20 ES of the OpenGL Shading Language Specification.
49
50Overview
51
52    This extension adds a new set of fragment shader texture functions
53    (textureLOD) that return the results of automatic level-of-detail
54    computations that would be performed if a texture lookup were performed.
55
56New Procedures and Functions
57
58    None.
59
60New Tokens
61
62    None.
63
64Additions to the OpenGL ES 3.2 Specification
65
66    None.
67
68Errors
69
70    None.
71
72New State
73
74    None.
75
76New Implementation Dependent State
77
78    None.
79
80Modifications to The OpenGL Shading Language Specification, Version 3.20.5
81
82    Including the following line in a shader can be used to control the
83    language features described in this extension:
84
85      #extension GL_EXT_texture_query_lod
86
87    A new preprocessor #define is added to the OpenGL Shading Language:
88
89      #define GL_EXT_texture_query_lod 1
90
91    Change section 8.9.1 "Texture Query Functions"
92
93    Remove the first paragraph and add to the table:
94
95    Syntax:
96
97      vec2 textureQueryLOD(gsampler2D sampler, vec2 coord)
98      vec2 textureQueryLOD(gsampler3D sampler, vec3 coord)
99      vec2 textureQueryLOD(gsamplerCube sampler, vec3 coord)
100      vec2 textureQueryLOD(gsampler2DArray sampler, vec2 coord)
101      vec2 textureQueryLOD(gsamplerCubeArray sampler, vec3 coord)
102      vec2 textureQueryLOD(sampler2DShadow sampler, vec2 coord)
103      vec2 textureQueryLOD(samplerCubeShadow sampler, vec3 coord)
104      vec2 textureQueryLOD(sampler2DArrayShadow sampler, vec2 coord)
105      vec2 textureQueryLOD(samplerCubeArrayShadow sampler, vec3 coord)
106
107    Description:
108
109      The textureQueryLOD function takes the components of <coord> and
110      computes the LOD information that the texture pipe would use to
111      make an access of that texture. The computed level of detail
112      lambda_prime (equation 8.7), relative to the base level, is
113      returned in the y component of the result vector. The level of
114      detail is obtained after any LOD bias, but prior to clamping to
115      [TEXTURE_MIN_LOD, TEXTURE_MAX_LOD]. The x component of the result
116      vector contains information on the mipmap array(s) that would be
117      accessed by a normal texture lookup using the same coordinates. If
118      a single level of detail would be accessed, the level-of-detail
119      number relative to the base level is returned. If multiple levels
120      of detail are accessed, a floating-point number between the two
121      levels is returned, with the fractional part equal to the
122      fractional part of the computed and clamped level of detail. The
123      algorithm used is given by the following pseudo-code:
124
125      float ComputeAccessedLod(float computedLod)
126      {
127        // Clamp the computed LOD according to the texture LOD clamps.
128        if (computedLod < TEXTURE_MIN_LOD) computedLod = TEXTURE_MIN_LOD;
129        if (computedLod > TEXTURE_MAX_LOD) computedLod = TEXTURE_MAX_LOD;
130
131        // Clamp the computed LOD to the range of accessible levels.
132        if (computedLod < 0)
133            computedLod = 0.0;
134        if (computedLod > (float)
135            maxAccessibleLevel) computedLod = (float) maxAccessibleLevel;
136
137        // Return a value according to the min filter.
138        if (TEXTURE_MIN_FILTER is LINEAR or NEAREST) {
139          return 0.0;
140        } else if (TEXTURE_MIN_FILTER is NEAREST_MIPMAP_NEAREST
141                   or LINEAR_MIPMAP_NEAREST) {
142          return ceil(computedLod + 0.5) - 1.0;
143        } else {
144          return computedLod;
145        }
146      }
147
148      The value <maxAccessibleLevel> is the level number of the smallest
149      accessible level of the mipmap array (the value q in section
150      8.14.3) minus the base level.
151
152      The returned value is then:
153
154        vec2(ComputeAccessedLod(lambda_prime), lambda_prime);
155
156      If textureQueryLOD is called on an incomplete texture, the results
157      are undefined. textureQueryLOD is only available fragment shaders.
158
159Dependencies on EXT_texture_cube_map_array
160
161      If EXT_texture_cube_map_array is not supported, remove the
162      textureQueryLOD lookup functions taking cube map array samplers.
163
164Issues
165
166    See the issue list in GL_ARB_texture_query_lod.
167
168Revision History
169
170    Rev.    Date      Author      Changes
171    ----  ----------  --------    -----------------------------------------
172    2     20/02/2019  Gert Wollny remove references to 1D textures and non-GLES
173                                  extensions
174
175    1     19/02/2019  Gert Wollny Initial EXT version based on ARB.
176                                  No functional changes.
177
178
179