15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    QCOM_framebuffer_foveated
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_QCOM_framebuffer_foveated
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContributors
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Skyler Saleh
125bd8deadSopenharmony_ci    Maurice Ribble
135bd8deadSopenharmony_ci    Tate Hornbeck
145bd8deadSopenharmony_ci    Jonathan Wicks
155bd8deadSopenharmony_ci    Robert VanReenen
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: May 10, 2017
285bd8deadSopenharmony_ci    Revision: #11
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ciNumber
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ci    OpenGL ES Extension #273
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_ciOverview
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ci    Foveated rendering is a technique that aims to reduce fragment processing
415bd8deadSopenharmony_ci    workload and bandwidth by reducing the average resolution of a framebuffer.
425bd8deadSopenharmony_ci    Perceived image quality is kept high by leaving the focal point of
435bd8deadSopenharmony_ci    rendering at full resolution.
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ci    It exists in two major forms:
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ci        - Static foveated(lens matched) rendering: where the gaze point is
485bd8deadSopenharmony_ci        fixed with a large fovea region and designed to match up with the lens
495bd8deadSopenharmony_ci        characteristics.
505bd8deadSopenharmony_ci        - Eye-tracked foveated rendering: where the gaze point is continuously
515bd8deadSopenharmony_ci        tracked by a sensor to allow a smaller fovea region (further reducing
525bd8deadSopenharmony_ci        average resolution)
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci    Traditionally foveated rendering involves breaking a framebuffer's area
555bd8deadSopenharmony_ci    into smaller regions such as bins, tiles, viewports, or layers which are
565bd8deadSopenharmony_ci    rendered to individually. Each of these regions has the geometry projected
575bd8deadSopenharmony_ci    or scaled differently so that the net resolution of these layers is less
585bd8deadSopenharmony_ci    than the original framebuffer's resolution. When these regions are mapped
595bd8deadSopenharmony_ci    back to the original framebuffer, they create a rendered result with
605bd8deadSopenharmony_ci    decreased quality as pixels get further from the focal point.
615bd8deadSopenharmony_ci
625bd8deadSopenharmony_ci    Foveated rendering is currently achieved by large modifications to an
635bd8deadSopenharmony_ci    applications render pipelines to manually implement the required geometry
645bd8deadSopenharmony_ci    amplifications, blits, and projection changes.  This presents a large
655bd8deadSopenharmony_ci    implementation cost to an application developer and is generally
665bd8deadSopenharmony_ci    inefficient as it can not make use of a platforms unique hardware features
675bd8deadSopenharmony_ci    or optimized software paths. This extension aims to address these problems
685bd8deadSopenharmony_ci    by exposing foveated rendering in an explicit and vendor neutral way, and by
695bd8deadSopenharmony_ci    providing an interface with minimal changes to how an application specifies
705bd8deadSopenharmony_ci    its framebuffer.
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ciNew Tokens
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci    Allowed in the config input in FramebufferFoveationConfigQCOM:
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ci        FOVEATION_ENABLE_BIT_QCOM                    0x1
775bd8deadSopenharmony_ci        FOVEATION_SCALED_BIN_METHOD_BIT_QCOM         0x2
785bd8deadSopenharmony_ci
795bd8deadSopenharmony_ciNew Procedures and Functions
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci    void FramebufferFoveationConfigQCOM(uint fbo,
825bd8deadSopenharmony_ci                                       uint numLayers,
835bd8deadSopenharmony_ci                                       uint focalPointsPerLayer,
845bd8deadSopenharmony_ci                                       uint requestedFeatures,
855bd8deadSopenharmony_ci                                       uint *providedFeatures);
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ci    void FramebufferFoveationParametersQCOM(uint fbo,
885bd8deadSopenharmony_ci                                           uint layer,
895bd8deadSopenharmony_ci                                           uint focalPoint,
905bd8deadSopenharmony_ci                                           float focalX,
915bd8deadSopenharmony_ci                                           float focalY,
925bd8deadSopenharmony_ci                                           float gainX,
935bd8deadSopenharmony_ci                                           float gainY,
945bd8deadSopenharmony_ci                                           float foveaArea);
955bd8deadSopenharmony_ci
965bd8deadSopenharmony_ciAdditions to Chapter 9 of the OpenGL ES 3.2 Specification
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ci    The command
995bd8deadSopenharmony_ci
1005bd8deadSopenharmony_ci    void FramebufferFoveationConfigQCOM( uint fbo, uint numLayers,
1015bd8deadSopenharmony_ci    uint focalPointsPerLayer, uint requestedFeatures, uint *providedFeatures);
1025bd8deadSopenharmony_ci
1035bd8deadSopenharmony_ci    is used to configure foveated rendering for the framebuffer object 'fbo'
1045bd8deadSopenharmony_ci    and to instruct the implementation to allocate any additional
1055bd8deadSopenharmony_ci    intermediate resources needed for foveated rendering.
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci    In order to enable foveation, this call must be issued prior to any
1085bd8deadSopenharmony_ci    operation which causes data to be written to a framebuffer attachment.
1095bd8deadSopenharmony_ci    Once this call is made for a framebuffer object, the fbo will remain a
1105bd8deadSopenharmony_ci    "foveated fbo". The following scenarios are unsupported conditions:
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ci        1. Rendering to a non foveated fbo, then calling
1135bd8deadSopenharmony_ci           FramebufferFoveationConfigQCOM results in current framebuffer content
1145bd8deadSopenharmony_ci           becoming undefined.
1155bd8deadSopenharmony_ci
1165bd8deadSopenharmony_ci        2. Rendering to a foveated fbo then switching attachments results in an
1175bd8deadSopenharmony_ci           error.
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ci    Each layer of a foveated framebuffer, the max of which is specified by
1205bd8deadSopenharmony_ci    'numLayers', can have multiple focal points as controlled by
1215bd8deadSopenharmony_ci    'focalPointsPerLayer'. This enables applications that make use of double
1225bd8deadSopenharmony_ci    wide rendering to utilize foveated rendering and also allows more complex
1235bd8deadSopenharmony_ci    falloff characteristics to be modeled with multiple overlapping focal
1245bd8deadSopenharmony_ci    points. There are limitations to the number of focal points that an
1255bd8deadSopenharmony_ci    implementation can support with different enabled features or framebuffer
1265bd8deadSopenharmony_ci    formats. When an implementation can not support having as many focal points
1275bd8deadSopenharmony_ci    per layer as was specified in this function, it will fail with the error
1285bd8deadSopenharmony_ci    INVALID_VALUE. It is recommended that an application utilize as
1295bd8deadSopenharmony_ci    few focal points per layer as possible.
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci    The 'requestedFeatures' bitfield is used to specify which features an
1325bd8deadSopenharmony_ci    application would like to use.
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci    An explanation of each of the features is below:
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ci        FOVEATION_ENABLE_BIT_QCOM: Is used to enable foveated rendering, if
1375bd8deadSopenharmony_ci        this bit is not specified foveated rendering will not be used.
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci        FOVEATION_SCALED_BIN_METHOD_BIT_QCOM: Requests that the implementation
1405bd8deadSopenharmony_ci        perform foveated rendering by dividing the framebuffer into a grid of
1415bd8deadSopenharmony_ci        subregions. Each subregions will be greater than or equal to one pixel
1425bd8deadSopenharmony_ci        and less than or equal to the full framebuffer. Then rendering the geometry
1435bd8deadSopenharmony_ci        to each of these regions with a different projection or scale. Then, finally
1445bd8deadSopenharmony_ci        upscaling the subregion to the native full resolution framebuffer.
1455bd8deadSopenharmony_ci        Quality in the scaled bin method is defined as a minimum pixel density
1465bd8deadSopenharmony_ci        which is the ratio of the resolution rendered compared to the native
1475bd8deadSopenharmony_ci        framebuffer.
1485bd8deadSopenharmony_ci
1495bd8deadSopenharmony_ci    In the future it is expected that more features will be added, without
1505bd8deadSopenharmony_ci    breaking backwards compatibility.
1515bd8deadSopenharmony_ci
1525bd8deadSopenharmony_ci    'providedFeatures' is a pointer to a uint that will be set to a new bitfield
1535bd8deadSopenharmony_ci    that tells the application which features the implementation provided for the
1545bd8deadSopenharmony_ci    current foveation configuration, in the same format as used in the 'requested
1555bd8deadSopenharmony_ci    Features' bitfield. This may include more or fewer features than the application
1565bd8deadSopenharmony_ci    requested.  The FOVEATION_ENABLE_BIT_QCOM will not be included if the
1575bd8deadSopenharmony_ci    implementation has to fallback to non-foveated rendering.
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci    If an application tries to make use of a feature that is not included in the
1605bd8deadSopenharmony_ci    'providedFeatures' bitfield, the results of the operation are implementation
1615bd8deadSopenharmony_ci    defined, but should not yield application termination.
1625bd8deadSopenharmony_ci
1635bd8deadSopenharmony_ci    If this command is called with 'requestedFeatures' equal to zero, then the value
1645bd8deadSopenharmony_ci    of 'providedFeatures' will have FOVEATION_ENABLE_BIT_QCOM unset, and the other
1655bd8deadSopenharmony_ci    bits will be set or unset to indicate which foveation features are supported
1665bd8deadSopenharmony_ci    by the implementation.
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci    The command
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ci    void FramebufferFoveationParametersQCOM(uint fbo,uint layer, uint focalPoint,
1715bd8deadSopenharmony_ci    float focalX, float focalY, float gainX, float gainY, float foveaArea);
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ci    is used to control the falloff of the foveated rendering of 'focalPoint'
1745bd8deadSopenharmony_ci    for layer  'layer' in the framebuffer object 'fbo'. Multiple focal points
1755bd8deadSopenharmony_ci    per layer are provided to enable foveated rendering when different regions
1765bd8deadSopenharmony_ci    of a framebuffer represent different views, such as with double wide
1775bd8deadSopenharmony_ci    rendering. Values of 0 to the framebuffers focalPointsPerLayer-1 are valid
1785bd8deadSopenharmony_ci    for the 'focalPoint' input and specify which focal point's data to update
1795bd8deadSopenharmony_ci    for the layer.
1805bd8deadSopenharmony_ci
1815bd8deadSopenharmony_ci    'focalX' and 'focalY' is used to specify the x and y coordinate
1825bd8deadSopenharmony_ci    of the focal point of the foveated framebuffer in normalized device
1835bd8deadSopenharmony_ci    coordinates. 'gainX' and 'gainY' are used to control how quickly the
1845bd8deadSopenharmony_ci    quality falls off as you get further away from the focal point in each
1855bd8deadSopenharmony_ci    axis. The larger these values are the faster the quality degrades.
1865bd8deadSopenharmony_ci    'foveaArea' is used to control the minimum size of the fovea region, the
1875bd8deadSopenharmony_ci    area before the quality starts to fall off. These parameters should be
1885bd8deadSopenharmony_ci    modified to match the lens characteristics.
1895bd8deadSopenharmony_ci
1905bd8deadSopenharmony_ci    For the scaled bin method, these parameters define the minimum pixel
1915bd8deadSopenharmony_ci    density allowed for a given focal point at the location (px,py) on a
1925bd8deadSopenharmony_ci    framebuffer layer in NDC as:
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ci    min_pixel_density=0.;
1955bd8deadSopenharmony_ci    for(int i=0;i<focalPointsPerLayer;++i){
1965bd8deadSopenharmony_ci        focal_point_density = 1./max((focalX[i]-px)^2*gainX[i]^2+
1975bd8deadSopenharmony_ci                            (focalY[i]-py)^2*gainY[i]^2-foveaArea[i],1.);
1985bd8deadSopenharmony_ci        min_pixel_density=max(min_pixel_density,focal_point_density);
1995bd8deadSopenharmony_ci    }
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci    While this function is continuous, it is worth noting that an
2025bd8deadSopenharmony_ci    implementation is allowed to decimate to a fixed number of supported
2035bd8deadSopenharmony_ci    quality levels, and it is allowed to group pixels into larger regions of
2045bd8deadSopenharmony_ci    constant quality level, as long as the implementation at least provides
2055bd8deadSopenharmony_ci    the quality level given in the above equation.
2065bd8deadSopenharmony_ci
2075bd8deadSopenharmony_ci    Future supported foveation methods could have different definitions of
2085bd8deadSopenharmony_ci    quality.
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci    The default values for each of the focal points in a layer is:
2115bd8deadSopenharmony_ci
2125bd8deadSopenharmony_ci    focalX=focalY=0;
2135bd8deadSopenharmony_ci    gainX=gainY=0;
2145bd8deadSopenharmony_ci    foveaArea=0;
2155bd8deadSopenharmony_ci
2165bd8deadSopenharmony_ci    Which requires the entire framebuffer to be rendered at full quality.
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ci    By specifying these constraints an application can fully constrain its
2195bd8deadSopenharmony_ci    render quality while leaving the implementation enough flexibility to
2205bd8deadSopenharmony_ci    render efficiently.
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ciErrors
2235bd8deadSopenharmony_ci
2245bd8deadSopenharmony_ci    OUT_OF_MEMORY is generated by FramebufferFoveationConfigQCOM if an
2255bd8deadSopenharmony_ci    implementation runs out of memory when trying to reserve the needed
2265bd8deadSopenharmony_ci    additional resources for the foveated framebuffer.
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ci    INVALID_VALUE is generated by FramebufferFoveationConfigQCOM if 'fbo' is
2295bd8deadSopenharmony_ci    not a valid framebuffer.
2305bd8deadSopenharmony_ci
2315bd8deadSopenharmony_ci    INVALID_VALUE is generated by FramebufferFoveationConfigQCOM if 'numLayers'
2325bd8deadSopenharmony_ci    is greater than GL_MAX_ARRAY_TEXTURE_LAYERS - 1.
2335bd8deadSopenharmony_ci
2345bd8deadSopenharmony_ci    INVALID_VALUE is generated by FramebufferFoveationConfigQCOM if
2355bd8deadSopenharmony_ci    'numFocalPoints' is greater than implementation can support.
2365bd8deadSopenharmony_ci
2375bd8deadSopenharmony_ci    INVALID_OPERATION is generated by FramebufferFoveationConfigQCOM if it is
2385bd8deadSopenharmony_ci    called for a fbo that has already been cofigured for foveated rendering.
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci    INVALID_VALUE is generated by FramebufferFoveationParametersQCOM if 'fbo'
2415bd8deadSopenharmony_ci    is not a valid framebuffer.
2425bd8deadSopenharmony_ci
2435bd8deadSopenharmony_ci    INVALID_OPERATION is generated by FramebufferFoveationParametersQCOM if
2445bd8deadSopenharmony_ci    'fbo' has not been configured for foveated rendering.
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ci    INVALID_VALUE is generated by FramebufferFoveationParametersQCOM if
2475bd8deadSopenharmony_ci    'layer' is greater than or equal to the numLayers that the fbo was
2485bd8deadSopenharmony_ci    previously configured for in FramebufferFoveationConfigQCOM.
2495bd8deadSopenharmony_ci
2505bd8deadSopenharmony_ci    INVALID_VALUE is generated by FramebufferFoveationParametersQCOM if
2515bd8deadSopenharmony_ci    'numFocalPoints' is greater than implementation can support.
2525bd8deadSopenharmony_ci
2535bd8deadSopenharmony_ci    INVALID_OPERATION is generated by any API call which causes a framebuffer
2545bd8deadSopenharmony_ci    attachment to be written to if the framebuffer attachments have changed for
2555bd8deadSopenharmony_ci    a foveated fbo.
2565bd8deadSopenharmony_ci
2575bd8deadSopenharmony_ci    INVALID_OPERATION is generated if a rendering command is issued and the
2585bd8deadSopenharmony_ci    current bound program uses tessellation or geometry shaders.
2595bd8deadSopenharmony_ci
2605bd8deadSopenharmony_ciIssues
2615bd8deadSopenharmony_ci
2625bd8deadSopenharmony_ci    1. Are layered framebuffers supported?
2635bd8deadSopenharmony_ci
2645bd8deadSopenharmony_ci    Layered framebuffers are supported to enable stereoscopic foveated
2655bd8deadSopenharmony_ci    rendering which is a main use case of this extension. When a layered
2665bd8deadSopenharmony_ci    framebuffer is used each layer has its own set of foveation parameters.
2675bd8deadSopenharmony_ci
2685bd8deadSopenharmony_ci    2. How is foveation performed?
2695bd8deadSopenharmony_ci
2705bd8deadSopenharmony_ci    How foveated rendering is performed to the framebuffer is implementation
2715bd8deadSopenharmony_ci    defined. However, if 'FOVEATION_SCALED_BIN_METHOD_BIT_QCOM' is set the
2725bd8deadSopenharmony_ci    implementation must perform foveation by dividing the framebuffer into a
2735bd8deadSopenharmony_ci    grid of subregions. Then rendering the geometry to each of these regions
2745bd8deadSopenharmony_ci    with a different projection or scale. And finally upscaling the subregion
2755bd8deadSopenharmony_ci    to the native full resolution framebuffer.
2765bd8deadSopenharmony_ci
2775bd8deadSopenharmony_ci    When that bit is not set the implementation can use any algorithm it
2785bd8deadSopenharmony_ci    wants for foveated rendering as long as it meets the application
2795bd8deadSopenharmony_ci    requested features.
2805bd8deadSopenharmony_ci
2815bd8deadSopenharmony_ci    3. How are MRTs handled?
2825bd8deadSopenharmony_ci
2835bd8deadSopenharmony_ci    Every framebuffer attachment uses the same quality in a given region.
2845bd8deadSopenharmony_ci
2855bd8deadSopenharmony_ci    4. How does gl_FragCoord work?
2865bd8deadSopenharmony_ci
2875bd8deadSopenharmony_ci    When using the scaled bin method, gl_FragCoord will be scaled to match
2885bd8deadSopenharmony_ci    the relative location in a foveated framebuffer. This means the absolute
2895bd8deadSopenharmony_ci    value of gl_FragCoord will not be correct in lower resolution areas,
2905bd8deadSopenharmony_ci    but the value relative to the full resolution will be consistent.
2915bd8deadSopenharmony_ci
2925bd8deadSopenharmony_ci    5. How is depth handled?
2935bd8deadSopenharmony_ci
2945bd8deadSopenharmony_ci    Depth surfaces can be used during foveated rendering, but the contents
2955bd8deadSopenharmony_ci    of the depth buffer will not be resolved out. The implementation can
2965bd8deadSopenharmony_ci    do an implicit discard of the depth buffer. The reasoning here is that
2975bd8deadSopenharmony_ci    the upsample of depth during resolve would produce irrelevant results.
2985bd8deadSopenharmony_ci
2995bd8deadSopenharmony_ci    6. How does unresolving from a foveated framebuffer work?
3005bd8deadSopenharmony_ci
3015bd8deadSopenharmony_ci    Loading from a foveated framebuffer is undefined, so the app must be
3025bd8deadSopenharmony_ci    sure not to trigger mid frame flushes. In the dynamic foveation case
3035bd8deadSopenharmony_ci    the focal point can move constantly. If a region A of a frame 0 was
3045bd8deadSopenharmony_ci    rendered at a lower quality because the focal point was far away,
3055bd8deadSopenharmony_ci    then the focal point moved to cover region A during frame 1, the
3065bd8deadSopenharmony_ci    unresolve could not reconstruct the full quality region A. The
3075bd8deadSopenharmony_ci    app must be careful to fully clear the surface and remove mid frame
3085bd8deadSopenharmony_ci    flushes to prevent unresolves.
3095bd8deadSopenharmony_ci
3105bd8deadSopenharmony_ciExamples:
3115bd8deadSopenharmony_ci
3125bd8deadSopenharmony_ci    (1) Initialize a foveated framebuffer
3135bd8deadSopenharmony_ci
3145bd8deadSopenharmony_ci        // Allocate and initialize a regular framebuffer and attachments
3155bd8deadSopenharmony_ci        GLuint fbo = createFramebufferAndAttachments();
3165bd8deadSopenharmony_ci        GLuint providedFeatures;
3175bd8deadSopenharmony_ci        glFramebufferFoveationConfigQCOM(fbo,1,1, GL_FOVEATION_ENABLE_BIT_QCOM, &providedFeatures);
3185bd8deadSopenharmony_ci        if(!(providedFeatures & GL_FOVEATION_ENABLE_BIT_QCOM)) {
3195bd8deadSopenharmony_ci            // Failed to enable foveation
3205bd8deadSopenharmony_ci        }
3215bd8deadSopenharmony_ci
3225bd8deadSopenharmony_ci    (2) Setup static foveated rendering
3235bd8deadSopenharmony_ci
3245bd8deadSopenharmony_ci        // Insert code from #1
3255bd8deadSopenharmony_ci        GLfloat focalX=0.f, focalY=0.f;  // Setup focal point at the center of screen
3265bd8deadSopenharmony_ci        GLfloat gainX=4.f, gainY=4.f;  // Increase these for stronger foveation
3275bd8deadSopenharmony_ci        glFramebufferFoveationParametersQCOM(fbo, 0, 0, focalX, focalY, gainX, gainY, 0.f);
3285bd8deadSopenharmony_ci
3295bd8deadSopenharmony_ci    (3) Change eye position for eye tracked foveated rendering
3305bd8deadSopenharmony_ci
3315bd8deadSopenharmony_ci        // Code called whenever the eye position changes
3325bd8deadSopenharmony_ci        // It is best to position this call both before rendering anything to
3335bd8deadSopenharmony_ci        //   a fbo and right before Flush or changing FBO since some
3345bd8deadSopenharmony_ci        //   some implementations can apply this state late by patching command
3355bd8deadSopenharmony_ci        //   buffers.
3365bd8deadSopenharmony_ci        glFramebufferFoveationParametersQCOM(fbo, 0, 0, focalX, focalY, gainX, gainY, 0.f);
3375bd8deadSopenharmony_ci
3385bd8deadSopenharmony_ci    (4) Setting parameters for a multiview stereo framebuffer
3395bd8deadSopenharmony_ci
3405bd8deadSopenharmony_ci        //focalPointsPerLayer should be 1
3415bd8deadSopenharmony_ci        float focalX1=0.f,focalY1=0.f;  // Gaze of left eye
3425bd8deadSopenharmony_ci        float focalX2=0.f,focalY2=0.f;  // Gaze of right eye
3435bd8deadSopenharmony_ci        float gain_x=10.f,gain_y=10.f;  // Strong foveation
3445bd8deadSopenharmony_ci        glFramebufferFoveationParametersQCOM(fbo, 0, 0, focalX1, focalY1,gainX, gainY, 0.f);
3455bd8deadSopenharmony_ci        glFramebufferFoveationParametersQCOM(fbo, 1, 0, focalX2, focalY2,gainX, gainY, 0.f);
3465bd8deadSopenharmony_ci
3475bd8deadSopenharmony_ci    (5) Setting parameters for a double wide stereo framebuffer
3485bd8deadSopenharmony_ci
3495bd8deadSopenharmony_ci        //focalPointsPerLayer should be 2
3505bd8deadSopenharmony_ci        float focalX1=0.f,focalY1=0.f;  // Gaze of left eye
3515bd8deadSopenharmony_ci        float focalX2=0.f,focalY2=0.f;  // Gaze of right eye
3525bd8deadSopenharmony_ci        float gainX=10.f,gainY=10.f;
3535bd8deadSopenharmony_ci        glFramebufferFoveationParametersQCOM(fbo, 0, 0, focalX1*0.5f-0.5f, focalY1, gainX*2.f ,gainY, 0.f);
3545bd8deadSopenharmony_ci        glFramebufferFoveationParametersQCOM(fbo, 0, 1, focalX2*0.5f+0.5f, focalY2, gainX*2.f ,gainY, 0.f);
3555bd8deadSopenharmony_ci
3565bd8deadSopenharmony_ci
3575bd8deadSopenharmony_ciRevision History
3585bd8deadSopenharmony_ci
3595bd8deadSopenharmony_ci    Rev.    Date     Author    Changes
3605bd8deadSopenharmony_ci    ----  --------  --------  ----------------------------------------------
3615bd8deadSopenharmony_ci     1    05/19/16  ssaleh    Initial draft.
3625bd8deadSopenharmony_ci     2    05/27/16  ssaleh    Made the extension much more explicit.
3635bd8deadSopenharmony_ci     3    07/08/16  ssaleh    Further refinements.
3645bd8deadSopenharmony_ci     4    08/11/16  ssaleh    Specified bitfield values
3655bd8deadSopenharmony_ci     5    08/19/16  ssaleh    Added support for double wide rendering
3665bd8deadSopenharmony_ci     6    08/24/16  mribble   Name changes and cleanup
3675bd8deadSopenharmony_ci     7    08/24/16  ssaleh    Add examples
3685bd8deadSopenharmony_ci     8    10/14/16  tateh     Clarify gl_FragCoord
3695bd8deadSopenharmony_ci     9    01/04/17  tateh     Update entry points and cleanup
3705bd8deadSopenharmony_ci    10    02/17/17  jleger    Convert from EXT to QCOM extension.
3715bd8deadSopenharmony_ci    11    05/10/17  tateh     Minor cleanup
372