src/libANGLE/Renderbuffer.cpp


Log

Author Commit Date CI Message
Jamie Madill 888081d5 2018-02-27T00:24:46 D3D11: Refactor dependent Framebuffer state changes. Previously, when a state change would cause a Texture to recreate its storage specific to D3D11, we would use a dependent notification from RenderTarget11 to Framebuffer11 to re-check internal dirty bits. In this new method, we instead set dirty bits on the gl::Frambuffer directly. This also means we use fewer internal objects for these notifications, because we share the same structures between the D3D11 back-end notifications and the top-level notifications we use for Robust init and Framebuffer completeness. This also allows us to get rid of one "if" that we check on every draw call in D3D11. This also introduces a dirty bits guard concept - a shadow set of dirty bits that is checked in dependent state changes to ensure that extra bits aren't set inside syncState. This also implements Framebuffer dirty bits for the D3D9 back-end. This has the side effect of cleaning up the "null colorbuffer" D3D9 workaround. Bug: angleproject:2372 Change-Id: Ie346d39030f4f6df583d735685b0babea4e745a8 Reviewed-on: https://chromium-review.googlesource.com/936691 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@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>
Jamie Madill e703c606 2018-02-20T10:21:48 Add gl::RenderbufferState shared state helper. This shared state will be read-only visible in the RenderbufferImpl class. It mirrors existing structs for Textures, Buffers, and other classes. It allows the implementation class to have a read-only view as to the current GL state of an object. This will be useful to the Vulkan back-end, which would like to know the current Renderbuffer state before having to redefine the storage. If the current parameters match, it might not have to redefine the storage at all. The solution involves passing around the gl::RenderbufferState through various factory methods. Also name the Renderbuffer implementation pointer consistently and make it use std::unique_ptr. Bug: angleproject:2347 Change-Id: Ied6e0358e24e74a7fedbe4aea692edee909b5838 Reviewed-on: https://chromium-review.googlesource.com/922457 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@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>
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>
Jamie Madill ea84f6ff 2017-09-20T13:20:30 Pass Context to Framebuffer11 dirty callback. This allows us to call StateManager11::invalidateRenderTarget from the Framebuffer11::signal function, which will then trigger state refresh on the next draw call. This requires passing Context through a few more Renderbuffer methods, and reorganizing the RenderTarget signalling so that it doesn't signal dirty in the destructor. Instead they are signaled as they are destroyed in the containing classes. BUG=angleproject:2151 Change-Id: I4cf575e4a01b48275ff78d75bc55b2d1fced591d Reviewed-on: https://chromium-review.googlesource.com/673139 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 71c88b31 2017-09-14T22:20:29 Enable [[nodiscard]] for gl::Error. This forces all return values to be checked for gl::Error. Requires quite a bit of minor refactoring. I also added a macro to swallow an error without returning from a function. We could look at storing the errors in the Context at some point, since almost always when we're generating errors that we need to discard we have access to the Context as a parameter. BUG=angleproject:2150 Change-Id: I457e48a30c002eda0993acbcd3180ba87bf169fb Reviewed-on: https://chromium-review.googlesource.com/665173 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@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 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>
Geoff Lang 47110bf4 2016-04-20T11:13:22 Implement CHROMIUM_copy_compressed_texture for D3D11. BUG=angleproject:1356 Change-Id: Id563997d2921cf558c52a781ae66d8bde58d1f2f Reviewed-on: https://chromium-review.googlesource.com/339847 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jamie Madill a3944d4f 2016-07-22T22:13:26 Add gl::Format to represent a texture/rb/surface format. This has a few advantages: it preserves all the information of the internal format, such as if it is sized or unsized. It also saves looking up the format multiple times in the table, which should improve speed in some cases. The extra sized-ness information will allow us to perform the correct validation in CopyTexSubImage calls. BUG=angleproject:1228 Change-Id: I42954771b0a9a968f5d787b8cf6e0af721791855 Reviewed-on: https://chromium-review.googlesource.com/362626 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 362876b1 2016-06-16T14:46:59 Cache Framebuffer completeness. Improves performance on the render-to-texture microbenchmark by ~3x on the OpenGL back-end. Wipes out several of the top profling hotspots on that benchmark. BUG=angleproject:1388 Change-Id: I6a35a0b435b2ed3c83d32acdb9df090df98214ad Reviewed-on: https://chromium-review.googlesource.com/348957 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Geoff Lang 70d0f499 2015-12-10T17:45:46 Implement GL_KHR_debug. BUG=angleproject:520 Change-Id: I9ced3e7ab1515feddf2ec103c26b2610a45b1784 Reviewed-on: https://chromium-review.googlesource.com/319830 Tryjob-Request: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 66988745 2015-12-22T19:39:19 Revert "Implement GL_KHR_debug." This reverts commit 6c521b7a70a53b1c9f7762e53e34b5a8146b0f7b. Change-Id: I6ff981198e31f34d3e405edea6277ee75516d6ee Reviewed-on: https://chromium-review.googlesource.com/319820 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 6c521b7a 2015-12-10T17:45:46 Implement GL_KHR_debug. BUG=angleproject:520 Change-Id: I78d14cc8c94f5cef58604220f0ca847473b25bf8 Reviewed-on: https://chromium-review.googlesource.com/317820 Tryjob-Request: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 6b120b9f 2015-11-24T13:00:07 Add checks for FBO attachment layer. We would allow the app to attach layers that were out-of-bounds. Fix this by checking against the underlying resource dimensions. Also rework the code a bit to clean up the texture size query, which is available from the ImageDesc. BUG=angleproject:869 Change-Id: I984f1db16daea6ca650d795884d8ec2cb8f05ebb Reviewed-on: https://chromium-review.googlesource.com/313991 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 51706eae 2015-08-07T14:39:22 Make FramebufferAttachmentObject not refcountable Re-land with a fix for an unitialized variable Instead the refcount is done via callbacks. This allows Surface to ignore this refcounting which will be useful in a follow-up CL. BUG=angleproject:891 Change-Id: I1925ccaa4ce7b502b33088660d31c404b8313cb5 Reviewed-on: https://chromium-review.googlesource.com/293712 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Cooper Partin 4d61f7ed 2015-08-12T10:56:50 Reland Fixed compiler warning C4267 'conversion from 'size_t' to 'type', possible loss of data' Additional warnings found with more testing and added C4267 warning disable only for angle_libpng BUG=angleproject:1120 Change-Id: Ic403dcff5a8018056fa51a8c408e64207f3362eb Reviewed-on: https://chromium-review.googlesource.com/293028 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Corentin Wallez 0020426e 2015-08-12T19:07:29 Revert "Make FramebufferAttachmentObject not refcountable" BUG= This reverts commit 19ba57469aa02074d094a9aef104f84d0b6d881e. Change-Id: I5dce6c8a81570e22affbcaf32183a97c97849718 Reviewed-on: https://chromium-review.googlesource.com/293351 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 19ba5746 2015-08-07T14:39:22 Make FramebufferAttachmentObject not refcountable Instead the refcount is done via callbacks. This allows Surface to ignore this refcounting which will be useful in a follow-up CL. BUG=angleproject:891 Change-Id: I39b028476e0e3ab1837c033e1121ea21e54d7970 Reviewed-on: https://chromium-review.googlesource.com/291651 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill b195643c 2015-08-12T17:35:20 Revert "Fixed compiler warning C4267 'conversion from 'size_t' to 'type', possible loss of data'" Seems to have quite a few warnings in 64-bit on my machine. BUG=angleproject:1120 This reverts commit c5cf9bc47d0ee028adbbf9e9f94ca567eec601dc. Change-Id: I86768b900aeba52e7a2242d9ae8949f93f1a5ba9 Reviewed-on: https://chromium-review.googlesource.com/293280 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Cooper Partin c5cf9bc4 2015-08-06T10:46:48 Fixed compiler warning C4267 'conversion from 'size_t' to 'type', possible loss of data' BUG=angleproject:1120 Change-Id: I01ef10bea7f487c2b394d030c76628f38d2ea645 Reviewed-on: https://chromium-review.googlesource.com/292780 Tested-by: Cooper Partin <coopp@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang a840617a 2015-07-21T16:53:39 Implement the egl and gl layers of EGL Image. Add end2end tests and unittests. BUG=angleproject:970 Change-Id: Ie8306971730a793f08dfd09ead1bfd6ff3e4623d Reviewed-on: https://chromium-review.googlesource.com/291260 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 4274f7d2 2015-08-05T23:07:38 Revert "Implement the egl and gl layers of EGL Image." This reverts commit 22a4f38c2ca9ca430b5f976fc7fc816d88918eba. Change-Id: I07acbfe28d11675236de2ea7f6b050c25f80579a Reviewed-on: https://chromium-review.googlesource.com/290960 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 22a4f38c 2015-07-21T16:53:39 Implement the egl and gl layers of EGL Image. Add end2end tests and unittests. BUG=angleproject:970 Change-Id: I13fc501b24c3f11bfedc810c1ff80fcf1318877c Reviewed-on: https://chromium-review.googlesource.com/287343 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 8cf813c7 2015-05-04T12:55:18 Query attachment render targets from Impl class. *re-land with fix for D3D9* This allows us to eradicate the GetAttachmentRenderTarget methods. This improves potential performance, at the cost of exposing a Renderer-specific function at the API object level. BUG=angleproject:963 Change-Id: Iee9f985ddaed668df0c622228004b348eb4d2ea8 Reviewed-on: https://chromium-review.googlesource.com/269006 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill e737b06c 2015-05-04T16:53:56 Revert "Query attachment render targets from Impl class." D3D9 bug is causing failures in the WebGL depth texture test. BUG=angleproject:963 This reverts commit 804e8436f91733e1d0f769ec10082e4741f2e549. Change-Id: I660f05033360e97258794138cb50b604f5ac16b6 Reviewed-on: https://chromium-review.googlesource.com/269005 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 804e8436 2015-04-30T09:42:23 Query attachment render targets from Impl class. This allows us to eradicate the GetAttachmentRenderTarget methods. This improves potential performance, at the cost of exposing a Renderer-specific function at the API object level. BUG=angleproject:963 Change-Id: Ifc227b5f42e87bd4deb451d685618cf61fea39f1 Reviewed-on: https://chromium-review.googlesource.com/263491 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 79481d65 2015-04-14T08:13:47 Add FramebufferAttachmentObject base class. This lets us share objects (Textures/RBs/Surface) in the attachment class. It will let us squash the attachment classes into one type, which will in turn let us store them by-value, instead of by-pointer. BUG=angleproject:963 Change-Id: Ia9a43dbc3b99475c00f6bc2ed5475deef55addc3 Reviewed-on: https://chromium-review.googlesource.com/263487 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang cd69f1c9 2015-03-18T14:33:23 Implement RenderbufferGL. BUG=angleproject:886 Change-Id: I7480943d678b2cdf6e997c3f8316acdef32f5f0d Reviewed-on: https://chromium-review.googlesource.com/260889 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Brandon Jones <bajones@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang a08e1bd0 2015-03-24T10:17:18 Split Renderbuffer::setStorage into two functions to match the API. BUG=angleproject:886 Change-Id: I74375351339464b450c2f058adbeed7a1ba18cdd Reviewed-on: https://chromium-review.googlesource.com/262125 Reviewed-by: Brandon Jones <bajones@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill bdd419f9 2015-03-20T15:29:42 Fix ResourceManager create-on-bind reallocations. *re-land with build fix for Clang* We had a funny bug where the Handle Allocator would re-allocate reserved handles after the app layer creates one with Bind rather than using Gen. This affects Textures, Buffers and Renderbuffers. Fix this by using a different allocation scheme. It should still be fast on the "good" case (using Gen) and use tree lookups on the bind case. Also add some unit tests. BUG=angleproject:942 Change-Id: I63ce608fcd6a11f92e2b5421f090551934e729ed Reviewed-on: https://chromium-review.googlesource.com/261591 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 21045f5a 2015-03-20T19:28:45 Revert "Fix ResourceManager create-on-bind reallocations." Build break on GPU FYI Bots on Linux/Mac: http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Mac%20Builder/builds/28092 This reverts commit 61ce1a414e74f6a72a520d6adf59bff13aff03a0. Change-Id: If2e7fb35c769708a783a32932b777dc97eaba8a4 Reviewed-on: https://chromium-review.googlesource.com/261590 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 61ce1a41 2015-03-20T13:13:04 Fix ResourceManager create-on-bind reallocations. We had a funny bug where the Handle Allocator would re-allocate reserved handles after the app layer creates one with Bind rather than using Gen. This affects Textures, Buffers and Renderbuffers. Fix this by using a different allocation scheme. It should still be fast on the "good" case (using Gen) and use tree lookups on the bind case. Also add some unit tests. BUG=angleproject:942 Change-Id: I2e3f4c31b28cb86bd3699035f5d55568a2a1d7d5 Reviewed-on: https://chromium-review.googlesource.com/258904 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang c2e75afa 2015-01-05T14:26:24 Rename RenderTarget to RenderTargetD3D and move it into the d3d folder. BUG=angle:681 Change-Id: I1946e01ce09d99405c318723c254fe300cc5ac53 Reviewed-on: https://chromium-review.googlesource.com/238471 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang d8a2258c 2014-12-17T15:28:23 Remove all uses of "actual" formats. BUG=angle:861 Change-Id: I7cd2d1a56772fdf18bcf926456399322d13e7a4f Reviewed-on: https://chromium-review.googlesource.com/236305 Reviewed-by: Brandon Jones <bajones@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill d98bbc39 2014-12-03T11:36:42 Remove RendererD3D header from Renderbuffer.cpp. BUG=angle:773 Change-Id: Idb9f840c0a83550bd9a58c3c4599c65ee916fa3c Reviewed-on: https://chromium-review.googlesource.com/231853 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Geoff Lang 2b5420c0 2014-11-19T14:20:15 Merge libGLESv2 and libEGL classes into libANGLE. BUG=angle:733 Change-Id: Ic491c971411fe82c56cd97c5c8325ac14ec218df Reviewed-on: https://chromium-review.googlesource.com/230830 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>