15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci QCOM_texture_foveated 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_QCOM_texture_foveated 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContributors 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Tate Hornbeck 125bd8deadSopenharmony_ci Jonathan Wicks 135bd8deadSopenharmony_ci Robert VanReenen 145bd8deadSopenharmony_ci Matthew Hoffman 155bd8deadSopenharmony_ci Jeff Leger 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ciContact 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ci Jeff Leger - jleger 'at' qti.qualcomm.com 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ciStatus 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ci Complete 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ciVersion 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ci Last Modified Date: Oct 06, 2017 285bd8deadSopenharmony_ci Revision: #5 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ciNumber 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ci OpenGL ES Extension #293 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ciDependencies 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci OpenGL ES 2.0 is required. This extension is written against OpenGL ES 3.2. 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ci This interacts with QCOM_framebuffer_foveated. 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ciOverview 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ci Foveated rendering is a technique that aims to reduce fragment processing 435bd8deadSopenharmony_ci workload and bandwidth by reducing the average resolution of a render target. 445bd8deadSopenharmony_ci Perceived image quality is kept high by leaving the focal point of 455bd8deadSopenharmony_ci rendering at full resolution. 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ci It exists in two major forms: 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ci - Static foveated (lens matched) rendering: where the gaze point is 505bd8deadSopenharmony_ci fixed with a large fovea region and designed to match up with the lens 515bd8deadSopenharmony_ci characteristics. 525bd8deadSopenharmony_ci - Eye-tracked foveated rendering: where the gaze point is continuously 535bd8deadSopenharmony_ci tracked by a sensor to allow a smaller fovea region (further reducing 545bd8deadSopenharmony_ci average resolution) 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci Traditionally foveated rendering involves breaking a render target's area 575bd8deadSopenharmony_ci into smaller regions such as bins, tiles, viewports, or layers which are 585bd8deadSopenharmony_ci rendered to individually. Each of these regions has the geometry projected 595bd8deadSopenharmony_ci or scaled differently so that the net resolution of these layers is less 605bd8deadSopenharmony_ci than the original render target's resolution. When these regions are mapped 615bd8deadSopenharmony_ci back to the original render target, they create a rendered result with 625bd8deadSopenharmony_ci decreased quality as pixels get further from the focal point. 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ci Foveated rendering is currently achieved by large modifications to an 655bd8deadSopenharmony_ci applications render pipelines to manually implement the required geometry 665bd8deadSopenharmony_ci amplifications, blits, and projection changes. This presents a large 675bd8deadSopenharmony_ci implementation cost to an application developer and is generally 685bd8deadSopenharmony_ci inefficient as it can not make use of a platforms unique hardware features 695bd8deadSopenharmony_ci or optimized software paths. This extension aims to address these problems 705bd8deadSopenharmony_ci by exposing foveated rendering in an explicit and vendor neutral way, and by 715bd8deadSopenharmony_ci providing an interface with minimal changes to how an application specifies 725bd8deadSopenharmony_ci its render targets. 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ciNew Tokens 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ci Accepted as a value for <pname> for the TexParameter{if} and 775bd8deadSopenharmony_ci TexParameter{if}v commands and for the <pname> parameter of 785bd8deadSopenharmony_ci GetTexParameter{if}v: 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_BITS_QCOM 0x8BFB 815bd8deadSopenharmony_ci TEXTURE_FOVEATED_MIN_PIXEL_DENSITY_QCOM 0x8BFC 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci Accepted as the <pname> parameter of GetTexParameter{if}v: 845bd8deadSopenharmony_ci 855bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_QUERY_QCOM 0x8BFD 865bd8deadSopenharmony_ci TEXTURE_FOVEATED_NUM_FOCAL_POINTS_QUERY_QCOM 0x8BFE 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ci Accepted as a value to <param> for the TexParameter{if} and 895bd8deadSopenharmony_ci to <params> for the TexParameter{if}v commands with a <pname> of 905bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_BITS_QCOM; returned as possible values for 915bd8deadSopenharmony_ci <params> when GetTexParameter{if}v is queried with a <pname> of 925bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_BITS_QCOM: 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ci FOVEATION_ENABLE_BIT_QCOM 0x1 955bd8deadSopenharmony_ci FOVEATION_SCALED_BIN_METHOD_BIT_QCOM 0x2 965bd8deadSopenharmony_ci 975bd8deadSopenharmony_ci Returned by CheckFramebufferStatus: 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ci FRAMEBUFFER_INCOMPLETE_FOVEATION_QCOM 0x8BFF 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ciAdd new rows to Table 8.19 (Texture parameters and their values): 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci Name | Type | Legal Values 1045bd8deadSopenharmony_ci ------------------------------------------------------------ 1055bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_BITS_QCOM | uint | 0, 1065bd8deadSopenharmony_ci FOVEATION_ENABLE_BIT_QCOM, 1075bd8deadSopenharmony_ci FOVEATION_ENABLE_BIT_QCOM | 1085bd8deadSopenharmony_ci FOVEATION_SCALED_BIN_METHOD_BIT_QCOM) 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_QUERY_QCOM | uint | 0, 1115bd8deadSopenharmony_ci FOVEATION_ENABLE_BIT_QCOM, 1125bd8deadSopenharmony_ci FOVEATION_ENABLE_BIT_QCOM | 1135bd8deadSopenharmony_ci FOVEATION_SCALED_BIN_METHOD_BIT_QCOM) 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci TEXTURE_FOVEATED_NUM_FOCAL_POINTS_QUERY_QCOM | uint | Any integer greater than 0 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci TEXTURE_FOVEATED_MIN_PIXEL_DENSITY_QCOM | float | Any float between 0.0 and 1.0 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ciAdd new rows to Table 21.10 Textures (state per texture object) 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci Get value | Type | Get Command | Initial Value | Description | Sec 1225bd8deadSopenharmony_ci ------------------------------------------------------------------ 1235bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_BITS_QCOM | Z+ | GetTexParameter{if}v | 0 | Foveation State | 8.19 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_QUERY_QCOM | Z+ | GetTexParameter{if}v | see sec 8.19 | Supported foveation state | 8.19 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ci TEXTURE_FOVEATED_NUM_FOCAL_POINTS_QUERY_QCOM | Z+ | GetTexParameter{if}v | see sec 8.19 | Number of supported focal points per texture layer | 8.19 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci TEXTURE_FOVEATED_MIN_PIXEL_DENSITY_QCOM | R[0.0,1.0] | GetTexParameter{if}v | 0.0 | Minimum pixel density allowed | 8.19 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ciNew Procedures and Functions 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci void TextureFoveationParametersQCOM(uint texture, 1345bd8deadSopenharmony_ci uint layer, 1355bd8deadSopenharmony_ci uint focalPoint, 1365bd8deadSopenharmony_ci float focalX, 1375bd8deadSopenharmony_ci float focalY, 1385bd8deadSopenharmony_ci float gainX, 1395bd8deadSopenharmony_ci float gainY, 1405bd8deadSopenharmony_ci float foveaArea); 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ciAdditions to the end of section 8.19 of the OpenGL ES 3.2 Specification 1435bd8deadSopenharmony_ci 1445bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_QUERY_QCOM is a texture property that can only be 1455bd8deadSopenharmony_ci queried via GetTexParameter{if}v. This will return the implementation's 1465bd8deadSopenharmony_ci supported foveation methods. 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ci glGetTexParameteriv(GL_TEXTURE_2D, 1495bd8deadSopenharmony_ci GL_TEXTURE_FOVEATED_FEATURE_QUERY_QCOM, 1505bd8deadSopenharmony_ci &query); 1515bd8deadSopenharmony_ci 1525bd8deadSopenharmony_ci if ((query & FOVEATION_ENABLE_BIT_QCOM == FOVEATION_ENABLE_BIT_QCOM) && 1535bd8deadSopenharmony_ci (query & FOVEATION_SCALED_BIN_METHOD_BIT_QCOM == 1545bd8deadSopenharmony_ci FOVEATION_SCALED_BIN_METHOD_BIT_QCOM)) 1555bd8deadSopenharmony_ci { 1565bd8deadSopenharmony_ci // Implementation supports scaled bin method of foveation 1575bd8deadSopenharmony_ci } 1585bd8deadSopenharmony_ci 1595bd8deadSopenharmony_ci TEXTURE_FOVEATED_NUM_FOCAL_POINTS_QUERY_QCOM is a texture property that 1605bd8deadSopenharmony_ci can only be queried GetTexParameter{if}v. This will return the number of 1615bd8deadSopenharmony_ci focal points per texture layer that the implementation supports. This must 1625bd8deadSopenharmony_ci be greater than 0. 1635bd8deadSopenharmony_ci 1645bd8deadSopenharmony_ci TEXTURE_FOVEATED_MIN_PIXEL_DENSITY_QCOM defines the minimum pixel density 1655bd8deadSopenharmony_ci that can be used for scaled bin foveated rendering. 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_BITS_QCOM can be used to enable foveation for a 1685bd8deadSopenharmony_ci texture render target. 1695bd8deadSopenharmony_ci 1705bd8deadSopenharmony_ci An explanation of each of the features is below: 1715bd8deadSopenharmony_ci 1725bd8deadSopenharmony_ci FOVEATION_ENABLE_BIT_QCOM: Is used to enable foveated rendering, if 1735bd8deadSopenharmony_ci this bit is not specified foveated rendering will not be used. 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ci FOVEATION_SCALED_BIN_METHOD_BIT_QCOM: Requests that the implementation 1765bd8deadSopenharmony_ci perform foveated rendering by dividing the texture render target into a 1775bd8deadSopenharmony_ci grid of subregions. Each subregions will be greater than or equal to one pixel 1785bd8deadSopenharmony_ci and less than or equal to the full size of the texture. Then rendering 1795bd8deadSopenharmony_ci the geometry to each of these regions with a different projection or scale. 1805bd8deadSopenharmony_ci Then, finally upscaling the subregion to the native texture resolution. 1815bd8deadSopenharmony_ci Quality in the scaled bin method is defined as a minimum pixel density 1825bd8deadSopenharmony_ci which is the ratio of the resolution rendered compared to the native 1835bd8deadSopenharmony_ci texture. 1845bd8deadSopenharmony_ci 1855bd8deadSopenharmony_ci glTexParameteri(GL_TEXTURE_2D, 1865bd8deadSopenharmony_ci GL_TEXTURE_FOVEATED_FEATURE_BITS_QCOM, 1875bd8deadSopenharmony_ci GL_FOVEATION_ENABLE_BIT_QCOM | 1885bd8deadSopenharmony_ci GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM); 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ci This will set a texture as foveated so all subsequent rendering to 1915bd8deadSopenharmony_ci this texture will be foveated as long as the FOVEATION_ENABLE_BIT_QCOM 1925bd8deadSopenharmony_ci is set. Foveation is a texture property that is only applicable for 1935bd8deadSopenharmony_ci rendering operations, it does not affect traditional texture functions 1945bd8deadSopenharmony_ci like TexImage2D or TexSubImage2D. 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ci The command 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ci void TextureFoveationParametersQCOM(uint texture, 1995bd8deadSopenharmony_ci uint layer, 2005bd8deadSopenharmony_ci uint focalPoint, 2015bd8deadSopenharmony_ci float focalX, 2025bd8deadSopenharmony_ci float focalY, 2035bd8deadSopenharmony_ci float gainX, 2045bd8deadSopenharmony_ci float gainY, 2055bd8deadSopenharmony_ci float foveaArea); 2065bd8deadSopenharmony_ci 2075bd8deadSopenharmony_ci is used to control the falloff of the foveated rendering of 'focalPoint' 2085bd8deadSopenharmony_ci for layer 'layer' in the texture object 'texture'. Multiple focal points 2095bd8deadSopenharmony_ci per layer are provided to enable foveated rendering when different regions 2105bd8deadSopenharmony_ci of a texture represent different views, such as with double wide 2115bd8deadSopenharmony_ci rendering. TEXTURE_FOVEATED_NUM_FOCAL_POINTS_QUERY_QCOM focal points are 2125bd8deadSopenharmony_ci supported per texture so values of 0 to 2135bd8deadSopenharmony_ci TEXTURE_FOVEATED_NUM_FOCAL_POINTS_QUERY_QCOM minus one are valid for the 2145bd8deadSopenharmony_ci 'focalPoint' input and specify which focal point's data to update for the 2155bd8deadSopenharmony_ci layer. 2165bd8deadSopenharmony_ci 2175bd8deadSopenharmony_ci 'focalX' and 'focalY' is used to specify the x and y coordinate 2185bd8deadSopenharmony_ci of the focal point of the foveated texture in normalized device 2195bd8deadSopenharmony_ci coordinates. 'gainX' and 'gainY' are used to control how quickly the 2205bd8deadSopenharmony_ci quality falls off as you get further away from the focal point in each 2215bd8deadSopenharmony_ci axis. The larger these values are the faster the quality degrades. 2225bd8deadSopenharmony_ci 'foveaArea' is used to control the minimum size of the fovea region, the 2235bd8deadSopenharmony_ci area before the quality starts to fall off. These parameters should be 2245bd8deadSopenharmony_ci modified to match the lens characteristics. 2255bd8deadSopenharmony_ci 2265bd8deadSopenharmony_ci For the scaled bin method, these parameters define the minimum pixel 2275bd8deadSopenharmony_ci density allowed for a given focal point at the location (px,py) on a 2285bd8deadSopenharmony_ci texture layer in NDC as: 2295bd8deadSopenharmony_ci 2305bd8deadSopenharmony_ci min_pixel_density=0.; 2315bd8deadSopenharmony_ci for(int i=0;i<focalPointsPerLayer;++i){ 2325bd8deadSopenharmony_ci focal_point_density = 1./max((focalX[i]-px)^2*gainX[i]^2+ 2335bd8deadSopenharmony_ci (focalY[i]-py)^2*gainY[i]^2-foveaArea[i],1.); 2345bd8deadSopenharmony_ci min_pixel_density=max(min_pixel_density,focal_point_density); 2355bd8deadSopenharmony_ci min_pixel_desnsity=max(min_pixel_desnsity, 2365bd8deadSopenharmony_ci TEXTURE_FOVEATED_MIN_PIXEL_DENSITY_QCOM); 2375bd8deadSopenharmony_ci } 2385bd8deadSopenharmony_ci 2395bd8deadSopenharmony_ci While this function is continuous, it is worth noting that an 2405bd8deadSopenharmony_ci implementation is allowed to decimate to a fixed number of supported 2415bd8deadSopenharmony_ci quality levels, and it is allowed to group pixels into larger regions of 2425bd8deadSopenharmony_ci constant quality level, as long as the implementation at least provides 2435bd8deadSopenharmony_ci the quality level given in the above equation. 2445bd8deadSopenharmony_ci 2455bd8deadSopenharmony_ci Future supported foveation methods could have different definitions of 2465bd8deadSopenharmony_ci quality. 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ci The default values for each of the focal points in a layer is: 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ci focalX = focalY = 0.0; 2515bd8deadSopenharmony_ci gainX = gainY = 0.0; 2525bd8deadSopenharmony_ci foveaArea = 0.0; 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ci Which requires the entire render target to be rendered at full quality. 2555bd8deadSopenharmony_ci 2565bd8deadSopenharmony_ci By specifying these constraints an application can fully constrain its 2575bd8deadSopenharmony_ci render quality while leaving the implementation enough flexibility to 2585bd8deadSopenharmony_ci render efficiently. 2595bd8deadSopenharmony_ci 2605bd8deadSopenharmony_ciAdditions to Chapter 9.4 (Framebuffer Completeness) of the OpenGL ES 3.2 Specification 2615bd8deadSopenharmony_ci 2625bd8deadSopenharmony_ci More than one color attachment is foveated. 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ci { FRAMEBUFFER_INCOMPLETE_FOVEATION_QCOM } 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ci Depth or stencil attachments are foveated textures. 2675bd8deadSopenharmony_ci 2685bd8deadSopenharmony_ci { FRAMEBUFFER_INCOMPLETE_FOVEATION_QCOM } 2695bd8deadSopenharmony_ci 2705bd8deadSopenharmony_ci The framebuffer has been configured for foveation via QCOM_framebuffer_foveated 2715bd8deadSopenharmony_ci and any color attachment is a foveated texture. 2725bd8deadSopenharmony_ci 2735bd8deadSopenharmony_ci { FRAMEBUFFER_INCOMPLETE_FOVEATION_QCOM } 2745bd8deadSopenharmony_ci 2755bd8deadSopenharmony_ciErrors 2765bd8deadSopenharmony_ci 2775bd8deadSopenharmony_ci INVALID_VALUE is generated by TextureFoveationParametersQCOM if 'texture' 2785bd8deadSopenharmony_ci is not a valid texture object. 2795bd8deadSopenharmony_ci 2805bd8deadSopenharmony_ci INVALID_OPERATION is generated by TextureFoveationParametersQCOM if 2815bd8deadSopenharmony_ci 'texture' has not been set as foveated. i.e. 'texture's parameter 2825bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_BITS_QCOM does not contain 2835bd8deadSopenharmony_ci FOVEATION_ENABLE_BIT_QCOM. 2845bd8deadSopenharmony_ci 2855bd8deadSopenharmony_ci INVALID_VALUE is generated by TextureFoveationParametersQCOM if 2865bd8deadSopenharmony_ci 'focalPoint' is larger than TEXTURE_FOVEATED_NUM_FOCAL_POINTS_QUERY_QCOM 2875bd8deadSopenharmony_ci minus one. 2885bd8deadSopenharmony_ci 2895bd8deadSopenharmony_ci INVALID_ENUM is generated by TexParameter{if} or TexParamter{if}v 2905bd8deadSopenharmony_ci if <pname> is TEXTURE_FOVEATED_FEATURE_QUERY_QCOM or 2915bd8deadSopenharmony_ci TEXTURE_FOVEATED_NUM_FOCAL_POINTS_QUERY_QCOM. 2925bd8deadSopenharmony_ci 2935bd8deadSopenharmony_ci INVALID_ENUM is generated by TexParameter{if} or TexParamter{if}v 2945bd8deadSopenharmony_ci if <pname> is TEXTURE_FOVEATED_FEATURE_BITS_QCOM and <param> has 2955bd8deadSopenharmony_ci other bits set besides the legal values listed in table 8.19. 2965bd8deadSopenharmony_ci 2975bd8deadSopenharmony_ci INVALID_OPERATION is generated by TexParameter{if} or TexParamter{if}v 2985bd8deadSopenharmony_ci if <pname> is TEXTURE_FOVEATED_FEATURE_BITS_QCOM and <param> does not have 2995bd8deadSopenharmony_ci FOVEATION_ENABLE_BIT_QCOM bit set, but the texture's parameter 3005bd8deadSopenharmony_ci TEXTURE_FOVEATED_FEATURE_BITS_QCOM already contains FOVEATION_ENABLE_BIT_QCOM. 3015bd8deadSopenharmony_ci i.e. Once foveation has been enabled for a texture, it cannot be disabled. 3025bd8deadSopenharmony_ci 3035bd8deadSopenharmony_ci INVALID_OPERATION is generated by TexParameter{if} or TexParamter{if}v 3045bd8deadSopenharmony_ci if <pname> is TEXTURE_FOVEATED_MIN_PIXEL_DENSITY_QCOM and <param> is a 3055bd8deadSopenharmony_ci float less than 0.0 or greater than 1.0. 3065bd8deadSopenharmony_ci 3075bd8deadSopenharmony_ci INVALID_OPERATION is generated by TexParameter{if} or TexParamter{if}v if 3085bd8deadSopenharmony_ci <pname> is GL_TEXTURE_FOVEATED_FEATURE_BITS_QCOM and <param> contains 3095bd8deadSopenharmony_ci FOVEATION_ENABLE_BIT_QCOM, but the query of TEXTURE_FOVEATED_FEATURE_QUERY_QCOM 3105bd8deadSopenharmony_ci of <target> does not contain FOVEATION_ENABLE_BIT_QCOM. 3115bd8deadSopenharmony_ci 3125bd8deadSopenharmony_ciIssues 3135bd8deadSopenharmony_ci 3145bd8deadSopenharmony_ci 1. Are texture arrays supported? 3155bd8deadSopenharmony_ci 3165bd8deadSopenharmony_ci Texture arrays are supported to enable stereoscopic foveated 3175bd8deadSopenharmony_ci rendering which is a main use case of this extension. When a texture 3185bd8deadSopenharmony_ci array is used as a foveated render target, each slice has its own set 3195bd8deadSopenharmony_ci of foveation parameters. 3205bd8deadSopenharmony_ci 3215bd8deadSopenharmony_ci 2. How is foveation performed? 3225bd8deadSopenharmony_ci 3235bd8deadSopenharmony_ci How foveated rendering is performed to the texture render target is implementation 3245bd8deadSopenharmony_ci defined. However, if 'FOVEATION_SCALED_BIN_METHOD_BIT_QCOM' is set the 3255bd8deadSopenharmony_ci implementation must perform foveation by dividing the render target into a 3265bd8deadSopenharmony_ci grid of subregions. Then rendering the geometry to each of these regions 3275bd8deadSopenharmony_ci with a different projection or scale. And finally upscaling the subregion 3285bd8deadSopenharmony_ci to the native full resolution render target. 3295bd8deadSopenharmony_ci 3305bd8deadSopenharmony_ci When that bit is not set the implementation can use any algorithm it 3315bd8deadSopenharmony_ci wants for foveated rendering as long as it meets the application 3325bd8deadSopenharmony_ci requested features. 3335bd8deadSopenharmony_ci 3345bd8deadSopenharmony_ci 3. How are MRTs handled? 3355bd8deadSopenharmony_ci 3365bd8deadSopenharmony_ci Only one color attachment may be foveated, all other color attachments 3375bd8deadSopenharmony_ci will inherit the foveated color attachment's foveation state. 3385bd8deadSopenharmony_ci 3395bd8deadSopenharmony_ci 4. Effect on screenspace shader built-ins 3405bd8deadSopenharmony_ci 3415bd8deadSopenharmony_ci When using the scaled bin method, a number of screenspace built-ins 3425bd8deadSopenharmony_ci can produce unexpected results. 3435bd8deadSopenharmony_ci 3445bd8deadSopenharmony_ci gl_FragCoord will be scaled to match the relative location in a 3455bd8deadSopenharmony_ci foveated texture. This means the absolute value of gl_FragCoord 3465bd8deadSopenharmony_ci will not be correct in lower resolution areas, but the value relative 3475bd8deadSopenharmony_ci to the full resolution will be consistent. 3485bd8deadSopenharmony_ci 3495bd8deadSopenharmony_ci interpolateAtOffset, gl_PointSize, gl_SamplePosition, dFdx, dFdy, 3505bd8deadSopenharmony_ci glLineWidth will have no corrective scaling applied and thus could 3515bd8deadSopenharmony_ci have unexpected results. 3525bd8deadSopenharmony_ci 3535bd8deadSopenharmony_ci 5. How is depth/stencil handled? 3545bd8deadSopenharmony_ci 3555bd8deadSopenharmony_ci Foveation cannot be enabled for depth or stencil texture attachments. However, 3565bd8deadSopenharmony_ci they will inherit foveation from a foveated color attachment attached to the 3575bd8deadSopenharmony_ci same framebuffer. In this case the depth and/or stencil attachments should 3585bd8deadSopenharmony_ci be discarded or invalidated after rendering, as the upscaled depth contents 3595bd8deadSopenharmony_ci are unlikely to be useful and may cause undesired rendering artifacts when used. 3605bd8deadSopenharmony_ci 3615bd8deadSopenharmony_ci 6. Does foveation have any effect on BlitFramebuffer. 3625bd8deadSopenharmony_ci 3635bd8deadSopenharmony_ci No, there is no option to foveate a BlitFramebuffer blit. You can BlitFramebuffer 3645bd8deadSopenharmony_ci from a fbo with a foveated color attachment. 3655bd8deadSopenharmony_ci 3665bd8deadSopenharmony_ci 7. Rendering to a foveated texture multiple times per flush 3675bd8deadSopenharmony_ci 3685bd8deadSopenharmony_ci The application must be careful to fully clear, or discard/invalidate, any 3695bd8deadSopenharmony_ci foveated attachments before rendering. Failure to do so would cause 3705bd8deadSopenharmony_ci unresolves of foveated content which may be undesirable (e.g. cases where 3715bd8deadSopenharmony_ci the foveation parameters or focal point has changed between resolves). 3725bd8deadSopenharmony_ci To prevent this the implementation may disable foveation for any rendering 3735bd8deadSopenharmony_ci to a foveated attachment that requires unresolves. Texture state related 3745bd8deadSopenharmony_ci to foveation, like TEXTURE_FOVEATED_FEATURE_BITS_QCOM and 3755bd8deadSopenharmony_ci TEXTURE_FOVEATED_MIN_PIXEL_DENSITY_QCOM will not be affected. 3765bd8deadSopenharmony_ci 3775bd8deadSopenharmony_ci 8. Interactions with QCOM_framebuffer_foveated 3785bd8deadSopenharmony_ci 3795bd8deadSopenharmony_ci It is illegal to mix usage of these extensions. If a framebuffer has been 3805bd8deadSopenharmony_ci configured for foveation via QCOM_framebuffer_foveated, no attached textures 3815bd8deadSopenharmony_ci can be configured for foveation via QCOM_texture_foveated. The framebuffer 3825bd8deadSopenharmony_ci will be incomplete for this situation. 3835bd8deadSopenharmony_ci 3845bd8deadSopenharmony_ci 9. Implementation forced down non-tiled path 3855bd8deadSopenharmony_ci 3865bd8deadSopenharmony_ci Certain feature sets may force an implementation to perform non tiled rendering. 3875bd8deadSopenharmony_ci The implemenation may implicitly disable foveation for these cases. Some 3885bd8deadSopenharmony_ci potential examples include tessellation, geometry shaders, or compute. 3895bd8deadSopenharmony_ci 3905bd8deadSopenharmony_ciExamples: 3915bd8deadSopenharmony_ci 3925bd8deadSopenharmony_ci (1) Setup a foveated texture 3935bd8deadSopenharmony_ci 3945bd8deadSopenharmony_ci // Allocate a texture 3955bd8deadSopenharmony_ci GLuint foveatedTexture; 3965bd8deadSopenharmony_ci glGenTextures(1, &foveatedTexture); 3975bd8deadSopenharmony_ci glBindTexture(GL_TEXTURE_2D, foveatedTexture); 3985bd8deadSopenharmony_ci ... 3995bd8deadSopenharmony_ci // Set texture as foveated 4005bd8deadSopenharmony_ci glTexParameteri(GL_TEXTURE_2D, 4015bd8deadSopenharmony_ci GL_TEXTURE_FOVEATED_FEATURE_BITS_QCOM, 4025bd8deadSopenharmony_ci GL_FOVEATION_ENABLE_BIT_QCOM | GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM); 4035bd8deadSopenharmony_ci ... 4045bd8deadSopenharmony_ci // Rendering to foveatedTexture 4055bd8deadSopenharmony_ci ... 4065bd8deadSopenharmony_ci // Set foveation parameters on texture 4075bd8deadSopenharmony_ci glTextureFoveationParametersQCOM(foveatedTexture, 0, 0, focalX, focalY, gainX, gainY, 0.0f); 4085bd8deadSopenharmony_ci glFlush(); 4095bd8deadSopenharmony_ci 4105bd8deadSopenharmony_ci (2) Setting parameters for a multiview stereo texture array 4115bd8deadSopenharmony_ci 4125bd8deadSopenharmony_ci float focalX1 = 0.0f; // Gaze of left eye 4135bd8deadSopenharmony_ci float focalY1 = 0.0f; // Gaze of left eye 4145bd8deadSopenharmony_ci float focalX2 = 0.0f; // Gaze of right eye 4155bd8deadSopenharmony_ci float focalY2 = 0.0f; // Gaze of right eye 4165bd8deadSopenharmony_ci float gainX = 4.0f; // Weak foveation 4175bd8deadSopenharmony_ci float gainY = 4.0f; // Weak foveation 4185bd8deadSopenharmony_ci 4195bd8deadSopenharmony_ci glTextureFoveationParametersQCOM(foveatedTextureArray, 4205bd8deadSopenharmony_ci 0, 4215bd8deadSopenharmony_ci 0, 4225bd8deadSopenharmony_ci focalX1, 4235bd8deadSopenharmony_ci focalY1, 4245bd8deadSopenharmony_ci gainX, 4255bd8deadSopenharmony_ci gainY, 4265bd8deadSopenharmony_ci 2.0f); 4275bd8deadSopenharmony_ci glTextureFoveationParametersQCOM(foveatedTextureArray, 4285bd8deadSopenharmony_ci 1, 4295bd8deadSopenharmony_ci 0, 4305bd8deadSopenharmony_ci focalX2, 4315bd8deadSopenharmony_ci focalY2, 4325bd8deadSopenharmony_ci gainX, 4335bd8deadSopenharmony_ci gainY, 4345bd8deadSopenharmony_ci 2.0f); 4355bd8deadSopenharmony_ci 4365bd8deadSopenharmony_ci (3) Setting parameters for a double wide stereo texture 4375bd8deadSopenharmony_ci 4385bd8deadSopenharmony_ci float focalX1 = -0.5f; // Gaze of left eye 4395bd8deadSopenharmony_ci float focalY1 = 0.0f; // Gaze of left eye 4405bd8deadSopenharmony_ci float focalX2 = 0.5f; // Gaze of right eye 4415bd8deadSopenharmony_ci float focalY2 = 0.0f; // Gaze of right eye 4425bd8deadSopenharmony_ci float gainX = 8.0f; // Strong foveation 4435bd8deadSopenharmony_ci float gainY = 8.0f; // Strong foveation 4445bd8deadSopenharmony_ci 4455bd8deadSopenharmony_ci glTextureFoveationParametersQCOM(foveatedTexture, 4465bd8deadSopenharmony_ci 0, 4475bd8deadSopenharmony_ci 0, 4485bd8deadSopenharmony_ci focalX1, 4495bd8deadSopenharmony_ci focalY1, 4505bd8deadSopenharmony_ci gainX * 2.0f, 4515bd8deadSopenharmony_ci gainY, 4525bd8deadSopenharmony_ci 8.0f); 4535bd8deadSopenharmony_ci glTextureFoveationParametersQCOM(foveatedTexture, 4545bd8deadSopenharmony_ci 0, 4555bd8deadSopenharmony_ci 1, 4565bd8deadSopenharmony_ci focalX2, 4575bd8deadSopenharmony_ci focalY2, 4585bd8deadSopenharmony_ci gainX * 2.0f, 4595bd8deadSopenharmony_ci gainY, 4605bd8deadSopenharmony_ci 8.0f); 4615bd8deadSopenharmony_ci 4625bd8deadSopenharmony_ciRevision History 4635bd8deadSopenharmony_ci 4645bd8deadSopenharmony_ci Rev. Date Author Changes 4655bd8deadSopenharmony_ci ---- -------- -------- ---------------------------------------------- 4665bd8deadSopenharmony_ci 1 08/22/17 tateh Initial spec 4675bd8deadSopenharmony_ci 2 09/20/17 tateh Clarified screenspace shader issues. Added 4685bd8deadSopenharmony_ci way to query number of supported focal points. 4695bd8deadSopenharmony_ci 3 09/25/17 tateh Add max scale factor texture parameter. 4705bd8deadSopenharmony_ci 4 10/3/17 tateh Add Table 21.10 modifications and issue #9 4715bd8deadSopenharmony_ci 5 10/6/17 tateh Changed max scale factor to min pixel density 4725bd8deadSopenharmony_ci 6 01/8/17 tateh Removed depth/stencil discard and invalidate 4735bd8deadSopenharmony_ci language. 474