src/libANGLE/Surface.h


Log

Author Commit Date CI Message
Igor Nazarov 5fd368aa 2025-07-30T14:45:55 Replace Surface::getWidth/Height() with getSize() Most places in the code use both `getWidth/Height()` methods at the same time. On some back-ends it is more optimal to have single method. For example, `WindowSurfaceWGL` first uses `GetClientRect()` Win32 API inside each method to then calculate width and hight in each method, causing repeated `GetClientRect()` call. The only place where only one of the methods may be used is from `SurfaceImpl::getUserSize()` when one of the parameters is `nullptr`, which is only possible from `QuerySurfaceAttrib()` function. This method is rewritten to use new `getSize()` method and then use whatever dimensions is requested by the caller. This may cause `QuerySurfaceAttrib()` inefficiency on some back-ends that get width and height of the surface differently (`SurfaceEGL` for example). In such cases `getUserSize()` is overridden to avoid returning a dimension which is not required. After this change all places in the code that previously used both `getWidth/Height()` methods (like `Surface::getAttachmentSize()`) will be more efficient. The `QuerySurfaceAttrib()`, on the other hand, will have slightly more overhead on back-ends where base `SurfaceImpl::getUserSize()` method is used, which only happens on back-ends with trivial `getSize()` implementation. Bug: angleproject:397848903 Change-Id: I4a22701a1e62ee4e7d07e77cac5b388050d98e4d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6802440 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Igor Nazarov 3e52318c 2025-06-26T10:46:00 Vulkan: Ensure always using resolved Window Surface size `WindowSurfaceVk::getWidth/Height()` methods return cached, previously resolved Surface size. Using these methods while current Window Surface size is unresolved may return stale values, causing undesired behavior. Appropriate ASSERTs were added to these methods to prevent such usage. Added ASSERTs revealed few places with incorrect usage: - In `Context::makeCurrent()` to set initial viewport or for capture. - In `IsPartialBlit()` and `ValidateReadPixelsBase()` validations. - In `SerializeFramebufferAttachment()` during capture. Rest of the code was thoroughly checked if it is possible to call `WindowSurfaceVk::getWidth/Height()` when size is unresolved. All other places always call these methods after framebuffer state synchronization, which acquires swapchain images and resolves the surface size. Added `ensureSizeResolved()` method that is called during validation and in the `SerializeFramebufferAttachment()` method. It is possible to use existing `Framebuffer::syncState()` method as alternative, but this solution was discarded since it may potentially interfere with `State::syncDirtyObjects()` method. The `Surface::getUserSize()` replaces old methods as optimization, to prevent calling relatively expensive method twice from `Context::makeCurrent()` to get width and height of the `drawSurface`. Test: angle_trace_tests --gtest_filter=EGLSurfaceTest.ResizeBeforeMakeCurrent/* Test: angle_trace_tests --gtest_filter=EGLSurfaceTest.ResizeBeforeMakeCurrentPostSizeQuery/* Test: angle_trace_tests --gtest_filter=EGLSurfaceTest.ResizeAndReadPixelsRobustANGLE/* Test: angle_trace_tests --gtest_filter=EGLSurfaceTest.ResizeAndBlitFramebufferANGLE/* Bug: angleproject:397848903 Change-Id: I082e13d0b8db5fd7d08ff25b102df1f283e1256d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6792928 Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Yuxiang Qian 6a03109f 2025-07-09T18:24:31 Refine getCompressionRate As Vulkan spec states, vkGetImageSubresourceLayout should not be called for the android swapchainimage when the image is not bound to memory. Refine the path of getCompressionRate to make sure at least swapchainimage[0] has been initialized when it is been called. Bug: angleproject:433057375 Change-Id: I80b68874686940c0ef77df97b928b0e153c5bbf8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6774721 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao ecc378cc 2025-03-03T16:43:33 Reland "Dont use Subject/Observer for SwapchainImageChanged" This is reland of the following CL https://chromium-review.googlesource.com/c/angle/angle/+/6319893 Because we do deferred ANI (VkAcquireNextImage) call until image is needed, we need a way to force Context to go through FramebufferVk::syncState call (FramebufferVk::syncState calls WindowSurfaceVk::getAttachmentRenderTarget, which end up calling ANI. Right now we uses subject/observer mechanism, by sending angle::SubjectMessage::SwapchainImageChanged to all observers of WindowSurfaceVk. In this case it is egl::Surface. Then eglSurface redirects this message to its observers, which are all gl::Framebuffer's attachments: color, depth, stencil. Even though only color attachment needs to be notified, but because we don't have a separate list of observers, depth/stencil attachment also receive the notification and they early out. Then gl::Framebuffer sets DIRTY_BIT_COLOR_BUFFER_CONTENTS_0 dirty bit and send the angle::SubjectMessage::DirtyBitsFlagged to Context, which dirty DrawFBO and ReadFBO and dirty cached state. Note that this is specific for swap image changed case, there is no surface property change (surface property change will still trigger the subject/observer message with SubjectMessage::SubjectChanged message, but this occurs rarely). This gets worse for apps that uses multiple contexts, for the example pokemon_masters_ex has three contexts, each context has its own default frame buffer that attach to the same surface, and we never remove non-current context from the observer list. This end up with egl::Surface has 12 observers and for every frame, it loop over the list of 12 observers and send message (virtual function call) to each of them. Color attachment also ends up sending two messages to Context, one for Read FBO and another for Draw FBO. There are total 21 virtual function calls. Even for single context usage, you have 6 virtual function calls, for every frame. EGL spec says "an EGLSurface must be current on only one thread at a time", any other context must call EGLMakeCurrent in order to use this surface, which will add all necessary dirty bits at that time. So we really only need to notify current context. In this CL, SwapchainImageChanged no longer uses subject/observer mechanism, so this message is removed. This CL still uses subject/observer mechanism to send DirtyBitsFlagged from Framebuffer back to context. We could call setDrawFramebufferDirty and setReadFramebufferDirty directly, but that will require to remove the "const" decoration out of gl::Context which generates too much code diff, so onStateChange(angle::SubjectMessage::DirtyBitsFlagged) is still used. Bug: angleproject:400711938 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6319893 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Change-Id: I017b0e8934b5194a520828fa5c4af1d6e3ef9aac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6404621
Igor Nazarov caf14998 2025-02-25T17:28:05 Vulkan: Fix window surface resize and size query Added `mSizeState` enum member. When it is not `Resolved`, surface size is not yet resolved and may change any time in response to native window resize. Otherwise, surface size is resolved and will not change until next swap. Updated `getUserWidth()`/`getUserHeight()` methods. They return current window size when surface size is not resolved, or current surface size, otherwise. Window size is queried either by `getCurrentWindowSize()`, when surface is sized by swapchain, or by querying vulkan surface capabilities. The "perFrameWindowSizeQuery" feature controls when `mSizeState` is updated. Initially it is not resolved. Marked as not resolved in `invalidateSwapchain()`, and in `deferAcquireNextImage()` when the feature is enabled. It is marked as resolved after swapchain is created when feature is disabled, or in `AcquireNextImageUnlocked()` function after acquire next image, otherwise. Enabled some tests that were previously failing. Replaced old resize tests with new versions. Test: angle_end2end_tests --gtest_filter=EGLSurfaceTest.Resize*/* Bug: angleproject:397848903 Bug: angleproject:373659619 Bug: angleproject:153329980 Bug: angleproject:42266013 Bug: angleproject:42265843 Bug: angleproject:42265529 Bug: angleproject:42264022 Bug: angleproject:42263074 Bug: angleproject:42261800 Bug: angleproject:40096826 Change-Id: I3ad836960a68229fab6c94624022f1a0aaf2c3e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6300645 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com>
Igor Nazarov 9f9a0dfd 2025-03-06T21:20:40 Fix framebuffer attachment format sizes query for Surface Surface as framebuffer attachment is always specified and should return valid format sizes even if extents is empty. At the same time, accessing Window surface sizes without previously acquiring next swapchain image (Vulkan backend) may result in outdated values. In other words, without framebuffer synchronization. This change not only fixes the bugs, but also removes dependency on surface size. Test: angle_end2end_tests --gtest_filter=PbufferTest.ZeroSizedSurfaceFormatQuery/* Bug: angleproject:402532204 Bug: angleproject:397848903 Bug: angleproject:42261031 Change-Id: I736a484caf99e0ff306c244ca13e1eb181222e64 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6329487 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 5b343e8f 2025-03-11T11:35:08 Vulkan: Remove support for Stadia Bug: angleproject:42262714 Change-Id: Icae5fe828fe4e0bcd287d297df1bc586708ef86e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6344390 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Igor Nazarov b5809efa 2025-01-16T17:56:47 Delay eglSwapInterval() effect until swap ... and fix resetting effect of `eglSwapInterval()` call by changing the `EGL_RENDER_BUFFER` attribute, and resetting desired shared present mode when calling `eglSwapInterval()`. Bug: angleproject:390333526 Change-Id: I473c7d4c5929e2179bbcd378b3695d10213644de Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6169922 Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Yuxiang Qian a1be7e61 2024-11-26T14:39:18 Implement EGL_EXT_surface_compression This patch adds implementation of EGL_EXT_surface_compression to ANGLE, including new API eglQuerySupportedCompressionRatesEXT and adding EGL_SURFACE_COMPRESSION_EXT in EGLQuerySurface and EGLCreateWindowSurface/EGLCreatePlatformWindowSurface. Angle end2end test is added to verify the extension. Bug: angleproject:375496226 Change-Id: I06926930d94485a378fc831d552cf55fe7938a57 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6073355 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Yuxiang Qian a137d702 2024-10-24T18:24:14 Reland "Delay EGLQueryContext render buffer change" This is a reland of commit 233d9ee5c3525cc8290b3af52385ed59973438b4 Original change's description: > Delay EGLQueryContext render buffer change > > According to the EGL spec, EGL_RENDER_BUFFER of a context > should change after eglSwapBuffers is called if > eglSurfaceAttrib changes. Refine ANGLE implemnetation > to delay the render buffer change. > > Bug: angleproject:375528202 > Change-Id: Ida7736a09e3a83223a529dbfad48e0f952f91a38 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5982241 > Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:375528202 Change-Id: I38330d99a9e6987ad3f97b4a36c34029acb211b9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6055500 Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Yuly Novikov 9c7ad319 2024-11-27T13:43:10 Revert "Delay EGLQueryContext render buffer change" This reverts commit 233d9ee5c3525cc8290b3af52385ed59973438b4. Reason for revert: ASSERT triggered on Linux NVIDIA 535.183.01 https://ci.chromium.org/ui/p/angle/builders/ci/linux-exp-test/1469/overview Original change's description: > Delay EGLQueryContext render buffer change > > According to the EGL spec, EGL_RENDER_BUFFER of a context > should change after eglSwapBuffers is called if > eglSurfaceAttrib changes. Refine ANGLE implemnetation > to delay the render buffer change. > > Bug: angleproject:375528202 > Change-Id: Ida7736a09e3a83223a529dbfad48e0f952f91a38 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5982241 > Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:375528202 Change-Id: I08fc76b1b764e57639e2c0708cb155d392f82f22 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6055417 Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Yuxiang Qian 233d9ee5 2024-10-24T18:24:14 Delay EGLQueryContext render buffer change According to the EGL spec, EGL_RENDER_BUFFER of a context should change after eglSwapBuffers is called if eglSurfaceAttrib changes. Refine ANGLE implemnetation to delay the render buffer change. Bug: angleproject:375528202 Change-Id: Ida7736a09e3a83223a529dbfad48e0f952f91a38 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5982241 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Hailin Zhang 8c12874c 2024-09-12T11:26:29 vulkan: add double buffer swapchain for fifo mode. Double buffer swapchain usually drop the performance. But at B* the default fps cap for silver device still at 30fps. This change is for reduce latency. Bug: b/311022968 Change-Id: Ida4044f439bbe3f235d53f5d1d2f945533cbb094 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5858255 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya b978974d 2024-03-03T10:48:48 Update frontend support for QCOM foveated extensions Modifications to frontend support - 1. EXTENDED_DIRTY_BIT_FOVEATED_RENDERING is removed 2. New framebuffer attachment API - getFoveationState 3. Attachment type restriction for foveated rendering is removed 4. Addition of new test - RenderbufferAttachmentClearThenDraw Bug: angleproject:8484 Change-Id: I699cbed81346c9a6344c4ff36afa51d6cc1bf052 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5338529 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya d05c9a5e 2024-01-25T13:01:49 Frontend support for QCOM foveated extensions Add frontend state management to support foveated rendering extensions. Bug: angleproject:8484 Test: Texture2D*Foveation* Change-Id: I0e1be9f11b2d442207674562da760f5bfd7debc8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5208091 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Igor Nazarov 959ccb96 2023-08-02T13:40:16 Add EGL_BAD_ACCESS validation into ValidateMakeCurrent Current code does not generate EGL_BAD_ACCESS in `eglMakeCurrent()` according to the specification: - If context is current to some other thread, or if either draw or read are bound to contexts in another thread, an EGL_BAD_ACCESS error is generated. Additional changes: - replace `Context::getRefCount()` with `isReferenced()` for consistency with added `Surface::isReferenced()` method. - remove duplicate `ValidateSurface` call for the `drawSurface` in case if `readSurface` is the same. - remove duplicate `ValidateCompatibleSurface()` call for the `readSurface` in case if `drawSurface` is different. - Fix EGLContextASANTest.DestroyContextInUse test. - Fix EGLContextSharingTestNoSyncTextureUploads.NoSync test. Bug: angleproject:8282 Change-Id: I2af0d7f50019c2445b42279bdd0e0197dd8ad20f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4742382 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Shahbaz Youssefi 3886af6e 2023-01-16T15:17:40 Vulkan: Generalize AHB optimization prohibitions ... to all external images. Bug: angleproject:7962 Change-Id: Ib8e090b995330b651865953057869adb4d14c83b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4169559 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Mohan Maiya 90b6d511 2023-01-13T10:06:12 Vulkan: Add support for AHB usage FRONT_BUFFER flag AHB usage flags have been updated to include front buffer usage. AHBs tagged with this flag need to be handled similar to single-buffered window surfaces especially w.r.t glFlush semantics. Account for the new usage flag when deferring flushes. Bug: angleproject:7956 Test: Android VTS GraphicsFrontBufferTests.* Change-Id: I79440d8447ac569c3d785de191815d2d2f3f069f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4167063 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Charlie Lao b19d17b8 2022-12-09T14:38:08 Vulkan: Split Serial class into UniqueSerial and Serial This CL splits Serial class into two classes: UniqueSerial and Serial. UniqueSerial supports the object unique serial usage where there is == and != operator but no > or < comparison. UniqueSerial can have invalid value, but Serial will not have invalid value (in next CL). The main reason is for next CL we can further optimize out the invalid value check in the QueueSerial comparison. Bug: b/262047600 Change-Id: Ieaed2a0d5546b012a6d63aa18b6006595e4aee1b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4093557 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Jamie Madill 0d203aef 2022-10-16T10:08:01 EGL: Add ID types for egl::Surface and egl::Image. This is in preparation for using resource maps for Context, Surface and EGLImage. The map change will make it much easier to work with the trace fixture. It will also have a small benefit in safety as we will longer be casting raw pointers for these types. As these objects are used in a lot of places, and simplified C can't handle unordered_map, it's necessary to index the maps by simple packed IDs in capture/replay code. Bug: angleproject:7758 Change-Id: Ib1d19622a4f2a6f0458cc28f5bbe30bb9f349b98 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3957163 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7c4dc253 2022-10-12T08:38:46 Capture/Replay: Clean up EGL capture. This switches the EGL capture types to ANGLE-casted pointers since that's what we receive in the capture layer. Note that even if the capture layer were used as a pure layer, not an EGL implementation, we'd still have these types for state tracking. This also prefixes each EGL class in the entry points with the egl namespace for consistency and for simplifying the ParamType code. Required changing to non-const gl::Context * in a few places. Also changes the gSurfaceMap to be indexed by the raw pointer value, which cleans up the code somewhat. Bug: angleproject:4035 Change-Id: Id800c1ba25e5819ac7ea1df8aab806bc393fe192 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3949910 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Mohan Maiya d50b2276 2022-06-21T12:05:28 Reland "Vulkan: Support EGL_ANDROID_front_buffer_auto_refresh" This is a reland of commit ef60d38ecf12d6663e9ecccacbff9803b1fba7c6 There are no fixes as the revert itself was a speculative one Original change's description: > Vulkan: Support EGL_ANDROID_front_buffer_auto_refresh > > Cache value of EGL_FRONT_BUFFER_AUTO_REFRESH_ANDROID attribute > and set swapchain present mode accordingly when recreating > swapchain in single buffer mode. > > Bug: angleproject:7224 > Tests: EGLAndroidAutoRefreshTest.Basic* > Change-Id: I2dbb92ce5c3fa047e0b02ea9011725311f346027 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3707570 > Reviewed-by: Ian Elliott <ianelliott@google.com> > Commit-Queue: mohan maiya <m.maiya@samsung.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Bug: angleproject:7224 Bug: angleproject:7465 Change-Id: Ia876ea17169c0f1b3afdb7753570e0b1aca985f5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3733521 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Gert Wollny ce4e11d3 2022-06-17T12:21:01 libANGLE: Add a unique ID to the Surface This is needed when capturing Pbuffer calls. Bug: angleproject:4964 Change-Id: Id9f35683bf887f08f916de69bbab8c414e5e8872 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3711740 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Yuly Novikov 46ddcc44 2022-06-27T14:53:31 Revert "Vulkan: Support EGL_ANDROID_front_buffer_auto_refresh" This reverts commit ef60d38ecf12d6663e9ecccacbff9803b1fba7c6. Reason for revert: crashes in end2end tests on Win Intel Vulkan Original change's description: > Vulkan: Support EGL_ANDROID_front_buffer_auto_refresh > > Cache value of EGL_FRONT_BUFFER_AUTO_REFRESH_ANDROID attribute > and set swapchain present mode accordingly when recreating > swapchain in single buffer mode. > > Bug: angleproject:7224 > Tests: EGLAndroidAutoRefreshTest.Basic* > Change-Id: I2dbb92ce5c3fa047e0b02ea9011725311f346027 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3707570 > Reviewed-by: Ian Elliott <ianelliott@google.com> > Commit-Queue: mohan maiya <m.maiya@samsung.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Bug: angleproject:7224, angleproject:7465 Change-Id: Ia48a31124c8e0a3e4bcd4b7dc6f62b0782b42d97 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3726099 Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Mohan Maiya ef60d38e 2022-06-21T12:05:28 Vulkan: Support EGL_ANDROID_front_buffer_auto_refresh Cache value of EGL_FRONT_BUFFER_AUTO_REFRESH_ANDROID attribute and set swapchain present mode accordingly when recreating swapchain in single buffer mode. Bug: angleproject:7224 Tests: EGLAndroidAutoRefreshTest.Basic* Change-Id: I2dbb92ce5c3fa047e0b02ea9011725311f346027 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3707570 Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Yuxin Hu 4c5e9d47 2022-06-21T17:12:56 Do not defer clear if FBO attachment is AHB image When application uses Android Hardware Buffer (AHB) image as the Framebuffer Object (FBO) attachment, it is possible the app doesn't call glReadPixels to fetch the FBO color. In this case deferred clears will not be flushed when the app reads the FBO pixel color, and the app will read the old FBO color. This CL fixes the issue by flushing the glClear calls immediately when any of the FBO color attachments is AHB image. Bug: b/236394768 Bug: angleproject:7458 Change-Id: I9151ab57750007c4ac18af39c3fa4abe752ede5e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3715851 Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Eddie Hatfield 91976352 2022-06-21T15:41:02 Use C++17 attributes instead of custom macros Bug: angleproject:6747 Change-Id: Iad6c7cd8a18d028e01da49b647c5d01af11e0522 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3718999 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen 15895160 2022-04-05T15:43:52 Avoid leaking gl::Framebuffers in gl::Context Fix by holding framebuffer via UniqueFramebufferPointer. Removes redundant functions from gl::Surface. Replaces UniqueObjectPointerBase with unique_ptr. The use-case needs default initialization, move assign and operator bool. With these implemented, UniqueObjectPointerBase would have been an imitation of unique_ptr. Patch by David Kilzer <ddkilzer@apple.com> Bug: angleproject:6920 Change-Id: Id0c8fda95f62caa54c89d0a70684e386804db094 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3568382 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Jamie Madill 2dd13ebb 2022-04-21T11:25:00 Track Surface color & depth/stencil init separately. This clears up some trace testing confusion due when robust resource init is enabled, and the app clears color but not depth on the default surface. Bug: angleproject:7221 Change-Id: Id97871aec32ad831b663aaa9116e04b582ab5a36 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3600375 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 5aaa402c 2022-03-30T06:13:02 Fix Surface use-after-free bug In Display::destroyContext we would incorrectly destroy current surfaces while trying to makeCurrent the context to be destroyed. Introduce ScopedSurfaceRef, mirroring ScopedContextRef, to keep the surfaces alive while destroying the context. Bug: angleproject:7141 Test: EGLSurfaceTest.SurfaceUseAfterFreeBug* Change-Id: Ie9b3d7841e5ee561d96c13bfee9c7c87b40cc39d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3561354 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Constantine Shablya e74d0e81 2022-02-11T18:05:12 Vulkan: Implement EGL_KHR_partial_update This change provides a trivial implementation of partial update that does nothing, making apps that want this extension happy. A possible efficient Vulkan implementation would use the damage set to narrow down render area, but it appears to only be useful for only some TBDR hardware. Bug: angleproject:6960 Reviewed-by: Antonio Caggiano <antonio.caggiano@collabora.com> Change-Id: Ic553ac9590c336093f1bf25a6521574622599bf6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3427640 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Auto-Submit: Constantine Shablya <constantine.shablya@collabora.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Lingfeng Yang 926b43e7 2022-01-06T13:31:54 Reland: Frontend: separate lock in swap prep Swapchain-based backends like Vulkan might block a lot in vkAcquireNextImageKHR, which is bad for overall fast progress if we also hold the global EGL lock there. This CL starts to split the global EGL lock. We release the EGL lock when performing vkAcquireNextImageKHR, and only maintain a lock for surfaces. This is done via a new custom entry point, EGL_PrepareSwapBuffers, so that we can control how the global lock is used throughout the entire call. Bug: angleproject:6851 Change-Id: I095cd8b3bdbb13c842cab0a46148e2122582cdfd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3373426 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Lingfeng Yang <lfy@google.com>
Jamie Madill 9d668d6c 2022-01-07T18:18:23 Revert "Frontend: separate lock in swap prep" This reverts commit 40c5cb255c0a07bdab574aa076ee603e7d791ab3. Reason for revert: Regression in TSAN caused by this CL: https://ci.chromium.org/ui/p/angle/builders/ci/linux-tsan-test/352/overview Original change's description: > Frontend: separate lock in swap prep > > Swapchain-based backends like Vulkan might block a lot in > vkAcquireNextImageKHR, which is bad for overall fast progress if we also > hold the global EGL lock there. > > This CL starts to split the global EGL lock. We release the EGL lock > when performing vkAcquireNextImageKHR, and only maintain a lock for > surfaces. > > Bug: angleproject:6851 > Change-Id: I329d5c4c579718a4980c4261590f77099ce1400e > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3361249 > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Lingfeng Yang <lfy@google.com> Bug: angleproject:6851 Change-Id: Ie03b784021f7b8b5c1ef95a911ef7da4029abd46 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3373165 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Lingfeng Yang 40c5cb25 2022-01-06T13:31:54 Frontend: separate lock in swap prep Swapchain-based backends like Vulkan might block a lot in vkAcquireNextImageKHR, which is bad for overall fast progress if we also hold the global EGL lock there. This CL starts to split the global EGL lock. We release the EGL lock when performing vkAcquireNextImageKHR, and only maintain a lock for surfaces. Bug: angleproject:6851 Change-Id: I329d5c4c579718a4980c4261590f77099ce1400e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3361249 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Lingfeng Yang <lfy@google.com>
Amirali Abdolrashidi 05a44dd2 2021-11-29T12:16:58 Vulkan: Set content undefined on eglSwapBuffers * Invalidate the swap buffer content if the swap behavior is EGL_BUFFER_DESTROYED. * In that event, WindowSurfaceVk::getBufferAge() sets `age` to 0 and returns with no errors. * Unit tests in EGLBufferAgeTest.cpp updated to reflect this. * Minor cleanup in the test file. Bug: angleproject:6363 Change-Id: Ibab7ccb99c1be149588e6aad16bcc2d6dd989295 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3307776 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Jeff Vigil 8b60855b 2021-09-15T15:16:10 EGL: implement EGL_KHR_mutable_render_buffer Pass render buffer mode change to WindowSurfaceVk. On mode change trigger OUT_OF_DATE. Then in CreateSwapchain, if new mode, set the Presentation mode and the Image count. OffscreenSurfaceVk ignores mode change. Add MUTABLE_RENDER_BUFFER_BIT to GenerateDefaultConfig. Test: dEQP-EGL.functional.mutable_render_buffer.* Bug: angleproject:3966 Change-Id: I7b59708514bcda10f8d45ce5f9528aa840fcccfa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3171822 Commit-Queue: Brandon Schade <b.schade@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jeff Vigil 5eb86d4a 2021-09-21T15:17:04 EGL: EGL_KHR_lock_surface3 frontend Add queries to get locked buffer attributes Add validation for LockSurface, QuerySurface Bug: angleproject:6062 Change-Id: I4919bef2a17d3505cccad08f7c4f8a3ca5d7e4e6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3174322 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang ad8e4d99 2021-09-28T11:48:46 Remove EGL_ANGLE_flexible_surface_compatibility This extension has been superseded by EGL_KHR_no_config_context. Bug: chromium:1253930 Change-Id: Ie299c34baa84e9f47c73ddb5a0636536bf510d72 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3190612 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill d2d1f41f 2021-08-16T08:05:55 Add EGL extension to create window with a swap interval set. On Vulkan this allows creating a window once without needing to recreate the swapChain after we specify the swap interval. Also adds a simple regression test and EGL enum assertion printing formatting. Bug: angleproject:5133 Change-Id: I72af124cb0e8f7cddfa810988a9862c0f36a0e46 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3097806 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Jeff Vigil 6136620b 2021-03-25T15:43:06 Reland "EGL: GLES: Implement GL_EXT_protected_textures" This is a reland of 6210a9b34a721df2c84cf69170ad9bf7ba40e4aa This removes changes in gl backend. Original change's description: > EGL: GLES: Implement GL_EXT_protected_textures > > Implement EGL_EXT_protected_content Images > Add protected member to Images and Textures > Add error when creating objects if not supported or > does't match native buffer > When creating siblings pass protected state > Add extension caps > Add Validation > Add GetTexParameter and SetTextparameter > Add protected to Texture and state > Expand tests for images and textures > > Test: angle_end2end_test --gtest_filter=EGLProtectedContentTest > > Bug: angleproject:3965 > Change-Id: I35a89b4e80bba6d9b6831c68e71630eef304dacb > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2802852 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Test: angle_end2end_test --gtest_filter=EGLProtectedContentTest Bug: angleproject:3965 Change-Id: Id36d697c53afc0f0dadf92bda4565f9157f4fc2a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3076825 Commit-Queue: Brandon Schade <b.schade@samsung.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill c408926f 2021-07-22T12:00:59 Revert "EGL: GLES: Implement GL_EXT_protected_textures" This reverts commit 6210a9b34a721df2c84cf69170ad9bf7ba40e4aa. Reason for revert: Suspected for breaking ANGLE->Chrome roller. Bug: angleproject:6204 Original change's description: > EGL: GLES: Implement GL_EXT_protected_textures > > Implement EGL_EXT_protected_content Images > Add protected member to Images and Textures > Add error when creating objects if not supported or > does't match native buffer > When creating siblings pass protected state > Add extension caps > Add Validation > Add GetTexParameter and SetTextparameter > Add protected to Texture and state > Expand tests for images and textures > > Test: angle_end2end_test --gtest_filter=EGLProtectedContentTest > > Bug: angleproject:3965 > Change-Id: I35a89b4e80bba6d9b6831c68e71630eef304dacb > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2802852 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:3965 Change-Id: Ia3ef260a17097b474189ccad5b235a9db99ee00b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3043889 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Jeff Vigil 6210a9b3 2021-03-25T15:43:06 EGL: GLES: Implement GL_EXT_protected_textures Implement EGL_EXT_protected_content Images Add protected member to Images and Textures Add error when creating objects if not supported or does't match native buffer When creating siblings pass protected state Add extension caps Add Validation Add GetTexParameter and SetTextparameter Add protected to Texture and state Expand tests for images and textures Test: angle_end2end_test --gtest_filter=EGLProtectedContentTest Bug: angleproject:3965 Change-Id: I35a89b4e80bba6d9b6831c68e71630eef304dacb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2802852 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jeff Vigil d2b659f9 2021-03-25T15:40:58 EGL: implement EGL_EXT_protected_content Context Add Validation check to Contexts and Surfaces Add Vulkan protected memory features and properties Add protected member to Surfaces and Contexts Implement hasProtectedContent in Vulkan Add QueueFamily helper, extent DeviceQueueMap Protected Swapchains always on for Android Add EGLProtectedContentTest Test: angle_end2end_test --gtest_filter=EGLProtectedContentTest Bug: angleproject:3965 Change-Id: I9352b1e594f71bb4e89cee7137a468940d186b1b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2800413 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 8c1cbc5a 2021-07-16T14:01:53 Implement EGL_KHR_mutable_render_buffer in the front-end. Note that we do not currently expose any mutable configs. Bug: b/192352791 Change-Id: Ib97f7889fedd91d09ef32dc7e7494ea4476cd7bd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3035583 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Gert Wollny b6009f64 2021-06-17T14:53:03 Capture/Replay: Add feature for robust resource init Query the feature when creating the display and the context, and pass the flag to the created context and also to durfaces. With that we create surfaces that will be marked "MayNeedInit" and are initialized if the resource is cleared or invalidated. Bug: angleproject:6041 Change-Id: I292f2e3f931736a18db93695441407e17d2265b6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2976656 Commit-Queue: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Jeff Vigil 22fc9523 2021-02-03T15:32:48 EGL: implement EGL_EXT_buffer_age Add extension flag. Add Validation check to surface query. Enable extension for vulkan. Modify AcquireNextImage to ++frame count and tag images with frame number. Buffer age is the difference between current frame count and the tagged frame number on the buffer. getBuffeAge may need to trigger AcquireNextImage to be current. Pass through egl extension and query. Add EGLBufferAgeTest Test: angle_end2end_test --gtest_filter=EGLBufferAgeTest Test: angle_deqp_egl_tests --deqp-case=dEQP-EGL.functional.buffer_age.* Bug: angleproject:3529 Change-Id: I0cb94be1c3e85d6f33e82a6a1ccdc9731b6a7f23 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2684724 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jonah Ryan-Davis 937bc82b 2020-12-17T17:57:50 Revert "GLX: Expose EGL_ANGLE_window_fixed_size" This reverts commit fa9b803e078fb833143df7a2b3f88c8694fa8f2f. Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=1157748 Original change's description: > GLX: Expose EGL_ANGLE_window_fixed_size > > Right now the GLX backend checks for resize on every SwapBuffers > call. If EGL_ANGLE_window_fixed_size is used, it will only resize > when signaled by Chrome. > > Bug: chromium:1132827 > Change-Id: Ia4ddbbbf6dcf13f46ad564208eccc517de8be33c > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2572886 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> TBR=syoussefi@chromium.org,jonahr@google.com,jmadill@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: chromium:1132827 Change-Id: I1110c5dd5d806b3c6c59308d4865f0d3aa57fc3f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2595197 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Xiaoxuan Liu 108b759e 2020-12-04T15:15:49 EGL: Update EGL headers/xml The new EGL headers introduced 'EGL_NO_X11' which we could use for ANGLE vulkan display/headless backend. Changes in CL: 1. Updated include/EGL/egl*.h and scripts/egl.xml based on latest EGL repo: https://github.com/KhronosGroup/EGL-Registry Note: local modifications to the file were preserved in eglext.h, search keyword 'eglext_angle.h' for detail 2. run scripts to update entry_points/loader scripts/generate_entry_points.py scripts/generate_loader.py scripts/run_code_generation.py 3. Update ANGLE code on API 'eglSwapBuffersWithDamage' 4. Format with 'git cl format' Bug: angleproject:5260 Change-Id: I70ed0dccecf0426929ef8b4775605554d66c5724 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2576314 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jonah Ryan-Davis fa9b803e 2020-12-03T17:53:12 GLX: Expose EGL_ANGLE_window_fixed_size Right now the GLX backend checks for resize on every SwapBuffers call. If EGL_ANGLE_window_fixed_size is used, it will only resize when signaled by Chrome. Bug: chromium:1132827 Change-Id: Ia4ddbbbf6dcf13f46ad564208eccc517de8be33c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2572886 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Geoff Lang 5b419533 2020-11-03T13:33:44 GL: Implement EXT_YUV_target Add test coverage of YUV format sampling as RGB or directly as YUV and rendering as YUV using layout(yuv). Initializing YUV AHardwareBuffers requires Android API 29 so ANGLE must be compiled with: android32_ndk_api_level = 29 android64_ndk_api_level = 29 The following tests can still run with Android API 26 because they don't need to initialize the buffer: ImageTestES3.ClearYUVAHB ImageTestES3.YUVValidation Bug: angleproject:4852 Bug: b/172649538 Change-Id: I4fe9afb2a68fb827dc5a5732b213b5eb60d585ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2517562 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 97843bda 2020-10-30T17:03:36 Vulkan: Fix EGL Surface robust init. The error here was related to using a single cache variable for the robust init setting for all the surfaces in a DisplayVk. Fix this by passing down the robust init setting from the SurfaceVk to image init. Bug: angleproject:5274 Change-Id: I9bc9c20990268d1d5166411fb53f8f2593fd1971 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2510694 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 185d9d08 2020-08-14T22:48:15 Re-land "Feedback Loop Redesign 2/3: Track bound FBOs in Texture." Re-land fixes the crash when drawing with no bound Program executable. Currently we track feedback loops by counting the times a Texture is bound as a sampler or image in a particular context. This is a bit tricky because Texture bindings change frequently. Relative to the number of times we need to check for a feedback loop this causes excess overhead. Usually Framebuffers have a low number of Textures bound (in many cases just 1). And Textures aren't usually bound to many different FBOs. So instead of counting the number of times a Texture is bound as a sampler or image we will track the Framebuffers that the Texture is bound to. This CL adds a small vector class to gl::Texture which tracks all the Framebufer Serials of its bound Framebuffers. We can use this set to quickly check if there's any potential feedback loop between the a FBO and this Texture. We also update the feedback loop check to use this new method. We will be able to remove the old counting method when we switch the Vulkan feedback loop handling to use the new tracking in this CL. Bug: angleproject:4500 Bug: angleproject:4959 Change-Id: If2bd25b08298a99f5e64b4055137f9154b0f0860 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2365595 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Khushal f6fb6da8 2020-08-19T21:04:35 Revert "Feedback Loop Redesign 2/3: Track bound FBOs in Texture." This reverts commit 699bcde0b729853f33474941a313f6d5c9e63faf. Reason for revert: Breaking GLES2WebGLDecoderPassthroughTest.DrawArraysInstancedANGLEEnablement. Here is a sample build : https://ci.chromium.org/p/chromium/builders/ci/Win10%20FYI%20x64%20Release%20%28NVIDIA%29/4240 Original change's description: > Feedback Loop Redesign 2/3: Track bound FBOs in Texture. > > Currently we track feedback loops by counting the times a Texture is > bound as a sampler or image in a particular context. This is a bit > tricky because Texture bindings change frequently. Relative to the > number of times we need to check for a feedback loop this causes excess > overhead. > > Usually Framebuffers have a low number of Textures bound (in many cases > just 1). And Textures aren't usually bound to many different FBOs. So > instead of counting the number of times a Texture is bound as a sampler > or image we will track the Framebuffers that the Texture is bound to. > > This CL adds a small vector class to gl::Texture which tracks all the > Framebufer Serials of its bound Framebuffers. We can use this set to > quickly check if there's any potential feedback loop between the a FBO > and this Texture. > > We also update the feedback loop check to use this new method. We will > be able to remove the old counting method when we switch the Vulkan > feedback loop handling to use the new tracking in this CL. > > Bug: angleproject:4500 > Bug: angleproject:4959 > Change-Id: I84a2f0ed8480d1da63d5879e0e56a8be4af4e735 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2358850 > Reviewed-by: Tobin Ehlis <tobine@google.com> > Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> > Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> > Commit-Queue: Jamie Madill <jmadill@chromium.org> TBR=tobine@google.com,courtneygo@google.com,jonahr@google.com,jmadill@chromium.org Change-Id: Ica795036895652add37ac8ed319031f9d5a321ac No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:4500 Bug: angleproject:4959 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2365077 Reviewed-by: Khushal <khushalsagar@chromium.org> Commit-Queue: Khushal <khushalsagar@chromium.org>
Jamie Madill 699bcde0 2020-08-14T22:48:15 Feedback Loop Redesign 2/3: Track bound FBOs in Texture. Currently we track feedback loops by counting the times a Texture is bound as a sampler or image in a particular context. This is a bit tricky because Texture bindings change frequently. Relative to the number of times we need to check for a feedback loop this causes excess overhead. Usually Framebuffers have a low number of Textures bound (in many cases just 1). And Textures aren't usually bound to many different FBOs. So instead of counting the number of times a Texture is bound as a sampler or image we will track the Framebuffers that the Texture is bound to. This CL adds a small vector class to gl::Texture which tracks all the Framebufer Serials of its bound Framebuffers. We can use this set to quickly check if there's any potential feedback loop between the a FBO and this Texture. We also update the feedback loop check to use this new method. We will be able to remove the old counting method when we switch the Vulkan feedback loop handling to use the new tracking in this CL. Bug: angleproject:4500 Bug: angleproject:4959 Change-Id: I84a2f0ed8480d1da63d5879e0e56a8be4af4e735 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2358850 Reviewed-by: Tobin Ehlis <tobine@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Sunny Sachanandani 4b225c70 2020-05-06T15:38:12 Add texture offset attributess for D3D texture pbuffer surfaces Add EGL_TEXTURE_OFFSET_X_ANGLE and EGL_TEXTURE_OFFSET_Y_ANGLE attributes to EGL_ANGLE_d3d_texture_client_buffer which are used to specify offsets used for rendering into the pbuffer surface backed by a D3D11 texture. Rendering with the correct offset is needed when Chrome gets a texture and offset from an external source e.g. when calling BeginDraw() on IDCompositionSurface. Bug: angleproject:2997 Change-Id: I363f739f3f05c38720f385e34c91e98fc6a622a0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2186176 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Ian Elliott 718ae508 2020-04-28T08:42:07 Vulkan: Always query EGL_WIDTH and EGL_HEIGHT This fixes the failures of the dEQP EGL resize tests on Android. Those tests don't actually resize the window (which would allow the tests to pass), but do change internal Android Surface values that vkGetPhysicalDeviceSurfaceCapabilitiesKHR queries. Therefore, by freshly querying these values the test passes. Bug: b/153329980 Change-Id: Ie966f221bfaa14988c1503c7f5503f0b21476bcb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2165639 Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Jamie Madill 1fc354fa 2020-04-22T11:49:00 Re-land: "Vulkan: Forward RenderBuffer/Surface dirty messages." Re-land fixes ASSERT on Android GLES. Previously we were only forwarding Texture staging changes to the Framebuffer for re-sync. We could miss out on clears that were staged in Surfaces and Renderbuffer attachments. Complete the chain by making the SurfaceVk and RenderbufferVk forward notifications from the VkImage. Bug: angleproject:4517 Change-Id: I91d31213b115a58546b574caa574eebbb098266c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2159294 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 623d0443 2020-04-21T15:15:03 Revert "Vulkan: Forward RenderBuffer/Surface dirty messages." This reverts commit 3fb33ade6ec8f286797bff5645304df580b1a963. Reason for revert: Causing WebGL test failures on GLES/ANGLE/Android. Bug: chromium:1072739 Original change's description: > Vulkan: Forward RenderBuffer/Surface dirty messages. > > Previously we were only forwarding Texture staging changes to the > Framebuffer for re-sync. We could miss out on clears that were staged > in Surfaces and Renderbuffer attachments. Complete the chain by making > the SurfaceVk and RenderbufferVk forward notifications from the > VkImage. > > Bug: angleproject:4517 > Change-Id: I15f36c225517e915f656d0c2464a99631ef9f945 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2150699 > Reviewed-by: Cody Northrop <cnorthrop@google.com> > Commit-Queue: Jamie Madill <jmadill@chromium.org> TBR=cnorthrop@google.com,timvp@google.com,jmadill@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: angleproject:4517 Change-Id: I4fd4d79dc11da0ba86065d3a80975de4c791a2a0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2159288 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3fb33ade 2020-04-09T15:27:12 Vulkan: Forward RenderBuffer/Surface dirty messages. Previously we were only forwarding Texture staging changes to the Framebuffer for re-sync. We could miss out on clears that were staged in Surfaces and Renderbuffer attachments. Complete the chain by making the SurfaceVk and RenderbufferVk forward notifications from the VkImage. Bug: angleproject:4517 Change-Id: I15f36c225517e915f656d0c2464a99631ef9f945 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2150699 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jonah Ryan-Davis 1a1a1427 2020-01-23T13:57:21 Expose eglGetMscRateCHROMIUM from EGL_CHROMIUM_sync_control When ANGLE is using the GL backend on GLX, we can expose eglGetMscRateCHROMIUM via glXGetMscRateOML. Otherwise, this function should return false. Bug: chromium:1042393 Change-Id: Id9b308c2217e07ee9860e2869be0e23b7a0c7411 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2017048 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jonah Ryan-Davis a829c0b9 2019-11-14T16:49:02 Expose EGL_CHROMIUM_sync_control via GLX_OML_sync_control On GLX, we can expose the EGL_CHROMIUM_sync_control extension by forwarding to GLX_OML_sync_control when it's available. This will help with accurate vsync times for Chrome Bug: 1020252 Change-Id: I9b1e8cf0f8b1a548cc7cc7202fac2d0cdb01d74d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1918104 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill c898ec1a 2019-11-04T15:20:18 Add EGL GGP extensions. This CL adds two new extensions: * EGL_ANGLE_ggp_stream_descriptor: Introduces a new attribute to CreateWindowSurface. Allows the app to pass in a stream descriptor to VkCreateSurfaceKHR. Mirrors VK_GGP_stream_descriptor_surface. * EGL_ANGLE_swap_with_frame_token: Introduces a new function 'eglSwapBuffersWithFrameTokenANGLE'. This allows the app to pass a GGP frame token down to vkQueuePresentKHR. Mirrors VK_GGP_frame_token. Bug: angleproject:4078 Change-Id: I4313ac4c264e68999905049f661bc64b44f72fab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1897315 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Tim Van Patten 56ba54cc 2019-08-08T13:03:34 Support separate read and draw surfaces in eglMakeCurrent Update ANGLE's default framebuffer implementation to support reading and writing to different surfaces within the same framebuffer. Bug: angleproject:2620 Test: EGLSurfaceTest[3] Change-Id: I4b1ea04ca87a751f80cf190bf3adec148fc4fce3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1744746 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Stuart Morgan 9d737966 2019-08-14T12:25:12 Standardize copyright notices to project style For all "ANGLE Project" copyrights, standardize to the format specified by the style guide. Changes: - "Copyright (c)" and "Copyright(c)" changed to just "Copyright". - Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1"). - Fixed a small number of files that had no copyright date using the initial commit year from the version control history. - Fixed one instance of copyright being "The ANGLE Project" rather than "The ANGLE Project Authors" These changes are applied both to the copyright of source file, and where applicable to copyright statements that are generated by templates. BUG=angleproject:3811 Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill eb1b1646 2019-07-30T17:22:17 Capture/Replay: Fix capture-enabled libs build. Adds a build option to use the capture libraries in the default output location for libGLESv2. With |angle_with_capture_by_default| enabled, libGLESv2 will have capture enabled and the non-capture libGLESv2 is built as libGLESv2_no_capture. Also moves the FrameCapture to be owned by gl::Context. Rearranges the code a bit so that we don't require a separate version of libANGLE for capture. Also implements a read pixels entry point parameter. Bug: angleproject:3611 Change-Id: Ic528e43e4779f794c8b6d0bf35410166dacc81b1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1719064 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 612b7417 2019-07-05T11:13:30 Capture/Replay: Add frame capture to cpp files. Capture is implemented mostly via code auto-generation. The capture requires a bit of custom logic for each captured pointer parameter. We handle this by using auto-generation to lay out the base template for each GL call and then custom logic that uses ANGLE's internals to know how much data to capture at which point. Client array pointers are captured before each draw call. Currently only GLES capture is supported. We write out cpp files and an optional data file accompanying each cpp. For small data chunks we inline them in the cpp files. For bigger chunks like texture data we pack them into the data file. Mid-execution capture is not yet supported. Configuring the capture is currently only available by modifying the cpp sources. Both of these features will be implemented in the future. Bug: angleproject:3611 Change-Id: If6d5dac2f7bf363129d42ea9198162aef0d3a4ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1671904 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 124f78c2 2019-06-18T11:48:24 Remove gl::Context parameter from Observer functions. It was only used in exactly one instance in VertexArray. Instead we can cache a bool and avoid needing to pass it around. Will make signaling dirty easier in the Vulkan back-end. Bug: angleproject:3539 Change-Id: Ia570aec051a24a5280df49edc4345c54022b46ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1663838 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang 0f4d72e6 2019-05-06T10:27:34 Add makeCurrent and unMakeCurrent to SurfaceImpl. SurfaceGL had these methods already so they are just moving up the inheritance hierarchy. This ends up simplifying some state tracking we had in our surface implementations. BUG=angleproject:2464 Change-Id: I480588ca8470d9ef507f95e0c0297fe126b3abfb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1595434 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jamie Madill ab2bfa81 2019-01-15T19:06:47 Enable Chromium clang style plugin for libANGLE. This fixes a few style warnings: * auto should not deduce to raw pointer type * inlined virtual methods are not allowed * non-trivial constructors and destructors should be explicit * inlined non-trivial constructors should not be in-class * missing override keywords Bug: angleproject:3069 Change-Id: I3b3e55683691da3ebf6da06a5d3c729c71b6ee53 Reviewed-on: https://chromium-review.googlesource.com/c/1407640 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 4f6592fa 2018-11-27T16:37:45 Remove gl::Error. Removes several TODOs. Only egl::Error remains. Also slightly decreases binary size. Bug: angleproject:2491 Change-Id: I3a9d1c22eb0884ca9e37362463fddd0083faf826 Reviewed-on: https://chromium-review.googlesource.com/c/1337462 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 6ba22ee1 2018-10-26T16:15:40 GL: Implement EGL_ANDROID_get_frame_timestamps. BUG=angleproject:2936 Change-Id: I758d797d185b2de330cce3401bfeef76c7df590e Reviewed-on: https://chromium-review.googlesource.com/c/1302836 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Yuly Novikov 2eb54074 2018-08-22T16:41:26 Fix EGLImage pixel format validation This fixes the scenario when EGLImage source and target have different types. For example, a texture is created with unsigned format using glTexImage2D, it is used as a source of EGLImage with eglCreateImageKHR, and then the EGLImage is used to create a renderbuffer target with glEGLImageTargetRenderbufferStorageOES. OES_EGL_image doesn't specify what should happen in this case, but GL implementations (Nexus 5X) seem to allow using this renderbuffer in glFramebufferRenderbuffer and the resulting framebuffer is complete. Thus, in this case, instead of checking whether the renderbuffer format can be used in glFramebufferRenderbuffer, we need to check whether the original texture can be used in glFramebufferTexture2D. Similarly in reverse direction. Also, for the case of source renderbuffer and target texture, presume that glEGLImageTargetTexture2DOES will succeed regardless of renderbuffer format. 1. Add isRenderable and isTexturable checks to egl::Image class, and perform different checks depending on source type. 2. Add isRenderable check to FramebufferAttachment and delegate EGLImage attachments check to egl::Image. 3. Use these checks in validation of EGLImageTargetTexture2D, EGLImageTargetRenderbufferStorage and when checking attachment completeness Bug: angleproject:2567 Change-Id: I8e9f4a2930a4075a4d8464f62582c6825270187e Reviewed-on: https://chromium-review.googlesource.com/1192585 Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
LRN 03d132eb 2018-07-14T13:31:35 Support EGL_(WIDTH|HEIGHT) in eglSurfaceAttrib(), fixed resize Setting EGL_WIDTH or EGL_HEIGHT results in mFixedWidth and mFixedHeight changing their values. Whenever the swap chain is tested for needing a resize, surfaces with mFixedSize are treated as if they should be resized to mFixedWidth and mFixedHeight from their current size. This way fixed-size surfaces can be resized - it's enough to do a couple of eglSurfaceAttrib() calls and then either let ANGLE check surface for needing a resize in due course, or force that by calling eglWaitNative(). BUG=angleproject:2725 Change-Id: I2932d8ecd5a2f10500e4aa8583a169aa09bf01bb Reviewed-on: https://chromium-review.googlesource.com/1139055 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill e62489f3 2018-07-16T19:12:33 Surface: Use ref count for bindTexImage. This frees up one more use of ProxyContext. It will also keep the bound surface alive until it is unbound from a Texture. Two usages of the proxy context remains. * DisplayD3D::restoreLostDevice. * Display::destroyImage. Bug: angleproject:2714 Change-Id: Ied72c6ebe060d7fc1743b3313e162d540fcbfe02 Reviewed-on: https://chromium-review.googlesource.com/1137878 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill e8cc4a64 2018-07-09T09:18:49 Surface: Don't use a BindingPointer for BindTexImage. The BindingPointer pattern isn't necessary. Every time we delete a Texture we call ReleaseTexImage internally. There shouldn't be any time that we keep an orphaned Texture is Surface. This cleans up one place where we were using the ProxyContext. Bug: angleproject:2714 Change-Id: I3b0fd2125d02ea7545922ec6da7f487451bed871 Reviewed-on: https://chromium-review.googlesource.com/1128925 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Geoff Lang 75359664 2018-04-11T01:42:27 Implement EGL_KHR_debug. BUG=angleproject:1618 Change-Id: I790944b49badc910b6c72266469fcb8e86ac4252 Reviewed-on: https://chromium-review.googlesource.com/1019387 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jiawei Shao a8802477 2018-05-28T11:17:47 ES31: Implement FramebufferTextureEXT on OpenGL back-ends This patch intends to implement FramebufferTextureEXT on OpenGL back-ends. 1. Support layered framebuffer attachments. 2. Add new framebuffer completeness rules on layered framebuffer attachments. 3. Support FRAMEBUFFER_ATTACHMENT_LAYERED_EXT as a valid <pname> parameter of GetFramebufferAttachmentParameteriv. Note that for an entire level of a cube map: 1. It has no TextureTarget because TEXTURE_CUBE is not a valid target for TexImage*D. 2. It corresponds to 6 ImageDescs (that represents its faces) in class Texture, so when the cube map is cube complete, we return the ImageDesc of its first face, meanwhile we do not allow querying ImageDesc if it is not cube complete. BUG=angleproject:1941 TEST=angle_end2end_tests dEQP-GLES31.functional.geometry_shading.query.framebuffer_attachment_layers dEQP-GLES31.functional.geometry_shading.query.framebuffer_incomplete_layer_targets dEQP-GLES31.functional.geometry_shading.layered.* dEQP-GLES31.functional.geometry_shading.instanced.invocation_per_layer_* dEQP-GLES31.functional.geometry_shading.instanced.multiple_layers_per_invocation_* Change-Id: I44393b513ec8f1a682fd1c47d3eaa6f3b3fae877 Reviewed-on: https://chromium-review.googlesource.com/1075811 Commit-Queue: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Geoff Lang bf7b95db 2018-05-01T16:48:21 Create a default framebuffer per surface/context pair on MakeCurrent. Sharing a gl::Framebuffer object between multiple contexts causes problems if contexts are not virtualized because the native framebuffer objects are not shared between these contexts. The FramebufferImpl created should be the glue that binds a specific context to a specific surface. Update the SurfaceImpl implementations to re-create the framebuffer object before passing it to FramebufferGL. No backing resources will be re-created. BUG=angleproject:2464 Change-Id: Id0b13a221c22b71517b25cb5b1ef2392ad2ecdd6 Reviewed-on: https://chromium-review.googlesource.com/1039985 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 1da46774 2018-05-14T14:30:30 Add support for EGL_ANDROID_presentation_time. BUG=angleproject:2506 Change-Id: I46b3c6ac7f259eabfdd8ea5799da6ef563ff81ee Reviewed-on: https://chromium-review.googlesource.com/1057997 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 493f9571 2018-05-24T19:52:15 Add PrimitiveMode packed GLenum. Bug: angleproject:2574 Change-Id: I3d7bd7ca0d69a364a611dc04799ea34906fc4a6c Reviewed-on: https://chromium-review.googlesource.com/1067114 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill d4703d50 2018-05-24T17:31:43 Move packed enum code to common/ This makes it accessible in the utilities files. Bug: angleproject:2574 Bug: angleproject:2169 Change-Id: I0fdd34b4233e72b7534cb2b09f451539c1a394cd Reviewed-on: https://chromium-review.googlesource.com/1067110 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Geoff Lang 8ceea819 2018-04-10T03:07:13 Refactor packed enum generation to support EGL enums. Convert the very simple EGL texture type enum. BUG=angleproject:1618 Change-Id: Ieea382a282a8f2544f2982627e8445e6e5cea826 Reviewed-on: https://chromium-review.googlesource.com/1019386 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill d444255a 2018-02-27T22:03:47 Refactor signal utils into Observer pattern. These types were over-generalized. All use cases featured arrays of resources attached to single parent resources. The channel ID is sufficient to identify the child resource in the parent, and having variadic template arguments wasn't necessary. Futhermore we can rename these types to use the common Observer pattern. This should make them more readable to new developers. Also update some classes to inherit from Subject instead of having a member Subject. This cleans up the code in a few places. This should lead to a simpler refactor to allow dependent dirty bits notifications in the Vulkan back-end. In the following patch the signal_utils files will be renamed. They are not renamed in this patch to ensure git history is preserved. Bug: angleproject:2372 Change-Id: I17a3f2c8d92afd4bb3cba2d378c3a2e8a6d7fb11 Reviewed-on: https://chromium-review.googlesource.com/936690 Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang 8170eab7 2017-09-21T13:59:04 D3D: Implement robust resource init for Surfaces. BUG=angleproject:2107 BUG=angleproject:2317 Change-Id: I22260e1093dc6c09e4627c62a95ca4088c99e951 Reviewed-on: https://chromium-review.googlesource.com/678480 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho ceffd20c 2018-01-08T16:39:45 Set colorspace of D3D pbuffers according to DXGI format When a EGL pbuffer is created based on a D3D SRGB texture using EGL_ANGLE_d3d_texture_client_buffer, SRGB conversions are performed as if it was an SRGB surface. The value of EGL_GL_COLORSPACE now reflects that correctly. If the pbuffer is bound to a texture and used as a framebuffer attachment, querying GL_FRAMEBUFFER_COLOR_ATTACHMENT also reflects that correctly. The behavior is the same on both the D3D backend, where there is no native interop involved, and on the GL backend using WGL_NV_DX_interop(2). There are a few limitations on the GL backend that relies on native interop: 1. SRGB conversion for textures created this way can't be disabled using the GL_FRAMEBUFFER_SRGB_EXT toggle that's exposed in ANGLE through EXT_sRGB_write_control. This is now documented in the EGL_ANGLE_d3d_texture_client_buffer spec. On the D3D backend this is not a problem since EXT_sRGB_write_control is not supported either way. 2. Creating a pbuffer out of a D3D11 texture with the format DXGI_FORMAT_B8G8R8A8_UNORM_SRGB does not work, even though it was listed as one of the supported formats in the EGL_ANGLE_d3d_texture_client_buffer spec. It's now mentioned that support for this format is optional. BUG=angleproject:2300 TEST=angle_white_box_tests Change-Id: I70ee0646680805e4469291a5b2ce59e92fda009e Reviewed-on: https://chromium-review.googlesource.com/866743 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Corentin Wallez 9db70de8 2017-07-04T18:28:42 Reland: Implement EGL_ANGLE_iosurface_client_buffer Includes a fix for creating pbuffers with <buftype> EGL_D3D_TEXTURE with EGL_WIDTH and EGL_HEIGHT attributes. BUG=angleproject:1649 TBR=geofflang@chromium.org Change-Id: Id2974b8fab02c3218febfac708b9b034e65cbc53 Reviewed-on: https://chromium-review.googlesource.com/823248 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 7f5c3eb7 2017-12-12T14:54:17 Revert "Implement EGL_ANGLE_iosurface_client_buffer" This reverts commit c7abc08034a30a41748eefc5b628a76d4e2daa8a. Reason for revert: Might have broken Chromium Win10 composition due to validation changes. Original change's description: > Implement EGL_ANGLE_iosurface_client_buffer > > BUG=angleproject:1649 > > Change-Id: I1e72c31d7c9497ad14039a8d3fb97317ab193cb2 > Reviewed-on: https://chromium-review.googlesource.com/559107 > Reviewed-by: Corentin Wallez <cwallez@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Corentin Wallez <cwallez@chromium.org> TBR=geofflang@chromium.org,cwallez@chromium.org Change-Id: I605b710b6d76056d6276b09822cd6ddca277bfd0 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:1649 Reviewed-on: https://chromium-review.googlesource.com/822172 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez c7abc080 2017-07-04T18:28:42 Implement EGL_ANGLE_iosurface_client_buffer BUG=angleproject:1649 Change-Id: I1e72c31d7c9497ad14039a8d3fb97317ab193cb2 Reviewed-on: https://chromium-review.googlesource.com/559107 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Jamie Madill acf2f3ad 2017-11-21T19:22:44 Apply Chromium style fixes. This addresses several minor code quality issues that are validated in Chromium, but not yet applied to ANGLE: * constructors and destructors must be defined out-of-line * auto is not allowed for simple pointer types * use override everywhere instead of virtual * virtual functions must also be defined out-of-line Slightly reduces binary size for me (~2k on Win, 150k on Linux). Bug: angleproject:1569 Change-Id: I073ca3365188caf5f29fb28d9eb207903c1843e6 Reviewed-on: https://chromium-review.googlesource.com/779959 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang b433e872 2017-10-05T14:01:47 Change robust resource init into a context creation attribute. Enabled support on OpenGL even through the extension is not fully implemented so that testing with Chromium/Passthrough commmand decoder is still possible. BUG=angleproject:1635 Change-Id: Ia417b1779aace1eae19514325701a79cd33f4ef3 Reviewed-on: https://chromium-review.googlesource.com/678479 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Geoff Lang e159717d 2017-10-05T12:02:30 Filter EGL attributes before passing them to the native driver. Adding extensions that are not native driver extensions would cause surface creation to fail. BUG=angleproject:1635 Change-Id: I2f683ee0560e463aa06f3ba92d0bf3f3d8c8927d Reviewed-on: https://chromium-review.googlesource.com/701602 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill c1abf917 2017-10-03T15:08:33 Fix leaking objects with UniqueObjectPointer. BUG=angleproject:2170 Change-Id: Ie0473022c153c4b70f350cab0c208dd3a0670c40 Reviewed-on: https://chromium-review.googlesource.com/691374 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 05b35b21 2017-10-03T09:01:44 D3D11: Lazy robust resource init. This patch moves the robust resource init logic to the GL front-end. Instead of initializing texture resources immediately on creation in D3D11, it defers the clear until before a draw call in some cases, or skips the update if we can determine if a texture (or other resource) has been fully initialized. Currently lazy init is only implemented for Textures, Renderbuffers, and Surfaces. Various places where lazy resource init is triggered: * Framebuffer operations (Draw, Blit, CopyTexImage, Clear, ReadPixels) * Texture operations (SubImage, GenerateMipmap, CopyTexImage) Some efficiency gains remain to be implemented, such as when a SubImage call fills the entire object. Similarly for Blit, and a few other operations. In these cases we can skip lazy init as an optimization. Edge cases with EGLImage are mostly untested. BUG=angleproject:2107 Change-Id: I2bf3a69b1eae0d4feeb5b17daca23451f1037be8 Reviewed-on: https://chromium-review.googlesource.com/576058 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Geoff Lang 40ac783b 2017-07-26T14:38:46 Implement remaining eglQuerySurface and eglSurfaceAttrib enums. BUG=angleproject:2075 Change-Id: I3b500fe80512e7a3e3a9ae9a9724015952c9cbc8 Reviewed-on: https://chromium-review.googlesource.com/587299 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jamie Madill 4928b7ca 2017-06-20T12:57:39 Proliferate gl::Context everywhere. This gives the D3D back-end access to the GL state almost anywhere. This uses the onDestroy hook for Textures to push errors up from destructors, although they still don't quite make it to the Context. There are places, such as in EGL object (Context/Surface) destruction, where we end up calling through to GL implementation internals without having access to a gl::Context. We handle this via a proxy Context to a Display, basically a null context, that has access to impl-side state like the Renderer pointer if necessary. It does not have access to the normal GL state. Also Pass gl::Context to RefCountObject::release(). Since we're using destroy() methods now, we should not ever call the destructor directly. BUG=angleproject:1156 Change-Id: Ie4c32ad6bf6caaff0289901f30b5c6bafa2ce259 Reviewed-on: https://chromium-review.googlesource.com/529707 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill fe54834f 2017-06-19T11:13:24 Proliferate gl::Context. This enables a few small things: it will enable making the platform a property of the Display rather than a global. The same goes for the global logging annotator. Also it ensures all back-end implementations have access to the GL / EGL state when available. Also introduces a smart pointer helper class to angleutils for objects that prefer to be destroyed with a context (gl::Context/egl::Display) parameter. We were using std::unique_ptr in a few places that would not work well with these objects. BUG=angleproject:1156 Change-Id: I59e288a3d6f766ff8a0f4b48ff3a1fbf7489daba Reviewed-on: https://chromium-review.googlesource.com/529706 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Frank Henigman aa7203ef 2017-05-03T23:32:29 Inherit privately from angle::NonCopyable. Make all inheritance from angle::NonCopyable private so the compiler complains about this (admittedly unlikely) code: class Foo: angle::NonCopyable { virtual ~Foo() { ... } }; angle::NonCopyable *p = new Foo; delete p; In the above code ~Foo() is not called, only ~NonCopyable(), because the latter is not virtual. Making it virtual would add overhead to all derived classes which don't already have a virtual method. Also tighten access in NonCopyable, because we can. BUG=angleproject:2026 Change-Id: Id0dc4d959cfb7bb82cf49382118129abb1d3a4f0 Reviewed-on: https://chromium-review.googlesource.com/495352 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 4fd95d54 2017-04-05T11:22:18 Stop using FramebufferAttachment::Target. Target includes the binding (DEPTH/STENCIL/COLOR), which is not useful for many operations. Simplify this to just passing the mip/layer. This allows us to stop using this internal struct in other classes. BUG=angleproject:1635 Change-Id: Ic5a11781bf45fe7835437fa1e363c190b876d453 Reviewed-on: https://chromium-review.googlesource.com/469152 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Stanislav Chiknavaryan ee218f27 2017-03-22T15:39:13 Re-land eglGetSyncValuesCHROMIUM extension. This reverts commit 20c97cac2a15144b61ceec7404a9e6249c40f50a and adds a few trivial changes to make it build with the current version of ANGLE code. Please see https://bugs.chromium.org/p/chromium/issues/detail?id=614147 for more details on how this extension will be used. Original description: This change adds implementation of eglGetSyncValuesCHROMIUM extension on D3D11 with Direct Composition. This should work on Windows 8.1 and above. The implementation is based on IDXGISwapChain::GetFrameStatistics. Extension documentation: https://chromium.googlesource.com/chromium/src/gpu/+/master/GLES2/extensions/CHROMIUM/EGL_CHROMIUM_get_sync_values.txt BUG=angleproject:1402 Change-Id: I4b77899f31a4c4cf1fa7f20ab12de5a02ccf74d8 Reviewed-on: https://chromium-review.googlesource.com/459217 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>