src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi 025504b9 2022-10-17T17:03:03 Pass worker pools to image load functions In preparation for the ASTC decoder using threaded decoding. Bug: b/250688943 Change-Id: I70d669bcb57b900dbb633304182e174aec362203 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3961339 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Greg Schlomoff <gregschlom@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Rafael Cintron c9360ccb 2022-08-10T16:05:49 Reflect TextureD3D label updates with storage object When developers change a label with the KHR_debug extension, TextureD3D calls TextureStorage::onLabelUpdate. However, onLableUpdate was still using the out of date member variable (mTextureLabel) that was set in the constructor. This change adds a setLabel method to the TextureStorage class which properly updates the texture label member variable. Calls to onLabelUpdate now retrieve the most up-to-date label. This change also renames TextureStorage::mTextureLabel to mKHRDebugLabel to make it more clear which label was being stored. Bug: angleproject:7569 Change-Id: I6bc65c35dfb2237b5da88a6ed0e2d872a14857ba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3825357 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Stephen White 3f59c285 2022-07-12T17:29:36 D3D11: implement image load/store format reinterpretation. Reinterpretation requires all UAV textures to be in a TYPELESS format. Implement an ensureUnorderedAccess() that converts the texture's storage to one with the D3D11_BIND_UNORDERED_ACCESS flag, which, prior to this change, was set unconditionally for all textures in an >= ES 3.1 context. If this flag is set at D3D texture creation time, use the appropriate TYPELESS format. Implementation uses a BindFlags struct, which subsumes the existing renderTarget for clarity. Factor out the relevant bits of ensureRenderTarget() into an ensureBindFlags() helper function, and make ensureRenderTarget() and ensureUnorderedAccess() wrappers around it. Add the corresponding typeless formats to the texture format table. Bug: angleproject:7501, angleproject:7520 Change-Id: Id21b9db3229aceca121da6ba6507704417034ec4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3780588 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Stephen White <senorblanco@chromium.org>
Rafael Cintron 39e88e6e 2022-06-29T13:48:14 Handle OOM in SwapChain11::getRenderTargetShaderResource SwapChain11::getRenderTargetShaderResource has a code path where it allocates a new texture if the current one has insufficient flags. When this happens, the return value of the texture allocation is not checked, leading to a nullptr crash. Since texture allocation can fail in the case of OOM, we need to handle the failure and propogate the error to callers. Bug: angleproject:7442 Change-Id: I686d84ace669c461e8f7ef66bb0e6c4466f1c5ff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3736687 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Stephen White 6c0d4658 2022-05-27T15:32:42 D3D11: implement stencil texturing. When GL_DEPTH_STENCIL_TEXTURE_MODE is set to GL_STENCIL_INDEX, GL requires the stencil value to be in the R component. However, when sampling a depth24stencil8 texture in D3D11, the stencil ends up in the G component. So in this mode, swizzle the result from G to R. In order to sample stencil, use the appropriate stencil-only format for the SRV: X24_TYPELESS_G8_UINT for d24s8, X32_TYPELESS_G8X24_UINT for d32fs8. This required adding a new field to D3D11 Format. Bug: angleproject:7303 Change-Id: I7cf70efaaf6c833fa0b2497e4080618dfd7103ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3679485 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Stephen White <senorblanco@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Stephen White 43b5311f 2022-05-31T12:03:23 D3D11: minor cleanup to getSRVLevel(). Change getSRVLevel() to take an enum rather than a bool. Bug: angleproject:7303 Change-Id: I5b39b1b6e4f2f3f8a6bc8dd3f5690368f427f574 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3679482 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Stephen White <senorblanco@chromium.org>
Hailin Zhang b7474d0a 2022-04-28T14:44:54 D3D11: Add GL_EXT_texture_buffer support tested: deqp-gles31.exe --deqp-gl-context-type=egl --deqp-case=dEQP-GLES31.functional.texture.texture_buffer.* passed Bug: b/206367167 Change-Id: I31a6f84bd701a737735a6bac2f4eef780c24a979 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3639722 Commit-Queue: Hailin Zhang <hailinzhang@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Stephen White 8e121571 2022-05-06T13:27:06 D3D11: fix 3D texture blits. Change-Id: Icf8b061bb8f5d3e1cdd03f75fdecf16157abc0e5 Bug: angleproject:7272 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3631348 Commit-Queue: Stephen White <senorblanco@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Aditya Kushwah d8471b29 2021-10-02T10:36:33 Fix ASAN bug caused by passing empty label string. This CL will fix the ASAN bug that was caused by passing empty label string to getMultisampledRenderTarget, function of TextureStorage11. Instead, pass mTextureLabel so we can get WebGL labels now. Also to avoid this in future, convert ref mTextureLabel to now store copy. The change in the test reflects the steps to first set the label string and later the label being used to initialize mTextureLabel via texture storage creation. Bug: chromium:1254746 Change-Id: I007bdf1c7a421a2b4b9288aa71fa4368c14cf333 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3201030 Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Aditya Kushwah 5e029401 2021-09-28T15:49:20 Add a new variant to the labeling API. This CL will create a new variant which will take both internal name and KHR debug name and send them over to the D3D. This will help us capture KHR debug label better and also prevent for the cases where ANGLE was dropping the KHR labels on the floor when calling the label API right after the commands like glTexStorage2D, glTexImage2D etc. Bug: chromium:1164111 Change-Id: Ifebe8df5435a34692c601c5c35fddc1911bf9d0c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3192180 Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Aditya Kushwah f015ae81 2021-08-02T12:47:32 Implement onLabelUpdate method. This change will implement the onLabelUpdate method by calling from every TextureStorage object. Instead of using setDebugName, introduced two new functions, setInternalName and setKHRDebugLabel, which will set the internal name and KHR label respectively that will further be sent to D3D string. Bug: chromium:1164111 Change-Id: I401ca9f6e8a2099a8807f0d7f321efe74269f9f0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3067921 Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Aditya Kushwah c9dcc553 2021-06-22T18:55:39 Move Objectlabel from Texture object to TextureState object. Created a subscriber function onLabelUpdated in the storage base class. The derived storage class will pass the label reference to the base storage class in the constructor. Future changes will use this label reference to update the label string with D3D. Bug: chromium:1164111 Change-Id: Ic5ca73bac61427afe392bb5bcc6a6eab8e785941 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2981451 Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Jamie Madill 1179b299 2020-09-25T21:33:10 D3D11: Enable renderable mipmap generation. This path might have been broken some time back with the "setData" path enabled. This speeds up sRGB mipmap generation considerably. Bug: chromium:1130678 Change-Id: Id1c22bc1cfb815339bad5955ce990fe9f48d8b5b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2432112 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang f17cd288 2020-09-18T11:36:50 Refactor IsMipmapFiltered to take the min filter directly. This function is more useful if it takes just the min filter mode instead of the entire sampler struct to read a single member. Bug: b/167404532 Change-Id: Ie8c01c4095a615f06fe046fb175cdfb92fa54cbf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2419111 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi b0245f68 2020-06-23T22:38:12 Vulkan: Remove superseded updates when flushing to image Especially with emulated formats and robust resource init, a clear is staged that's often superseded by a data upload to the same subresource. This change ensures that superseded updates are dropped to avoid unnecessary GPU work. Bug: angleproject:4691 Change-Id: I697ccd438b92fd2fff17a5800550694658c95c54 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2262574 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jiajie Hu e7d27705 2020-04-30T05:50:21 Fix corruption when changing the base level of a framebuffer texture attachment In the D3D renderer, changing the base level may trigger re-allocation of the texture storage, for example if the new base level has a different aspect ratio. During the process, image contents in the texture storage should be backed up properly. The D3D11 backend does this if an image has been associated with the texture storage, but it may happen such an association has never been established, and corruption will be observed then. The proposed patch mitigates the problem by introducing a new method named findRenderTarget(), with which one can tell if a mip level has been used as the render target. This works based on the fact that render targets are cached in the texture storage object. Hence all mip levels of interest can be found, without relying on the association between images and texture storage. Bug: angleproject:2291 Change-Id: Ic73af7b603be25c65760928f276bec16df003baf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2158830 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Rafael Cintron 920ef28a 2020-01-15T15:26:17 Fix FL10_0 multisampling The last render-to-texture commit broke FL10_0 multisampling by unconditionally asking for D3D11_STANDARD_MULTISAMPLE_PATTERN quality setting. Per the documentation on https://docs.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_standard_multisample_quality_levels applications can only request the standard multisample pattern on feature levels 10_1 and above. For feature levels 10_0 and below, we'll stick with asking for a quality level of 0 like the code previous did. Bug: chromium:1036367 Change-Id: I0dd7704cf144ebce952e1f7d5e148d3382891aed Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2003238 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mingyu Hu 3b43647f 2019-11-15T14:17:55 EXT_multisampled_render_to_texture clean up and prep for 2DMultisampleArray. 1) Added new Multisampled Image Index. For the upcoming multisampled array case, we cannot automatically create the same MS image index during resolve. So the correct MS image index is created and saved during the initial creation of the MS Texture. It seems to be more streamlined as well, only creating the MS image index once, and not using hardcoded values to get the subresourceIndex. 2) reordering resolveTextureHelper to remove duplicated code. Bug: angleproject:3107 Change-Id: Ifd91136a64efb5e7bd296e09cd876a6e6eb8e77e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1919555 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Mingyu Hu 5f4db6a7 2019-11-11T14:52:37 Fix performance issue with EXT_multisampled_render_to_texture Adding a dirty flag to the mMSTexInfo struct so that the multisampled texture does not get unnecessarily resolved on each call. Bug: chromium:1019199 Change-Id: Ia9b24cd0a7f2d82f83f20f7e60f9f2b23383ec6f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1910531 Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Mingyu Hu 9122bec2 2019-10-21T11:03:48 Fix EXT_multisample_render_to_texture perf regression EXT_multisampled_render_to_texture was causing perf degradation through multiple unnecessary creation/destruction of the shadow multisampled texture. This is solved by keeping around the multisampled texture, so both will be available. Bug: chromium:1015031 Change-Id: I44deee67c02c19bc8749d3ed0d45661f52902e72 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1872618 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Mingyu Hu 2d0e5b55 2019-08-27T13:49:07 GL_EXT_multisampled_render_to_texture extension. Part 2. For textures that use this extension, a multisampled texture is implicitly created for the texture. Upon write or read, the multisampled texture is either return to be drawn to or resolved and returned as a single sampled texture. This is the functionality change with end2end tests. Bug: angleproject:980428 Change-Id: I5776875a132fed7a3f4f00fb02f9e8e250684630 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1773717 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Austin Kinross bf4268a3 2019-09-17T13:33:56 Fix misc VS2019 bool conversion warnings BUG=angleproject:3921 Change-Id: I06de5131f98b27c2556ed60dd7228c9cfa154802 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1811858 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mingyu Hu 7e44ec26 2019-08-26T15:59:48 GL_EXT_multisampled_render_to_texture extension. Part 1. Adding new parameters for extension without adding any real code change. Since no new code paths were added, we expect all tests to pass as before. Bug: angleproject:980428 Change-Id: I551b46a66f422eabd357fd021e00cf266a991efb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1772377 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.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>
Jonah Ryan-Davis beb0eb2d 2019-06-14T15:10:33 Clean up workarounds/features to single location. Rename all workarounds structs to features, and move the lists to a shared location in include/platform (to help with documentation, see: https://cs.chromium.org/chromium/src/ui/gl/gl_switches.cc?sq=package:chromium&g=0&l=69) Bug: angleproject:1621 Change-Id: I4069f08131db5e886047a007efb5d7764dfee5f2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1660952 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jonah Ryan-Davis 776694cd 2019-05-08T10:28:55 Change all ANGLE workarounds to use struct definition with info. Change each workaround from a simple bool to a struct with info including name, workaround set, description, and bug IDs. This will help with future workaround integration with Chrome. Bug: angleproject:1621 Change-Id: Ia27c180abaf845e280060c803e5994cc3152a057 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1593917 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Qin Jiajia e7da32f1 2018-12-27T15:31:47 Fix the failure in UpdateImageTextureInUse If we update the texture data between two dispatch calls, ReadPixels can't get right result after the second dispatch call. The failure reason is that after the first dispatch, ReadPixels will sync framebufer state which will update color render target. Finally, TextureD3D::ensureRenderTarget is reached. However, we are in compute pipeline. mTexStorage->isRenderTarget() will be false. That results the current texture will create a new render target storage. But the UAV is still bound with the previous texture storage. If there is no texture dirty bit between these two dispatch calls, applyTexturesForCompute won't be called. After the second dispatch, readPixels will read data from the new texture storage which is not updated. Bug: angleproject:3015 Change-Id: Ib2494ab8bf6e12faefc0a7370719d383526c36ba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1390710 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
Geoff Lang 48d040e8 2019-01-18T10:43:45 D3D11: Fix reads and writes to EGL image textures with mip offsets. RenderTarget11 knows how to render to a specific mip of a texture but if TextureStorage11 attempts to read or write to the backing resource directly it does not select the correct subresource index. This manifested in calls to glTexSubImage going to the wrong mip of the resource. Fix TextureStorage11::getSubresourceIndex to look up the correct subresource in TextureStorage11_EGLImage. Add a test to cover this case in ImageTest.MipLevels. BUG=angleproject:2668 Change-Id: Id9270ab3bf9f37c7c671639bb8b7ce9578daaed6 Reviewed-on: https://chromium-review.googlesource.com/c/1422058 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jamie Madill 7c985f5c 2018-11-29T18:16:17 Make angle::Result an enum. This moves away from a class type to a value type. This should improve performance when using angle::Result as a return value. Previously the generated code would return a pointer instead of a value. Improves performance in the most targeted microbenchmark by 10%. In more realistic scanarios it will have a smaller improvement. Also simplifies the class implementation and usage. Includes some unrelated code generation changes. Bug: angleproject:2491 Change-Id: Ifcf86870bf1c00a2f73c39ea6e4f05ca705050aa Reviewed-on: https://chromium-review.googlesource.com/c/1356139 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
Jamie Madill e4634a13 2018-11-14T09:54:35 Apply code formatting. Several files were formatted by the code generation script. Bug: angleproject:2957 Change-Id: I8a5cbf2c17297a3644686004a8981ab2305c1ada Reviewed-on: https://chromium-review.googlesource.com/c/1334428 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 526392dd 2018-11-16T09:35:14 Use angle::Result in front-end (Part 9) This removes the ANGLE_TRY_HANDLE macro. Also the internal uses of gl::ErrorStreamBase. There are remaining uses in the validation code. Further progress will be blocked on removing egl::Error and the use of gl::Error in the validation layer. Also reduces binary size by up to 4k. Bug: angleproject:2491 Change-Id: I3e0481f99738f9f24256c10e73f3efcce9826a35 Reviewed-on: https://chromium-review.googlesource.com/c/1334427 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill c1fd7376 2018-10-26T22:48:39 Move index range calculations into VertexArray. This is in preparation for removing the entire DrawCallParams struct. This struct was big enough to cause a performance hit on draw call perf tests just by virtue of initializing the fields. Also dereferencing the struct members is slower than reading function parameters since it adds an indirection. Also includes some error refactoring to enable moving code to a shared location. In total this patch series reduces overhead by up to 5%. Bug: angleproject:2933 Change-Id: Ib663f2538c14ac30d4c31fd10d6350be469626e2 Reviewed-on: https://chromium-review.googlesource.com/c/1298380 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 55e57f96 2018-09-18T11:32:43 Remove some redundant dirty bits notifications. These were already being signaled in the front end. Bug: angleproject:2763 Change-Id: Id78d3d764e80e687c29c08395b59048d314bfbe2 Reviewed-on: https://chromium-review.googlesource.com/1204490 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho efbabde2 2018-08-29T14:37:36 Support multisample array textures on D3D11 This implements complete support for multisample array textures on the D3D11 backend. There's a specialized TextureD3D class as well as a TextureStorage11 class for multisample array textures that have the bulk of the functionality. BUG=angleproject:2775 TEST=angle_end2end_tests, angle_deqp_gles31_tests Change-Id: I68116635c01cef0e48c089fd9da05a844ef2d802 Reviewed-on: https://chromium-review.googlesource.com/1216003 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 8370e6bc 2018-09-11T17:56:23 Rename constant to kCubeFaceCount. This corrects the naming style for this constant variable. Also updates many usages in TextureD3D.cpp and TextureGL.cpp. Bug: angleproject:2470 Change-Id: I029dd98e925cabf23a4bb26467a62afe6c5bb6e0 Reviewed-on: https://chromium-review.googlesource.com/1220726 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 480edb8c 2018-08-30T18:25:43 Clean up TextureStorage11_2DMultisample This de-duplicates functionality from TextureStorage11_EGLImage and TextureStorage11_2DMultisample. Neither of those supports changing the associated images or image access in shaders. Multisampled textures also cannot be compressed, so the size doesn't need to be adjusted according to block size. BUG=angleproject:2275 TEST=angle_end2end_tests Change-Id: I45bc573584065bf4f528f883435fadfbd7281077 Reviewed-on: https://chromium-review.googlesource.com/1216002 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Till Rathmann c1551dc2 2018-08-15T17:04:49 D3D11 fix: Mipmapping was used although disabled via Sampler When using a sampler the texture was created as if it has mipmaps, regardless what you specified in GL_TEXTURE_MIN_FILTER via glSamplerParameteri() -- mistakenly the default value GL_NEAREST_MIPMAP_LINEAR or the value set via glTexParameteri() was evaluated. If you didn't provide mipmaps and didn't let the driver generate them this led to not sampling your texture data when minification occurred. BUG=angleproject:2772 TEST=angle_end2end_tests.Texture2DTestES3.MinificationWithSamplerNoMipmapping Change-Id: I195147e208129c6fa8686bb0d9aea6931b2f20b1 Reviewed-on: https://chromium-review.googlesource.com/1175910 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill ec1fe5b7 2018-08-10T10:05:52 D3D: Use angle::Result error pattern. This completes the refactor for the D3D9/D3D11 back-ends. Bug: angleproject:2752 Change-Id: Ie35a925f75c902d8f9fdab6bc33b3bb9c937f85b Reviewed-on: https://chromium-review.googlesource.com/1167209 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 7a5814e2 2018-07-27T08:12:50 D3D11: Use angle::Result error pattern. 3/3 This completes the initial refactor for the D3D11 back-end. Bug: angleproject:2738 Change-Id: I6bc59d6a1a724b3c64d6cd904e6748c2acf8f67d Reviewed-on: https://chromium-review.googlesource.com/1151452 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 306b6c16 2018-07-27T08:12:49 D3D11: Use angle::Result error pattern. 1/3 This CL improves performance on the draw call microbenchmark by 10% when no-oping driver calls. Bug: angleproject:2738 Change-Id: I4f5c11db90d9056ce4557b2a4432bc55b42b5bba Reviewed-on: https://chromium-review.googlesource.com/1150093 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill b1565903 2018-07-27T08:12:48 D3D: Pass gl::Context to many more functions. This makes the Context more available for logging errors. Also includes more refactoring to VertexDataManager to ensure we can access the gl::Context. Bug: angleproject:2738 Change-Id: Iae3d22a1403078d236bfe63a3e2d203c13678dc4 Reviewed-on: https://chromium-review.googlesource.com/1151449 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 096c5296 2018-07-24T11:06:49 Blit11: Refactor for error returning. Don't use ErrorOrResult. Also pass gl::Context around to more places. Bug: angleproject:2378 Change-Id: Id498471fc9ab4f4d6b2285e110381b10a1247689 Reviewed-on: https://chromium-review.googlesource.com/1148465 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill daf2e913 2018-07-24T11:06:48 TextureStorage11: Pass more Context around. This will make it possible to record errors in the context immediately. Bug: angleproject:2378 Change-Id: Ib7ccdbcfa2bf51e3cc876496267c61cf5a26b7bd Reviewed-on: https://chromium-review.googlesource.com/1148464 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7b4ef3da 2018-07-24T11:06:48 TextureStorage11: Don't use gl::ErrorOrResult. Bug: angleproject:2738 Change-Id: I062b2fe3ff2b53bb361539c408b61626ac6c2f25 Reviewed-on: https://chromium-review.googlesource.com/1148463 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill ca2ff38b 2018-07-11T09:01:17 Refactor internal format pixel math methods. This removes the use of the ErrorOrResult class from these methods. This will enable more performant Error handling. Also cleans up the ANGLE_TRY_CHECKED_MATH macro to be more general. Bug: angleproject:2713 Change-Id: I349947d320907839ca88ec1f9251e6ddc3858a08 Reviewed-on: https://chromium-review.googlesource.com/1128920 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jeff Gilbert 31d3deb4 2018-05-18T18:32:16 Add `formatType` arg to computeSkipBytes. Fix texture upload format tests: - Format tests should definitely run on ES3 also. - Also set filters to NEAREST since some formats aren't filterable. - Fix RGB9_E5 test reference encoding and add a test for it. - True int/uint textures require i/usamplers. Bug: angleproject:2576 Change-Id: Ia5bac34cdee6554a88db339de443689a71a0cf70 Reviewed-on: https://chromium-review.googlesource.com/1068142 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill cc129377 2018-04-12T09:13:18 ImageIndex: Consolidate layer/cube face. In terms of the Texture or Image resource, a cube face refers to a layer of a 2D texture. This layer has a special meaning for cube textures, but it is represented as a layer with a layer index. Cube array textures are no different, they just use a different indexing scheme for the array layers. This also cleans up the ImageIndex helper to have a class structure with private data, and cleans up a few cases to use generic Make functions and iterators where they were setting properties of the index directly. This will make it easier to have ImageIndexes address entire levels of a Cube map in the future, and makes the layer count logic in Vulkan cleaner. Bug: angleproject:2318 Change-Id: Iea9842e233f974a9896282ca224cb001f7882bd1 Reviewed-on: https://chromium-review.googlesource.com/987525 Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill ec0a7028 2018-04-10T17:24:32 D3D11: Add more debug names. Bug: None Change-Id: Iedf69564f465ad1a48fd5cebfe384ace6787a720 Reviewed-on: https://chromium-review.googlesource.com/1006050 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
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>
Geoff Lang b52fac03 2018-02-21T15:45:35 Refactor ImageIndex to have separate type and target members. BUG=angleproject:2169 Change-Id: Ib3fb699058f76d0eb810a9691ea1d64311dadbb1 Reviewed-on: https://chromium-review.googlesource.com/929650 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang f81d17c2 2018-02-02T15:10:37 D3D11: Downsample when copying to emulated 16-bit texture formats. BUG=angleproject:2313 Change-Id: Ic1e679164d82f3024bb6842c9af2716aa10feb76 Reviewed-on: https://chromium-review.googlesource.com/900042 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Xinghua Cao 08a8ec88 2017-12-27T13:31:11 ES31: Support bindImageTexture on Texture3D/Texture2DArray/TextureCube for compute shaders on D3D BUG=angleproject:1987 TEST=angle_end2end_tests.ComputeShaderTest.* Change-Id: I075296ac3b6796a334929699c16f2399d7915e51 Reviewed-on: https://chromium-review.googlesource.com/844063 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Xinghua Cao 26143fdd 2017-11-01T18:19:05 ES31: Support bindImageTexture on Texture2D for compute shaders on D3D BUG=angleproject:1987 TEST=angle_end2end_tests Change-Id: I3b0afb441a41dbd7f204b1d1bba7884c8d203ce1 Reviewed-on: https://chromium-review.googlesource.com/749004 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jeff Gilbert 3dddccff 2017-11-14T16:44:36 Support RGB gl-tex-external stream consumers for StreamProducerNV12. This makes it relatively simple to sample from a D3D11Texture of arbitrary format. From: https://bugzilla.mozilla.org/show_bug.cgi?id=1322746 BUG=angleproject:2233 TEST=angle_end2end_tests Change-Id: I10cd3043b5cb0c5d36dd613467ba6c0ceadf41af Reviewed-on: https://chromium-review.googlesource.com/758042 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@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 92019431 2017-11-20T13:09:34 Make conversion from GL types to native bools consistant. Some places would compare with "== GL_TRUE" and others with "!= GL_FALSE". This behaviour is not in the OpenGL spec but "!= GL_FALSE" is the most standard and follows the same rules as C and C++. Remove un-necessary validation that params are either GL_TRUE or GL_FALSE. Update some internal storage from GLboolean to bool. BUG=angleproject:2258 Change-Id: I12adbe2d24318a206521ca6ad1099ee7e2bf677e Reviewed-on: https://chromium-review.googlesource.com/779799 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang f7480ad2 2017-10-24T11:46:02 D3D11 FL 10: Create cubemap SRVs as cube maps instead of 2D arrays. The creation of these SRVs would fail and spew D3D11 runtime errors. BUG=angleproject:2171 Change-Id: I80b6390822f74128b3443db7b6d48c4d318ec34d Reviewed-on: https://chromium-review.googlesource.com/735745 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@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 1f9d6843 2017-09-21T11:01:44 StateManager11: Defer RenderTarget invalidation to draw. Although this adds a boolean check (and state flag maintenance) cost to each draw call, it makes ANGLE's internal life a lot simpler because it doesn't have to process a framebuffer change until the draw call. It turns out there are a few dependent checks of the Framebuffer that aren't always easy to do. In one test, Context destruction was triggering RenderTarget invalidation, after the Context had already freed the Framebuffer manager. This also fixes the problem in feature level 9_3 with framebuffer invalidation affecting the internal dirty bit set. (Note that it still dirties the Framebuffer for the next frame). BUG=chromium:767279 BUG=angleproject:2151 Change-Id: I74d61bddf9926004a04f712a9f9eb1205d5df0e1 Reviewed-on: https://chromium-review.googlesource.com/676657 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@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 8ec383e6 2017-09-20T13:20:29 Use array template aliases in TextureStorage11. This cleans up some of the iteration logic. BUG=angleproject:2151 Change-Id: I8d80a8d732ee808babbb4859290b648b4fa67b4d Reviewed-on: https://chromium-review.googlesource.com/673138 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 136a2742 2017-09-20T12:29:44 TextureStorage11: Use unique_ptr for RenderTargets. This ensures they are auto-freed when the Storage is destroyed. Also remove the 'delete this' design pattern. BUG=angleproject:2151 Change-Id: I784b94c7125a1bbc15f5d6ae90e55317e199faa6 Reviewed-on: https://chromium-review.googlesource.com/673137 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>
JiangYizhou 5b03f475 2017-01-09T10:22:53 ES31: Implement getMultisamplefv for D3D part. Implement getMultisamplefv for d3d part.Because standard D3D sample positions from https://msdn.microsoft.com/en-us/library/windows/ desktop/ff476218.aspx are fixed sample pattern,we put the sample positions into a constant array in renderer11_utils.cpp with a function to query it. BUG=angleproject:1590 TEST=dEQP-GLES31.functional.texture.multisample.samples_*.sample_position Change-Id: I6e6006ed1c4e22fe006522e9ffd3297247bee75e Reviewed-on: https://chromium-review.googlesource.com/594970 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill eb335950 2017-09-09T23:32:49 D3D11: Only update swizzles after a state change. Triggers the swizzle update whenever a new texture is bound, or when a subImage call triggers a swizzle cache update. BUG=angleproject:1387 Change-Id: Ia2a82126a621d8a643f715ea7e4a9c35b97e0a18 Reviewed-on: https://chromium-review.googlesource.com/648729 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill ad6e2b6a 2017-09-03T16:28:29 D3D11: Fix memory allocation in markLevelDirty. This would drastically slow down some framebuffer updates. BUG=angleproject:1155 Change-Id: Ibff428c49bd5127a101bce46cc1df355f4542ccf Reviewed-on: https://chromium-review.googlesource.com/649986 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Martin Radev 18b75bad 2017-08-15T15:50:40 D3D11: Handle Clear* commands for layered framebuffers According to the ANGLE_multiview spec, Clear* commands only affect the range of attached layers to the multi-view layered framebuffer. The patch extends ImageIndex so that the range of attached layers is tracked and a render target view can be created with that range of texture array slices attached. The special case of scissored clears for depth and stencil attachments is handled by instancing the same number of quads as there are views and selecting the layer within a geometry shader. BUG=angleproject:2062 TEST=angle_end2end_tests Change-Id: Ibea248b980513f83d918652030a72c62c7ecd88b Reviewed-on: https://chromium-review.googlesource.com/632256 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 200e2d23 2017-08-14T13:19:54 D3D11: Force level zero render target in FL 9.3. Since 9.3 doesn't support non-zero level render targets, we should always be getting the level zero render target. Previously the code would never try creating a render target when level zero mode was not enabled, but this can break if we refactor the code. Fixes a bug in a future patch which creates the storage as a render target instead of as a non-renderable texture first. BUG=angleproject:2107 Change-Id: Ib2732a35e586bc4956d07783325429e8edeb0c66 Reviewed-on: https://chromium-review.googlesource.com/614120 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 9c335865 2017-07-18T11:51:38 Refactor StateManager11 for dirty bits. This will make iterating over an internal set of dirty bits simpler. This also reorganizes the framebuffer invalidation logic a bit, including how the sample count is pulled from the Framebuffer. BUG=angleproject:1156 Change-Id: I79dbcd11704ab52568c587d836af9c1bff1d2d1f Reviewed-on: https://chromium-review.googlesource.com/529708 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
JiangYizhou 34bc315d 2017-03-29T14:56:01 ES31: Implement multisampled Textures for D3D part. Implement TexStorage2DMultisample api for d3d part. BUG=angleproject:1590 TEST=angle_end2end_tests --gtest_filter=TextureMultisampleTest* TEST=angle_deqp_gles31_tests --deqp-case=dEQP-GLES31.functional.texture.multisample.negative.fbo_* Change-Id: Icbfba45b9c2965af02b54dd4060b7b49970cb74b Reviewed-on: https://chromium-review.googlesource.com/457161 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill da066657 2017-06-21T11:33:48 Fix invalid storage recovery on FL 9_3. This problem was uncovered when I inadvertently changed TextureD3D to delete its storage before its images. Small mips of compressed textures must use a nullptr argument to CopySubResource, otherwise the runtime complains about un-aligned sizes. Also change the class to delete the Images before the Storage again so we don't wastefully recover the images before deleting them. Also change the Image pointers to use std::array and std::unique_ptr. BUG=angleproject:1156 BUG=angleproject:2077 Change-Id: Idb2e53835b7a9b973285ff0781f70b25f05c77aa Reviewed-on: https://chromium-review.googlesource.com/543438 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@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>
Yuly Novikov c4d18aac 2017-03-09T18:45:02 Use ErrorStream everywhere Eliminates one more usage of FormatString and its static initializer. Add more ErrorStream types and replace gl::Error and egl::Error with them. BUG=angleproject:1644 Change-Id: Ib498d0ae4b81a332ec71aed7cf709993b154e6bb Reviewed-on: https://chromium-review.googlesource.com/505429 Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 0a82f2fa 2017-05-30T15:42:00 D3D11: Don't copy SharedSRVs around. This was causing a very large performance regression in Texture re-binding. Instead pass by const &, which should be fine, since values in std::map (and unordered_map) are not reallocated when the map changes. Also make the SharedResource type non-copyable, and add an explicit makeCopy method for when we need to clone the shared pointer. BUG=angleproject:2034 BUG=chromium:727318 Change-Id: I39508a6ca4b41e4da31fe68899caa4464138cada Reviewed-on: https://chromium-review.googlesource.com/517670 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 2c479d6e 2017-05-24T14:37:22 D3D11: Use TextureHelper11 everywhere. This consolidates all texture allocation into ResourceManager11. It removes a lot of error checking and resource management code. In a few places we're storing some redundant information, like in TextureStorage11, we might store the Format pointer in two places, or the Texture's size. BUG=angleproject:2034 Change-Id: I9369e76925a67632c444c662e5667c5ed7875547 Reviewed-on: https://chromium-review.googlesource.com/503252 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang 4f0e003e 2017-05-01T16:04:35 Implement the new formats/features of the ES3 CHROMIUM_copy_texture. Some non-renderable texture formats remain unimplemented. BUG=angleproject:1932 Change-Id: Id206432d6e26a70fc0e84478a4e43e9eefadcf2f Reviewed-on: https://chromium-review.googlesource.com/491948 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill e0e009fe 2017-05-19T14:13:03 D3D11: Consolidate SRV allocation. This change also moves all SRV storage to use the custom smart pointer classes in ResourceManager11. Every single SRV is now allocated in ResourceManager11. For TextureStorage11 and RenderTarget11, we use a shared pointer type since the SRVs use shared ownership by both classes. BUG=angleproject:2034 Change-Id: I90666fbbbc23ff10870b7401f3da09ef79258136 Reviewed-on: https://chromium-review.googlesource.com/503250 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 764a1e76 2017-05-18T11:11:47 D3D11: Consolidate DSV allocation. This uses the new classes introduced in ResourceManager11. Smart pointers mean we can use ANGLE_TRY in more places, and don't need to manually release these views. There is now a single point in the D3D11 back-end where depth stencil views are allocated. BUG=angleproject:2034 Change-Id: If0de2529ece1298e8babf24c07cc4be9849cc4de Reviewed-on: https://chromium-review.googlesource.com/503249 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 403c1682 2017-05-18T11:11:46 D3D11: Add resource manager classes. The resource manager tracks the allocations and deallocations of all D3D11 resources that have device memory: Buffers and Textures (which are either 2D or 3D). It also tracks the number of active Views (DSV, RTV, and SRV, potentially UAV with ES 3.1). A new smart pointer type will wrap the resource deallocation so that the object notifies the manager when ANGLE is done with the resouce. This allows us to track precisely how much GPU memory we think we're using at any point, and will help prevent resource leaks for these object types. It also makes initialization and releasing much more trivial. The base class for a resource uses a template template parameter so that we can use a unique or shared pointer depending on if the object in question needs unique or shared ownership. For some resources (in our case, SRVs are shared between the TextureStorage11 and RenderTarget11 classes, and Textures are shared in many places) we need to have the ability to have shared ownership. Unique ownership is a little bit more efficient so supporting both can be helpful. In this patch RenderTargetView allocation is moved to use the unique smart pointer. BUG=angleproject:2034 Change-Id: Idb1245c24cd66733b8b5ca524c727350b2d2c745 Reviewed-on: https://chromium-review.googlesource.com/503248 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jiajia Qin f6b986c8 2017-04-18T14:52:31 Refactor TextureStorage11 The CL includes below changes: 1. Change bool isAssociatedImageValid to void verifyAssociatedImageValid since we always required that the validation check should never be false. So ASSERT() is enough. Same to Image11::isAssociatedStorageValid->Image11::verifyAssociatedStorageValid. 2. Remove the unnecessary if checking after ASSERT 3. Use override instead of virtual if the function is virtual and is overriding a virtual function from the base class. BUG=angleproject:2006 Change-Id: I036666ae1ed4bfcaa8cef9e0e9626d375cd81a27 Reviewed-on: https://chromium-review.googlesource.com/480015 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Geoff Lang ca27139e 2017-04-05T12:30:00 Key the format tables on internal format and type. Keying the format tables on internal format alone is not enough to fully validate the unsized formats which require additional type information. This CL has no functional changes, it just splits the tables and updates the calls to GetInternalFormat info to provide type information when the format is not sized. BUG=angleproject:1523 BUG=angleproject:1958 BUG=angleproject:1228 Change-Id: I37e5201e7f54fa8eca01b8a6e64b11a6b94484e7 Reviewed-on: https://chromium-review.googlesource.com/468449 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 9f9b1d2d 2017-03-06T18:25:22 Make ScratchBuffer its own type. This helper tool in Renderer11 can be useful in other back-ends, or even in the front end. BUG=angleproject:1635 Change-Id: I18ec19a891a9bdfa7b80dea1b8e308abf206906b Reviewed-on: https://chromium-review.googlesource.com/450919 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill fd3dd436 2017-02-02T19:59:59 WebGL: Add 3D tex copying feedback loop detection. When copying to and from the same texture, we need to reject only the feedback loops formed with the same levels of the texture - copying between different unrelated layers and levels is fine. This change also fixes a couple bugs in our D3D11 CopyTexSubImage3D implementation. We were missing some "!" operators, and we actually would hit an ASSERT when trying to blit from a level of a 3D texture. BUG=angleproject:1685 Change-Id: Id715bebafe8336cf8bb95d0d06275a8b95e522e1 Reviewed-on: https://chromium-review.googlesource.com/425494 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Yuly Novikov d73f852f 2017-01-13T17:48:57 Reland "Replace gl::trace logging with Chromium style logging" Removing one usage of FormatString() and its static buffer. And preparation for Platform logging. Fix incorrect enabling of ERR() calls in UNIMPLEMENTED() and UNREACHABLE(), resulting in increased code size and <iostream> adding 5 static initializers to chrome because of cerr referenced in statically linked translator. BUG=angleproject:1660 Change-Id: I7caa18036118d532e0544f75278602559172ae04 Reviewed-on: https://chromium-review.googlesource.com/431457 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6a6b09c9 2017-01-12T21:52:29 Revert "Replace gl::trace logging with Chromium style logging" Failing Chromium static initializers check: FAILED linux-release-64/sizes/chrome-si/initializers: actual 8, expected 7, better lower Possibly due to the static initializer for std::array for the log severity types. We should change it to POD. BUG=angleproject:1660 This reverts commit afcc41cee4ff63e7f6c9e60e55fc061adbba7dd4. Change-Id: Ifb362a4af78542608397c7a0b19e6afe076f2cf3 Reviewed-on: https://chromium-review.googlesource.com/427235 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Yuly Novikov afcc41ce 2016-12-13T12:59:39 Replace gl::trace logging with Chromium style logging Removing one usage of FormatString() and its static buffer. And preparation for Platform logging. BUG=angleproject:1660 Change-Id: I58192988ad16196706fe48d0c0ab0fd1a10c0210 Reviewed-on: https://chromium-review.googlesource.com/424173 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
He Yunchao acd1898e 2017-01-04T10:46:42 Replace Error(GL_NO_ERROR) with NoError(). In order to make the errors be consistent throughout ANGLE. BUG=angleproject:1686 Change-Id: I0a2d86091d640aedeac94beae345c1fb6971b00d Reviewed-on: https://chromium-review.googlesource.com/424835 Commit-Queue: Yunchao He <yunchao.he@intel.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 408293f8 2016-12-20T10:11:45 D3D11: Fix stale SRVs with tiny depth textures. When the tiny depth texture would get re-created on change, it was not freeing any cached SRVs which were pointing to the old tex. Fix this by erasing the cache entry if the texure is recreated. Also include a test which hooks into the workarounds to force testing on every platform. Also narrow the workaround to only apply to depth/stencil textures which use these mips in GL, rather than D3D, where we always create a full mip chain. BUG=angleproject:1664 Change-Id: If0ac396b8847e1bf9b50165e5332da573e9bb3e4 Reviewed-on: https://chromium-review.googlesource.com/421567 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 60e6edfa 2016-10-31T12:17:19 Make ASSERT reference the conditional expression. This should prevent further unexpected bot breakage due to unreferenced variables in the ASSERT expression. Also remove the no longer needed variable referencing macro. BUG=angleproject:1586 Change-Id: I127695165bdfe39c51fe8d17e00daf6bf2fa8252 Reviewed-on: https://chromium-review.googlesource.com/404948 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 4f57e5f9 2016-10-27T17:36:53 D3D11: Make several format tables constexpr. This should guarantee the best memory access patterns. It introduces some indirections for some format queries, but most of these should be direct array lookups, or used infrequently. We can optimize this later if necessary. BUG=angleproject:1389 Change-Id: I5e2c8c530a07798494afd3ea36b6164d7564c02c Reviewed-on: https://chromium-review.googlesource.com/403314 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 7efe747c 2016-10-07T16:12:46 D3D11: Fix style in the entire back-end. BUG=None Change-Id: I32cbcd4daa1f386654ea5e8f0a25d8635b5df731 Reviewed-on: https://chromium-review.googlesource.com/402016 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 8234e7b3 2016-10-07T15:12:10 Refactor some errors into ANGLE_TRY macros. BUG=None Change-Id: I00ff2523995cb49d1af60cae62c2bba0d020eed4 Reviewed-on: https://chromium-review.googlesource.com/395569 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b7fe49db 2016-10-05T16:39:11 D3D11: Fold mipmap gen caps into the support table. This change is two-fold: first it allows us to remove the std::map for D3D11 format info, which was only being used in a single place. Secondly, it fixed the support table to use the correct 9_3 caps for texture support, determined by running the D3D11FormatTablesTest. This should reduce the number of format queries we need to run on 9_3 startup. BUG=angleproject:1389 BUG=angleproject:1459 Change-Id: I2435a47fc221e73c96337bc7c1c4ed37b527bc1f Reviewed-on: https://chromium-review.googlesource.com/392210 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e0548ad2 2016-10-06T15:55:35 D3D11: Split off DXGI component type query. This query is currently a part of a std::map. Split it off to its own switch using auto-generation based on the format string. Also introduce a DXGI-to-angle format map. This map is not totally complete because some more esoteric formats don't have corresponding ANGLE formats yet. We should add these other formats (EG NV12) if we need them. BUG=angleproject:1389 BUG=angleproject:1459 Change-Id: I49e045bdc04a52166299c9e22a4c4d3f24069dbc Reviewed-on: https://chromium-review.googlesource.com/392209 Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b80a5e9c 2016-10-05T16:39:09 Store channel bits info in angle::Format. This allows us to delete some duplicated code in the D3D11-side. BUG=angleproject:1389 BUG=angleproject:1459 Change-Id: Ifdcfcd4a56e06ff2ae8f5ca0bda72281d52c2964 Reviewed-on: https://chromium-review.googlesource.com/392208 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 0e48719f 2016-10-03T16:30:38 formatutils: allow reusing rowPitch computation for depthPitch This should fix a null D3D11 backend draw call performance regression. BUG=651101 Change-Id: I2eb10cddd15f0e7b25b886c89eccd2906e988c72 Reviewed-on: https://chromium-review.googlesource.com/392227 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 886de369 2016-09-27T10:49:35 Factor code between PixelUnpackState and PixelPackState BUG=angleproject:1512 Change-Id: I4c60472d216bfc5198e635d70fd197a5738dde98 Reviewed-on: https://chromium-review.googlesource.com/390133 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 9e3d7aa0 2016-09-02T15:19:43 D3D11: Work around small mipped stencil textures. AMD has a bug with 2x2 and 1x1 mips of depth/stencil textures. Formats D24S8 and D32FS8 both seem to render black for the very small mips. We can work around this by selectively caching a copy of the texture data that only has depth information, since stencil isn't filterable in OpenGL ES. BUG=angleproject:1493 BUG=chromium:638323 Change-Id: Iebef42c4680018d9854dbe789d677823167213dd Reviewed-on: https://chromium-review.googlesource.com/380037 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>