src/libANGLE/renderer/d3d/VertexBuffer.cpp


Log

Author Commit Date CI Message
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>
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>
Jiawei-Shao 2597fb64 2016-12-09T16:38:02 ES31: Refactor VertexArray for Vertex Attrib Binding OpenGL ES3.1 feature Vertex Attrib Binding requires vertex arrays should be split into two arrays: 1. an array of vertex buffer binding points, each of which specifies: - a bound buffer object, - a starting offset for vertex attribute data in that buffer object, - a stride used by all attributes using that binding point, - a frequency divisor used by all attributes using that binding point. 2. an array of generic vertex attribute format information records, each of which specifies: - a reference to one of the new buffer binding points above, - a component count and format, and a normalization flag for the attribute data, - the offset of the attribute data relative to the base offset of each vertex found at the associated binding point. Current ANGLE implementation simply uses a struct to represent a vertex attribute object, which does not meet the requirements above. This patch aims to be the the basis of the implementation of all ES3.1 Vertex Attrib Binding APIs by refactoring the struct VertexAttribute and the class VertexArray to fit the new data layout and ensuring all current functionality is retained. BUG=angleproject:1593 TEST=angle_unittests, angle_end2end_tests, gpu_unittests Change-Id: Ieb41f1bf503f815fd0476d2ea045dcb863465254 Reviewed-on: https://chromium-review.googlesource.com/418880 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e2e406c3 2016-06-02T13:04:10 Add base::numerics for safe math and conversions. This replaces are "IsUnsignedXXXSafe" family of methods. Also add overflow checks to unpack block sizes. BUG=angleproject:1397 Change-Id: Ib47be149b0486c70f795b0d0f8899441faac9340 Reviewed-on: https://chromium-review.googlesource.com/348062 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill da123308 2016-03-29T17:00:48 Add ANGLE_TRY macros to reduce boilerplate with gl/egl Errors. The macros don't need to disambiguate between GL/EGL. Also make helpers to deal with ErrorOrResult. BUG=angleproject:1310 BUG=angleproject:1327 Change-Id: I8041c4b17a859fe1f236bca3ad266453d67a8fd4 Reviewed-on: https://chromium-review.googlesource.com/335826 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7d712e7d 2016-03-29T21:54:33 Re-land "Clean up Buffer11." This cleans up some messy stuff from the emulated index buffers, which were caching variables that didn't need to be cached. Also add in missing error checks. This touches a lot of code. Re-land with a fix for clang-win build. BUG=angleproject:1327 BUG=angleproject:1310 Change-Id: I31ed81c7242782bef7c5f6cde2192552f7ff9403 Reviewed-on: https://chromium-review.googlesource.com/336052 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e34deaa3 2016-03-30T01:50:40 Revert "Clean up Buffer11." Fails Clang-win because of std::forward ..\..\third_party\angle\src\libANGLE/Error.h(60,40): error: no matching function for call to 'forward' BUG=598944 BUG=angleproject:1327 BUG=angleproject:1310 This reverts commit 041d678b4764484386f934df927f00a5df48a351. Change-Id: I9fb0685cd01090b1faf8417ffa3c9b49eeb4510e Reviewed-on: https://chromium-review.googlesource.com/336040 Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 041d678b 2016-03-29T17:00:47 Clean up Buffer11. This cleans up some messy stuff from the emulated index buffers, which were caching variables that didn't need to be cached. Also add in missing error checks. This touches a lot of code. BUG=angleproject:1327 BUG=angleproject:1310 Change-Id: Icd722d57d9449388fbabc62c7ea37f0526a568ff Reviewed-on: https://chromium-review.googlesource.com/334731 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3be43be0 2016-03-09T20:05:08 Fix crash in IndexDataManagerPerfTest. Using a mock BufferFactory would sometimes leave us with a nullptr in the VertexBufferInterface class. This would lead to a null deref in the perf tests only. Fix this by adding a null check. BUG=593541 Change-Id: I98685a9990124f521cd26ed81a26aeb11aafaf0d Reviewed-on: https://chromium-review.googlesource.com/331768 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e36b92d4 2016-03-04T15:46:58 D3D: Use a single D3D buffer per static vertex attribute. The current caching logic stores multiple static attributes in a single buffer if the attributes share a D3D buffer - sometimes. If a buffer is 'committed' (has been used in a draw) then we would make a new D3D buffer for the next set of static attributes. Instead use a simpler scheme of a single D3D buffer for each static attribute. Also change rx::VertexBuffer to a reference counted class. This simplifies the caching logic for static vertex buffers (translated attributes) considerably. We only need to release the buffers when the ref count is zero, and ensure we track the ref count correctly when bound to D3D. This leads the way towards using a simpler dirty bit scheme for intelligent state updates, and less overhead doing work with buffer state updates. BUG=angleproject:1327 Change-Id: I99461d50b9663024eaa654cd56b42a63f1416d08 Reviewed-on: https://chromium-review.googlesource.com/330170 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d8fa9215 2016-03-02T11:51:43 D3D: Refactor VertexBuffer::getSpaceRequired. By making this a virtual call to BufferFactoryD3D (aka RendererD3D), we can also stop having side-effects in the BufferD3D class of creating a static buffer storage when we only want to know the space required for some vertex elements. This refactoring will aid implementation of VertexArray11 dirty bits. BUG=angleproject:1327 Change-Id: I0e34c6e9f5da35edebc179d578ad9392dc0166db Reviewed-on: https://chromium-review.googlesource.com/329741 Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill dbfc6c63 2016-02-29T01:08:57 D3D: Make directStoragePossible a local static method. This method doesn't need to call through to the VertexBuffer class, since in only really depends on vertex format caps. This makes the code local to the VertexDataManager, the only place it is used. Refactoring patch only, for VertexArray11 dirty bits. BUG=angleproject:1327 Change-Id: I315313a72a00186930d7f9b1091ccb91f37f9f96 Reviewed-on: https://chromium-review.googlesource.com/329740 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Austin Kinross 84b0c3b7 2015-11-05T15:15:28 Re-land "In D3D, cache static vertex buffers to prevent wasteful recreation" BUG=angleproject:197 Changes since first failed patch: - Optimized BufferD3D::getStaticVertexBuffer() - Removed loop to commit static buffers - Out-of-date static buffers (which are much rarer anyway after this patch) are marked for deletion at the *next* draw call, rather than searched for before each draw call. That search was expensive. The change should see a net improvement to DrawCallPerfBenchmark for D3D null. Change-Id: If4942e0afd9e8fefadce8820a1305e13636547ef Reviewed-on: https://chromium-review.googlesource.com/311115 Tested-by: Austin Kinross <aukinros@microsoft.com> Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 5b58cae2 2015-11-05T14:51:47 Revert "In D3D, cache static vertex buffers to prevent wasteful recreation" Perf bisect traced performance regression to this CL: 8.1% regression in angle_perftests/DrawCallPerf_d3d9_null/score 6.2% regression in angle_perftests/DrawCallPerf_d3d11_null/score BUG=angleproject:197 This reverts commit 868651d334d060458af13c7ff9211c2f72be0cad. Change-Id: Iaba7eb4e574eb886496361e61fd5fe78ca14dcb8 Reviewed-on: https://chromium-review.googlesource.com/311150 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Austin Kinross 868651d3 2015-08-31T15:31:18 In D3D, cache static vertex buffers to prevent wasteful recreation BUG=angleproject:197 Change-Id: I66cd10609b2edbcf12b99530eafe1727511fe515 Reviewed-on: https://chromium-review.googlesource.com/296503 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Austin Kinross <aukinros@microsoft.com> Tested-by: Jamie Madill <jmadill@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>
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>
Jamie Madill 3dfcdcb6 2015-08-10T14:28:54 D3D: Fix buffer overflow in VertexBuffer.cpp. Under certain situations an integer overflow could lead to ANGLE writing to places where it shouldn't. BUG=518206 Change-Id: I9217685daecb160a4072fbf79c26e5bee9f4621e Reviewed-on: https://chromium-review.googlesource.com/292391 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill d3dfda2b 2015-07-06T08:28:49 Refactor how we store vertex formats. Instead of storing a vertex format as a struct with the full info, instead use an enum, and look up the info when we need it. This saves a lot of constructor initialization time, operator comparison time, and storage. It also will allow us to look up D3D format info more quickly. BUG=angleproject:959 Change-Id: I202fd1ea96981073bc1b5b232b1ec3efa91485cb Reviewed-on: https://chromium-review.googlesource.com/277289 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3d72cc79 2015-06-22T13:57:19 Pass current value type instead of the object. This allows us to simplify the logic in VertexDataManager enough that we can start to cache attribute information. BUG=angleproject:959 Change-Id: I7b53a137d73f40f86e3acb9caebb66f9cacf8b6f Reviewed-on: https://chromium-review.googlesource.com/277283 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 7d112bb9 2015-06-22T13:57:19 Refactor source pointer math out of VertexBuffer9/11. This math can live in a single place in the VertexDataManager. This cleans up the code and paves the way for future optimizations. BUG=angleproject:959 Change-Id: I7138c6e080d9c3d6507b55d981bfb62c2590a2a8 Reviewed-on: https://chromium-review.googlesource.com/277282 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill fd1bf4e6 2015-03-31T09:46:02 Add an BufferFactoryD3D class to help mocking. This D3D-only class has one method, used to generate the D3D IndexBuffer/VertexBuffer. This can help us mock up IndexDataManager. At a later point we can refactor the VertexFormat queries from Renderer into a Caps struct that mirrors our Texure Caps. BUG=angleproject:956 Change-Id: Id8b1220a763873ee871ce92365bbee03633789c7 Reviewed-on: https://chromium-review.googlesource.com/262774 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 9236b418 2015-02-02T16:51:52 Add generic Impl casting helper methods. GetAs and GetImplAs are template helpers that can replace all of our custom "makeTextureD3D", etc methods. This will help save code across different back-ends. Change-Id: Ib3215c005bfac5a819c5d8f7d60a73a725241332 Reviewed-on: https://chromium-review.googlesource.com/245390 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Cooper Partin d8e62a39 2015-01-29T15:21:25 Added required casts to fix 64-bit compilation errors Change-Id: I5ec9090e0129c778de8fcdc6cf70ea0fe460a19d Reviewed-on: https://chromium-review.googlesource.com/244510 Tested-by: Cooper Partin <coopp@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>