15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_framebuffer_multisample_blit_scaled 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_framebuffer_multisample_blit_scaled 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Gareth Hughes, NVIDIA Corporation (gareth 'at' nvidia.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Jeff Bolz, NVIDIA 165bd8deadSopenharmony_ci Pat Brown, NVIDIA 175bd8deadSopenharmony_ci Alex Eddy, Apple 185bd8deadSopenharmony_ci Gareth Hughes, NVIDIA 195bd8deadSopenharmony_ci Eric Werness, NVIDIA 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ciStatus 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ci Complete. 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ciVersion 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ci Last Modified Date: 07/05/11 285bd8deadSopenharmony_ci Revision: 8 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ciNumber 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ci 409 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ciDependencies 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci ARB_framebuffer_object is required. 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ci Written based on the wording of the OpenGL 2.1 specification. 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ciOverview 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ci This extension relaxes some of the restrictions associated with 445bd8deadSopenharmony_ci multisample resolve operations, specifically to allow a combined 455bd8deadSopenharmony_ci resolve and scale operation through a single call to BlitFramebuffer. 465bd8deadSopenharmony_ci It also adds two new filter types to control the quality of the 475bd8deadSopenharmony_ci combined scaled resolve operation. 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ci In traditional multisampled framebuffer rendering, color samples 505bd8deadSopenharmony_ci must be explicitly resolved via BlitFramebuffer before any other 515bd8deadSopenharmony_ci operation on the resulting pixel values can be performed. This 525bd8deadSopenharmony_ci multisample resolve operation must be done using a BlitFramebuffer 535bd8deadSopenharmony_ci call where the dimensions of the source and destination rectangles 545bd8deadSopenharmony_ci are identical. If the resulting pixel values need to be copied to a 555bd8deadSopenharmony_ci texture with different dimensions, these resolved values can then be 565bd8deadSopenharmony_ci scaled with a second call to BlitFramebuffer. 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci By requiring two separate calls to BlitFramebuffer, the quality 595bd8deadSopenharmony_ci of final image can be maintained to a certain degree. The samples 605bd8deadSopenharmony_ci are first resolved, and then these resolved values can be filtered 615bd8deadSopenharmony_ci to produce the final image. This image quality comes at the price 625bd8deadSopenharmony_ci of increased memory usage and lower performance. However, the 635bd8deadSopenharmony_ci scaling blit can still introduce artifacts, particularly if it is 645bd8deadSopenharmony_ci done with a simple bilinear filter. 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci The new filter types introduced by this extension allow the scaled 675bd8deadSopenharmony_ci resolve to be done with a single call to BlitFramebuffer. Not all 685bd8deadSopenharmony_ci samples from the read framebuffer are required to be be used when 695bd8deadSopenharmony_ci producing the final pixel values, and there may be a loss in quality 705bd8deadSopenharmony_ci when compared to an image produced by a separate resolve and scale. 715bd8deadSopenharmony_ci However, the single-pass scaled resolve blit should be faster than 725bd8deadSopenharmony_ci the traditional two-pass resolve then scale blits. 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ciNew Procedures and Functions 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci None. 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ciNew Types 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ci None. 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci 855bd8deadSopenharmony_ciNew Tokens 865bd8deadSopenharmony_ci 875bd8deadSopenharmony_ci Accepted by the <filter> parameter of BlitFramebuffer: 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci SCALED_RESOLVE_FASTEST_EXT 0x90BA 905bd8deadSopenharmony_ci SCALED_RESOLVE_NICEST_EXT 0x90BB 915bd8deadSopenharmony_ci 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 2.1 Specification (Per-Fragment 945bd8deadSopenharmony_ciOperations and the Frame Buffer) 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci In section 4.3.3 "Copying Pixels", modify the fifth paragraph 975bd8deadSopenharmony_ci describing BlitFramebuffer as follows: 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ci "If the source and destination rectangle dimensions do not match, 1005bd8deadSopenharmony_ci the source image is stretched to fit the rectangle. <filter> must 1015bd8deadSopenharmony_ci be LINEAR, NEAREST, SCALED_RESOLVE_FASTEST_EXT or 1025bd8deadSopenharmony_ci SCALED_RESOLVE_NICEST_EXT and specifies the method of interpolation 1035bd8deadSopenharmony_ci to be applied if the image is stretched. LINEAR, 1045bd8deadSopenharmony_ci SCALED_RESOLVE_FASTEST_EXT or SCALED_RESOLVE_NICEST_EXT filtering is 1055bd8deadSopenharmony_ci allowed only for the color buffer; if ..." 1065bd8deadSopenharmony_ci 1075bd8deadSopenharmony_ci Modify the following text in section 4.3.3 "Copying Pixels" that was 1085bd8deadSopenharmony_ci added by ARB_framebuffer_object: 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci "If SAMPLE_BUFFERS for the read framebuffer is greater than zero, 1115bd8deadSopenharmony_ci SAMPLE_BUFFERS for the draw framebuffer is zero and the dimensions 1125bd8deadSopenharmony_ci of the source and destination rectangles provided to 1135bd8deadSopenharmony_ci BlitFramebuffer are identical, the samples corresponding to each 1145bd8deadSopenharmony_ci pixel location in the source are converted to a single sample before 1155bd8deadSopenharmony_ci being written to the destination." 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci Modify the last paragraph in section 4.3.3 "Copying Pixels" that was 1185bd8deadSopenharmony_ci added by ARB_framebuffer_object: 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci "If SAMPLE_BUFFERS for either the read framebuffer or draw 1215bd8deadSopenharmony_ci framebuffer is greater than zero, no copy is performed and an 1225bd8deadSopenharmony_ci INVALID_OPERATION error is generated if the dimensions of the source 1235bd8deadSopenharmony_ci and destination rectangles provided to BlitFramebuffer are not 1245bd8deadSopenharmony_ci identical and the filter is NEAREST or LINEAR, or if the formats of 1255bd8deadSopenharmony_ci the read and draw framebuffers are not identical." 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ci Append to section 4.3.3, after the text that was added by 1285bd8deadSopenharmony_ci ARB_framebuffer_object: 1295bd8deadSopenharmony_ci 1305bd8deadSopenharmony_ci "If SAMPLE_BUFFERS for the read framebuffer is greater than zero, 1315bd8deadSopenharmony_ci SAMPLE_BUFFERS for the draw framebuffer is zero, the dimensions of 1325bd8deadSopenharmony_ci the source and destination rectangles provided to BlitFramebuffer 1335bd8deadSopenharmony_ci are not identical, and the filter is SCALED_RESOLVE_FASTEST_EXT or 1345bd8deadSopenharmony_ci SCALED_RESOLVE_NICEST_EXT, then the source samples are resolved and 1355bd8deadSopenharmony_ci scaled in an implementation specific manner. When the filter is 1365bd8deadSopenharmony_ci SCALED_RESOLVE_FASTEST_EXT, no fewer than four samples from the read 1375bd8deadSopenharmony_ci framebuffer will be used to construct each destination pixel. When 1385bd8deadSopenharmony_ci the filter is SCALED_RESOLVE_NICEST_EXT, the number of samples used 1395bd8deadSopenharmony_ci to construct each destination pixel will be at least as many as is 1405bd8deadSopenharmony_ci used when the filter is SCALED_RESOLVE_FASTEST_EXT. 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci Futhermore, if the filter provided to BlitFramebuffer is 1435bd8deadSopenharmony_ci SCALED_RESOLVE_FASTEST_EXT or SCALED_RESOLVE_NICEST_EXT, and if 1445bd8deadSopenharmony_ci SAMPLE_BUFFERS for the read framebuffer is zero or SAMPLE_BUFFERS 1455bd8deadSopenharmony_ci for the draw framebuffer is greater than zero then no copy is 1465bd8deadSopenharmony_ci performed and an INVALID_OPERATION error is generated." 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ci If OpenGL 3.1 is supported, modify the following text in section 1495bd8deadSopenharmony_ci 4.3.2 "Copying Pixels": 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ci "Calling BlitFramebuffer will result in an INVALID_OPERATION error if 1525bd8deadSopenharmony_ci filter is not NEAREST and read buffer contains integer data." 1535bd8deadSopenharmony_ci 1545bd8deadSopenharmony_ci 1555bd8deadSopenharmony_ciDependencies on ARB_framebuffer_object 1565bd8deadSopenharmony_ci 1575bd8deadSopenharmony_ci ARB_framebuffer_object is required. 1585bd8deadSopenharmony_ci 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ciErrors 1615bd8deadSopenharmony_ci 1625bd8deadSopenharmony_ci If either the draw or read framebuffer is framebuffer complete and 1635bd8deadSopenharmony_ci has a value of SAMPLE_BUFFERS that is greater than zero, then the 1645bd8deadSopenharmony_ci error INVALID_OPERATION is generated if BlitFramebuffer is called 1655bd8deadSopenharmony_ci and the specified source and destination dimensions are not 1665bd8deadSopenharmony_ci identical and the filter is NEAREST or LINEAR. 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ci If the draw framebuffer is framebuffer complete and has a value of 1695bd8deadSopenharmony_ci SAMPLE_BUFFERS that is greater than zero, or if the read framebuffer 1705bd8deadSopenharmony_ci is framebuffer complete and has a value of SAMPLE_BUFFERS that is 1715bd8deadSopenharmony_ci zero, then the error INVALID_OPERATION is generated if 1725bd8deadSopenharmony_ci BlitFramebuffer is called and the filter is 1735bd8deadSopenharmony_ci SCALED_RESOLVE_FASTEST_EXT or SCALED_RESOLVE_NICEST_EXT. 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ci 1765bd8deadSopenharmony_ciNVIDIA Implementation Details 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci When SAMPLE_BUFFERS is greater than zero, the samples are laid out 1795bd8deadSopenharmony_ci in a rectangular grid roughly corresponding to the location of the 1805bd8deadSopenharmony_ci samples where the aspect ratio per pixel is no worse than two. 1815bd8deadSopenharmony_ci 1825bd8deadSopenharmony_ci SCALED_RESOLVE_FASTEST_EXT is implemented with a simple bilinear 1835bd8deadSopenharmony_ci filter of the source samples, regardless of the number of samples in 1845bd8deadSopenharmony_ci the read framebuffer. 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci SCALED_RESOLVE_NICEST_EXT is implemented with an anisotropic filter 1875bd8deadSopenharmony_ci of the source samples, regardless of the number of samples in the 1885bd8deadSopenharmony_ci read framebuffer. The final image quality will be somewhat 1895bd8deadSopenharmony_ci dependent on the ratio of the dimensions of the draw and read 1905bd8deadSopenharmony_ci framebuffers, but in all cases will be no worse than a simple 1915bd8deadSopenharmony_ci bilinear filter. 1925bd8deadSopenharmony_ci 1935bd8deadSopenharmony_ci 1945bd8deadSopenharmony_ciIssues 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ci (1) What should this extension be called? 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ci RESOLVED: EXT_framebuffer_multisample_blit_scaled. 1995bd8deadSopenharmony_ci 2005bd8deadSopenharmony_ci This extension is mostly based on the functionality introduced 2015bd8deadSopenharmony_ci by EXT_framebuffer_multisample and EXT_framebuffer_blit, and so 2025bd8deadSopenharmony_ci should include all of these terms. 2035bd8deadSopenharmony_ci 2045bd8deadSopenharmony_ci (2) Should there be an explicit way to enable the scaled resolve 2055bd8deadSopenharmony_ci blit, or should this feature be silently enabled by the mere 2065bd8deadSopenharmony_ci presence of this extension? 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci RESOLVED: Explicit enums. 2095bd8deadSopenharmony_ci 2105bd8deadSopenharmony_ci While it might be simpler to just remove the restriction on the 2115bd8deadSopenharmony_ci dimensions of the rectangles passed to BlitFramebuffer when 2125bd8deadSopenharmony_ci SAMPLE_BUFFERS is greater than zero for either the read or draw 2135bd8deadSopenharmony_ci framebuffer, a new filter type was added to address the 2145bd8deadSopenharmony_ci potential loss in quality when doing a single-pass scaled 2155bd8deadSopenharmony_ci resolve blit. 2165bd8deadSopenharmony_ci 2175bd8deadSopenharmony_ci (3) Should the restriction be removed in all cases, or only when 2185bd8deadSopenharmony_ci SAMPLE_BUFFERS is greater than zero for the read framebuffer? 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci RESOLVED: Only for multisample resolves. 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ci Given the fact that this extension adds new filter types 2235bd8deadSopenharmony_ci explicitly designed for a scaled multisample resolve blit, it 2245bd8deadSopenharmony_ci seems reasonable to limit the use of this new filter type to 2255bd8deadSopenharmony_ci multisample resolves and not pixel replication when 2265bd8deadSopenharmony_ci SAMPLE_BUFFERS is greater than zero for the draw framebuffer. 2275bd8deadSopenharmony_ci As such, the new filter types can only be used with a 2285bd8deadSopenharmony_ci multisample read framebuffer and a single-sample draw 2295bd8deadSopenharmony_ci framebuffer. 2305bd8deadSopenharmony_ci 2315bd8deadSopenharmony_ci (4) Should the restriction be removed when SAMPLE_BUFFERS is greater 2325bd8deadSopenharmony_ci than zero for both the read and draw framebuffer? 2335bd8deadSopenharmony_ci 2345bd8deadSopenharmony_ci RESOLVED: NO. 2355bd8deadSopenharmony_ci 2365bd8deadSopenharmony_ci The purpose of this extension is to improve performance of the 2375bd8deadSopenharmony_ci multisample resolve operation when the resulting pixel data 2385bd8deadSopenharmony_ci needs to be copied to a texture with different dimensions. By 2395bd8deadSopenharmony_ci allowing the resolve and scale to be completed with a single 2405bd8deadSopenharmony_ci BlitFramebuffer call, there is no need for an intermediate 2415bd8deadSopenharmony_ci framebuffer object. This both reduces the memory footprint and 2425bd8deadSopenharmony_ci increases performance by reducing the amount of data that needs 2435bd8deadSopenharmony_ci to be copied. 2445bd8deadSopenharmony_ci 2455bd8deadSopenharmony_ci (5) Does the process in which sample values are resolved and scaled 2465bd8deadSopenharmony_ci need to be defined? 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ci RESOLVED: NO. 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ci The minimum levels of quality are defined by this extension, but 2515bd8deadSopenharmony_ci the exact details are left up to the implementation. In fact, 2525bd8deadSopenharmony_ci it is likely that a single, potentially random sample for each 2535bd8deadSopenharmony_ci pixel will be accessed as part of a simple bilinear filter 2545bd8deadSopenharmony_ci operation. This will depend on the memory layout for the given 2555bd8deadSopenharmony_ci number of SAMPLE_BUFFERS, the dimensions of the source and 2565bd8deadSopenharmony_ci destination rectangles, and so on. 2575bd8deadSopenharmony_ci 2585bd8deadSopenharmony_ci (6) How good is SCALED_RESOLVE_FASTEST_EXT? 2595bd8deadSopenharmony_ci 2605bd8deadSopenharmony_ci RESOLVED: No worse than a 4-tap linear filter. 2615bd8deadSopenharmony_ci 2625bd8deadSopenharmony_ci The implementation of this filter type should be no worse than a 2635bd8deadSopenharmony_ci simple 4-tap linear filter. The exact image quality may depend 2645bd8deadSopenharmony_ci on the memory layout of the multisampled read framebuffer. 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ci (7) How good is SCALED_RESOLVE_NICEST_EXT? 2675bd8deadSopenharmony_ci 2685bd8deadSopenharmony_ci RESOLVED: No worse than SCALED_RESOLVE_FASTEST_EXT. 2695bd8deadSopenharmony_ci 2705bd8deadSopenharmony_ci The implementation of this filter type should be at least as 2715bd8deadSopenharmony_ci good as than a simple 4-tap linear filter, but does not need to 2725bd8deadSopenharmony_ci be bit-for-bit identical with the original two-pass resolve and 2735bd8deadSopenharmony_ci scale. The exact image quality may depend on the memory layout 2745bd8deadSopenharmony_ci of the multisampled read framebuffer. 2755bd8deadSopenharmony_ci 2765bd8deadSopenharmony_ci (8) Can the new filter types be used with integer data? 2775bd8deadSopenharmony_ci 2785bd8deadSopenharmony_ci RESOLVED: NO. 2795bd8deadSopenharmony_ci 2805bd8deadSopenharmony_ci It does not make sense to have the new filter types be used with 2815bd8deadSopenharmony_ci integer data when the OpenGL 3.1 spec does not allow a filter of 2825bd8deadSopenharmony_ci LINEAR in those cases. 2835bd8deadSopenharmony_ci 2845bd8deadSopenharmony_ci 2855bd8deadSopenharmony_ciRevision History 2865bd8deadSopenharmony_ci 2875bd8deadSopenharmony_ci Rev. Date Author Changes 2885bd8deadSopenharmony_ci ---- -------- -------- ----------------------------------------- 2895bd8deadSopenharmony_ci 8 07/05/11 ghughes Update status to complete. 2905bd8deadSopenharmony_ci 7 03/10/11 ghughes Update contributors. 2915bd8deadSopenharmony_ci 6 03/01/11 ghughes Updated NVIDIA implementation details. 2925bd8deadSopenharmony_ci 5 03/01/11 ghughes More clarifications. 2935bd8deadSopenharmony_ci 4 02/28/11 ghughes Clarified language about filter types. 2945bd8deadSopenharmony_ci 3 08/30/10 ghughes Updated filter enums, added more issues. 2955bd8deadSopenharmony_ci 2 08/30/10 ghughes Added new filter types. 2965bd8deadSopenharmony_ci 1 08/27/10 ghughes Initial revision. 297