102f4aeb0Sopenharmony_ciName 202f4aeb0Sopenharmony_ci 302f4aeb0Sopenharmony_ci ARM_pixmap_multisample_discard 402f4aeb0Sopenharmony_ci 502f4aeb0Sopenharmony_ciName Strings 602f4aeb0Sopenharmony_ci 702f4aeb0Sopenharmony_ci EGL_ARM_pixmap_multisample_discard 802f4aeb0Sopenharmony_ci 902f4aeb0Sopenharmony_ciContributors 1002f4aeb0Sopenharmony_ci 1102f4aeb0Sopenharmony_ci Arne Bergene Fossaa 1202f4aeb0Sopenharmony_ci Tom Cooksey 1302f4aeb0Sopenharmony_ci Endre Sund 1402f4aeb0Sopenharmony_ci David Garbett 1502f4aeb0Sopenharmony_ci 1602f4aeb0Sopenharmony_ciContacts 1702f4aeb0Sopenharmony_ci 1802f4aeb0Sopenharmony_ci Tom Cooksey (tom 'dot' cooksey 'at' arm 'dot' com) 1902f4aeb0Sopenharmony_ci 2002f4aeb0Sopenharmony_ciStatus 2102f4aeb0Sopenharmony_ci 2202f4aeb0Sopenharmony_ci Complete. 2302f4aeb0Sopenharmony_ci 2402f4aeb0Sopenharmony_ciVersion 2502f4aeb0Sopenharmony_ci 2602f4aeb0Sopenharmony_ci Version 1, March 5, 2013 2702f4aeb0Sopenharmony_ci 2802f4aeb0Sopenharmony_ciNumber 2902f4aeb0Sopenharmony_ci 3002f4aeb0Sopenharmony_ci EGL Extension #54 3102f4aeb0Sopenharmony_ci 3202f4aeb0Sopenharmony_ciDependencies 3302f4aeb0Sopenharmony_ci 3402f4aeb0Sopenharmony_ci EGL 1.0 is required. 3502f4aeb0Sopenharmony_ci 3602f4aeb0Sopenharmony_ci This extension is written against the wording of the EGL 1.4 Specification. 3702f4aeb0Sopenharmony_ci 3802f4aeb0Sopenharmony_ciOverview 3902f4aeb0Sopenharmony_ci 4002f4aeb0Sopenharmony_ci ARM_pixmap_multisample_discard adds an attribute to eglCreatePixmapSurface 4102f4aeb0Sopenharmony_ci that allows the client API implementation to resolve a multisampled pixmap 4202f4aeb0Sopenharmony_ci surface, therefore allowing the multisample buffer to be discarded. 4302f4aeb0Sopenharmony_ci 4402f4aeb0Sopenharmony_ci Some GPU architectures - such as tile-based renderers - are capable of 4502f4aeb0Sopenharmony_ci performing multisampled rendering by storing multisample data in internal 4602f4aeb0Sopenharmony_ci high-speed memory and downsampling the data when writing out to external 4702f4aeb0Sopenharmony_ci memory after rendering has finished. Since per-sample data is never written 4802f4aeb0Sopenharmony_ci out to external memory, this approach saves bandwidth and storage space. In 4902f4aeb0Sopenharmony_ci this case multisample data gets discarded, however this is acceptable in 5002f4aeb0Sopenharmony_ci most cases. 5102f4aeb0Sopenharmony_ci 5202f4aeb0Sopenharmony_ci The extension provides the EGL_DISCARD_SAMPLES_ARM attribute that allows 5302f4aeb0Sopenharmony_ci for implicit resolution when rendering to a pixmap surface. This complements 5402f4aeb0Sopenharmony_ci the OpenGL ES EXT_multisampled_render_to_texture extension which provides 5502f4aeb0Sopenharmony_ci similar functionality for rendering to an OpenGL ES texture. 5602f4aeb0Sopenharmony_ci 5702f4aeb0Sopenharmony_ciNew Types 5802f4aeb0Sopenharmony_ci 5902f4aeb0Sopenharmony_ci None 6002f4aeb0Sopenharmony_ci 6102f4aeb0Sopenharmony_ciNew Procedures and Functions 6202f4aeb0Sopenharmony_ci 6302f4aeb0Sopenharmony_ci None 6402f4aeb0Sopenharmony_ci 6502f4aeb0Sopenharmony_ciNew Tokens 6602f4aeb0Sopenharmony_ci 6702f4aeb0Sopenharmony_ci Accepted as an attribute name in the <attrib_list> argument of 6802f4aeb0Sopenharmony_ci eglCreatePixmapSurface and by the <attribute> parameter of eglQuerySurface: 6902f4aeb0Sopenharmony_ci 7002f4aeb0Sopenharmony_ci EGL_DISCARD_SAMPLES_ARM 0x3286 7102f4aeb0Sopenharmony_ci 7202f4aeb0Sopenharmony_ciChanges to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors) 7302f4aeb0Sopenharmony_ci 7402f4aeb0Sopenharmony_ci Modify the second paragraph under "The Multisample Buffer" of Section 3.4, 7502f4aeb0Sopenharmony_ci page 18 (Configuration Management) 7602f4aeb0Sopenharmony_ci 7702f4aeb0Sopenharmony_ci "Operations such as posting a surface with eglSwapBuffers (see section 7802f4aeb0Sopenharmony_ci 3.9.1, copying a surface with eglCopyBuffers (see section 3.9.2), reading 7902f4aeb0Sopenharmony_ci from the color buffer using client API commands, binding a client API 8002f4aeb0Sopenharmony_ci context to a surface (see section 3.7.3), and flushing to a pixmap surface 8102f4aeb0Sopenharmony_ci created with the EGL_DISCARD_SAMPLES_ARM attribute enabled (see 8202f4aeb0Sopenharmony_ci section 3.5.4) may cause resolution of the multisample buffer to the color 8302f4aeb0Sopenharmony_ci buffer." 8402f4aeb0Sopenharmony_ci 8502f4aeb0Sopenharmony_ci Modify the fifth paragraph under "The Multisample Buffer" of Section 3.4, 8602f4aeb0Sopenharmony_ci page 18 (Configuration Management) 8702f4aeb0Sopenharmony_ci 8802f4aeb0Sopenharmony_ci "There are no single-sample depth or stencil buffers for a multisample 8902f4aeb0Sopenharmony_ci EGLConfig, or with a pixmap surface created with the 9002f4aeb0Sopenharmony_ci EGL_DISCARD_SAMPLES_ARM attribute (see section 3.5.4). The only depth and 9102f4aeb0Sopenharmony_ci stencil buffers are those in the multisample buffer. If the color samples 9202f4aeb0Sopenharmony_ci in the multisample buffer store fewer bits than are stored in the color 9302f4aeb0Sopenharmony_ci buffers, this fact will not be reported accurately. Presumably a 9402f4aeb0Sopenharmony_ci compression scheme is being employed, and is expected to maintain an 9502f4aeb0Sopenharmony_ci aggregate resolution equal to that of the color buffers." 9602f4aeb0Sopenharmony_ci 9702f4aeb0Sopenharmony_ci Modify the fifth paragraph of Section 3.5.4, page 34 (Creating Native 9802f4aeb0Sopenharmony_ci Pixmap Rendering Surfaces) 9902f4aeb0Sopenharmony_ci 10002f4aeb0Sopenharmony_ci "attrib list specifies a list of attributes for the pixmap. The list has the 10102f4aeb0Sopenharmony_ci same structure as described for eglChooseConfig. Attributes that can be 10202f4aeb0Sopenharmony_ci specified in attrib list include EGL_VG_COLORSPACE, EGL_VG_ALPHA_FORMAT and 10302f4aeb0Sopenharmony_ci EGL_DISCARD_SAMPLES_ARM." 10402f4aeb0Sopenharmony_ci 10502f4aeb0Sopenharmony_ci Add the following between paragraphs eight and nine of Section 3.5.4, 10602f4aeb0Sopenharmony_ci page 34 (Creating Native Pixmap Rendering Surfaces) 10702f4aeb0Sopenharmony_ci 10802f4aeb0Sopenharmony_ci "EGL_DISCARD_SAMPLES_ARM specifies whether the client API implementation is 10902f4aeb0Sopenharmony_ci allowed to implicitly resolve the multisample buffer. On some GPU 11002f4aeb0Sopenharmony_ci architectures - such as tile-based renderers - an implicit resolve can avoid 11102f4aeb0Sopenharmony_ci writing the multisample buffer back to external memory as the multisample 11202f4aeb0Sopenharmony_ci data is stored in internal high-speed memory. 11302f4aeb0Sopenharmony_ci 11402f4aeb0Sopenharmony_ci The implicit resolve can occur when the client API uses the pixmap as the 11502f4aeb0Sopenharmony_ci source or destination of any operation, when flushing to the pixmap or when 11602f4aeb0Sopenharmony_ci the client API unbinds (or breaks) the pixmap. When these operations occur 11702f4aeb0Sopenharmony_ci is dependent on the client API implementation. They can occur as an explicit 11802f4aeb0Sopenharmony_ci part of client API functions (such as glFinish, glReadPixels and 11902f4aeb0Sopenharmony_ci glCopyTexImage) or they can occur implicitly. 12002f4aeb0Sopenharmony_ci 12102f4aeb0Sopenharmony_ci Further rendering causes the implementation to read the surface buffer and 12202f4aeb0Sopenharmony_ci any ancillary buffers back in as single-sampled data. 12302f4aeb0Sopenharmony_ci Therefore use of this attribute may result in lower quality images. 12402f4aeb0Sopenharmony_ci 12502f4aeb0Sopenharmony_ci Valid values are EGL_TRUE, in which case the multisample buffer can be 12602f4aeb0Sopenharmony_ci discarded, or EGL_FALSE, in which case the multisample buffer is preserved. 12702f4aeb0Sopenharmony_ci The default value is EGL_FALSE. 12802f4aeb0Sopenharmony_ci 12902f4aeb0Sopenharmony_ci Note that the multisample buffer may be discarded during eglMakeCurrent 13002f4aeb0Sopenharmony_ci regardless of the value of the EGL_DISCARD_SAMPLES_ARM attribute (see 13102f4aeb0Sopenharmony_ci section 3.7.3)." 13202f4aeb0Sopenharmony_ci 13302f4aeb0Sopenharmony_ci Modify the ninth paragraph of Section 3.5.4, page 34 (Creating Native 13402f4aeb0Sopenharmony_ci Pixmap Rendering Surfaces) 13502f4aeb0Sopenharmony_ci 13602f4aeb0Sopenharmony_ci "On failure eglCreatePixmapSurface returns EGL_NO_SURFACE. If the attributes 13702f4aeb0Sopenharmony_ci of pixmap do not correspond to config, then an EGL_BAD_MATCH error is 13802f4aeb0Sopenharmony_ci generated. If config does not support rendering to pixmaps (the 13902f4aeb0Sopenharmony_ci EGL_SURFACE_TYPE attribute does not contain EGL_PIXMAP_BIT), an 14002f4aeb0Sopenharmony_ci EGL_BAD_MATCH error is generated. If config does not support the colorspace 14102f4aeb0Sopenharmony_ci or alpha format attributes specified in attriblist (as defined for 14202f4aeb0Sopenharmony_ci eglCreateWindowSurface), an EGL_BAD_MATCH error is generated. If config does 14302f4aeb0Sopenharmony_ci not specify non-zero EGL_SAMPLES and EGL_SAMPLE_BUFFERS and the 14402f4aeb0Sopenharmony_ci EGL_DISCARD_SAMPLES_ARM attribute is set to EGL_TRUE, then an EGL_BAD_MATCH 14502f4aeb0Sopenharmony_ci error is generated. If config is not a valid EGLConfig, an EGL_BAD_CONFIG 14602f4aeb0Sopenharmony_ci error is generated. If pixmap is not a valid native pixmap handle, then an 14702f4aeb0Sopenharmony_ci EGL_BAD_NATIVE_PIXMAP error should be generated. If there is already an 14802f4aeb0Sopenharmony_ci EGLSurface associated with pixmap (as a result of a previous 14902f4aeb0Sopenharmony_ci eglCreatePixmapSurface call), then a EGL_BAD_ALLOC error is generated. 15002f4aeb0Sopenharmony_ci Finally, if the implementation cannot allocate resources for the new EGL 15102f4aeb0Sopenharmony_ci pixmap, an EGL_BAD_ALLOC error is generated." 15202f4aeb0Sopenharmony_ci 15302f4aeb0Sopenharmony_ci 15402f4aeb0Sopenharmony_ci Add the following entry to Table 3.5, page 36 15502f4aeb0Sopenharmony_ci (Queryable surface attributes and types) 15602f4aeb0Sopenharmony_ci 15702f4aeb0Sopenharmony_ci Attribute Type Description 15802f4aeb0Sopenharmony_ci ------------------------- ------- --------------------------------------- 15902f4aeb0Sopenharmony_ci EGL_DISCARD_SAMPLES_ARM boolean Multisample resolve when flushing to 16002f4aeb0Sopenharmony_ci surface 16102f4aeb0Sopenharmony_ci 16202f4aeb0Sopenharmony_ci Add the following paragraph before the last paragraph of Section 3.5.7, 16302f4aeb0Sopenharmony_ci page 38 (Surface Attributes) 16402f4aeb0Sopenharmony_ci 16502f4aeb0Sopenharmony_ci "Querying EGL_DISCARD_SAMPLES_ARM returns whether a multisample resolve 16602f4aeb0Sopenharmony_ci is forced on every flush to the surface (see section 3.5.4). This will only 16702f4aeb0Sopenharmony_ci return EGL_TRUE for pixmap surfaces created with the EGL_DISCARD_SAMPLES_ARM 16802f4aeb0Sopenharmony_ci attribute set to EGL_TRUE. EGL_FALSE will be returned for window and 16902f4aeb0Sopenharmony_ci pbuffer surfaces." 17002f4aeb0Sopenharmony_ci 17102f4aeb0Sopenharmony_ciIssues 17202f4aeb0Sopenharmony_ci 17302f4aeb0Sopenharmony_ci 1. Should eglSurfaceAttrib accept EGL_DISCARD_SAMPLES_ARM? 17402f4aeb0Sopenharmony_ci RESOLVED: No. The attribute should be decided at surface creation time. 17502f4aeb0Sopenharmony_ci 17602f4aeb0Sopenharmony_ci 2. Should eglCreateWindowSurface or eglCreatePbufferSurface accept 17702f4aeb0Sopenharmony_ci EGL_DISCARD_SAMPLES_ARM? 17802f4aeb0Sopenharmony_ci RESOLVED: No. While the attribute could equally apply to window and 17902f4aeb0Sopenharmony_ci pbuffer surfaces, no use case has been identified to justify the 18002f4aeb0Sopenharmony_ci additional maintenance this would require. 18102f4aeb0Sopenharmony_ci 18202f4aeb0Sopenharmony_ciRevision History 18302f4aeb0Sopenharmony_ci 18402f4aeb0Sopenharmony_ci Version 1, 2013/03/05 - Original release. 18502f4aeb0Sopenharmony_ci 186