15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci QCOM_texture_foveated_subsampled_layout 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_QCOM_texture_foveated_subsampled_layout 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContributors 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Tate Hornbeck 125bd8deadSopenharmony_ci Jonathan Wicks 135bd8deadSopenharmony_ci Robert VanReenen 145bd8deadSopenharmony_ci Jeff Leger 155bd8deadSopenharmony_ci 165bd8deadSopenharmony_ciContact 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ci Jeff Leger - jleger 'at' qti.qualcomm.com 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ciStatus 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ci Complete 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ciVersion 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ci Last Modified Date: 275bd8deadSopenharmony_ci Revision: #3 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ciNumber 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ci OpenGL ES Extension #306 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ciDependencies 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ci OpenGL ES 2.0 is required. This extension is written against OpenGL ES 3.2. 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci QCOM_texture_foveated is required. 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci This extension interacts with OES_EGL_image_external and 405bd8deadSopenharmony_ci OES_EGL_image_external_essl3. 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ciOverview 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci This extension builds on QCOM_texture_foveated by introducing a new foveation 455bd8deadSopenharmony_ci method bit that aims to reduce memory bandwidth by avoiding the upscaling that 465bd8deadSopenharmony_ci occurred as part of the original extension. 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci With the original FOVEATION_SCALED_BIN_METHOD_BIT_QCOM foveation method, 495bd8deadSopenharmony_ci the render target in system memory is entirely populated. The lower 505bd8deadSopenharmony_ci resolution framebuffer data is upscaled to fill the entire render target. 515bd8deadSopenharmony_ci The subsampled layout method introduced in this extension leaves the 525bd8deadSopenharmony_ci framebuffer data at the calculated lower density and instead samples 535bd8deadSopenharmony_ci directly from the the lower resolution texels. 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ci The primary usecase this is targeting is traditional VR pipeline. The 565bd8deadSopenharmony_ci application eye buffers would be rendered as textures with a subsampled layout 575bd8deadSopenharmony_ci and then sampled by the warp process. Sampling from a texture with a 585bd8deadSopenharmony_ci subsampled layout requires a new sampler layout qualifier. 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ciNew Tokens 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ci Accepted as a value to <param> for the TexParameter{if} and 635bd8deadSopenharmony_ci to <params> for the TexParameter{if}v commands with a <pname> of 645bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_BITS_QCOM returned as possible values for 655bd8deadSopenharmony_ci <params> when GetTexParameter{if}v is queried with a <pname> of 665bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_BITS_QCOM: 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM 0x4 695bd8deadSopenharmony_ci 705bd8deadSopenharmony_ci Accepted by the <value> parameter of GetBooleanv, GetIntegerv, 715bd8deadSopenharmony_ci GetInteger64v, and GetFloatv: 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci MAX_SHADER_SUBSAMPLED_IMAGE_UNITS_QCOM 0x8FA1 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ciAdditions to the OpenGL ES 3.2 Specification 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci Modify section 8.1 "Texture Objects" 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ci Modify rows in Table 8.19 "Texture parameters and their values" 805bd8deadSopenharmony_ci 815bd8deadSopenharmony_ci Name | Type | Legal Values 825bd8deadSopenharmony_ci ------------------------------------------------------------ 835bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_BITS_QCOM | uint | 0, 845bd8deadSopenharmony_ci FOVEATION_ENABLE_BIT_QCOM, 855bd8deadSopenharmony_ci (FOVEATION_ENABLE_BIT_QCOM | 865bd8deadSopenharmony_ci FOVEATION_SCALED_BIN_METHOD_BIT_QCOM), 875bd8deadSopenharmony_ci (FOVEATION_ENABLE_BIT_QCOM | 885bd8deadSopenharmony_ci FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM) 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_QUERY_QCOM | uint | 0, 915bd8deadSopenharmony_ci FOVEATION_ENABLE_BIT_QCOM, 925bd8deadSopenharmony_ci (FOVEATION_ENABLE_BIT_QCOM | 935bd8deadSopenharmony_ci FOVEATION_SCALED_BIN_METHOD_BIT_QCOM), 945bd8deadSopenharmony_ci (FOVEATION_ENABLE_BIT_QCOM | 955bd8deadSopenharmony_ci FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM) 965bd8deadSopenharmony_ci 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ci Additions to the end of section 8.19 of the OpenGL ES 3.2 Specification 995bd8deadSopenharmony_ci after the description of FOVEATION_SCALED_BIN_METHOD_QCOM: 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ci FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM: Requests that the 1025bd8deadSopenharmony_ci implementation perform foveated rendering by dividing the texture render target 1035bd8deadSopenharmony_ci into a grid of subregions. Each subregions will be greater than or equal to one 1045bd8deadSopenharmony_ci pixel and less than or equal to the full size of the texture. Then rendering 1055bd8deadSopenharmony_ci the geometry to each of these regions with a different projection or scale. 1065bd8deadSopenharmony_ci No upscale is done when writing out to system memory, instead, to sample 1075bd8deadSopenharmony_ci from a texture with a subsampled layout, the application must declare the sampler 1085bd8deadSopenharmony_ci with a "subsampled" layout qualifier. Any attempt to read/write 1095bd8deadSopenharmony_ci this subsampled memory with the CPU will result in a reconstruction pass. 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci glGetTexParameteriv(GL_TEXTURE_2D, 1125bd8deadSopenharmony_ci GL_TEXTURE_FOVEATED_FEATURE_QUERY_QCOM, 1135bd8deadSopenharmony_ci &query); 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci if ((query & GL_FOVEATION_ENABLE_BIT_QCOM == GL_FOVEATION_ENABLE_BIT_QCOM) && 1165bd8deadSopenharmony_ci (query & GL_FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM == 1175bd8deadSopenharmony_ci GL_FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM)) 1185bd8deadSopenharmony_ci { 1195bd8deadSopenharmony_ci // Implementation supports subsampled layout scaled bin method of foveation 1205bd8deadSopenharmony_ci } 1215bd8deadSopenharmony_ci 1225bd8deadSopenharmony_ci glTexParameteri(GL_TEXTURE_2D, 1235bd8deadSopenharmony_ci GL_TEXTURE_FOVEATED_FEATURE_BITS_QCOM, 1245bd8deadSopenharmony_ci GL_FOVEATION_ENABLE_BIT_QCOM | 1255bd8deadSopenharmony_ci GL_FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM); 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ci This will set a texture as having a subsampled layout once it has been rendered to. 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci If any shader attempts to use more than MAX_SHADER_SUBSAMPLED_IMAGE_UNITS_QCOM a compile time 1305bd8deadSopenharmony_ci error will occur. 1315bd8deadSopenharmony_ci 1325bd8deadSopenharmony_ci Add a new row in Table 21.52 "Implementation Dependent Aggregate Shader Limits" 1335bd8deadSopenharmony_ci 1345bd8deadSopenharmony_ci Get Value Type Get Command Minimum Value Description Sec 1355bd8deadSopenharmony_ci --------- ---- ----------- ------------- ----------- ------ 1365bd8deadSopenharmony_ci MAX_SHADER_SUBSAMPLED_IMAGE_UNITS_QCOM Z+ GetIntegerv 1 No. of subsampled texture 8.19 1375bd8deadSopenharmony_ci images allowed in any 1385bd8deadSopenharmony_ci shader stage. 1395bd8deadSopenharmony_ci 1405bd8deadSopenharmony_ciErrors 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci INVALID_ENUM is generated by TexParameter{if} or TexParameter{if}v 1435bd8deadSopenharmony_ci if <pname> is TEXTURE_FOVEATED_FEATURE_BITS_QCOM and <param> has 1445bd8deadSopenharmony_ci both FOVEATION_SCALED_BIN_METHOD_BIT_QCOM and 1455bd8deadSopenharmony_ci FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM set. 1465bd8deadSopenharmony_ci 1475bd8deadSopenharmony_ci INVALID_VALUE is generated by TexParameter{if} or TexParameter{if}v 1485bd8deadSopenharmony_ci if <pname> is TEXTURE_MAX_ANISOTROPY_EXT and <param> is a value 1495bd8deadSopenharmony_ci > 1.0f and the texture at <target> target has a subsampled layout. 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ci INVALID_OPERATION is generated by TexParameter{if} or TexParameter{if}v 1525bd8deadSopenharmony_ci if <pname> is TEXTURE_WRAP_S, TEXTURE_WRAP_T, or TEXTURE_WRAP_R and 1535bd8deadSopenharmony_ci <param> is not CLAMP_TO_EDGE or CLAMP_TO_BORDER and the texture at 1545bd8deadSopenharmony_ci <target> target has a subsampled layout. 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ci INVALID_OPERATION is generated by GenerateMipmap if the texture at 1575bd8deadSopenharmony_ci <target> target has a subsampled layout. 1585bd8deadSopenharmony_ci 1595bd8deadSopenharmony_ciModifications to the OpenGL ES Shading Language Specification, Version 1.0.17 1605bd8deadSopenharmony_ci 1615bd8deadSopenharmony_ci #extension GL_QCOM_texture_foveated_subsampled_layout: <behavior> 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci The above line is needed to control the GLSL features described in 1645bd8deadSopenharmony_ci this section. 1655bd8deadSopenharmony_ci 1665bd8deadSopenharmony_ci A new preprocessor #define is added to the OpenGL ES Shading Language: 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ci #define GL_QCOM_texture_foveated_subsampled_layout 1 1695bd8deadSopenharmony_ci 1705bd8deadSopenharmony_ci [[ The following applies if GL_QCOM_texture_foveated_subsampled_layout is supported. ]] 1715bd8deadSopenharmony_ci 1725bd8deadSopenharmony_ci Add a new Section 4.x (Layout Qualifiers) as follows: 1735bd8deadSopenharmony_ci 1745bd8deadSopenharmony_ci 4.x Layout Qualifiers 1755bd8deadSopenharmony_ci 1765bd8deadSopenharmony_ci Layout qualifiers can appear with an individual variable declaration: 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci <layout-qualifier> <declaration>; 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ci <layout-qualifier>: 1815bd8deadSopenharmony_ci layout( <layout-qualifier-id-list> ) 1825bd8deadSopenharmony_ci 1835bd8deadSopenharmony_ci <layout-qualifier-id-list>: 1845bd8deadSopenharmony_ci comma separated list of <layout-qualifier-id> 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci Declarations of layouts can only be made at global scope, and only where 1875bd8deadSopenharmony_ci indicated in the following subsection; their details are specific to what 1885bd8deadSopenharmony_ci the declaration interface is, and are discussed individually. 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ci The tokens in any <layout-qualifier-id-list> are identifiers, not 1915bd8deadSopenharmony_ci keywords. Generally they can be listed in any order. Order-dependent 1925bd8deadSopenharmony_ci meanings exist only if explicitly called out below. Similarly, these 1935bd8deadSopenharmony_ci identifiers are not case-sensitive, unless explicitly noted otherwise. 1945bd8deadSopenharmony_ci 1955bd8deadSopenharmony_ci 4.x.1 Sampler Layout Qualifiers 1965bd8deadSopenharmony_ci 1975bd8deadSopenharmony_ci Shaders may specify the following layout qualifier only for samplers of type: 1985bd8deadSopenharmony_ci 1995bd8deadSopenharmony_ci sampler2D 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ci if OES_EGL_image_external is supported: 2025bd8deadSopenharmony_ci 2035bd8deadSopenharmony_ci samplerExternalOES 2045bd8deadSopenharmony_ci 2055bd8deadSopenharmony_ci The allowed layout qualifier identifiers for these samplers are: 2065bd8deadSopenharmony_ci 2075bd8deadSopenharmony_ci <layout-qualifier-id>: 2085bd8deadSopenharmony_ci subsampled 2095bd8deadSopenharmony_ci 2105bd8deadSopenharmony_ci Specifying subsampled layout qualifier for any other sampler types will result 2115bd8deadSopenharmony_ci in a compile time error. Additionally, dynamically indexing an array of subsampled 2125bd8deadSopenharmony_ci samplers will result in a compile time error. 2135bd8deadSopenharmony_ci 2145bd8deadSopenharmony_ci For samplers specified with subsampled layout qualifier only texture2D() 2155bd8deadSopenharmony_ci lookup function may be used. Any other texel lookup function will produce 2165bd8deadSopenharmony_ci a compile time error. 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ci This identifier specifies that the sampler is reading from a texture with a 2195bd8deadSopenharmony_ci subsampled layout. Attempting to sample a texture previously rendered with 2205bd8deadSopenharmony_ci FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM without this layout 2215bd8deadSopenharmony_ci qualifier will result in undefined behaviour. Declarations are done as follows: 2225bd8deadSopenharmony_ci 2235bd8deadSopenharmony_ci layout(subsampled) mediump uniform sampler2D u_sampler2D; 2245bd8deadSopenharmony_ci 2255bd8deadSopenharmony_ciModifications to the OpenGL ES Shading Language Specification, Version 3.10 2265bd8deadSopenharmony_ci 2275bd8deadSopenharmony_ci #extension GL_QCOM_texture_foveated_subsampled_layout: <behavior> 2285bd8deadSopenharmony_ci 2295bd8deadSopenharmony_ci The above line is needed to control the GLSL features described in 2305bd8deadSopenharmony_ci this section. 2315bd8deadSopenharmony_ci 2325bd8deadSopenharmony_ci A new preprocessor #define is added to the OpenGL ES Shading Language: 2335bd8deadSopenharmony_ci 2345bd8deadSopenharmony_ci #define GL_QCOM_texture_foveated_subsampled_layout 1 2355bd8deadSopenharmony_ci 2365bd8deadSopenharmony_ci Modify section 8.9 "Texture Functions" 2375bd8deadSopenharmony_ci 2385bd8deadSopenharmony_ci Add paragraph at end: 2395bd8deadSopenharmony_ci 2405bd8deadSopenharmony_ci For samplers specified with subsampled layout qualifier only texture() 2415bd8deadSopenharmony_ci lookup function may be used. Any other texel lookup function will produce 2425bd8deadSopenharmony_ci a compile time error. 2435bd8deadSopenharmony_ci 2445bd8deadSopenharmony_ci Add a new section 4.4.8 "Sampler Layout Qualifiers" 2455bd8deadSopenharmony_ci 2465bd8deadSopenharmony_ci Shaders may specify the following layout qualifier only for samplers of type: 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ci sampler2D 2495bd8deadSopenharmony_ci sampler2DArray 2505bd8deadSopenharmony_ci isampler2D 2515bd8deadSopenharmony_ci isampler2DArray 2525bd8deadSopenharmony_ci usampler2D 2535bd8deadSopenharmony_ci usampler2DArray 2545bd8deadSopenharmony_ci 2555bd8deadSopenharmony_ci if OES_EGL_image_external_essl3 is supported: 2565bd8deadSopenharmony_ci 2575bd8deadSopenharmony_ci samplerExternalOES 2585bd8deadSopenharmony_ci 2595bd8deadSopenharmony_ci The allowed layout qualifier identifiers for these samplers are: 2605bd8deadSopenharmony_ci 2615bd8deadSopenharmony_ci <layout-qualifier-id>: 2625bd8deadSopenharmony_ci subsampled 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ci Specifying subsampled layout qualifier for any other sampler types will result 2655bd8deadSopenharmony_ci in a compile time error. Additionally, dynamically indexing an array of subsampled 2665bd8deadSopenharmony_ci samplers will result in a compile time error. 2675bd8deadSopenharmony_ci 2685bd8deadSopenharmony_ci This identifier specifies that the sampler is reading from a texture with a 2695bd8deadSopenharmony_ci subsampled layout. Attempting to sample a texture previously rendered with 2705bd8deadSopenharmony_ci FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM without this layout 2715bd8deadSopenharmony_ci qualifier will result in undefined behaviour. Declarations are done as follows: 2725bd8deadSopenharmony_ci 2735bd8deadSopenharmony_ci layout(subsampled) mediump uniform sampler2D u_sampler2D; 2745bd8deadSopenharmony_ci 2755bd8deadSopenharmony_ciIssues 2765bd8deadSopenharmony_ci 2775bd8deadSopenharmony_ci 1. Mipmap support 2785bd8deadSopenharmony_ci 2795bd8deadSopenharmony_ci RESOLVED: Mipmaps are not supported for textures that have a subsampled layout. 2805bd8deadSopenharmony_ci 2815bd8deadSopenharmony_ci 2. How does ReadPixels / CPU access work? 2825bd8deadSopenharmony_ci 2835bd8deadSopenharmony_ci RESOLVED: A reconstruction pass will occur to fill in the subsampled texture before 2845bd8deadSopenharmony_ci attempting to access. 2855bd8deadSopenharmony_ci 2865bd8deadSopenharmony_ci For the sake of completeness, CPU access is supported for textures with a subsampled 2875bd8deadSopenharmony_ci layout. The implementation guarantees that no uninitialized data in the texture 2885bd8deadSopenharmony_ci will be returned to the CPU. Accessing a texture with a subsampled layout in this 2895bd8deadSopenharmony_ci manner removes any bandwidth benefits from this method of foveated rendering and 2905bd8deadSopenharmony_ci should be avoided when possible. 2915bd8deadSopenharmony_ci 2925bd8deadSopenharmony_ci 3. How does this extension interact with BlitFramebuffer? 2935bd8deadSopenharmony_ci 2945bd8deadSopenharmony_ci RESOLVED: Similar to ReadPixels, BlitFramebuffer will trigger a reconstruction 2955bd8deadSopenharmony_ci pass that will be followed by the normal BlitFramebuffer. 2965bd8deadSopenharmony_ci 2975bd8deadSopenharmony_ci 4. TexImage2D/TexSubImage2D/CopyTexImage2D 2985bd8deadSopenharmony_ci 2995bd8deadSopenharmony_ci RESOLVED: Similar to ReadPixels, TexImage2D type calls will trigger a reconstruction 3005bd8deadSopenharmony_ci pass and then the data will be uploaded to texture memory. 3015bd8deadSopenharmony_ci 3025bd8deadSopenharmony_ci 5. Wrap Modes 3035bd8deadSopenharmony_ci 3045bd8deadSopenharmony_ci Resolved: Only CLAMP_TO_EDGE and CLAMP_TO_BORDER are allowed for textures that have 3055bd8deadSopenharmony_ci a subsampled layout 3065bd8deadSopenharmony_ci 3075bd8deadSopenharmony_ci 6. Aniso 3085bd8deadSopenharmony_ci 3095bd8deadSopenharmony_ci Resolved: Aniso > 1.0f is not supported for textures that have a subsampled layout. 3105bd8deadSopenharmony_ci 3115bd8deadSopenharmony_ci 7. Dynamically indexing subsampled sampler arrays 3125bd8deadSopenharmony_ci 3135bd8deadSopenharmony_ci Resolved: Do not allow dynamically indexed subsampled sampler arrays. This is to 3145bd8deadSopenharmony_ci ease the GLSL->SPIRV translation that glslang will perform. 3155bd8deadSopenharmony_ci 3165bd8deadSopenharmony_ciRevision History 3175bd8deadSopenharmony_ci 3185bd8deadSopenharmony_ci Rev. Date Author Changes 3195bd8deadSopenharmony_ci ---- -------- -------- ---------------------------------------------- 3205bd8deadSopenharmony_ci 1 08/22/17 tateh Initial spec 3215bd8deadSopenharmony_ci 2 07/27/18 tateh Update to layout qualifiers and update 3225bd8deadSopenharmony_ci wrap mode limitations 3235bd8deadSopenharmony_ci 3 08/24/18 tateh Added MAX_SHADER_SUBSAMPLED_IMAGE_UNITS_QCOM query 3245bd8deadSopenharmony_ci and dynamically indexed issue 325