src/libANGLE/VertexArray.cpp


Log

Author Commit Date CI Message
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 e90d4ee9 2018-11-28T14:04:00 Pass Context to setLabel. This is useful for triggering a dirty state notification for Textures. It will lead to improvements for program and texture dirty bits. Bug: angleproject:2966 Change-Id: Iaba625da8a970a558f7d158bfa2f09c964f6761a Reviewed-on: https://chromium-review.googlesource.com/c/1347669 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 8dc27f99 2018-11-29T11:45:44 Use packed enum for DrawElementsType. The packing and unpacking take a few extra instructions. But it completely obviates the need for any switches in the validation code. Speed is slightly faster or the similar depending on the back-end. Also add gl_angle_ext.xml to GL entry point generator inputs. This was missing and would cause the code generation to miss certain changes. Bug: angleproject:2985 Change-Id: I1ea41a71db71135000166ead8305ec42d22ff7b3 Reviewed-on: https://chromium-review.googlesource.com/c/1351729 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@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 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 cd0a0a3c 2018-10-18T18:41:57 Introduce SubjectBindingPointer. We can share the same pointer for the subject binding and the binding pointer. This further allows us to optimize buffer re-binding. The shared memory increases cache coherency and reduces the number of instructions needed. Bug: angleproject:2891 Change-Id: Id3162fa79de203f75989e7289ea02cb2ea1bec73 Reviewed-on: https://chromium-review.googlesource.com/c/1270217 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 472ddc82 2018-10-18T18:41:56 Make gl::Buffer an angle::Subject. This will allow us to share the BindingPointer and ObserverBinding. It also cleans up the code a little bit. Bug: angleproject:2891 Change-Id: Ib8e2c34ccd379dc5b5648bac324fa4ff22a5a1a0 Reviewed-on: https://chromium-review.googlesource.com/c/1270216 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@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 6f755b21 2018-10-09T12:48:54 Use angle::Result in front-end. (Part 1) This covers most of the hot paths used in draw calls. Gives in the order of a 5% reduction in draw call overhead. Bug: angleproject:2491 Change-Id: I2d53afb1163eaceed61fb9cd9ce6c1267c85c0fa Reviewed-on: https://chromium-review.googlesource.com/c/1258149 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d84b6737 2018-09-06T15:54:35 Cache ValidateDrawStates. This improves performance of all draw call validation. The error that should be generated on the draw call is cached in the Context. The cache is updated in several places. Bug: angleproject:2747 Change-Id: I178617623731608e2e7166b53ab6489d8b742ff5 Reviewed-on: https://chromium-review.googlesource.com/1158612 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7b2f0274 2018-08-27T10:16:08 Inline more buffer binding calls. This splits checkObjectAllocation into the inline part and the slow part. It uses ANGLE_INLINE to force the former to be inlined. Also inlines and optimizes a few other buffer binding related checks. Improves performance in a bindings performance test by about 20%. Includes contributions from matavenrath@nvidia.com. Test: Bindings_gl_100_objects_allocated_at_initialization Bug: angleproject:2777 Change-Id: I71b07d72a8e81db7a90140ef84eca599a29239ed Reviewed-on: https://chromium-review.googlesource.com/1190442 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 337bd698 2018-08-22T16:16:38 Disable vertex attributes if not active in program Even if explicitly enabled. Bug: angleproject:2138 Change-Id: I598d21296bb6843e05cdeab146c1ff3da3a1174b Reviewed-on: https://chromium-review.googlesource.com/1185743 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@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 d69a5f12 2018-08-01T11:34:48 Cache VertexArray::hasMappedBuffer. This can be updated in several places. Also adds a test which covers some of the paths. Bug: angleproject:2746 Change-Id: Id119e527fd0064998d7ad5011a9d8376e7b9dab0 Reviewed-on: https://chromium-review.googlesource.com/1153569 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill cc73f241 2018-08-01T11:34:48 Micro-optimize some validation checks. Prepares for caching hasMappedBuffer. Also inclines several checks for faster speed. Bug: angleproject:2746 Change-Id: I74f9408d7b41e245c3f58d367dd2cc8fbace4a7a Reviewed-on: https://chromium-review.googlesource.com/1150762 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill a2d1d2db 2018-08-01T11:34:46 Context: Cache VAO element limits. Cache the minimum value for non instanced and instanced active attributes. The cache is updated in the following places: 1. Context: bindVertexArray. 2. Context: any executable change (linkProgram/useProgram/programBinary). 3. Vertex Array: any state change call. 4. Buffer: a dependent buffer resize. This greatly reduces the time we're spending in ValidateDrawAttribs. Bug: angleproject:1391 Change-Id: I84bb222a1b9736e6165fe40e972cd4299ca1178d Reviewed-on: https://chromium-review.googlesource.com/1150516 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill a11819de 2018-07-30T10:26:01 Context: Use Observer pattern for container objects. Container objects in this case are the Vertex Array and Read and Draw Framebuffers. Instead of using a mutable dirty bit state with a const function to notify of dirty bits we can use the Observer/Subject pattern. This more cleanly allows us to do cache updates. Bug: angleproject:1391 Change-Id: I88f863894ec3efa00322038f323a84850166107d Reviewed-on: https://chromium-review.googlesource.com/1153399 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@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>
Jamie Madill ac43aaa2 2018-07-31T11:22:13 Refactor client check from ValidateDrawAttribs. This moves out some shared logic into a more accessible place. We don't need to validate buffer overflows when using robust resource access but we do need to validate we are using client side data correctly. Bug: angleproject:1391 Change-Id: I7a3dca8409c5a1faf1ff7bc732d5ed1bd62eb3b1 Reviewed-on: https://chromium-review.googlesource.com/1148817 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill dc358af7 2018-07-31T11:22:13 Context: Cache attributes masks. This cache is updated in the following locations: 1. GLES1: clientActiveTexture. 2. GLES1: disableClientState/enableClientState. 3. Context: linkProgram/useProgram/programBinary. 4. Context: bindVertexArray. 5. Vertex Array: most state changes. Improves performance by about 6% in the GL no-op test. Also includes fixes for keeping the client memory attribs mask in sync. The cache also includes a boolean if there are any enabled client attributes. Bug: angleproject:1391 Change-Id: I93b6a2c8492355958fd5483f14b70535729091d6 Reviewed-on: https://chromium-review.googlesource.com/1147437 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jiawei Shao 6a5d98c4 2018-05-04T15:42:20 ES31: Implement Vertex Attrib Binding on D3D11 This patch implements Vertex Attrib Binding on D3D11 and enables all the test cases related to Vertex Attrib Binding on D3D11 back-ends. On D3D11 back-ends the information in both GL vertex attributes and bindings should be updated together. When a binding is dirty, we need to find out and update all the attributes that are using this binding. To speed up this process, this patch adds a map from each binding to all the attrib indexes that are using this binding. This map may be updated when VertexAttribBinding is implicitly or explicitly called. With this map we can easily get all the attributes that should be updated with the current dirty binding. This patch also removes some unused variables in VertexArray11.cpp. BUG=angleproject:2700 TEST=dEQP-GLES31.functional.vertex_attribute_binding.* angle_end2end_tests Change-Id: I9a28ec357fd3aba835812cecc410cfa4e3734f0c Reviewed-on: https://chromium-review.googlesource.com/1048980 Commit-Queue: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Jamie Madill <jmadill@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 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 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>
Jamie Madill 51af38b8 2018-04-15T08:50:56 Optimize ValidateDrawAttribs: Part 1. This moves several loop checks outside the loop, and uses more of the gl::AttributesMask class to do bitset operations instead of using checks and for loops. Bug: angleproject:1391 Change-Id: I90a1a7db550390ecd1402cf5a8a6677fd852b7b0 Reviewed-on: https://chromium-review.googlesource.com/1008273 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill bcef3224 2018-04-13T15:19:11 Move client attribs mask to front-end. The Vulkan and GL back-ends both had a client attributes mask. This consolidates them into the front-end, where it can also be used in the validation layer. Also includes a fix which was incorrectly setting the enabled mask in setVertexAttribFormatImpl. Bug: angleproject:1391 Change-Id: I5e45c1e2a56b30a36dec1482d170592c30a16d40 Reviewed-on: https://chromium-review.googlesource.com/1008272 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
Jamie Madill 0946393d 2018-04-04T05:26:59 Move Buffer Subject/Observer to front end. This makes BufferImpl into an Observer Subject. It also refactors the Vertex Array updates for the D3D11 backend use more of a dirty bit coding style. This change makes it so Buffer contents changes trigger front-end dirty bits from the back-end, which may be undesirable. Bug: angleproject:2389 Change-Id: Iac8ce1171284a86851c18cd1373ddf24fcefe40b Reviewed-on: https://chromium-review.googlesource.com/979812 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Frank Henigman 0af5b86a 2018-03-27T20:19:33 Return gl::Error from VertexArray::syncState(). No functional change. When we add vertex data format conversion to Vulkan we will need to be able to return an error from VertexArray::syncState(). BUG=angleproject:2405 Change-Id: I4b537946ecbb6593280b6510c5cd8d8e3c65e8dd Reviewed-on: https://chromium-review.googlesource.com/982897 Commit-Queue: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
Jamie Madill e858cb1d 2018-03-27T09:44:32 Split VAO dirty bits to speed iteration. Using > 64 bits (we had over 90) would use a much slower dirty bit iteration. Speed this up by splitting the dirty bits into two levels. The first top level only has a single dirty bit per attrib, per binding, and one bit for the element array buffer. The next level has separate dirty bits for attribs and bindings. The D3D11 back-end doesn't actually care about individual dirty bits of attribs or bindings, since it resets entire attributes at a time, but the GL back-end only refreshes the necessary info. Improves the score of a simple state change microbenchmark by 15% on the D3D11 and GL back-ends with a no-op driver. Real-world impact will be smaller. Also includes a test suppression for an NVIDIA bug that surfaced when we changed the order of that GL commands were sent to the driver. BUG=angleproject:2389 Change-Id: If8d5e5eb0b27e2a77e20535e33626183d372d311 Reviewed-on: https://chromium-review.googlesource.com/556799 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@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>
Brandon Jones c405ae71 2017-12-06T14:15:03 Optimize Vertex Shader Attribute Type Validition Improves ValidateVertexShaderAttributeTypeMatch by storing vertex attributes types into masks for quick comparisons when needed. This shows 2% improvement to glDrawElements for the aquarium workload. BUG=angleproject:2202 Change-Id: I87fa3d30c3d8cdba6dfd936cd1a41fd27b1c6b77 Reviewed-on: https://chromium-review.googlesource.com/814795 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill d078c681 2018-01-02T11:50:24 VertexArray: Add enabled attribs bitmask. This replaces the "max enabled attrib" integer with a bitmask of enabled attribs. Should have better worst-case performance (only attribute 15 is enabled) and similar best-case performance (when only attribute 0 is enabled). This might also help implementing validation optimizations. Bug: angleproject:2202 Change-Id: I5cbb533c3af23851a42c80a6dc409a0da84e87c3 Reviewed-on: https://chromium-review.googlesource.com/847284 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 06ef36b9 2017-09-09T23:32:46 Add top-level state sync for Samplers. This also reformats the Sampler class to use a shared state struct with the implementation. It removes the call to sync the sampler state from the StateManagerGL::setGenericShaderState method, since it should all be handled at the front-end now. Also rename 'syncImplState' to 'syncState' methods. BUG=angleproject:1387 Change-Id: I5f0219b719aee99aaaa486ec188b2af0c9128e6a Reviewed-on: https://chromium-review.googlesource.com/648054 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shao dde78e8c 2017-05-22T14:13:27 ES31: Implement Vertex Attrib Binding on OpenGL This patch intends to implement Vertex Attrib Binding on OpenGL back-ends: 1. Add supports for updating vertex attributes by Vertex Attrib Binding APIs. 2. Refactor the process of updating vertex attribtues in class VertexArray to make it easier to implement this feature. BUG=angleproject:1593 TEST=dEQP-GLES31.functional.vertex_attribute_binding.* Change-Id: I800e61518c552b94b84c415895ad31668b0a84b2 Reviewed-on: https://chromium-review.googlesource.com/510251 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 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>
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>
Jamie Madill c564c070 2017-06-01T12:45:42 Pass gl::Context to impl methods instead of ContextImpl. In some cases we might have to call back into the GL layer, passing the Context, and if we just have a ContextImpl pointer this isn't possible. It also removes the need for SafeGetImpl. BUG=angleproject:2044 Change-Id: I6363e84b25648c992c25779d4c43f795aa2866d6 Reviewed-on: https://chromium-review.googlesource.com/516835 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6de51858 2017-04-12T09:53:01 Optimize angle::BitSetIterator. Adds a new custom bitset template to handle packing as many bits as possible into a single variable. Intelligently select the right class depending on platform features and bit sizes. For now, always use a packed 64-bit set on 64-bit, instead of using a 32-bit set for smaller bitsets. BUG=angleproject:1814 Change-Id: I3ffef815c15515555833f6fc9302d8a4eee5423b Reviewed-on: https://chromium-review.googlesource.com/471827 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill dd43e6cd 2017-03-24T14:18:49 Pass Context to VertexArray and Framebuffer syncstate. This will enable more Vulkan-friendly idioms like clearing the vulkan pipeline caches correctly on GL state changes immediately because we have access to the ContextVk. BUG=angleproject:1898 Change-Id: I16c848d8abdde8e26a38d384e565cec8548a66d0 Reviewed-on: https://chromium-review.googlesource.com/459079 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shao 80957d99 2017-02-20T21:25:59 ES31: Implement Vertex Attrib Binding entry points This patch intends to implement all entry points related to Vertex Attrib Binding. (1) Add entry points and validation code on following APIs: - VertexAttribFormat - VertexAttribIFormat - VertexAttribBinding - BindVertexBuffer - VertexBindingDivisor (2) Add queries on following parameters: - VERTEX_ATTRIB_BINDING - VERTEX_ATTRIB_RELATIVE_OFFSET - VERTEX_BINDING_DIVISOR - VERTEX_BINDING_OFFSET - VERTEX_BINDING_STRIDE - VERTEX_BINDING_BUFFER BUG=angleproject:1593 TEST=angle_end2end_tests TEST=angle_unittests TEST=dEQP-GLES31.functional.state_query.integer.max_vertex_attrib_relative_offset_* TEST=dEQP-GLES31.functional.state_query.integer.max_vertex_attrib_bindings_* TEST=dEQP-GLES31.functional.state_query.integer.max_vertex_attrib_stride_* TEST=dEQP-GLES31.functional.state_query.vertex_attribute_binding.* TEST=dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.vertex_attrib_pointer TEST=dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.vertex_attrib_format TEST=dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.vertex_attrib_i_format Change-Id: I4b477a82df6aad89b89b088580a06d66963e6666 Reviewed-on: https://chromium-review.googlesource.com/446124 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@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 7aea7e05 2016-05-10T10:39:45 Add EGLImplFactory. Also rename ImplFactory to GLImplFactory. This will allow us to use the same factory design pattern for EGL objects, and to use State helper classes to share data with Impls. BUG=angleproject:1363 BUG=angleproject:1369 Change-Id: I07a8fe40838d5d4ca32b04910c306edeab4d25a7 Reviewed-on: https://chromium-review.googlesource.com/342051 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3f572680 2016-04-26T13:41:36 Rename gl::VertexArray::Data to gl::VertexArrayState. BUG=angleproject:1363 Change-Id: I5acf670bd88988941676cc9bc75606d55cca224e Reviewed-on: https://chromium-review.googlesource.com/340744 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 52b09c2f 2016-04-11T14:12:31 Re-re-land "D3D11: Implement dirty bits for VertexArray11."" Translated attributes are now stored in the VertexArray11 in a cache, and only updated when dirty bits change. Currently dynamic attributes must be re-translated every call, so these are stored in a list and processed repeatedly. This skips doing a lot of the VertexDataManager work for vertex attributes that don't change between draw calls. Current value attributes, which correspond to disabled attributes that the program will pulls vertex data from, are owned by the Context, so these need to be handled outside of the VertexArray11. Further changes will be necessary to reduce the redundant work we do in the InputLayoutCache. We shouldn't need to re-check the cache if nothing relevant changed. This give about a 23% performance improvement on the draw call benchmark on my machine. Re-land with a fix for the start vertex offset. Re-re-land with a fix for using XFB with deleted buffers. BUG=angleproject:1327 Change-Id: I0fba49515375c149bbf54d933f8d1f747fbb8158 Reviewed-on: https://chromium-review.googlesource.com/338003 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 53a36004 2016-04-08T19:03:18 Revert "Re-land "D3D11: Implement dirty bits for VertexArray11.""" Seems to make the following dEQP test flaky: dEQP-GLES3.functional.lifetime.attach.deleted_output.buffer_transform_feedback doesn't show up on every bot test, but run it a few times and it'll flake. Reverting while I investigate. BUG=angleproject:1327 This reverts commit 3477f3a62dc139a253a0b361ee138116e9fa881f. Change-Id: Ic23a392526f5f6e107cf0aa06448389804d6b208 Reviewed-on: https://chromium-review.googlesource.com/337961 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3477f3a6 2016-03-29T17:15:29 Re-land "D3D11: Implement dirty bits for VertexArray11."" Translated attributes are now stored in the VertexArray11 in a cache, and only updated when dirty bits change. Currently dynamic attributes must be re-translated every call, so these are stored in a list and processed repeatedly. This skips doing a lot of the VertexDataManager work for vertex attributes that don't change between draw calls. Current value attributes, which correspond to disabled attributes that the program will pulls vertex data from, are owned by the Context, so these need to be handled outside of the VertexArray11. Further changes will be necessary to reduce the redundant work we do in the InputLayoutCache. We shouldn't need to re-check the cache if nothing relevant changed. This give about a 23% performance improvement on the draw call benchmark on my machine. Re-land with a fix for the start vertex offset. BUG=angleproject:1327 Change-Id: Ic23e48fb18ed7f29c1999914a2f799ac04aa03e9 Reviewed-on: https://chromium-review.googlesource.com/334225 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 00f394ec 2016-03-16T12:09:11 Revert Dirty bits for VertexArray11 This is a combination of two reverts: Revert "D3D11: Remove unused mRenderer from VertexArray11." Revert "D3D11: Implement dirty bits for VertexArray11." Reverting only the first commit would trigger warnings on the Windows clang bot. BUG=594509 BUG=angleproject:1327 This reverts commit fc4712b5ed270436f2993bfda9e916d4f92684a4. This reverts commit 7d8585b802b7eb741b380bd0d05769281d9507c9. Change-Id: I612dbba0816d6144f71ce815701c13a798585bc7 Reviewed-on: https://chromium-review.googlesource.com/332989 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7d8585b8 2016-03-09T15:53:12 D3D11: Implement dirty bits for VertexArray11. Translated attributes are now stored in the VertexArray11 in a cache, and only updated when dirty bits change. Currently dynamic attributes must be re-translated every call, so these are stored in a list and processed repeatedly. This skips doing a lot of the VertexDataManager work for vertex attributes that don't change between draw calls. Current value attributes, which correspond to disabled attributes that the program will pulls vertex data from, are owned by the Context, so these need to be handled outside of the VertexArray11. Further changes will be necessary to reduce the redundant work we do in the InputLayoutCache. We shouldn't need to re-check the cache if nothing relevant changed. This give about a 23% performance improvement on the draw call benchmark on my machine. BUG=angleproject:1327 Change-Id: I7fb944d32ea7e6c78b9e478406bdb7e10a7fc05b Reviewed-on: https://chromium-review.googlesource.com/330173 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang 70d0f499 2015-12-10T17:45:46 Implement GL_KHR_debug. BUG=angleproject:520 Change-Id: I9ced3e7ab1515feddf2ec103c26b2610a45b1784 Reviewed-on: https://chromium-review.googlesource.com/319830 Tryjob-Request: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 66988745 2015-12-22T19:39:19 Revert "Implement GL_KHR_debug." This reverts commit 6c521b7a70a53b1c9f7762e53e34b5a8146b0f7b. Change-Id: I6ff981198e31f34d3e405edea6277ee75516d6ee Reviewed-on: https://chromium-review.googlesource.com/319820 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 6c521b7a 2015-12-10T17:45:46 Implement GL_KHR_debug. BUG=angleproject:520 Change-Id: I78d14cc8c94f5cef58604220f0ca847473b25bf8 Reviewed-on: https://chromium-review.googlesource.com/317820 Tryjob-Request: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill e79b1e14 2015-11-04T16:36:37 D3D11: Restrict use of MAX_UINT element indexes. We need to block the app from using MAX_UINT on D3D11 because we can't disable primitive restart on this platform. Instead generate an INVALID_OPERATION error, which is spec-compliant in ES3 because the result is undefined behaviour. This is also compliant with WebGL which explicitly defines an error here. BUG=angleproject:597 Change-Id: I7ebc5371b63ff860dc6dddf79939e9629ebb2a3c Reviewed-on: https://chromium-review.googlesource.com/309638 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tryjob-Request: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 0b9e9032 2015-08-17T11:51:52 Revert "Revert "Implement dirty bits acceleration for VertexArrayGL."" Should be fixed with the Iterator change. BUG=angleproject:1040 This reverts commit 5b21ed5fd030d33ae379b8cc493746244d2928b4. Change-Id: Ibb77775b6b2ce5a49cee7dd81efc62d8c3ba3c62 Reviewed-on: https://chromium-review.googlesource.com/293901 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 5b21ed5f 2015-08-14T18:12:50 Revert "Implement dirty bits acceleration for VertexArrayGL." Seems to cause an exception in Release, in end2end_tests. BUG=angleproject:1040 This reverts commit 6d51c70ccf63a2c5ec240d960ff1bc179d36c92c. Change-Id: I6548bc68dce07d2d85e40afdb604157e689c1d6c Reviewed-on: https://chromium-review.googlesource.com/293821 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6d51c70c 2015-08-14T10:38:10 Implement dirty bits acceleration for VertexArrayGL. BUG=angleproject:1040 TEST=angle_end2end_tests,angle_perftests,WebGL Change-Id: I91d9aea5eefb58ecaf5b1cc95926fddb2aa846ea Reviewed-on: https://chromium-review.googlesource.com/289570 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 77a90c26 2015-08-11T16:33:17 Reland of "Store the applied element array buffer as a binding pointer." To be consistent with how we start vertex attributes. A null pointer indicates we're using the streaming buffer. Will also aid the dirty state bits refactor. The re-land fixes a crash with WebGL related to element array buffers. BUG=angleproject:1040 TEST=WebGL CTS, end2end_tests, unittests Change-Id: I9b82e06825bf95f0fc2b7c7427e1eb6dd257c1ee Reviewed-on: https://chromium-review.googlesource.com/290044 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 2e5b500c 2015-07-30T17:40:29 Revert "Store the applied element array buffer as a binding pointer." This reverts commit 0018c85ea45090b5de61d4be1fbfbf96a3cde48b. Change-Id: Ieab61c0a4cd1b24d606263e9bf2bae31ea2e8ac4 Reviewed-on: https://chromium-review.googlesource.com/289486 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 0018c85e 2015-07-30T10:57:46 Store the applied element array buffer as a binding pointer. to be consistent with how we start vertex attributes. A null pointer indicates we're using the streaming buffer. Will also aid the dirty state bits refactor. BUG=angleproject:1040 TEST=WebGL CTS, end2end_tests, unittests Change-Id: I7a9167282b60dbe0cbb9f0e5d9e3770890ffeb71 Reviewed-on: https://chromium-review.googlesource.com/284619 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill cc7bbafa 2015-07-21T15:14:10 ES3: Fix off-by-one max enabled attrib. In some cases we would have a 'max enabled' attrib that was checked incorrectly, and this could lead to edge cases which crash when we have a vertex attribute and buffer both NULL. BUG=angleproject:1081 TEST=dEQP-GLES3.functional.lifetime.attach.deleted_input.buffer_vertex_array Change-Id: I62a9fa79f38340c99a708e54751d2b67dd4b6c1f Reviewed-on: https://chromium-review.googlesource.com/286854 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 8e34494f 2015-07-09T14:22:07 Share data between VertexArray and Impl. Using the same design as for the Framebuffer::Data helper, we can use a struct to share between the object and the Impl. This also gives the Impl access to the maxEnabledAttrib, and saves some duplicated storage. BUG=angleproject:1040 TEST=WebGL CTS, end2end_tests, unittests Change-Id: I55c91e8a5f3dcae302cab441182320aafd5375ef Reviewed-on: https://chromium-review.googlesource.com/283930 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang ee09b58e 2015-06-16T15:13:52 Notify the VertexArrayImpl when a buffer is detached. Update VertexArrayGL to clear it's cached buffer binding when a buffer is detached to prevent name aliasing. Fixes: * DEQP standalone crashes. * WebGL Conformance DEQP tests. Change-Id: If21a617629e15873ddeae0368b5399616f2ca68b Reviewed-on: https://chromium-review.googlesource.com/278050 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill aebf9dde 2015-04-28T12:39:07 Cache maximum enabled vertex attribute. This can give us much faster draw call validation, by saving us from checking buffer sizes for non-enabled attribs. Also for checking if vertex buffers are mapped. Gives >100% increase in the benchmark. BUG=angleproject:959 Change-Id: I211c310385bdee46ed06f68ecd9c98385e1f8db9 Reviewed-on: https://chromium-review.googlesource.com/267751 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Brandon Jones <bajones@chromium.org>
Geoff Lang 5ead927f 2015-03-25T12:27:43 Don't use a helper function to get the vertex attributes. The overhead of the function call ended up being a hot spot for draw calls since the attributes are iterated over many times in VertexDataManager. BUG=angleproject:959 Change-Id: I9bbfcbd115661ad629db9ed93d683cd8d0dc9a78 Reviewed-on: https://chromium-review.googlesource.com/263102 Tested-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 5b97287e 2015-03-30T19:52:55 Revert "Don't use a helper function to get the vertex attributes." Caused a warning on 32-bit builds. This reverts commit 20d78d241b448aa0b2e3f49d902d3ab63a551932. Change-Id: I4d61024fb29978e7f1bacdd693fc6f1bc00bd0cc Reviewed-on: https://chromium-review.googlesource.com/262918 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 20d78d24 2015-03-25T12:27:43 Don't use a helper function to get the vertex attributes. The overhead of the function call ended up being a hot spot for draw calls since the attributes are iterated over many times in VertexDataManager. BUG=angleproject:959 Change-Id: I6c11d4a5a22c314c69b3403dfdeb2d950b1c7639 Reviewed-on: https://chromium-review.googlesource.com/262336 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@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>