1Name 2 3 QCOM_texture_foveated_subsampled_layout 4 5Name Strings 6 7 GL_QCOM_texture_foveated_subsampled_layout 8 9Contributors 10 11 Tate Hornbeck 12 Jonathan Wicks 13 Robert VanReenen 14 Jeff Leger 15 16Contact 17 18 Jeff Leger - jleger 'at' qti.qualcomm.com 19 20Status 21 22 Complete 23 24Version 25 26 Last Modified Date: 27 Revision: #3 28 29Number 30 31 OpenGL ES Extension #306 32 33Dependencies 34 35 OpenGL ES 2.0 is required. This extension is written against OpenGL ES 3.2. 36 37 QCOM_texture_foveated is required. 38 39 This extension interacts with OES_EGL_image_external and 40 OES_EGL_image_external_essl3. 41 42Overview 43 44 This extension builds on QCOM_texture_foveated by introducing a new foveation 45 method bit that aims to reduce memory bandwidth by avoiding the upscaling that 46 occurred as part of the original extension. 47 48 With the original FOVEATION_SCALED_BIN_METHOD_BIT_QCOM foveation method, 49 the render target in system memory is entirely populated. The lower 50 resolution framebuffer data is upscaled to fill the entire render target. 51 The subsampled layout method introduced in this extension leaves the 52 framebuffer data at the calculated lower density and instead samples 53 directly from the the lower resolution texels. 54 55 The primary usecase this is targeting is traditional VR pipeline. The 56 application eye buffers would be rendered as textures with a subsampled layout 57 and then sampled by the warp process. Sampling from a texture with a 58 subsampled layout requires a new sampler layout qualifier. 59 60New Tokens 61 62 Accepted as a value to <param> for the TexParameter{if} and 63 to <params> for the TexParameter{if}v commands with a <pname> of 64 TEXTURE_FOVEATED_FEATURE_BITS_QCOM returned as possible values for 65 <params> when GetTexParameter{if}v is queried with a <pname> of 66 TEXTURE_FOVEATED_FEATURE_BITS_QCOM: 67 68 FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM 0x4 69 70 Accepted by the <value> parameter of GetBooleanv, GetIntegerv, 71 GetInteger64v, and GetFloatv: 72 73 MAX_SHADER_SUBSAMPLED_IMAGE_UNITS_QCOM 0x8FA1 74 75Additions to the OpenGL ES 3.2 Specification 76 77 Modify section 8.1 "Texture Objects" 78 79 Modify rows in Table 8.19 "Texture parameters and their values" 80 81 Name | Type | Legal Values 82 ------------------------------------------------------------ 83 TEXTURE_FOVEATED_FEATURE_BITS_QCOM | uint | 0, 84 FOVEATION_ENABLE_BIT_QCOM, 85 (FOVEATION_ENABLE_BIT_QCOM | 86 FOVEATION_SCALED_BIN_METHOD_BIT_QCOM), 87 (FOVEATION_ENABLE_BIT_QCOM | 88 FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM) 89 90 TEXTURE_FOVEATED_FEATURE_QUERY_QCOM | uint | 0, 91 FOVEATION_ENABLE_BIT_QCOM, 92 (FOVEATION_ENABLE_BIT_QCOM | 93 FOVEATION_SCALED_BIN_METHOD_BIT_QCOM), 94 (FOVEATION_ENABLE_BIT_QCOM | 95 FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM) 96 97 98 Additions to the end of section 8.19 of the OpenGL ES 3.2 Specification 99 after the description of FOVEATION_SCALED_BIN_METHOD_QCOM: 100 101 FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM: Requests that the 102 implementation perform foveated rendering by dividing the texture render target 103 into a grid of subregions. Each subregions will be greater than or equal to one 104 pixel and less than or equal to the full size of the texture. Then rendering 105 the geometry to each of these regions with a different projection or scale. 106 No upscale is done when writing out to system memory, instead, to sample 107 from a texture with a subsampled layout, the application must declare the sampler 108 with a "subsampled" layout qualifier. Any attempt to read/write 109 this subsampled memory with the CPU will result in a reconstruction pass. 110 111 glGetTexParameteriv(GL_TEXTURE_2D, 112 GL_TEXTURE_FOVEATED_FEATURE_QUERY_QCOM, 113 &query); 114 115 if ((query & GL_FOVEATION_ENABLE_BIT_QCOM == GL_FOVEATION_ENABLE_BIT_QCOM) && 116 (query & GL_FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM == 117 GL_FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM)) 118 { 119 // Implementation supports subsampled layout scaled bin method of foveation 120 } 121 122 glTexParameteri(GL_TEXTURE_2D, 123 GL_TEXTURE_FOVEATED_FEATURE_BITS_QCOM, 124 GL_FOVEATION_ENABLE_BIT_QCOM | 125 GL_FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM); 126 127 This will set a texture as having a subsampled layout once it has been rendered to. 128 129 If any shader attempts to use more than MAX_SHADER_SUBSAMPLED_IMAGE_UNITS_QCOM a compile time 130 error will occur. 131 132 Add a new row in Table 21.52 "Implementation Dependent Aggregate Shader Limits" 133 134 Get Value Type Get Command Minimum Value Description Sec 135 --------- ---- ----------- ------------- ----------- ------ 136 MAX_SHADER_SUBSAMPLED_IMAGE_UNITS_QCOM Z+ GetIntegerv 1 No. of subsampled texture 8.19 137 images allowed in any 138 shader stage. 139 140Errors 141 142 INVALID_ENUM is generated by TexParameter{if} or TexParameter{if}v 143 if <pname> is TEXTURE_FOVEATED_FEATURE_BITS_QCOM and <param> has 144 both FOVEATION_SCALED_BIN_METHOD_BIT_QCOM and 145 FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM set. 146 147 INVALID_VALUE is generated by TexParameter{if} or TexParameter{if}v 148 if <pname> is TEXTURE_MAX_ANISOTROPY_EXT and <param> is a value 149 > 1.0f and the texture at <target> target has a subsampled layout. 150 151 INVALID_OPERATION is generated by TexParameter{if} or TexParameter{if}v 152 if <pname> is TEXTURE_WRAP_S, TEXTURE_WRAP_T, or TEXTURE_WRAP_R and 153 <param> is not CLAMP_TO_EDGE or CLAMP_TO_BORDER and the texture at 154 <target> target has a subsampled layout. 155 156 INVALID_OPERATION is generated by GenerateMipmap if the texture at 157 <target> target has a subsampled layout. 158 159Modifications to the OpenGL ES Shading Language Specification, Version 1.0.17 160 161 #extension GL_QCOM_texture_foveated_subsampled_layout: <behavior> 162 163 The above line is needed to control the GLSL features described in 164 this section. 165 166 A new preprocessor #define is added to the OpenGL ES Shading Language: 167 168 #define GL_QCOM_texture_foveated_subsampled_layout 1 169 170 [[ The following applies if GL_QCOM_texture_foveated_subsampled_layout is supported. ]] 171 172 Add a new Section 4.x (Layout Qualifiers) as follows: 173 174 4.x Layout Qualifiers 175 176 Layout qualifiers can appear with an individual variable declaration: 177 178 <layout-qualifier> <declaration>; 179 180 <layout-qualifier>: 181 layout( <layout-qualifier-id-list> ) 182 183 <layout-qualifier-id-list>: 184 comma separated list of <layout-qualifier-id> 185 186 Declarations of layouts can only be made at global scope, and only where 187 indicated in the following subsection; their details are specific to what 188 the declaration interface is, and are discussed individually. 189 190 The tokens in any <layout-qualifier-id-list> are identifiers, not 191 keywords. Generally they can be listed in any order. Order-dependent 192 meanings exist only if explicitly called out below. Similarly, these 193 identifiers are not case-sensitive, unless explicitly noted otherwise. 194 195 4.x.1 Sampler Layout Qualifiers 196 197 Shaders may specify the following layout qualifier only for samplers of type: 198 199 sampler2D 200 201 if OES_EGL_image_external is supported: 202 203 samplerExternalOES 204 205 The allowed layout qualifier identifiers for these samplers are: 206 207 <layout-qualifier-id>: 208 subsampled 209 210 Specifying subsampled layout qualifier for any other sampler types will result 211 in a compile time error. Additionally, dynamically indexing an array of subsampled 212 samplers will result in a compile time error. 213 214 For samplers specified with subsampled layout qualifier only texture2D() 215 lookup function may be used. Any other texel lookup function will produce 216 a compile time error. 217 218 This identifier specifies that the sampler is reading from a texture with a 219 subsampled layout. Attempting to sample a texture previously rendered with 220 FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM without this layout 221 qualifier will result in undefined behaviour. Declarations are done as follows: 222 223 layout(subsampled) mediump uniform sampler2D u_sampler2D; 224 225Modifications to the OpenGL ES Shading Language Specification, Version 3.10 226 227 #extension GL_QCOM_texture_foveated_subsampled_layout: <behavior> 228 229 The above line is needed to control the GLSL features described in 230 this section. 231 232 A new preprocessor #define is added to the OpenGL ES Shading Language: 233 234 #define GL_QCOM_texture_foveated_subsampled_layout 1 235 236 Modify section 8.9 "Texture Functions" 237 238 Add paragraph at end: 239 240 For samplers specified with subsampled layout qualifier only texture() 241 lookup function may be used. Any other texel lookup function will produce 242 a compile time error. 243 244 Add a new section 4.4.8 "Sampler Layout Qualifiers" 245 246 Shaders may specify the following layout qualifier only for samplers of type: 247 248 sampler2D 249 sampler2DArray 250 isampler2D 251 isampler2DArray 252 usampler2D 253 usampler2DArray 254 255 if OES_EGL_image_external_essl3 is supported: 256 257 samplerExternalOES 258 259 The allowed layout qualifier identifiers for these samplers are: 260 261 <layout-qualifier-id>: 262 subsampled 263 264 Specifying subsampled layout qualifier for any other sampler types will result 265 in a compile time error. Additionally, dynamically indexing an array of subsampled 266 samplers will result in a compile time error. 267 268 This identifier specifies that the sampler is reading from a texture with a 269 subsampled layout. Attempting to sample a texture previously rendered with 270 FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM without this layout 271 qualifier will result in undefined behaviour. Declarations are done as follows: 272 273 layout(subsampled) mediump uniform sampler2D u_sampler2D; 274 275Issues 276 277 1. Mipmap support 278 279 RESOLVED: Mipmaps are not supported for textures that have a subsampled layout. 280 281 2. How does ReadPixels / CPU access work? 282 283 RESOLVED: A reconstruction pass will occur to fill in the subsampled texture before 284 attempting to access. 285 286 For the sake of completeness, CPU access is supported for textures with a subsampled 287 layout. The implementation guarantees that no uninitialized data in the texture 288 will be returned to the CPU. Accessing a texture with a subsampled layout in this 289 manner removes any bandwidth benefits from this method of foveated rendering and 290 should be avoided when possible. 291 292 3. How does this extension interact with BlitFramebuffer? 293 294 RESOLVED: Similar to ReadPixels, BlitFramebuffer will trigger a reconstruction 295 pass that will be followed by the normal BlitFramebuffer. 296 297 4. TexImage2D/TexSubImage2D/CopyTexImage2D 298 299 RESOLVED: Similar to ReadPixels, TexImage2D type calls will trigger a reconstruction 300 pass and then the data will be uploaded to texture memory. 301 302 5. Wrap Modes 303 304 Resolved: Only CLAMP_TO_EDGE and CLAMP_TO_BORDER are allowed for textures that have 305 a subsampled layout 306 307 6. Aniso 308 309 Resolved: Aniso > 1.0f is not supported for textures that have a subsampled layout. 310 311 7. Dynamically indexing subsampled sampler arrays 312 313 Resolved: Do not allow dynamically indexed subsampled sampler arrays. This is to 314 ease the GLSL->SPIRV translation that glslang will perform. 315 316Revision History 317 318 Rev. Date Author Changes 319 ---- -------- -------- ---------------------------------------------- 320 1 08/22/17 tateh Initial spec 321 2 07/27/18 tateh Update to layout qualifiers and update 322 wrap mode limitations 323 3 08/24/18 tateh Added MAX_SHADER_SUBSAMPLED_IMAGE_UNITS_QCOM query 324 and dynamically indexed issue 325