src/libANGLE/renderer/vulkan/VertexArrayVk.h


Log

Author Commit Date CI Message
Charlie Lao b97aab3f 2022-03-09T17:36:24 Vulkan: resync mCurrentElementArrayBuffer when out of lineloop When glDrawElements is called with GL_UNSIGNED_BYTE type or LineLoop mode, we will internally allocate an element buffer and copy data to it. But when we switch out of that mode, we must re-sync mCurrentElementArrayBuffer to what it should be based on VertexArray buffer binding. This CL fix the bug that we were previously not updating it and end up using the wrong element buffer. Also added three tests: DrawWithSameBufferButDifferentTypes: that uses GL_UNSIGNED_BYTE data and GL_UNSIGNED_SHORT data in the same buffer and switch between these two data types without incurring buffer change. DrawWithSameBufferButDifferentModes: draw line mode followed by triangle without the same element buffer. DrawArraysLineLoopFollowedByDrawElementsTriangle: draw line mode with glDrawArrays and then followed by DrawElements. Bug: chromium:1299261 Change-Id: I5c471117d300e9fac9127a9d8fa66d48ac312f03 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3513553 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 38723c28 2022-02-15T16:29:36 Vulkan: Allocate space for default attrib only if it is enabled When context's default attributes is dirty, we allocate space for the default attribute, regardless it is enabled or not. Then we call into VertexArrayVk::updateDefaultAttrib() which only update its state if the attribute is enabled. This causes a use-after-free scenario that if it is disabled, the vertex array may have a pointer to the buffer that is now becomes inflight which may gets deleted when DynamicBuffer code think the size no longer matches etc. Bug: chromium:1296467 Change-Id: Ib9ec8e60ebdb326f9bbfb215b3711c37631fce4b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3466776 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 1608a956 2022-02-02T13:54:53 Vulkan: Revert client vertex data streaming to use DynamicBuffer In early CL crrev.com/c/3352489, I switched client vertex data streaming from using DynamicBuffer to sub-allocating from the buffer pool. That caused CPU overhead regression due to extra cost of handling the suballocation object creating and garbage collection etc. Even after all other optimizations I did since then that significantly improved garbage collection performance, there is still 6% CPU time regression as measured with gardenscape. This CL moves StreamVertexData() back to use DynamicBuffer. In order to do that, I have cleaned up DynamicBuffer interface to be consistent with suballocation interface by storing the current allocated offset/size in the suballocation object. With that, the BufferHelper object that returned from DynamicBuffer will be able to pass around and referenced exactly like it comes from suballocation code path, and you can retrieve offset/size from that BufferHelper object instead of having to pass offset around between various function calls. Given that streaming vertex data from client memory is only possible for default vertex array and there is only one default vertex array for each context, this stream vertex data dynamic buffer is essentially a per context object. So the other change I made here is that I have merged mDynamicVertexData with default attribute (which uses per context dynamic buffers) code to use the same sets of dynamic buffers, since you will only use one or the other but not both. Bug: b/205337962 Change-Id: I0ceca5b854069f00afdb9544ee86953b9b773821 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3434645 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 293c0b51 2022-01-21T15:53:38 Vulkan: Cache commonly used 6 ushorts stream index array data Looking at all app traces that we currently have, 16 out of 100 apps are making glDrawElements calls without element buffer. And among these usages, most of them are calling glDrawElements with 6 unsigned shorts, which makes sense for drawing a quad. This CL caches first four BufferHelper objects with 6 uint16_t indices in a buffer and reuse them if the data matches. With this we avoid create/destroy suballocations, we even save the time of data copy and set DIRTY_BIT_INDEX_BUFFER when called with same set of indices, which is the case for almost all apps that uses glDrawElements based on app traces research. In order to test the effect, I modified the `--minimize-gpu-work` to keep glDrawElements calls with (count=6, tye=ushort) to pass down count/type into angle, and only change the mode to point. That way this new optimization will gets activated with `--minimze-gpu-work` command line option (see crrev.com/c/3421377). With that, this CL sees cpu overhead reduced from 2.54ms to 2.37ms on Pixel6 with vulkan_offscreen_gardenscape. Bug: b/215768827 Change-Id: I9b682868978e3bef7b5b9d1a596500ead2738d3e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3404677 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao ad27d5d6 2021-12-21T11:22:30 Reland "Vulkan: Consolidate all vertex conversion buffers to shared pool" This is a reland of cca412cd8b349b7281727c50f2a59d115fd90a05 Further inspection shows it was red-herring. The original CL does not have the un-intended diff that I saw in the commit email. This is try to reland the original CL without any modification. Original change's description: > Vulkan: Consolidate all vertex conversion buffers to shared pool > > There are various conversion buffers that holds converted vertex or > element or index data. They are DynamicBuffer for now. This CL switches > them to use the shared group buffer pool. With this change, all > allocation is represented by a BufferHelper object instead of an offset. > I am able to remove the offset arguments from a lot of APIs. > > Bug: b/208323792 > Change-Id: Ib611beb0c16cddbdd9ddf7b8961c439da9fa5180 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3352489 > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Charlie Lao <cclao@google.com> Bug: b/208323792 Change-Id: I90852ad38c2b9ac423800bb6854757bcc17cd166 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3370602 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 4e85bdd9 2022-01-06T17:06:25 Revert "Vulkan: Consolidate all vertex conversion buffers to shared pool" This reverts commit cca412cd8b349b7281727c50f2a59d115fd90a05. Reason for revert: There is accidental code merge bug left in. Original change's description: > Vulkan: Consolidate all vertex conversion buffers to shared pool > > There are various conversion buffers that holds converted vertex or > element or index data. They are DynamicBuffer for now. This CL switches > them to use the shared group buffer pool. With this change, all > allocation is represented by a BufferHelper object instead of an offset. > I am able to remove the offset arguments from a lot of APIs. > > Bug: b/208323792 > Change-Id: Ib611beb0c16cddbdd9ddf7b8961c439da9fa5180 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3352489 > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Charlie Lao <cclao@google.com> Bug: b/208323792 Change-Id: I18bba207d1d8bb76dff32d9855a744dba93bc6d6 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3370601 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao cca412cd 2021-12-21T11:22:30 Vulkan: Consolidate all vertex conversion buffers to shared pool There are various conversion buffers that holds converted vertex or element or index data. They are DynamicBuffer for now. This CL switches them to use the shared group buffer pool. With this change, all allocation is represented by a BufferHelper object instead of an offset. I am able to remove the offset arguments from a lot of APIs. Bug: b/208323792 Change-Id: Ib611beb0c16cddbdd9ddf7b8961c439da9fa5180 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3352489 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi e354ff1a 2021-03-05T04:07:21 Vulkan: Allow DynamicBuffer suballocation in BufferVk When allocations are made from DynamicBuffer, they suballocate from a possibly larger BufferHelper. In BufferVk, the offset of the suballocation was discarded, which limited the use of DynamicBuffer to a pool of small buffers. This change applies any such offset that may arise from suballocations everywhere, and makes BufferVk use a larger buffer size when the GL_DYNAMIC_* buffer usage hints are provided. Bug: angleproject:5719 Change-Id: I3df3317f7acff1b1b06a5e3e2bb707616a7d0512 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2738650 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang f0b02054 2020-08-06T20:55:05 Add a Vulkan feature to compress float32 vertex formats. Use the vertex conversion pipeline in VertexArrayVk to detect static vertex data and convert float32 vertices to float16. This feature is useful for determining if an allication is vertex bandwidth bound and seeing what gains could be had by using smaller attributes. This feature could be implemented in ANGLE's frontend but new infrastructure for converting and storing the converted attributes would need to be added to gl::VertexArray. Our backends already have the functionality needed to handle unsupported attribute formats and this can be repurposed for compressing vertex formats. Bug: b/167404532 Bug: b/161716126 Change-Id: I9a09656a72e8499faa4124adf876d7261c8341c9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2342285 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 959037e0 2020-05-25T15:40:38 Vulkan: Preserve RPs on XFB changes when possible. Instead of unconditonally ending the RenderPass we keep a set of active XFB buffers in the ContextVk. This lets us re-use RPs when we don't write to the same buffer repeatedly. Reduces the RenderPass count in our Manhattan capture from 29->23. Bug: angleproject:4622 Change-Id: I28c2d4d3db1490e5d07be3c48d21fd2cc6ff85d6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2196957 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 93577b20 2020-05-28T15:16:46 Vulkan: Move "null" buffer to RendererVk. This will allow the TransformFeedback and other classes to share the same buffer. Also should save a bit of memory. Bug: chromium:1086532 Change-Id: I198170b4e09165a4770b68af6df9aa7b690e8d66 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2219138 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Tobin Ehlis 67d8b63a 2019-12-23T11:35:52 Vulkan:Update Vulkan Vertex Attribute Offsets This fixes most of the test for dEQP 3.1 KHR-GLES31.core.vertex_attrib_binding.basic-input* The bug fixes is that we were not correctly setting the vertex attribute offset for vertex attribs that were converted into their own buffer. We kept the attrib offset from the frontend as if the converted attribs were in the original buffer, but converted vtx attrib buffers in the VK backend are tightly packed from the start of the buffer so when converting the actual offset should be 0. Also, in order to avoid a VK validation error, this change includes a tmp workaround to make sure transform feedback output buffer range is never 0, but sets VK_WHOLE_SIZE in that case. A follow-on fix that focuses on transform feedback fixes will address this validation error more fully. Bug: angleproject:4145 Bug: angleproject:4236 Change-Id: I8c218954725945414a8f18beb4f964b90da7062a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1980906 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya c373dfd8 2019-11-22T08:48:22 Vulkan : Handle dirty state correctly when there are muiltiple VAOs If vertex array object binding is changed, we need to update the pipeline cache with the attribute information of the newly bound VAO. We cache the strides of attributes because emulated attributes will have strides that don't match the stride info cached in its binding struct. Also added a test case that switches between multiple VAOs. Bug: angleproject:4127 Test: angle_end2end_tests.exe --gtest_filter=SimpleStateChangeTestES31.MultipleVertexArrayObjectRendering Change-Id: I4f23aec33d5aa5988baa41f3c63db5534daf75ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1917453 Reviewed-by: Tobin Ehlis <tobine@google.com> Commit-Queue: Tobin Ehlis <tobine@google.com>
Courtney Goeltzenleuchter 7f418fc2 2019-10-01T07:56:53 Vulkan: lineloop support for DrawArrayIndirect Add support for lineloops. Includes a compute shader for generating an index buffer to draw lineloop. Instancing turns out to be a special case for indirect draws if we have vertex attributes that need to be emulated (e.g. divisor too large or native vertex format not available). Test: dEQP.GLES31/functional_draw_indirect_* angle_end2end_tests --gtest_filter=LineLoopIndirectTest.*/* dEQP.GLES3/functional_draw_* Bug: angleproject:3564 Change-Id: I1fdabe2c8a690c8b6df9e252e1e839e08796bcca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1834682 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Courtney Goeltzenleuchter f03259ad 2019-09-19T11:31:40 Vulkan: lineloop support for DrawElementsIndirect Add support for lineloops. Includes a compute shader for converting lineloop index buffer with optional restart into linestrip. Test: dEQP.GLES31/functional_draw_indirect_* angle_end2end_tests --gtest_filter=LineLoopIndirectTest.*/* Bug: angleproject:3564 Change-Id: I12d08db1c8d99867f0611e53be50193647695260 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1797106 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tobin Ehlis <tobine@google.com>
Jamie Madill f10bf6bf 2019-09-26T10:27:18 Vulkan: Implement multi-threaded GL. The main component of this change is to make vk::BufferHelper, vk::ImageHelper and vk::SyncHelper use a common path. We introduce a new "vk::SharedGarbage" helper class that stores small lists of garbage from individual objects like an ImageHelper or BufferHelper. The SharedGarbage is stored in the RendererVk with the ResourceUse of the helper object. The ResourceUse tells RendererVk when it is safe to destroy the GarbageObjects. New "onGraphAccess" commands are added in a few places to enable the common garbage collection path. A couple Context-only resources like default attributes now are referenced where they were not before. Also reorganizes some functions so we can add a few helpful ASSERTs to our graph dependencies. Added "updateCurrentAccessNodes" for this. Also adds a "RendererScoped" helper to replace many uses of "ContextScoped". The multithreading EGL tests mostly pass but have some remaining flakiness so cannot yet be enabled. Bug: angleproject:2464 Change-Id: Ia3e3ae8848d731abf3f21ebe04c33e381e130be0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1808444 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tobin Ehlis 71c1138d 2019-08-16T12:23:04 Vulkan: Emulate instanced attrib divisor This sets instancedArrays[ANGLE|EXT] extenstions as always supported regardless of underlying Vulkan HW's max vertex attrib divisor. Then detect instances where app sets a divisor that isn't supported by hardware and emulate those cases. Emulations is accomplished by copying the instanced attribs to a new buffer where each attrib is present once per instance, using the attrib divisor value as a factor to replicate the attribs, and then setting the actual divisor value for the draw to "1". Also, we only store 8 bits for the divisor used in the PSO, so this code also handles emulation of the case where divisor is > 255. This is passing all of the drawInstanced/Elements dEQP tests where divisor has to be emulated. Also enabled end2end InstancingTestES3 for Vulkan backend. Bug: angleproject:2672 Change-Id: I9932f9eab49b16a19e8bbd35dacaf3b5a27a213f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1758689 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Tobin Ehlis <tobine@google.com>
Courtney Goeltzenleuchter 3c2a5230 2019-09-23T11:07:18 Vulkan: 8bit index support for DrawElementsIndirect Add partial support for DrawElementsIndirect. This supports all primitives types except lineloop. Includes a compute shader for converting 8bit index buffers to 16bit index buffers where the index buffer range is defined in a GPU buffer. Test: dEQP.GLES31/functional_draw_indirect_* Bug: angleproject:3564 Change-Id: Ibe9c55323e46a398f0b703cd8597a72ba6790570 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1792948 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jiacheng Lu 0136ac37 2019-07-17T17:29:52 Separate dirty bit for attrib's binding VBO change Make a separate dirty bit DIRTY_ATTRIB_POINTER_BUFFER for vertex attrib's binding buffer change. So in handling glVertexAttribPointer, ANGLE will only modify a vulkan graphics pipeline when attrib.format, attrib.stride or attrib.divisor change. If only the VBO pointer changes, then Vulkan can update the state via "vkCmdBindVertexBuffers()" without triggering a pipeline update. Bug: angleproject:3256 Change-Id: I01e02adde3708963b496a20050a5723e8eb57ab2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1707614 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jiacheng Lu <lujc@google.com>
James Darpinian 7e48c9eb 2019-08-06T17:17:19 Add explicit integer casts WebKit uses the -Wshorten-64-to-32 flag which warns on these cases. Bug: 3439 Change-Id: I8c1de60da0f173ca2036e2120e79b857f5f2775f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1740866 Commit-Queue: James Darpinian <jdarpinian@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
James Dong bf3d9333 2019-07-29T10:00:44 Vulkan: support relative offset in attrib bindings Handles the ES 3.1 relative offset parameter in vertex attributes by adding it to the binding offset. Test: ./angle_deqp_gles31_no_gtest --deqp-egl-display-type=angle-vulkan -n dEQP-GLES31.functional.vertex_attribute_binding.usage.single_binding.unaligned_offset_elements_1_aligned_elements Bug: angleproject:3598 Change-Id: Idbbd5ba4868a4dfc8f99188a84a5cd1374e09065 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1724453 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: James Dong <dongja@google.com>
Jamie Madill 375ddfc5 2019-07-12T11:12:14 Signal different dirty bit for vertex buffer change. We use new logic to compare if the attribute format changes before setting dirty bits. This improves performance of VBO-only state changes significantly. On the VBO change Vulkan microbenchmark gives about a 30% improvement. Bug: angleproject:3256 Change-Id: Ifaf1c92ed7a09422156ef79b5983e7349de63346 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1684294 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 875509e9 2019-06-17T13:44:21 Vulkan: Minor cleanup to ContextVk::setupIndexedDraw. This removes VertexArrayVk::updateIndexTranslation. Turns out this helper function wasn't that helpful. Bug: angleproject:3539 Change-Id: Ia4573219073261767e9d215ed4227233c23cbfaa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1660639 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
James Dong 08b56293 2019-06-10T12:55:36 Vulkan: add LINE_LOOP with primitive restart Adds support for GL_LINE_LOOP with primitive restart. Bug: angleproject:3215 Change-Id: Ief1bdf15ef9b108dba025eaf4ce580bba54af623 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1649351 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 44063c80 2019-06-04T15:20:30 Vulkan: Store array buffer conversions in BufferVk. The intent of this CL is to call convertVertexBuffer*PU only when we have new data to convert. If the app unbinds and rebinds a vertex buffer without changing the data we can now retrieve the cached vertex buffer info from the BufferVk class. Previously we would always reconvert the data on a rebind. This was slowing down applications and benchmarks. To achieve this we add a conversion cache to BufferVk. Each cache entry stores a key based on the vertex info. Also we store a ring buffer for each cache entry and a flag to indicate if the entry is dirty. The cache is dirtied on a bufffer data update or a map call. Improves performance in the T-Rex benchmark. Bug: angleproject:3495 Change-Id: Ia999c9187510748ba95bc98362eb332e1990d270 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1638903 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Jamie Madill 98f21671 2019-05-31T15:34:39 Vulkan: Refactor index buffer convert functions. This is a prepratory refactor for converting index buffers on the GPU using a more generic compute shader. No functional change. Bug: angleproject:3490 Change-Id: Iadf4b1429314db6850320aee33c4113f38577378 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1639057 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang ee244c77 2019-05-06T10:30:18 Vulkan: Move command graph and garbage to ContextVk. To support multithreading, contexts should manage their own command graphs and garbage. This allows safe access to vulkan resources such as command pools without thread synchronization. BUG=angleproject:2464 Change-Id: I930149bc9f0793028761ee05ab50b8c0a4dec98a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1516515 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Frank Henigman 52047de4 2018-11-13T17:22:36 Vulkan: support instanced draws. (reland) Enable instanced draws with the Vulkan backend. So far it only works when Vulkan has VK_EXT_vertex_attribute_divisor. BUG=angleproject:2672 Change-Id: Ib6655625776344305911a1a742c85f17638cee8f Reviewed-on: https://chromium-review.googlesource.com/c/1469263 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
Shahbaz Youssefi 341304d8 2019-02-12T20:58:54 Revert "Vulkan: support instanced draws." This reverts commit 199a9f385f5489b957fe1e42bf08f3f40edd38ca. Reason for revert: Causes a validation error when the extension is not present. See failures here: https://ci.chromium.org/p/chromium/builders/luci.chromium.try/win-angle-rel/693 Original change's description: > Vulkan: support instanced draws. > > Enable instanced draws with the Vulkan backend. > So far it only works when Vulkan has VK_EXT_vertex_attribute_divisor. > > BUG=angleproject:2672 > > Change-Id: I9445ba64282fa00a6eaee207b15efa2c7a9abbd3 > Reviewed-on: https://chromium-review.googlesource.com/c/1334973 > Commit-Queue: Frank Henigman <fjhenigman@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=fjhenigman@chromium.org,jmadill@chromium.org,syoussefi@chromium.org Change-Id: Iffccc2cca259bcd19c068a87a415d4e196901f45 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:2672 Reviewed-on: https://chromium-review.googlesource.com/c/1468201 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Frank Henigman 199a9f38 2018-11-13T17:22:36 Vulkan: support instanced draws. Enable instanced draws with the Vulkan backend. So far it only works when Vulkan has VK_EXT_vertex_attribute_divisor. BUG=angleproject:2672 Change-Id: I9445ba64282fa00a6eaee207b15efa2c7a9abbd3 Reviewed-on: https://chromium-review.googlesource.com/c/1334973 Commit-Queue: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi c81e7bfe 2019-01-18T15:35:55 Vulkan: refactor CommandGraphResource Merged back RecordableGraphResource into CommandGraphResource. Queries didn't really need to be a resource, as they always inserted separate single-command nodes in the graph. The CommandGraph class is augmented with a few functions that generate such nodes. This is in preparation for debug markers, as they too require such nodes. Bug: angleproject:2853 Change-Id: I5251a0e0fdd42ed1126921b4acc13687a14af9cd Reviewed-on: https://chromium-review.googlesource.com/c/1422549 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill a63cc59f 2019-01-16T13:27:16 Vulkan: Don't store vertex attrib format and stride. We only use these values in vertex conversion. We can instead pass more info to the convertGPU/CPU functions. In client attribute streaming we can query the format table a second time. This is a bit slower. But the runtime of attribute streaming would usually be dominated by the conversion function time. So it shouldn't regress any real work perf. This saves on a bit of storage and memory overhead in the vertex sync functions in VertexArrayVk. Bug: angleproject:3014 Change-Id: I401eeff024664aa0efeea710503c0f619e6d4f22 Reviewed-on: https://chromium-review.googlesource.com/c/1406889 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@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 80766cfa 2019-01-10T10:20:34 Vulkan: Update individual VAO attribs when dirty. This simplifies the dirty state updates in VertexArrayVk. It also lets us use a smaller dirty bit mask when a single attribute is marked dirty in a vertex array. Improves performance by about 1-2% in the VBO state change test. Will allow for better performance using a pipeline transition table. Bug: angleproject:3013 Change-Id: I25c5172b3f41b7abac6b8273c8f9cd42eb46cc9f Reviewed-on: https://chromium-review.googlesource.com/c/1403958 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill dbc605ce 2019-01-04T16:39:14 Vulkan: Optimize VBO state changes. Also has some minor optimizations for the front-end. 12% improvement on the Vulkan VBO change test. Bug: angleproject:3014 Change-Id: I38e1a8194edfc14bfe57424be348cb9688e928f4 Reviewed-on: https://chromium-review.googlesource.com/c/1369286 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 611bbaab 2018-12-06T01:59:53 Vulkan: Convert vertex attributes in compute In this commit, VertexArrayVk::convertVertexBuffer() is renamed to VertexArrayVk::convertVertexBufferCpu() to explicitly show it does a CPU readback. A new VertexArrayVk::convertVertexBuffer() function is added that has the same functionality in gpu (with some assumptions, where the CPU fallback is used should those assumptions fail). Currently, the only requirement is that buffer offset/stride are divided by the component size. ConvertVertex.comp is the shader responsible for this conversion, and it implements the functionality in renderer/copyvertex.inc, minus a few functions that are not used in the Vulkan backend. Bug: angleproject:2958, angleproject:3009 Change-Id: I8ec9a5f4672509bcf7b9e352cd27663970ad4653 Reviewed-on: https://chromium-review.googlesource.com/c/1364451 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Shahbaz Youssefi 4abdf74f 2018-11-28T14:41:10 Vulkan: Add dynamic index buffers to graph With DynamicBuffer outputting BufferHelper objects, these objects can participate in the command graph, i.e. record commands. This means they need appropriate dependencies in the graph as well as pipeline barriers. There are a few users of DynamicBuffer for which this change should be applied to. This change covers index buffers. This commit includes a fix to BufferHelper::copyFromBuffer for WaW hazards. It also includes a fix for a missing pipeline barrier after BufferVk::copyToBuffer. Bug: angleproject:2958 Change-Id: I3e61af56936580b2da20c28c45defece552d9a39 Reviewed-on: https://chromium-review.googlesource.com/c/1352732 Reviewed-by: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@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>
Shahbaz Youssefi c30f45d3 2018-11-12T16:37:59 Vulkan: Rename PipelineDesc/Cache to Graphics& PipelineDesc describes a Vertex-Fragment pipeline and PipelineCache (not to be confused with vk::PipelineCache) implements a cache of such pipeline objects. In preparation for Compute support, these data structures are prefixed with Graphics. Bug: angleproject:2959 Change-Id: I9181586fb946b787216ca0b2ad6340f90c3ab55f Reviewed-on: https://chromium-review.googlesource.com/c/1333971 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 03d1a5ed 2018-11-12T11:34:24 Vulkan: Use global buffer barriers. This switches from using resource barriers for buffers to using global barriers. This matches the general advised best practice. It also allows us to combine multiple barriers into one. On a draw we might combine all the vertex and index barriers into a single barrier call. We implement this using a bit of extra state tracking in BufferHelper. Bug: angleproject:2828 Change-Id: I196b368804ff50e60d085687a643e5566ba1c5b6 Reviewed-on: https://chromium-review.googlesource.com/c/1309977 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 193a284d 2018-10-30T17:28:41 Vulkan: Split vk::CommandGraphResource. This adds two subclasses: RecordableGraphResource and QueryGraphResource. Each specializes for Buffer/Image/Frambuffer use cases and Query use cases respectively. No virtual functions are added to keep best performance. We also change the CommandGraph API slightly to optimize away the check for a barrier resource. This requires exposing the set current barrier API on the CommandGraph. Bug: angleproject:2828 Change-Id: I1c23f52bfe04cc682a00b245d63c3ac9a651615d Reviewed-on: https://chromium-review.googlesource.com/c/1305994 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill bfe31c42 2018-10-25T17:03:47 Remove uses of DrawCallParams. Packing and referencing this structure was causing unnecessary draw call overhead. This improves performance on all the back-ends. Impacts the GL back-end the most. In total this patch series reduces overhead by up to 5%. Bug: angleproject:2933 Change-Id: Ief416ab874e481baf960d02965978a311214a146 Reviewed-on: https://chromium-review.googlesource.com/c/1299477 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 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 88fc6da3 2018-08-30T16:18:36 Vulkan: Mega-refactor to VertexArrayVk. This moves a lot of the code in VertexArrayVk into ContextVk. Having the code in a centralized place makes the code a bit more organized since the Context is reponsible for binding state to the command buffers. It also makes it easier to use dirty bits to track the command buffer state. Bug: angleproject:2786 Change-Id: I5cefbb14028e8f3fe651f26e997ca88f8f1c7628 Reviewed-on: https://chromium-review.googlesource.com/1188953 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 253038d8 2018-08-30T16:18:35 Vulkan: Refactor VertexArrayVk::streamIndexData. This enables us to use the same code for streaming client side index arrays and for translating buffers. Also includes a few more code cleanups. Bug: angleproject:2786 Change-Id: Ic615d87cb50fd0acd8ab6b63ed334da4b1c40eff Reviewed-on: https://chromium-review.googlesource.com/1188952 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill a064c27c 2018-08-30T16:18:34 Vulkan: Refactor VertexArrayVk::streamVertexData. Merges duplicated code in convertVertexBuffer with streamVertexData. Refactoring change only. Bug: angleproject:2786 Change-Id: I32baaad42d74918cfb17f04970d3c7e9b88362e7 Reviewed-on: https://chromium-review.googlesource.com/1188950 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Frank Henigman e452382a 2018-07-19T16:10:53 Vulkan: convert/align vertex data from buffers When we get a buffer with vertex data in an unsupported format or alignment, correct that as we copy it to a DynamicBuffer, then use the copy. Enable tests. BUG=angleproject:2405 Change-Id: I2132abea4d936f6b53d9209be7f99a0e2d8de219 Reviewed-on: https://chromium-review.googlesource.com/1141277 Commit-Queue: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 5a4c932a 2018-07-16T11:01:58 Vulkan: Implement "default" vertex attributes. Rendering from disabled attributes is implemented using small dynamic buffers. The buffers use a stride of zero so the same vertex data is pulled for every index. This fixes all the disable attribute tests in dEQP. Bug: angleproject:2444 Change-Id: I04fe139076da3e3ff723bed8eb17e333b4cb0ddf Reviewed-on: https://chromium-review.googlesource.com/1136664 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Frank Henigman 419acc8f 2018-06-24T19:57:31 Vulkan: Convert streamed vertex data as needed. Add two members to vk::Format: - vertex data copy function - flag indicating if the function converts or not Use the function when streaming vertex data so it gets converted if needed. Add fallbacks for integer formats. These formats will now work everywhere, as long as they are in client memory, not a buffer object. Adjust test expectations accordingly. BUG=angleproject:2405 Change-Id: I677221219d933c35740633a0ab7694293e218177 Reviewed-on: https://chromium-review.googlesource.com/1084328 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 21061026 2018-07-12T23:56:30 Vulkan: Use angle::Result error handling. Introduces a vk::Context class to contain an error handler and Renderer pointer. This abtracts the common code path for ContextVk + DisplayVk. Removes vk::Error in favor of the POD angle::Result class. There are a few remaining usages of gl::Error that will have to be cleaned up when we can change the front-end APIs. Bug: angleproject:2713 Change-Id: I5e68f223d595c6c561b59d6a85759e5738ed43c6 Reviewed-on: https://chromium-review.googlesource.com/1128924 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Frank Henigman 2ad498eb 2018-06-20T13:19:01 Vulkan: get vertex formats from format table. Use the Vulkan format table to look up the Vulkan format for vertex data. This will let us support more vertex formats by adding them to the table. It also eliminates one usage of gl::VertexFormatType. No functional change. BUG=angleproject:2405 BUG=angleproject:2531 Change-Id: I73eb69ccac50d427de3e7d5479f92bb17c49aed3 Reviewed-on: https://chromium-review.googlesource.com/1051028 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org> Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
Luc Ferron 6ed167a9 2018-06-13T13:45:55 Vulkan: Implement conversion to uint16 for drawElements with ubytes Bug: angleproject:2646 Bug: angleproject:2659 Change-Id: If3c7a2b77d6acd18c8ca2522a427a43e10ed6db2 Reviewed-on: https://chromium-review.googlesource.com/1099420 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Luc Ferron 49aacad5 2018-06-12T08:33:59 Vulkan: Support the indices offset in drawElements calls Also fixes an issue in buffer copy synchronization. Bug: angleproject:2645 Change-Id: Ibca7052daaf1e6fe37913c8a8216ec33c66426b6 Reviewed-on: https://chromium-review.googlesource.com/1096911 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
Jamie Madill 316c6065 2018-05-29T10:49:45 Vulkan: Call GraphResource instead of GraphNode. We don't need to use the CommandGraphNode class directly. This CL consolidates our code so we never call the GraphNodes class directly. Instead we call operations on GraphResource. This should simplify the interaction with APIs from the various graph and dependency management classes in the Vulkan back-end. A new concept of 'starting' vs 'appending' commands is introduced. Appending tries to avoid starting new command buffers when possible. Should not change how the graphs are constructed, and mostly be a refactoring change. There may be minor behaviour changes to some commands. Bug: angleproject:2539 Change-Id: Ia971e5cacb1164b9b3b22fa4a0a55b954d81f10e Reviewed-on: https://chromium-review.googlesource.com/1052068 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Luc Ferron a9ab0f37 2018-05-17T17:03:55 Vulkan: Fix DynamicBuffer usages, need to use specific alignment The alignment used to allocate VkBuffers in the VkBuffer needs to be at least the size of the nonCoherentAtomSize defined in the limits of the VkDevicePhysicalProperties. The latest roll of the vulkan-validation-layers added that check and caused a bunch of errors. This is fixing them. Bug: angleproject:2565 Change-Id: Ia2ad506dce7966adb6220c52ea891903922c47d0 Reviewed-on: https://chromium-review.googlesource.com/1064950 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 18e323ab 2018-05-11T16:54:17 D3D11: Fix out-of-range access with robust access. When using a vertex buffer with DYNAMIC usage, with robust buffer access enabled, we would sometimes read out-of-bounds when using very large values for the index range. An unchecked signed addition would overflow and lead to reading a negative offset. Fix this problem by keeping the value size_t whenever possible. Also do clamped casts when converting to a smaller values. Also adds a regression test. Bug: chromium:842028 Change-Id: Ie630ac857c6acfc0bace849a03eebfbaa2fbe89a Reviewed-on: https://chromium-review.googlesource.com/1055928 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@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 a56467e0 2018-04-11T16:19:41 VertexArray: Use switch macro for faster iteration. Has a small but noticeable impact on performance on a microbenchmark. Seems to improve a synthetic score by about 1%. Should have a very small improvement in real-world performance. Note that the odd formatting is an idiosyncrasy of clang-format. Bug: angleproject:2389 Change-Id: I888bf101c6d8b80a0fbafdb9c5a84205c9c8fee6 Reviewed-on: https://chromium-review.googlesource.com/962963 Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 22f12fed 2018-04-08T14:23:40 Vulkan: Rename vk::LineLoopHelper. This more closely follows the general pattern laid out by the naming in vk_helpers.h. It also changes the dynamic buffer that the helper wraps to be stored by-value since the header include order problem is fixed. Bug: angleproject:2318 Change-Id: I1de9e1edee2125d3afd490b4f9c99cf70c61215c Reviewed-on: https://chromium-review.googlesource.com/1001654 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 9cceac42 2018-03-31T14:19:16 Vulkan: Update resource dependency semantics. This removes passing the Serial around to several methods, so that dependency management is a bit more automatic. This makes life a bit easier when dealing with state updates when resources are in use by Vulkan. The FramebuffeVk no longer stores an extra serial of the last draw, instead it will trigger creation of a new writing node on a state change update. Bug: angleproject:2318 Change-Id: Ie58ec66e6e8644ba4d402c509255c3795d363dd3 Reviewed-on: https://chromium-review.googlesource.com/985201 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 6c7ab7fe 2018-03-31T14:19:15 Vulkan: Reorganize helper classes. This renames ResourceVk to vk::CommandGraphResource, which should help clarify its usage. This also moves LineLoopHandler, ImageHelper, and the DynamicBuffer and DynamicCommandPool classes into a new vk_helpers module. This file contains helper classes that manage other resources. Also this makes DynamicBuffer and DynamicDescriptorPool no longer inherit from CommandGraphResource. In the future, only Impl objects will be allowed to be graph resources. Bug: angleproject:2318 Change-Id: I0fa23da2ac853d90f3c822547a4a314f247cc757 Reviewed-on: https://chromium-review.googlesource.com/985200 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill b8e39660 2018-04-04T11:41:42 Vulkan: Remove Observer from LineLoopHandler. This can now use the VertexArrayVk dirty bits. It also seems as though there are a couple caching bugs with the LineLoopHandler. Bug: angleproject:2389 Change-Id: I8af73f4acf56768ed9c68395349ba96acfbe9666 Reviewed-on: https://chromium-review.googlesource.com/989259 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Luc Ferron <lucferron@google.com>
Jamie Madill c3755fc5 2018-04-05T08:39:13 Vulkan: Move Streaming data to VertexArrayVk. Instead of the ContextVk owning the translations for the various attributes, make the VertexArrayVk own them. This way they can handle the dirty bit state notifications directly instead of needing their own Observers. Bug: angleproject:2389 Change-Id: I5e571ba6c563e820a4c0d5f92db35031e6f2428a Reviewed-on: https://chromium-review.googlesource.com/989258 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill f3614370 2018-03-31T14:19:14 Vulkan: Rename StreamingBuffer to DynamicBuffer. This makes it consistent with DynamicDescriptorPool, and gives a bit more precise definition. Bug: angleproject:2318 Change-Id: I8953113165ebe2d0dcfc0fc923d94280180442ce Reviewed-on: https://chromium-review.googlesource.com/985199 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
Jamie Madill 32fd63bc 2018-03-31T11:20:35 Vulkan: Use DrawCallParams in draw methods. This cleans up some of the vertex streaming logic. Bug: angleproject:2389 Change-Id: I8ed2f8acd06bbdd97db40acac35e5692112a3efe Reviewed-on: https://chromium-review.googlesource.com/989257 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@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>
Frank Henigman a53d0e18 2018-02-13T00:06:06 Vulkan: support indices in client memory. glDrawElements will now work with indices and/or vertex data in client memory, as well as in a buffer object. Enable corresponding tests. BUG=angleproject:1683 Change-Id: Iefb9796a48b21ed6f9a837b08b0ad3218ff6dd6b Reviewed-on: https://chromium-review.googlesource.com/915721 Commit-Queue: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Frank Henigman 6dd4a92a 2018-03-02T16:35:13 Vulkan: track attributes in client memory. To support indexed draws it's useful to have a cheap query for the presence of vertex attribute data in client memory. This patch adds a bit mask to keep track of such attributes. It also lets us simplify VertexArrayVk::streamVertexData() slightly. BUG=angleproject:1683 Change-Id: I871bfb885112650b025e110c383db3c391eafb90 Reviewed-on: https://chromium-review.googlesource.com/947927 Commit-Queue: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Luc Ferron 78e39b3f 2018-02-26T07:42:44 Vulkan: Line loops for indexed draw calls Bug: angleproject:2335 Change-Id: Iabd6ae8181c6d3fb487f953a6fbf699db568a1c9 Reviewed-on: https://chromium-review.googlesource.com/941261 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 1f46bc12 2018-02-20T16:09:43 Vulkan: Add CommandGraph class. This also renames CommandBufferNode to CommandGraphNode. It also renames some of the intenal members to more closely represent the tree relationships (parents/children). This should clean up the command graph classes and make them a bit easier to understand. Bug: angleproject:2361 Change-Id: I024bffcc7f4157c78072ef902a3c40a07a08b18a Reviewed-on: https://chromium-review.googlesource.com/922121 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Frank Henigman 17448956 2017-01-05T15:48:26 Vulkan: vertex attributes in client memory. Support vertex data stored in client memory passed to glVertexAttribPointer. Only GL_FLOAT data is supported at this time. Includes a simple test. BUG=angleproject:1683 Change-Id: I3bc0cdefe02b02c046b0e85822019a0f1762235e Reviewed-on: https://chromium-review.googlesource.com/425137 Commit-Queue: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 112a3a8e 2018-01-23T13:04:06 Vulkan: De-couple Program from VertexArrayVk dirtyiness. The VertexArrayVk is responsible for filling out the packed shader input info in ANGLE's packed PipelineDesc info structure. This packed info structure is used for Pipeline init and caching lookup. The prior design had this info depend on the active inputs in the current Program. This was undesirable because then, on a Program change, the ContextVk would have to call into the VertexArrayVk to invalidate this info. Instead, keep a working copy of the VertexArrayVk bits and only update the bits corresponding to dirty vertex attributes. This simplifies the cached state management a little bit for ContextVk. This also means we don't have to update the cached copy in the VertexArray on a change in VertexArray binding. Bug: angleproject:2163 Change-Id: I5ba74535367aed74957d17bdc61f882508562d0e Reviewed-on: https://chromium-review.googlesource.com/881703 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 3c424b48 2018-01-19T12:35:09 Vulkan: Add vk_cache_utils.h. This file contains the Pipeline and RenderPass cache utils. Also renames renderervk_utils.h to vk_utils.h and the format utils file. Refactoring change only. Bug: angleproject:2163 Change-Id: I5113a9a2c6f0b0960d38e6c2d8e391fa2d9f5f6a Reviewed-on: https://chromium-review.googlesource.com/876505 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill f2f6d379 2018-01-10T21:37:23 Vulkan: Add PipelineDesc. The PipelineDesc class is a 512-byte packed description of the entire Vulkan pipeline state. It uses the alignas keyword and some static asserts to verify that the structures are packed. This ensures that when ANGLE uses MurmurHash to hash the entire struct, and memcmp to check for identity, that there are no garbage padding bits. This CL does not implement the Pipeline cache, but it will help, since now we have a packed type that can be used as the key to a hash map. Bug: angleproject:2163 Change-Id: I16efa927f08d30d89a9c4c8943edd211c6878ac8 Reviewed-on: https://chromium-review.googlesource.com/829893 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 49ac74bd 2017-12-21T14:42:33 Vulkan: Implement command re-ordering. This introduces a new CommandBufferNode class. Nodes are linked together to form a graph based on their dependencies. When the app triggers a readback or swap, the graph is flushed entirely. This sends the queued ANGLE Vulkan work to the Vulkan queue which is then processed on the GPU with the right dependencies. This design allows us to save on some unnecessary RenderPass creation and also allows us to know what load/store ops to use. It also allows us to take advantage of the Vulkan automatic RenderPass transitions for performance. Load/Store ops and automatic transitions will be implemented in later patches. Bug: angleproject:2264 Change-Id: I0e729c719e38254202c6fedcede4e63125eb4810 Reviewed-on: https://chromium-review.googlesource.com/780849 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill da854a27 2017-11-30T17:24:21 Vulkan: Clean up VAO cached resources. We can actually store a pointer to the base ResourceVk instead of BufferVk for updating serials. This will work a little nicer with streaming vertex data, which won't have a BufferVk but will have an accessible ResourceVk pointer. Also add an element array resource pointer for serial update. This was missing and could lead to incorrect behaviour. Also change the types of the caches from std::vector to gl::AttribArray, which is a std::array. Bug: angleproject:2264 Change-Id: Ibd79b7676b5dbc3875ae9d110be477d228e01c5c Reviewed-on: https://chromium-review.googlesource.com/798170 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill acf2f3ad 2017-11-21T19:22:44 Apply Chromium style fixes. This addresses several minor code quality issues that are validated in Chromium, but not yet applied to ANGLE: * constructors and destructors must be defined out-of-line * auto is not allowed for simple pointer types * use override everywhere instead of virtual * virtual functions must also be defined out-of-line Slightly reduces binary size for me (~2k on Win, 150k on Linux). Bug: angleproject:1569 Change-Id: I073ca3365188caf5f29fb28d9eb207903c1843e6 Reviewed-on: https://chromium-review.googlesource.com/779959 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill ebf7299e 2017-10-13T14:09:45 Vulkan: Minimal dirty bits for ContextVk. Currently this won't speed up performance much, if at all, since we don't even really support state changes. It sets the stage for using a pipeline cache later, with better state change support. It also makes implementing descriptor sets for Textures a bit simpler, since we can just update descriptor sets when the dirty bits tell us of a Texture change. Add cache structures to VertexArrayVk and ContextVk so we only need to update the structures before we create a new pipeline. When we support pipeline caching, we will most likely be updating a compact representation for fast cache query. BUG=angleproject:1898 BUG=angleproject:2167 Change-Id: Id545f2c67c06d8b6e8b7eb63ca70464f6b9a51f6 Reviewed-on: https://chromium-review.googlesource.com/713586 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill bd159f06 2017-10-09T19:39:06 Vulkan: Use minimal dirty bits in VertexArrayVk. This should slightly reduce draw call overhead. BUG=angleproject:1898 Change-Id: I0e515bf2868f237f1d6948c12942f8cb6637c0c0 Reviewed-on: https://chromium-review.googlesource.com/707690 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 492f58ec 2017-10-09T19:41:33 Rename VertexArrayImpl::mData to mState. Refactoring change only. BUG=angleproject:1898 Change-Id: I9f55651f923ff930c395a9bb575b4f86ad5d9cbd Reviewed-on: https://chromium-review.googlesource.com/707689 Reviewed-by: Yuly Novikov <ynovikov@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 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 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>
Jamie Madill 9e54b5af 2016-05-25T12:57:39 Add Vulkan stubs. Currently enabled for Windows by default. BUG=angleproject:1319 Change-Id: I87921c579bee466465fb1e3f629bb3a40fdff659 Reviewed-on: https://chromium-review.googlesource.com/328730 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>