102f4aeb0Sopenharmony_ciName 202f4aeb0Sopenharmony_ci 302f4aeb0Sopenharmony_ci NV_post_sub_buffer 402f4aeb0Sopenharmony_ci 502f4aeb0Sopenharmony_ciName Strings 602f4aeb0Sopenharmony_ci 702f4aeb0Sopenharmony_ci EGL_NV_post_sub_buffer 802f4aeb0Sopenharmony_ci 902f4aeb0Sopenharmony_ciContributors 1002f4aeb0Sopenharmony_ci 1102f4aeb0Sopenharmony_ci Arcady Goldmints-Orlov 1202f4aeb0Sopenharmony_ci James Jones 1302f4aeb0Sopenharmony_ci Daniel Kartch 1402f4aeb0Sopenharmony_ci 1502f4aeb0Sopenharmony_ciContact 1602f4aeb0Sopenharmony_ci 1702f4aeb0Sopenharmony_ci James Jones, NVIDIA Corporation (jajones 'at' nvidia.com) 1802f4aeb0Sopenharmony_ci 1902f4aeb0Sopenharmony_ciStatus 2002f4aeb0Sopenharmony_ci 2102f4aeb0Sopenharmony_ci Draft. 2202f4aeb0Sopenharmony_ci 2302f4aeb0Sopenharmony_ciVersion 2402f4aeb0Sopenharmony_ci 2502f4aeb0Sopenharmony_ci Version 3, November 5, 2010 2602f4aeb0Sopenharmony_ci 2702f4aeb0Sopenharmony_ciNumber 2802f4aeb0Sopenharmony_ci 2902f4aeb0Sopenharmony_ci EGL Extension #27 3002f4aeb0Sopenharmony_ci 3102f4aeb0Sopenharmony_ciDependencies 3202f4aeb0Sopenharmony_ci 3302f4aeb0Sopenharmony_ci Requires EGL 1.1 3402f4aeb0Sopenharmony_ci 3502f4aeb0Sopenharmony_ci This extension is written against the wording of the EGL 1.4 3602f4aeb0Sopenharmony_ci Specification 3702f4aeb0Sopenharmony_ci 3802f4aeb0Sopenharmony_ciOverview 3902f4aeb0Sopenharmony_ci 4002f4aeb0Sopenharmony_ci Many EGL client APIs do not support rendering to window surfaces 4102f4aeb0Sopenharmony_ci directly, so there is no way to efficiently make small updates to 4202f4aeb0Sopenharmony_ci window surfaces. Applications that need to perform many small updates 4302f4aeb0Sopenharmony_ci must either use the back-buffer preservation flag which forces 4402f4aeb0Sopenharmony_ci eglSwapBuffers to copy the entire back surface, or redraw the entire 4502f4aeb0Sopenharmony_ci back buffer on every update and hope eglSwapBuffers is implemented 4602f4aeb0Sopenharmony_ci using buffer-flipping. This extension provides a 3rd alternative: a 4702f4aeb0Sopenharmony_ci function which posts a sub-rectangle of a window surface and 4802f4aeb0Sopenharmony_ci preserves the back-buffer contents. 4902f4aeb0Sopenharmony_ci 5002f4aeb0Sopenharmony_ciNew Types 5102f4aeb0Sopenharmony_ci 5202f4aeb0Sopenharmony_ci None. 5302f4aeb0Sopenharmony_ci 5402f4aeb0Sopenharmony_ciNew Procedures and Functions 5502f4aeb0Sopenharmony_ci 5602f4aeb0Sopenharmony_ci EGLBoolean eglPostSubBufferNV(EGLDisplay dpy, 5702f4aeb0Sopenharmony_ci EGLSurface surface, 5802f4aeb0Sopenharmony_ci EGLint x, EGLint y, 5902f4aeb0Sopenharmony_ci EGLint width, EGLint height); 6002f4aeb0Sopenharmony_ci 6102f4aeb0Sopenharmony_ciNew Tokens 6202f4aeb0Sopenharmony_ci 6302f4aeb0Sopenharmony_ci Accepted by the <attribute> parameter of eglQuerySurface and by the 6402f4aeb0Sopenharmony_ci <attrib_list> parameter of eglCreateWindowSurface: 6502f4aeb0Sopenharmony_ci 6602f4aeb0Sopenharmony_ci EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE 6702f4aeb0Sopenharmony_ci 6802f4aeb0Sopenharmony_ciChanges to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors) 6902f4aeb0Sopenharmony_ci 7002f4aeb0Sopenharmony_ci Modify the second paragraph of Section 3.5.1, page 27 7102f4aeb0Sopenharmony_ci (Creating On-Screen Rendering Surfaces) 7202f4aeb0Sopenharmony_ci 7302f4aeb0Sopenharmony_ci "<attrib_list> specifies a list of attributes for the window. The list 7402f4aeb0Sopenharmony_ci has the same structure as described for eglChooseConfig. Attributes 7502f4aeb0Sopenharmony_ci that can be specified in <attrib_list> include EGL_POST_SUB_BUFFER_- 7602f4aeb0Sopenharmony_ci SUPPORTED_NV, EGL_RENDER_BUFFER, EGL_VG_COLORSPACE, and EGL_VG_ALPHA_- 7702f4aeb0Sopenharmony_ci FORMAT." 7802f4aeb0Sopenharmony_ci 7902f4aeb0Sopenharmony_ci Add the following between paragraphs 4 and 5 of Section 3.5.1, page 27 8002f4aeb0Sopenharmony_ci (Creating On-Screen Rendering Surfaces) 8102f4aeb0Sopenharmony_ci 8202f4aeb0Sopenharmony_ci "EGL_POST_SUB_BUFFER_SUPPORTED_NV specifies whether the application 8302f4aeb0Sopenharmony_ci would perfer a surface that supports sub-buffer post operations, as 8402f4aeb0Sopenharmony_ci described in section 3.9.1. Its values can be EGL_TRUE, in which case 8502f4aeb0Sopenharmony_ci the implementation will attempt to allocate a surface that supports 8602f4aeb0Sopenharmony_ci sub-buffer posts, or EGL_FALSE, in which case the implementation will 8702f4aeb0Sopenharmony_ci not take sub-buffer post capabilities into account. 8802f4aeb0Sopenharmony_ci 8902f4aeb0Sopenharmony_ci "Implementations may not be able to support sub-buffer post 9002f4aeb0Sopenharmony_ci mechanisms, or may support them only on some native windows. Use 9102f4aeb0Sopenharmony_ci eglQuerySurface to determine a surface's capabilities (see section 9202f4aeb0Sopenharmony_ci 3.5.6)." 9302f4aeb0Sopenharmony_ci 9402f4aeb0Sopenharmony_ci Add the following entry to Table 3.5, page 36 9502f4aeb0Sopenharmony_ci (Queryable surface attributes and types) 9602f4aeb0Sopenharmony_ci 9702f4aeb0Sopenharmony_ci Attribute Type Description 9802f4aeb0Sopenharmony_ci -------------------------------- ------- ------------------------ 9902f4aeb0Sopenharmony_ci EGL_POST_SUB_BUFFER_SUPPORTED_NV boolean Surface can be used with 10002f4aeb0Sopenharmony_ci eglPostSubBufferNV 10102f4aeb0Sopenharmony_ci 10202f4aeb0Sopenharmony_ci Add the following paragraph to Section 3.5.6, page 37 10302f4aeb0Sopenharmony_ci (Surface Attributes) 10402f4aeb0Sopenharmony_ci 10502f4aeb0Sopenharmony_ci "Querying EGL_POST_SUB_BUFFER_SUPPORTED_NV returns EGL_TRUE if the 10602f4aeb0Sopenharmony_ci surface can use eglPostSubBufferNV (See section 3.9.1) to post sub- 10702f4aeb0Sopenharmony_ci rectangles of the back color buffer. Otherwise, EGL_FALSE is 10802f4aeb0Sopenharmony_ci returned." 10902f4aeb0Sopenharmony_ci 11002f4aeb0Sopenharmony_ci Replace all but the last paragraph of section Section 3.9.1, page 50 11102f4aeb0Sopenharmony_ci (Posting to a Window) 11202f4aeb0Sopenharmony_ci 11302f4aeb0Sopenharmony_ci "To post the color buffer to a window, call 11402f4aeb0Sopenharmony_ci 11502f4aeb0Sopenharmony_ci EGLBoolean eglSwapBuffers(EGLDisplay dpy, 11602f4aeb0Sopenharmony_ci EGLSurface surface); 11702f4aeb0Sopenharmony_ci 11802f4aeb0Sopenharmony_ci "To post a sub-rectangle of the color buffer to a window, call 11902f4aeb0Sopenharmony_ci 12002f4aeb0Sopenharmony_ci EGLBoolean eglPostSubBufferNV(EGLDisplay dpy, 12102f4aeb0Sopenharmony_ci EGLSurface surface, EGLint x, EGLint y, 12202f4aeb0Sopenharmony_ci EGLint width, EGLint height); 12302f4aeb0Sopenharmony_ci 12402f4aeb0Sopenharmony_ci "Where <x> and <y> are pixel offsets from the bottom-left corner of 12502f4aeb0Sopenharmony_ci <surface>. 12602f4aeb0Sopenharmony_ci 12702f4aeb0Sopenharmony_ci "If <surface> is a back-buffered surface, then the requested portion 12802f4aeb0Sopenharmony_ci of the color buffer is copied to the native window associated with 12902f4aeb0Sopenharmony_ci that surface. If <surface> is a single-buffered window, pixmap, or 13002f4aeb0Sopenharmony_ci pbuffer surface, eglSwapBuffers and eglPostSubBufferNV have no 13102f4aeb0Sopenharmony_ci effect. 13202f4aeb0Sopenharmony_ci 13302f4aeb0Sopenharmony_ci "The contents of ancillary buffers are always undefined after calling 13402f4aeb0Sopenharmony_ci eglSwapBuffers or eglPostSubBufferNV. The contents of the color 13502f4aeb0Sopenharmony_ci buffer are unchanged if eglPostSubBufferNV is called, or if 13602f4aeb0Sopenharmony_ci eglSwapBuffers is called and the value of the EGL_SWAP_BEHAVIOR 13702f4aeb0Sopenharmony_ci attribute of <surface> is EGL_BUFFER_PRESERVED. The value of EGL_- 13802f4aeb0Sopenharmony_ci SWAP_BEHAVIOR can be set for some surfaces using eglSurfaceAttrib, as 13902f4aeb0Sopenharmony_ci described in section 3.5.6. 14002f4aeb0Sopenharmony_ci 14102f4aeb0Sopenharmony_ci "Native Window Resizing 14202f4aeb0Sopenharmony_ci 14302f4aeb0Sopenharmony_ci "If the native window corresponding to <surface> has been resized 14402f4aeb0Sopenharmony_ci prior to the swap, <surface> must be resized to match. <surface> will 14502f4aeb0Sopenharmony_ci normally be resized by the EGL implementation at the time the native 14602f4aeb0Sopenharmony_ci window is resized. If the implementation cannot do this transparently 14702f4aeb0Sopenharmony_ci to the client, then eglSwapBuffers and eglPostSubBufferNV must 14802f4aeb0Sopenharmony_ci detect the change and resize <surface> prior to copying its pixels to 14902f4aeb0Sopenharmony_ci the native window. The sub-rectangle defined by <x>, <y>, <width>, and 15002f4aeb0Sopenharmony_ci <height> parameters to eglPostSubBufferNV will be clamped to the 15102f4aeb0Sopenharmony_ci extents of <surface>. If, after clamping, the rectangle contains no 15202f4aeb0Sopenharmony_ci pixels, eglPostSubBufferNV will have no effect." 15302f4aeb0Sopenharmony_ci 15402f4aeb0Sopenharmony_ci Modify the following sentences in Section 3.9.3, page 51 (Posting 15502f4aeb0Sopenharmony_ci Semantics) 15602f4aeb0Sopenharmony_ci 15702f4aeb0Sopenharmony_ci Paragraph 2, first sentence: 15802f4aeb0Sopenharmony_ci 15902f4aeb0Sopenharmony_ci "If <dpy> and <surface> are the display and surface for the calling 16002f4aeb0Sopenharmony_ci thread's current context, eglSwapBuffers, eglPostSubBufferNV, and 16102f4aeb0Sopenharmony_ci eglCopyBuffers perform an implicit flush operation on the context 16202f4aeb0Sopenharmony_ci (glFlush for OpenGL or OpenGL ES context, vgFlush for an OpenVG 16302f4aeb0Sopenharmony_ci context)." 16402f4aeb0Sopenharmony_ci 16502f4aeb0Sopenharmony_ci Paragraph 3, first sentence: 16602f4aeb0Sopenharmony_ci 16702f4aeb0Sopenharmony_ci "The destination of a posting operation (a visible window, for 16802f4aeb0Sopenharmony_ci eglSwapBuffers or eglPostSubBufferNV, or a native pixmap, for 16902f4aeb0Sopenharmony_ci eglCopyBuffers) should have the same number of components and 17002f4aeb0Sopenharmony_ci component sizes as the color buffer it's being copied from." 17102f4aeb0Sopenharmony_ci 17202f4aeb0Sopenharmony_ci Paragraph 6, first two sentences: 17302f4aeb0Sopenharmony_ci 17402f4aeb0Sopenharmony_ci "The function 17502f4aeb0Sopenharmony_ci 17602f4aeb0Sopenharmony_ci EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint 17702f4aeb0Sopenharmony_ci interval); 17802f4aeb0Sopenharmony_ci 17902f4aeb0Sopenharmony_ci specifes the minimum number of video frame periods per color buffer 18002f4aeb0Sopenharmony_ci post operation for the window associated with the current context. The 18102f4aeb0Sopenharmony_ci interval takes effect when eglSwapBuffers or eglPostSubBufferNV is 18202f4aeb0Sopenharmony_ci first called subsequent to the eglSwapInterval call." 18302f4aeb0Sopenharmony_ci 18402f4aeb0Sopenharmony_ci Modify the following sentences in Section 3.9.4, page 52 (Posting 18502f4aeb0Sopenharmony_ci Errors) 18602f4aeb0Sopenharmony_ci 18702f4aeb0Sopenharmony_ci Paragraph 1, first sentence: 18802f4aeb0Sopenharmony_ci 18902f4aeb0Sopenharmony_ci "eglSwapBuffers, eglPostSubBufferNV, and eglCopyBuffers return 19002f4aeb0Sopenharmony_ci EGL_FALSE on failure." 19102f4aeb0Sopenharmony_ci 19202f4aeb0Sopenharmony_ci Paragraph 1, seventh sentence: 19302f4aeb0Sopenharmony_ci 19402f4aeb0Sopenharmony_ci "If eglSwapBuffers or eglPostSubBufferNV are called and the native 19502f4aeb0Sopenharmony_ci window associated with <surface> is no longer valid, an EGL_BAD_- 19602f4aeb0Sopenharmony_ci NATIVE_WINDOW error is generated. If eglPostSubBufferNV is called 19702f4aeb0Sopenharmony_ci and <x>, <y>, <width>, or <height> are less than zero, EGL_BAD_- 19802f4aeb0Sopenharmony_ci PARAMETER is generated." 19902f4aeb0Sopenharmony_ci 20002f4aeb0Sopenharmony_ciIssues 20102f4aeb0Sopenharmony_ci 20202f4aeb0Sopenharmony_ci 1. Should all surfaces be required to support sub-buffer posts if 20302f4aeb0Sopenharmony_ci this extension is supported? 20402f4aeb0Sopenharmony_ci 20502f4aeb0Sopenharmony_ci RESOLVED: No. Some implementations may support multiple types of 20602f4aeb0Sopenharmony_ci native windows. Support for sub-surface posting is therefore a 20702f4aeb0Sopenharmony_ci per-surface property, so a surface query should be used to determine 20802f4aeb0Sopenharmony_ci which surfaces support sub-surface posts. 20902f4aeb0Sopenharmony_ci 21002f4aeb0Sopenharmony_ci 2. What should this extension be called? 21102f4aeb0Sopenharmony_ci 21202f4aeb0Sopenharmony_ci RESOLVED: Names considered EGL_NV_copy_sub_buffer, EGL_NV_present_sub- 21302f4aeb0Sopenharmony_ci surface, EGL_NV_post_sub_buffer. eglCopySubBuffer() sounded too 21402f4aeb0Sopenharmony_ci similar to eglCopyBuffer(), which operates on different types of 21502f4aeb0Sopenharmony_ci surfaces. EGL_present_sub_surface was originally chosen as it was 21602f4aeb0Sopenharmony_ci sufficiently different than eglCopyBuffer(), but based on internal 21702f4aeb0Sopenharmony_ci feedback, the term "Post" is preferable to "Present" because it is 21802f4aeb0Sopenharmony_ci already used in the EGL spec to describe buffer presentation 21902f4aeb0Sopenharmony_ci operations. "Buffer" was chosen over "surface" at this point as well, 22002f4aeb0Sopenharmony_ci because it is more consistent with the eglSwapBuffers() and 22102f4aeb0Sopenharmony_ci eglCopyBuffer() commands, and eglPostSubBuffer() is still 22202f4aeb0Sopenharmony_ci differentiated enough from eglCopyBuffer() that the two won't be 22302f4aeb0Sopenharmony_ci confused. 22402f4aeb0Sopenharmony_ci 22502f4aeb0Sopenharmony_ciRevision History 22602f4aeb0Sopenharmony_ci 22702f4aeb0Sopenharmony_ci#3 (James Jones, November 5, 2010) 22802f4aeb0Sopenharmony_ci -Renamed from NV_present_sub_surface to NV_post_sub_buffer based on 22902f4aeb0Sopenharmony_ci feedback from internal reviews. 23002f4aeb0Sopenharmony_ci 23102f4aeb0Sopenharmony_ci -Allowed EGL_POST_SUB_BUFFER_SUPPORTED_NV to be used as a hint when 23202f4aeb0Sopenharmony_ci creating window surfaces. 23302f4aeb0Sopenharmony_ci 23402f4aeb0Sopenharmony_ci -Clarified that eglSwapInterval applies to all color-buffer post 23502f4aeb0Sopenharmony_ci operations affecting on-screen surfaces, not just eglSwapBuffers. 23602f4aeb0Sopenharmony_ci 23702f4aeb0Sopenharmony_ci#2 (James Jones, November 1, 2010) 23802f4aeb0Sopenharmony_ci - Fixed a few typos. 23902f4aeb0Sopenharmony_ci 24002f4aeb0Sopenharmony_ci#1 (James Jones, October 22, 2010) 24102f4aeb0Sopenharmony_ci - Initial revision, based on GLX_MESA_copy_sub_buffer 242