src/libANGLE/renderer/vulkan/VertexArrayVk.cpp


Log

Author Commit Date CI Message
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 ccd984ff 2021-04-08T12:06:57 Reland "Add a Vulkan feature to compress float32 vertex formats." This reverts commit 8ace36f8c15877264fb58af7b54baad635899dca. Original change's description: > Revert "Add a Vulkan feature to compress float32 vertex formats." > > Bug: b/167404532 > Bug: b/161716126 > Change-Id: I95157a006d5c1fd2d3c0c2c2be37fa0403c07f93 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2510011 > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Geoff Lang <geofflang@chromium.org> Bug: b/167404532 Bug: b/161716126 Change-Id: Ic6811fe3a7124e6eb1efe7c72a1a03a120217753 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2815260 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 3813c361 2021-04-12T11:45:46 Vulkan: More perf warning for vertex format conversion The perf warning was previously only issued when a GPU buffer had to be converted. This change adds a warning when client data needs to change format too. Bug: b/184355822 Change-Id: I3539e22f277593d60e5e1ce172baf7b8db0477fa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2821751 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Ian Elliott fedb85b7 2021-04-07T16:25:54 Vulkan: Warn for unsupported vertex attrib format Provide both a performance warning and a debug-util label (for AGI) when loading a vertex attribute requires a format conversion. Bug: b/184355822 Change-Id: Id8cbb34f70214327e1f5cc96559e4ea66dc17889 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2801154 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi e366e2c3 2021-02-27T01:00:02 Vulkan: Keep dynamic buffer's free list trimmed ContextVk's staging buffer never gets a chance to free its free buffer list. During application load time, a large amount of memory may be allocated from this buffer to stage texture updates and they would remain throughout the life of the application. This change ensures that the free buffer list doesn't grow unbounded. In the Manhattan trace, this saves >1GB of memory on Linux. There are now three policies for vk::DynamicBuffer: - Always reuse buffers: This is useful for dynamic buffers that make frequent small allocations, such as default uniforms, driver uniforms, default vertex attributes and UBO updates. - Never reuse buffers: This is for situations where the buffer is unlikely to be used after some initial usage, such as texture data upload or vertex format emulation (as the conversion result is cached, so it's never redone). - Limited reuse of buffers: For the staging buffer in the context which is shared by all immutable texture data uploads, it's useful to keep a limited number of buffers (1 in this change) to support future texture streaming while allowing a large number of buffers allocated in a burst to be discarded. Bug: angleproject:5690 Change-Id: Ic39ce61e6beb3165dbce4b668e1d3984a2b35986 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2725499 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 7ae8531b 2021-02-17T15:20:07 Vulkan: Fix crash with 0-sized element buffer VertexArray::syncState syncs all dirty bits, including DIRTY_BIT_ELEMENT_ARRAY_BUFFER even for draw calls that don't use this buffer, such as glDrawArrays. If the element buffer is given 0 size, this caused a crash in the Vulkan backend. Bug: chromium:1172577 Change-Id: I02d78c9660c07b896f7403867b648901478251fe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2701831 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi bb062070 2021-02-09T15:30:04 Vulkan: Fix updates to element buffer If glBufferSubData results in a new vk::BufferHelper allocation, VertexArrayVk::mCurrentElementArrayBuffer needs to be updated. VertexArrayVk::syncState was working under the assumption that DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA cannot result in a vk::BufferHelper pointer change. This assumption was broken in https://chromium-review.googlesource.com/c/angle/angle/+/2204655. Bug: b/178231226 Change-Id: I969549c5ffec3456bdc08ac3e03a0fa0e7b4593f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2685439 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 8ace36f8 2020-10-30T09:51:16 Revert "Add a Vulkan feature to compress float32 vertex formats." Bug: b/167404532 Bug: b/161716126 Change-Id: I95157a006d5c1fd2d3c0c2c2be37fa0403c07f93 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2510011 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@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>
Charlie Lao 234be194 2020-07-15T14:55:18 Vulkan: Move mEmptyBuffer from program to ContextVk And merge that with TheNUllBuffer as well so that you only have one dummy buffer per context. Bug: b/161391337 Change-Id: I75fddb5c48393876e745ff237e11d9c5672ae10e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2300707 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
Mohan Maiya 745e0712 2020-03-21T17:46:05 Vulkan: Enable CPU only buffers for PBOs Add support for a CPU only buffer for PBOs that serve as the destination for all host operations like MapBuffer*. This removes the latency caused by waiting for the in-flight GPU commands to be complete before handing over the buffer to the app. This change removes a ~6ms wait/sleep on the first call to MapBuffer* in each frame of Manhattan Bug: angleproject:4339 Tests: angle_end2end_tests --gtest_filter=BufferDataTest*Vulkan Change-Id: I52016b160af8a670cc30f01c05e48f699521310f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2116874 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Tobin Ehlis <tobine@google.com>
Mohan Maiya 7daf31d8 2020-03-18T09:19:52 Vulkan: Use device local memory for conversion buffers that can be converted with the GPU When converting a vertex buffer by using GPU, the conversion buffer doesn't need to be host mappable. Hence the conversion buffer can be allocated on device local memory for faster GPU access times. Bug: angleproject:3534 Change-Id: I2efabec20186992479920bddd3abd36f9c13babc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2108706 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Xiaoxuan Liu f8b28678 2020-02-26T19:12:39 Vulkan: Add support for VK_EXT_index_type_uint8 Enable VK_EXT_index_type_uint8 Vulkan extension if supported by VkDevice. Bug: angleproject:4405 Change-Id: I84d030497898c5944a36d9a88a31e7377ccd5e9e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2082391 Commit-Queue: Xiaoxuan Liu <xiaoxuan.liu@arm.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill a741abb9 2020-02-21T16:37:37 Vulkan: Rename CommandGraphResource to Resource. Also renames the h and cpp files to ResourceVk (to keep distinct from other resource.h/cpp files) and renames 'onResourceAccess' to 'retain'. Cleans up a few remaining mentions of the command graph in comments. Bug: angleproject:4029 Change-Id: Ifc8e880c8cea3fc48a4aec4730191c88aa35a076 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2065920 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill c3854ebc 2020-02-07T11:11:26 Vulkan: Clamp vertex buffer offsets. Vulkan mandates that vertex buffer offsets are within the size of the buffer even if robust buffer access is enabled. Do a check in VertexArrayVk::syncDirtyAttrib to guard against this. Bug: angleproject:3350 Change-Id: Ia01deb9b7335dd8f632f2cf9b32d2908ba55645c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2044491 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@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>
Jamie Madill beacd8c8 2019-10-17T14:34:02 Vulkan: Rename format fields. Renames 'angleFormat' to 'intendedFormat'. Also renames 'bufferFormat' and 'imageFormat' to 'actualImageFormat' and 'actualBufferFormat'. This renaming should make it clearer to the reader what the meaning of the different format fields are. Intended format is the front-end format and the actual formats are the formats we pass to Vulkan. Also updates the documentation. Bug: angleproject:4009 Change-Id: If61bf7250e88f7ed3d452718574c963d718e27b2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1866077 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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>
Mohan Maiya 8400d05c 2019-08-07T14:52:54 Vulkan: Support the vertex_type_2_10_10_10_rev format - Modify the python script and json file to generate the code which adds the function for vertex_type_2_10_10_10_rev. These functions handle the loading and conversion for vertex_type_2_10_10_10_rev. - Modify ConvertVertex.comp and ConvertVertex.comp.json to perform a GPU based conversion for vertex format of type 2_10_10_10_rev - Modify BindingIsAligned function to check that both stride and binding offset is aligned to the format size when the component size is not aligned to 8 bits. - Modify deqp3 expectations file to enable type_2_10_10_10_rev format vertex array tests. Bug: angleproject:3193 Test: dEQP-GLES3.functional.vertex_arrays.single_attribute.*2_10_10_10* Change-Id: I2358d0d8888f7dfd7eac999dc150f643167de817 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1709035 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi ad77f55e 2019-08-01T14:41:17 Vulkan: Remove finish calls before BufferVk::mapImpl This function already calls a finishToSerial(), which waits only for the last submission in which the buffer was used to finish. There is no need to call finish() beforehands. Bug: angleproject:3213 Change-Id: I410adb80a630ff9a1cba8f7202cf002a7ea5f87b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1731551 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@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>
James Dong 7e50f4cd 2019-07-25T09:58:51 Vulkan: Fix ES 3.1 vertex attribute bindings When handling dirty bindings, we were treating binding indices as if they were attribute indices, causing strange behavior. This change fixes the dirty bit handler to use the provided index properly and update the attributes that correspond to the binding index. Test: ./angle_end2end_tests --gtest_filter='VertexAttributeTestES31.OnlyUpdate*/ES3_1_Vulkan' Bug: angleproject:3598 Change-Id: I2bc3cd4da5f639a1301776fcf057a74368812c56 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1718786 Commit-Queue: James Dong <dongja@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi f92fc916 2019-07-15T22:39:23 Vulkan: Compute shader support A DispatchHelper class is created as the equivalent of FramebufferHelper as a command graph resource. There's currently a single dispatcher and all dispatch calls are recorded on that. Context dirty bits are set up in such a way that graphics and compute workloads are independently handled, so that issuing a dispatch call wouldn't cause a framebuffer's render pass to rebind resources. Bug: angleproject:3562 Change-Id: Ib96db48297074d99b04324e44b067cfbfd43e333 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1688504 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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>
James Dong 9917988a 2019-07-10T13:47:32 Vulkan: change packed attrib to ANGLE format ID This prevents later issues with some VkFormat values being over 256, as well as providing more information to pipeline creation. A preliminary step towards handling mismatched vertex attributes. Bug: angleproject:3634 Change-Id: Idb15a14088a2d73b43b4b92d3cfdb12587c5f711 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1696212 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill ee21a187 2019-07-04T08:51:34 Store angle::Format in gl::VertexAttribute. Instead of storing type/size/normalized/pureInteger we instead store a pointer to the angle::Format. This makes some code logic simpler and will let us more easily check if a vertex attribute format changes in calls to VertexAttribPointer or VertexAttribFormat. This CL adds extra information to angle::Format to represent the vertex format info needed. It also caches the channel count so that it can be queried faster. Also renames "Int" -> "Sint" in UtilsVk for consistency. Bug: angleproject:3256 Change-Id: I5ef9b983dad8a58c341113c802500b89ce081566 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1684293 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Jamie Madill c773ab98 2019-06-25T17:11:58 Vulkan: Recycle dynamic buffer storage. This adds a free list to the dynamic buffer storage. Buffers are added to the free list when the retained buffers are released. They are taken from the free list when we allocate a new buffer. We only allocate a new buffer in the ring when we run out of free buffers. This reduces the amount of time we spend in allocation for frequent updates. Now that we're recycling buffers inside of DynamicBuffer we also need to be a bit more careful about when we allow ourselves to reuse them. If they're still in use by the GPU we should not try to modify them. Bug: angleproject:3082 Change-Id: Ibee5a7e2fe4a17f4a2f7af6bc6bcce54bdc413c2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1646548 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com>
Jamie Madill 7f2520f1 2019-06-26T11:18:33 Vulkan: Refactor DynamicBuffer::init. This will allow us to more easily create a white box test that sets a very small initial size for a dynamic buffer. Bug: angleproject:3082 Change-Id: Ic02bbee83ee8e0f4bfe182e9448c2ce60dea66d5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1667645 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com>
Courtney Goeltzenleuchter b867bc6f 2019-06-19T12:11:13 Vulkan: Fix dirty element array buffer updates. The issue occurs that binds the same buffer and calls glDrawElements with the same indices. The offset has been reset in the VertexArrayVk::syncState(), but it doesn't check the actual value in the ContextVk::setupIndexedDraw(). Also corrected case where update via BufferSubData wasn't being sent to the HW. Bug: angleproject:3362 Change-Id: I0f7d2fc162bc8f1c36cb09ba689fd27b482b9035 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1666345 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 3ea463bf 2019-06-19T14:21:33 Move event tracer back into common. Requires that we update the TRACE_EVENT macros to accept a platform as an argument. The refactor isn't complete. In order to finish we'd need to ensure we have the Display's PlatformMethods available at all sites. Unblocks adding trace events directly in the perf tests. Bug: angleproject:1892 Bug: angleproject:3117 Change-Id: Iee0ca086ccfe23acab3fc186fb042f018711a94c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1664794 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@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>
James Dong 2806a898 2019-06-07T12:10:46 Vulkan: implement primitive restart Implements ES 3.0 feature GL_PRIMITIVE_RESTART_FIXED_INDEX, which allows the application to use a fixed "restart" index to restart the primitive during a single draw call. This change does't handle GL_LINE_LOOP primitives, which requires a bit of special handling. Bug: angleproject:3215 Change-Id: I2388852683fd17328a6a76c48d70a24d67ce8b67 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1650301 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
James Dong a4a24af3 2019-06-06T10:50:21 Vulkan: fix uint indices causing incomplete buffer Fixes buffer size calculation when uploading element buffer to account for 4-byte (uint) indices. Bug: angleproject:2902 Change-Id: Id70fc0fdffecd0b27995820bd0ad88e4cb61e013 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1648325 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 5993d899 2019-06-03T13:05:38 Vulkan: Use storage buffers for index conversion shader. This allows us to use the shader regardless of driver support for texel buffer views. It also allows us to convert indices on the GPU unconditionally. We add a new internal compute shader that converts pairs of indices into a packed single uint value that stores two 16-bit values. In the future we could add support for converting primitive restart indices. Should speed up benchmarks on systems which didn't have R8_UINT support for compute shader buffers. Bug: angleproject:3490 Change-Id: I56ca0cabb094e97f36ab4edc779e6c8ad2d2601e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1639058 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@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>
Michael Spang ab6a59b2 2019-05-21T21:26:26 Vulkan: Submit semaphores from glWaitSemaphoreEXT & glSignalSemaphoreEXT Implement submission of client semaphores passed to glWaitSemaphoreEXT & glSignalSemaphoreEXT. This also relaxes the expectation that we will not flush() if there are no commands. Signaling semaphores in particular requires queue submission irrespective of whether there are any command buffers to submit. If there are neither commands nor semaphores, we can still skip queue submission. WebGL runs in Chrome with ANGLE & Vulkan interop as of this patch, albeit with incorrect synchronization due to texture barriers not being implemented yet. Quite a few flags are needed to try this: GN args: angle_vulkan_conformant_configs_only=true chrome \ --enable-features=UseSkiaRenderer,UiGpuRasterization \ --enable-gpu-rasterization \ --enable-oop-rasterization \ --enable-vulkan \ --use-gl=angle \ --use-angle=vulkan Bug: angleproject:3289 Change-Id: I3d49c230a2fbf0cd2a2b943b05ded0e4604cc313 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1623815 Commit-Queue: Michael Spang <spang@chromium.org> Reviewed-by: 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>
Jonah Ryan-Davis 776694cd 2019-05-08T10:28:55 Change all ANGLE workarounds to use struct definition with info. Change each workaround from a simple bool to a struct with info including name, workaround set, description, and bug IDs. This will help with future workaround integration with Chrome. Bug: angleproject:1621 Change-Id: Ia27c180abaf845e280060c803e5994cc3152a057 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1593917 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten e76c5c3c 2019-05-03T15:51:30 Vulkan: Enable drawRangeElements() Enable drawRangeElements() for the Vulkan backend and the associated tests. Test: angle_deqp_gles3_tests Bug: angleproject:3420 Change-Id: I98770631ce1387131bb45e2c1e9df24e911bc692 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1595101 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 892d1805 2019-03-27T14:21:34 Vulkan: Have the WindowSurfaceVk own the submit semaphores. Chaining of submit semaphores is only needed for window surfaces because they are required for the first usage of the swap chain image and final present of the image. Move ownership of the submit semaphores from RendererVk to WindowSurfaceVk and update all calls to finish and flush to be piped through a ContextVk which tracks the currently bound window surface. BUG=angleproject:2464 Change-Id: I4b3083124d7910a5dee297afc219e3a3f28057f2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1542257 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 198658a3 2019-03-19T22:09:14 Vulkan: Force a flush in ContextVk::onDestroy. Otherwise we could potentially be destroying resources that are currently in use. Was caught by changing some of the test tear down ordering. Also might affect some of the dEQP EGL multithread tests. Requires fixing the serial tracking of the "null" buffer. Otherwise we could be destroying the null buffer in the incorrect order. Bug: angleproject:3261 Bug: angleproject:3059 Change-Id: I57d1059ce9b1da19ced8ac753fab80c625901066 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1531291 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@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>
Tobin Ehlis 4a41914b 2019-02-05T08:50:30 Vulkan: Add trace markers Add systrace markers for various RendererVk::finish paths in order to quickly identify cause of finishes. Also added marker to commandPool destroy which is currently a known hotspot on some devices. Bug: angleproject:2528 Change-Id: I5a2fc741679a58445d71a2edd6204cf9e869d236 Reviewed-on: https://chromium-review.googlesource.com/c/1454277 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill c09ae15c 2019-02-01T14:16:32 Enable -Wextra-semi and -Wextra-semi-stmt. This will prevent users from accidentally making semicolon errors in the future. Bug: chromium:926235 Change-Id: I79a6fa376fb1ad8f0fcf1b65b1f572a035d1f4e9 Reviewed-on: https://chromium-review.googlesource.com/c/1446493 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@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 17a50e17 2019-01-10T22:05:43 Vulkan: Enable robust buffer access. This is not a complete implementation because it does not have the ability to disable the physical device feature. It does pass the current set of robust access tests. But there could be a performance regression on platforms that have a slower impelmentation. We would want the ability to support cases with bufer robustness on or off. Bug: angleproject:3062 Change-Id: I7d6eb889debcbd32f6ed809b526677123f872726 Reviewed-on: https://chromium-review.googlesource.com/c/1403967 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill c759b8b4 2019-01-03T15:16:50 Vulkan: More Vertex Array optimizations. Inlines a number of Vulkan vertex array methods. Also changes the way vertex buffers are bound. Note that Vulkan doesn't support NULL buffer bindings. Thus we create an emulated NULL buffer to work around the problem of having gaps in the bound vertex buffers. This allows us to use a single bind call for ranges of vertex buffers even when there are gaps. Also changes how vertex array dirty bits are reset. Instead of calling memset to clear the affected buffers we pass a mutable pointer to the Vertex Array sync state. This allows us to only reset the dirty bits that we sync. This saves on the memory clearing time. Improves perf by about 10% in the Vulkan VBO state change test. Bug: angleproject:3014 Change-Id: Ib7b742dff7897fc891606a652ea0b64255a24c86 Reviewed-on: https://chromium-review.googlesource.com/c/1390360 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 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 e321940c 2018-12-08T16:54:14 Vulkan: Move image clear functionality to UtilsVk DispatchUtilsVk is renamed to UtilsVk and the functionality in framebuffer's clearWithDraw() is moved to that class. Eventually, more fragment-shader-based internal algorithms will be added to this class as well. Bug: angleproject:2958 Change-Id: I4753c9cb3288b59cd1ed60fe7a57b9f189704322 Reviewed-on: https://chromium-review.googlesource.com/c/1369284 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 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>
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>
Shahbaz Youssefi ec06305b 2018-12-06T01:58:06 Vulkan: Add dynamic vertex 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 vertex attribute buffers. Bug: angleproject:2958 Change-Id: Ic3f8e187639919aba23102bba238de9ce70e6394 Reviewed-on: https://chromium-review.googlesource.com/c/1364450 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 8f1b7a66 2018-11-14T16:02:54 Vulkan: Add DispatchUtilsVK This class provides a set of compute-based internal utilities. Currently, buffer clear and copy are implemented. Other possibilities include more efficient mip map generation, or specialized texture operations. VertexArrayVk::updateIndexTranslation() is updated to convert the GL_UNSIGNED_BYTE index buffer to a GL_UNSIGNED_SHORT one using this class to avoid a CPU readback. The vk::Format class is augmented with a few flags (IsInt, IsUnsigned) to be able to select the appropriate shader based on the format (float, int or uint). Bug: angleproject:2958,angleproject:3003 Change-Id: Ie35519deb3c32a3da5ccf74080c70092c9287f0a Reviewed-on: https://chromium-review.googlesource.com/c/1336307 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@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 254b32cb 2018-11-26T11:58:03 Vulkan: Make DynamicBuffer use BufferHelper This is so that the resulting buffers can be written to by the GPU. Additionally, the class is given the ability to create host-visible or device-local buffers, making map()-on-init() optional. This is in preparation for vertex/index transformations in compute. Bug: angleproject:2958 Change-Id: Ib8f5829e33a1e49fa8f80c70dbde74f313ae49ec Reviewed-on: https://chromium-review.googlesource.com/c/1351113 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@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>
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>
Shahbaz Youssefi fca8fd62 2018-11-13T13:55:48 Vulkan: Refix cleanup race condition on Context destroy This partially reverts commit 905ee08219faed8ea50e194be0d76ad69faf1026 due to regression caused on startup time. Instead of calling finish before destroying the context, the objects in the Vulkan backend are `release()`ed instead of `destroy()`ed, so they will be kept alive for the duration of current work. Bug: 904846 Change-Id: Ia774470666c4c0d4c1ddc348f685d621243de204 Reviewed-on: https://chromium-review.googlesource.com/c/1333969 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@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 bc5834cd 2018-11-06T11:13:50 Vulkan: Use dynamic state for Viewport and Scissor. This reduces the size of the pipeline cache descriptor under 256 bytes. Further improves the speed of cache query. Has the minor cost of needing more state application during a new command buffer or render pass. Bug: angleproject:2522 Change-Id: I3d71e457a36084ac4748d04fe3c9bab4caad503c Reviewed-on: https://chromium-review.googlesource.com/c/1316888 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 77b2436e 2018-11-05T22:39:29 Vulkan: Reduce PipelineDesc size. This packs the desc into 288 bytes. Down from over 400. The hashing and memcmp functions are sped up considerably. Improves performance in the VulkanPipelineCachePerf test by 50% and also improves performance in the state changing draw call test by 20%. Bug: angleproject:2522 Change-Id: I72ed191a93721b875684f647f806c09be4e66821 Reviewed-on: https://chromium-review.googlesource.com/c/1308460 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 77abad8d 2018-10-25T17:03:48 Remove Context::gatherParams. This won't be used in the future. It saves a few instructions on each entry point. Also refactors a bit of touched code. Also adds in a missed entry point: "glTexStorage2DMultisampleANGLE". Removes related code and moves remaining helper code in params.h into a new file entry_point_utils.h. In total this patch series reduces overhead by up to 5%. Bug: angleproject:2933 Change-Id: Ifb49564597cde6ba82dfc3e185227619fdc62612 Reviewed-on: https://chromium-review.googlesource.com/c/1299478 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@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 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 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>
jchen10 5dc0a6f9 2018-09-20T14:30:45 Vulkan: Vertex buffer should be format aligned. The address of each attribute in a vertex buffer must be aligned according to its format. See section 20.3 of vkspec. Currently we don't handle this when using DynamicBuffer as vertex input buffer. This loosely fixes the issue by using max alignment for all formats. BUG=angleproject:2797,angleproject:2405 Change-Id: I2b27950dacc8fda75dcb646ef4b4d66ff27d629a Reviewed-on: https://chromium-review.googlesource.com/1234281 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 2d03ff4a 2018-09-27T15:04:26 Vulkan: Make Buffer/Image be CommandGraphResources. Don't make TextureVk/RenderbufferVk/SurfaceVk/BufferVk own the manipulation of the command graph. Instead put the operations close to the buffers and images used to render. This will lead towards implementing implicit barriers on the command graph resources. Bug: angleproject:2828 Change-Id: I07b742b6792c60285b280d6454f90e963d667e0e Reviewed-on: https://chromium-review.googlesource.com/1246983 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 299bdfe7 2018-09-25T11:44:19 Vulkan: Update AMD suppressions. Bug: angleproject:2463 Bug: angleproject:2847 Bug: angleproject:2848 Change-Id: I4036363c517dbe293566bb9d51a2470685d41ac2 Reviewed-on: https://chromium-review.googlesource.com/1240108 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Frank Henigman 85c4b43e 2018-09-19T23:35:00 Vulkan: Translate line loop indices from buffer. When a line loop is drawn with byte indices from a buffer, translate to short. Enable test. BUG=angleproject:2802 Change-Id: Ie178ec866387be85b91291c28e1978db0a09c20a Reviewed-on: https://chromium-review.googlesource.com/1237293 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
Frank Henigman 9d84ccba 2018-09-12T18:09:02 Vulkan: renderer->finish() before reading buffers. Have to call renderer->finish() before reading a buffer otherwise you can get stale data. Enable IndexBufferOffsetTest.UInt8Index/ES2_VULKAN which now works. Disable LineLoopTest.LineLoopUShortIndexBuffer/ES2_VULKAN which stopped working on Windows with Intel GPU. BUG=angleproject:2659 Change-Id: I1e21b0e1dacd3368923caf18e767e34ab696eef6 Reviewed-on: https://chromium-review.googlesource.com/1227032 Commit-Queue: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 0a17e484 2018-08-31T17:19:11 Vulkan: Fix sync of initially disabled attributes. If an attribute was never enabled or disabled the default state was not properly synced in our implementation. This wasn't caught by currently enabled tests. Those tests are now enabled in VertexAttributeTest. Bug: angleproject:2800 Change-Id: I97c063651911379e16de4ee557d9840782114c54 Reviewed-on: https://chromium-review.googlesource.com/1199724 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
Geoff Lang 89e82979 2018-08-28T11:32:53 Vulkan: Allow gaps in vertex attributes by packing them. Work around restrictions with setting null vertex buffers on command buffers by binding ranges of non-null buffers. Enable VertexAttributeTest on ES2/Vulkan BUG=angleproject:2792 BUG=angleproject:2797 Change-Id: Ief9db1e60c8c9045a4101abe859302d529decbcb Reviewed-on: https://chromium-review.googlesource.com/1194282 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
Jamie Madill 4c310831 2018-08-29T13:43:17 Vulkan: Return VkDeviceSize from DynamicBuffer. This obviates many static_casts. More closely represents what Vulkan is doing. One cast remains where we are using uint32_t for dynamic offsets with uniform buffers. Bug: angleproject:2786 Change-Id: I043ebb5d965f46ee6ebbfcb91d75a58508cacfe3 Reviewed-on: https://chromium-review.googlesource.com/1188949 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@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>
Frank Henigman 67c388e6 2018-07-19T19:16:11 Vulkan: support GL_FIXED vertex data. Override fixed to float, generate code, enable tests. BUG=angleproject:2405 Change-Id: Ic3e9a31eaf22372023b94081b0f4a83770dcabbe Reviewed-on: https://chromium-review.googlesource.com/1144455 Commit-Queue: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Geoff Lang <geofflang@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 ba365939 2018-07-18T17:23:46 Rename angle::Format::ID to angle::FormatID. This allow for predeclaring the enum. It solves some include dependency issues. Bug: angleproject:2729 Change-Id: Ibbbab0796e466c62848404ba277c5f454fd9ac62 Reviewed-on: https://chromium-review.googlesource.com/1142299 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 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>
Jamie Madill eebe2190 2018-07-11T09:01:18 Vulkan: Clean up Error usage. * Adds a nodiscard to the Error class. * Fixes the places where Error was discard. * Uses more vk::Error instead of gl::Error. This enables the Vulkan back-end Error refactoring. Bug: angleproject:2713 Change-Id: I09606d965e8b7cfd341ad7fb95cf029b9d694ef4 Reviewed-on: https://chromium-review.googlesource.com/1128922 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>