src/libANGLE/VertexAttribute.cpp


Log

Author Commit Date CI Message
Jamie Madill ee21a187 2019-07-04T08:51:34 Store angle::Format in gl::VertexAttribute. Instead of storing type/size/normalized/pureInteger we instead store a pointer to the angle::Format. This makes some code logic simpler and will let us more easily check if a vertex attribute format changes in calls to VertexAttribPointer or VertexAttribFormat. This CL adds extra information to angle::Format to represent the vertex format info needed. It also caches the channel count so that it can be queried faster. Also renames "Int" -> "Sint" in UtilsVk for consistency. Bug: angleproject:3256 Change-Id: I5ef9b983dad8a58c341113c802500b89ce081566 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1684293 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Jamie Madill 6e18a238 2019-01-16T13:27:14 Optimize more front-end VertexArray binding. Improves perf slightly (1-2%) in the Vulkan VBO state change test. Bug: angleproject:3014 Change-Id: Ia8082b5b3f5e847a6b2775e896893fa8d38c1afd Reviewed-on: https://chromium-review.googlesource.com/c/1393904 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill dd34b3b9 2019-01-16T09:59:54 Pack VertexAttribType enum. This improves performance slightly in vertex array format checks. Instead of needing to switch on GLenum values we can use packed arrays and tables to determine the values we need. Does not significantly affect performance but will enable future work. Bug: angleproject:3074 Change-Id: I6f4821a463e9b41fe3f8c8967eb3ed4c1d6b84be Reviewed-on: https://chromium-review.googlesource.com/c/1393903 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill c759b8b4 2019-01-03T15:16:50 Vulkan: More Vertex Array optimizations. Inlines a number of Vulkan vertex array methods. Also changes the way vertex buffers are bound. Note that Vulkan doesn't support NULL buffer bindings. Thus we create an emulated NULL buffer to work around the problem of having gaps in the bound vertex buffers. This allows us to use a single bind call for ranges of vertex buffers even when there are gaps. Also changes how vertex array dirty bits are reset. Instead of calling memset to clear the affected buffers we pass a mutable pointer to the Vertex Array sync state. This allows us to only reset the dirty bits that we sync. This saves on the memory clearing time. Improves perf by about 10% in the Vulkan VBO state change test. Bug: angleproject:3014 Change-Id: Ib7b742dff7897fc891606a652ea0b64255a24c86 Reviewed-on: https://chromium-review.googlesource.com/c/1390360 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@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 ca8eda41 2018-10-18T18:41:56 Use dispatch table to optimize buffer binding. Using a table of function pointers is faster than using a switch followed by a function call. Also more aggressively inline binding methods. Based on contribution by mtavenrath@nvidia.com. In total this patch sequence improves the performance of a buffer binding perf test by up to 27%. Test: BindingsBenchmark.Run/gl_100_objects_allocated_at_initialization Bug: angleproject:2891 Change-Id: Iaab1e2a135b635bd72736d7d1d4271562c3a4ece Reviewed-on: https://chromium-review.googlesource.com/c/1281783 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill bf5177d3 2018-08-21T12:58:20 Optimize element array binding. This inlines some methods and code that was regressing binding performance. Improves the score of a bindings benchmark by 15%. Based on contributions by matavenrath@nvidia.com. Test: bindings_gl_100_objects_allocated_at_initialization Bug: angleproject:2777 Change-Id: Ied5fdbc67ced862a36c5145fff5ac94f93b40c21 Reviewed-on: https://chromium-review.googlesource.com/1181865 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 88602e6e 2018-08-08T12:49:30 Fix vertex array element limit condition. Certain overflows wouldn't be detected when the attribute size was less than the attribute size and we were drawing a small number of vertices. Fix this and also set the sentinel value for an integer overflow to be negative maxint instead of -1 to more effectily distinguish the cases. Bug: angleproject:1391 Change-Id: I970d5e2a630c0a84c2c02ac0ac41ab1a395819fe Reviewed-on: https://chromium-review.googlesource.com/1162264 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill bdc610ae 2018-07-30T10:26:00 VertexArray: Cache element limit for buffer checks. Uses checked math in VertexAttribute updates to store an element limit. This computes more when changing the vertex array rather than at draw call time. There may be a performance regression for workflows such as: loop() { VertexAttribPointer DrawArrays } It should improve performance in most other cases. Bug: angleproject:1391 Change-Id: I210d666d9dae9164a1c65f70f5e2151fb4f2d86d Reviewed-on: https://chromium-review.googlesource.com/1150514 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill ad63728b 2018-07-31T11:22:14 VertexArray: Store bound attributes mask in binding. Making the bound attributes mask part of the struct keeps the style a bit more consistent. It will also make updating the cache variable a bit easier. Bug: angleproject:1391 Change-Id: I2b0ba1161d2579d95ddfbae7a05e490c9644a126 Reviewed-on: https://chromium-review.googlesource.com/1150513 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
James Darpinian 09303e44 2018-06-22T17:53:57 Treat transform feedback generic binding point specially The transform feedback generic binding point is not part of the transform feedback object and is not used for transform feedback. Only the indexed binding points are used. A buffer that is bound to the generic binding point should be usable for either transform feedback or non-transform-feedback purposes. Bug: 853978 Change-Id: I5b730212c65524188134ac34645328328664f0a4 Reviewed-on: https://chromium-review.googlesource.com/1112841 Commit-Queue: James Darpinian <jdarpinian@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 2fc0806f 2018-05-10T15:10:55 Micro-optimize uniform updates. This CL is adapted from work by matavenrath@nvidia.com. It does the following small optimizations: * inlines a bunch of accessors. * reorders checks to hit the cache more often Also some small style updates. Bug: angleproject:1671 Change-Id: I8f21318e6644dcfe1f99c98f7f377742fcad78d3 Reviewed-on: https://chromium-review.googlesource.com/1054367 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 7267aa65 2018-04-17T15:28:21 Optimize ValidateDrawAttribs: Part 3. This is a small optimization for the WebGL compatibility mode. Instead of scanning the list of attributes for a Transform feedback conflict, it can quickly check a cached mask. This should save a lot of cycles on the fast path. Bug: angleproject:1391 Change-Id: Icb8d095493a629dbff0e93872357e5bf7c7458ae Reviewed-on: https://chromium-review.googlesource.com/1011236 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 629bb259 2018-04-20T11:01:33 Fix WebGL compat feedback loop null deref. This regressed in "Optimize ValidateDrawAttribs: Part 2." Bug: chromium:834943 Bug: angleproject:1391 Change-Id: I217719d76b0524ed7900e18bcc4ca1280ec7b6ff Reviewed-on: https://chromium-review.googlesource.com/1020280 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 02c9c04f 2018-04-17T13:43:48 Optimize ValidateDrawAttribs: Part 2. This moves much of the math into cached values in the VertexAttribute and VertexBinding. Bug: angleproject:1391 Change-Id: I1b6c0553bf57fef864c27c5193c7dd7ca9b56f53 Reviewed-on: https://chromium-review.googlesource.com/1008274 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
James Darpinian e8a93c6e 2018-01-04T18:02:24 New transform feedback buffer binding rules Detects undefined behavior when a buffer is bound to a transform feedback binding point and a non transform feedback binding point at the same time. Also moves the transform feedback buffer generic binding point out of the transform feedback object and into the context's global state, to match driver behavior. This way binding a new transform feedback object does not affect GL_TRANSFORM_FEEDBACK_BUFFER_BINDING which is similar to how VAOs work with GL_ARRAY_BUFFER_BINDING. Bug: 696345 Change-Id: If3b9306cde7cd2197a8ce35e10c3af9ee58da0b8 Reviewed-on: https://chromium-review.googlesource.com/853130 Commit-Queue: James Darpinian <jdarpinian@chromium.org> Reviewed-by: 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>
Martin Radev 553590a5 2017-07-31T16:40:39 Modify attribute divisor for multiview instanced rendering If the ANGLE_multiview extension is used in a program, the number of geometry instances is the number of instances passed to glDraw*Instanced times the number of views in the program. The attribute divisor has to be multiplied by the number of views so that the correct attributes are gathered in the input assembly stage. BUG=angleproject:2062 TEST=angle_end2end_tests Change-Id: I960d6313c02e3eb83f7a07e72b9bcac072c736f4 Reviewed-on: https://chromium-review.googlesource.com/593953 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 4928b7ca 2017-06-20T12:57:39 Proliferate gl::Context everywhere. This gives the D3D back-end access to the GL state almost anywhere. This uses the onDestroy hook for Textures to push errors up from destructors, although they still don't quite make it to the Context. There are places, such as in EGL object (Context/Surface) destruction, where we end up calling through to GL implementation internals without having access to a gl::Context. We handle this via a proxy Context to a Display, basically a null context, that has access to impl-side state like the Renderer pointer if necessary. It does not have access to the normal GL state. Also Pass gl::Context to RefCountObject::release(). Since we're using destroy() methods now, we should not ever call the destructor directly. BUG=angleproject:1156 Change-Id: Ie4c32ad6bf6caaff0289901f30b5c6bafa2ce259 Reviewed-on: https://chromium-review.googlesource.com/529707 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Martin Radev dd5f27ee 2017-06-07T10:17:09 Make VertexBinding's member variables private The patch decorates all members in VertexBinding as private and limits access to them only through getters and setters. This makes it easier to debug and keep track of any assignments to the class members. BUG=angleproject:2062 TEST=angle_end2end_tests Change-Id: Iddd49063d060f136bc9cf11c313a5af0931d433c Reviewed-on: https://chromium-review.googlesource.com/530786 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 9ab5b822 2017-05-30T16:19:23 Validate that vertex shader input matches the vertex attribute types. BUG=angleproject:2012 TEST=conformance2/rendering/attrib-type-match Change-Id: Ic282e0933a5c3c377322dd484534fcc1dfcb3840 Reviewed-on: https://chromium-review.googlesource.com/517974 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@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>
Geoff Lang 3cf12ce6 2015-08-27T14:40:48 Implement the instanced draw calls in RendererGL. BUG=angleproject:1136 Change-Id: I1167365618bdc3ca37ac0f4c60809de32c7a9d78 Reviewed-on: https://chromium-review.googlesource.com/295733 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 5b49bb83 2015-08-31T18:48:50 Revert "Implement the instanced draw calls in RendererGL." Causing crashes in some dEQP tests. This reverts commit c1948415e52dbaefb0d3176b75a58a7b86bd091a. Change-Id: Idedb32484b4f2b09090346bc4228fe536190a621 Reviewed-on: https://chromium-review.googlesource.com/296440 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang c1948415 2015-08-27T14:40:48 Implement the instanced draw calls in RendererGL. BUG=angleproject:1136 Change-Id: Id04e357b97c04b3843b25827f705fd802e6a68e3 Reviewed-on: https://chromium-review.googlesource.com/295233 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang d5451f11 2015-06-05T10:59:04 Inline comparison operators of several small ANGLE structs. Improves draw call overhead of RendererGL. DrawCallPerf_gl: Before: 129779 score After: 136973 score Improvement: 5.543% No noticeable difference in DLL size or draw call perf of the D3D renderers. BUG=angleproject:959 Change-Id: Id54d49e9e2cfb69431ee26d632c58fee2c42b82c Reviewed-on: https://chromium-review.googlesource.com/275408 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 6ae6efca 2015-03-09T14:42:35 Only sync the VAO state just before the draw call. BUG=angleproject:880 Change-Id: Ifd59c0f67aeab0e4700b3dca57c1b75e3fae48b8 Reviewed-on: https://chromium-review.googlesource.com/257671 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill dff56337 2015-01-05T16:17:00 Ensure all source files end in a newline. This fixes compile errors on OSX. BUG=angle:773 Change-Id: I11ce9fd470a54b08656a62afc50586e5d2f987d8 Reviewed-on: https://chromium-review.googlesource.com/238446 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@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>