src/libANGLE/renderer/vulkan/BufferVk.cpp


Log

Author Commit Date CI Message
Mohan Maiya cf8422c2 2020-05-19T10:14:02 Vulkan: Acquire a new BufferHelper from the pool based on a threshold We acquire a new BufferHelper from the pool when the app updates the data of the entire buffer. In scenarios where the app updates say, 60% of the buffer it would still be benificial to acquire a new buffer and copy over the remaining 40% of data from the old buffer to the new one. This reduces the transfer workload from 60% to 40% of buffer size. Currently the threshold is set to 50% of buffer size. Bug: angleproject:4380 Change-Id: I12576c585230e771d4c1a4352fab93dd3db2ecef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2204655 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 41f7bcce 2020-04-30T16:09:36 Vulkan: Add missing cache flush DynamicBuffer are not cache coherent, thus requires flush. Also adds a few assertion to ensure implementation matches expectation. Bug: b/155432713 Change-Id: Iaf28786168a3bb5d746b43e030f882c4b6d005ad Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2174269 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao df31624e 2020-04-30T13:28:24 Vulkan: Reduce the onBufferRead/onBufferWrite API verbosity a bit This adds helper functions to handle common use case for onBufferRead and onBufferWrite to reduce the API verbosity a little bit. Also fix the transform feedback bug that we are passing in wrong access/stage flags when it is emulated by vertex shader. Bug: b/155122200 Change-Id: Id2549ca00cad184a90c6230dc3665aaff44dda08 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2174265 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao f07d0072 2020-04-27T16:51:05 Vulkan: use fine grain stage for buffer barriers We are using VK_PIPELINE_STAGE_ALL_COMMANDS_BIT for mGlobalMemoryBarrierStages, which is used for both src and dst. This will cause a full pipeline stall whenever a buffer object introduces a barrier. This CL will let the caller pass in the specific stage it will be used for, allowing us to track write and read stage dependencies separately and request the corresponding barriers. Bug: b/155122200 Change-Id: I8b8bd291a03b77d07cfbcbe7c3cda2d3771588b9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2169014 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Brandon Schade fa03eb9d 2020-02-05T15:25:52 Vulkan: Use DynamicBuffer for BufferVk When there is glBufferData API call, if the current VkBuffer is in use, we copy to a staging buffer to be gpu copied later. Instead of doing this second copy, write directly to a new buffer that will be used for subsequent gpu operations. BufferVk now has a DynamicBuffer to handle the logic of acquiring a new/free buffer to be used. Bug: angleproject:4380 Change-Id: I207f334013ae944090eb48c26c692a09e8815f74 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2040513 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Hyunchang Kim 6e0d718a 2020-03-31T18:41:57 Vulkan: Implement device memory sub-allocation Use AMD Vulkan Memory Allocator for device memory sub-allocation. We now have a mempool from which all glBuffer memory is allocated. The CPU overhead involved in repeated IOCTL calls to the kernel is reduced significantly. Bug: angleproject:2162 Change-Id: Id7681ffe2ac3d2853141ebe34c7df7b7fdd0d55e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2124519 Reviewed-by: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.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>
Hyunchang Kim d30da072 2020-03-31T15:01:14 Vulkan: Request host uncached memory for some glBuffer objects Uncached memory is an optimal memory type for resources with write-only access from the CPU since it avoids polluting CPU caches with data the CPU will never use. Bug: angleproject:2162 Change-Id: I33d0d91830979990bcdcca3bd9eedde0345fb5a6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2131880 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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>
Mohan Maiya 78a85f2c 2020-03-16T10:28:59 Vulkan: Request device local memory for glBuffer with GL_STATIC* usage glBuffer objects with GL_STATIC_* usage patterns will now request the storage to be allocated in device local memory. For glBuffer objects with GL_DYNAMIC_* usage patterns we request a host cached memory. Bug: angleproject:4480 Change-Id: I7ca968f5ddfb59e4df3ecd07ae65df2bbf734190 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2102958 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Jamie Madill 916d204c 2020-02-25T14:18:38 Vulkan: Use new APIs in BufferHelper::copyFromBuffer. We shouldn't need to special case the barrier logic in this function any more. Instead use the 'onBufferRead' and 'onBufferWrite' APIs. Bug: angleproject:4029 Change-Id: I7f67b67aa312d9ae64172b40d73086b7772d49d2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2071143 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill aa09ca69 2020-02-24T13:33:30 Vulkan: Update ContextVk command buffer access methods. Use the following names: - flushAndBeginRenderPass - endRenderPassAndGetCommandBuffer - flushAndGetPrimaryCommandBuffer This clarifies that a flush is part of the method. Bug: angleproject:4029 Change-Id: I6c870761339ea7aa39c83142200781ba39ad6a4b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2068129 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
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 c58458e6 2020-02-19T14:51:41 Vulkan: Remove CommandGraph code. Also updates relevant comments to no longer refer to a graph. Bug: angleproject:4029 Change-Id: Ic29716e9ae4926870f902947d49d8fee7af98662 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2057804 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 20b1259a 2020-02-05T17:08:05 Vulkan: Command graph linearization (Step 2). ES 2.0 is feature complete. Passes all of the angle_end2end_tests with the new linear command recording method. Also runs the T-Rex benchmark without any obvious glitches. Likely has issues with creating too many RenderPasses. ES3 is mostly untouched. Bug: angleproject:4029 Change-Id: Ic5acf3d768495fbffd07b07bf0a6f2b5787c51f8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2012900 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3712b2e4 2020-01-24T17:08:30 Vulkan: Command graph linearization (Step 1). This initial prototype introduces a new feature to the Vulkan back-end that disables the deferred command recording. The intent is to have a lower CPU overhead during submission calls which currently walk a DAG. The feature is not complete. Currently it only passes the ANGLE SimpleOperationTests. Moreover it is extremely simple and only allows use of one command buffer at a time. In the future we'll allow open command buffers for recording outside and inside render pass commands at the same time. We'll also support collapsing RenderPasses together for some use cases. Currently the prototype only passes "SimpleOperationTest". There are quite a few unimplemented features like queries, XFB, etc. Bug: angleproject:4029 Change-Id: I82760986683f55e37ac4ea559de6f4cffb6ef84e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1953485 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com>
Jamie Madill 7d45184d 2020-01-22T08:34:48 Vulkan: Fix naming in CommandGraphResource. Accidentally submitted a patch set without requested changes. This corrects the function names to 'hasRecordedCommands' and 'hasRunningCommands'. Bug: angleproject:4029 Change-Id: I1cf3046052ace304594ef939566b0b36bae822df Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2013924 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 579c5940 2020-01-17T13:20:21 Vulkan: Rename onGraphAccess to onResourceAccess. Clarifies the function for the upcoming command graph linearization. Bug: angleproject:4029 Change-Id: Ib50997c007053757de533f69c155a92d7555e0b2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2003235 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 09a2d065 2020-01-17T13:20:20 Vulkan: Clean up naming of ResourceUse checks. Instead of referring to command graphs we can refer to if the resource is in use by "ANGLE" or the "Driver". This will make the methods more consistent when we switch away from the command graph. Bug: angleproject:4029 Change-Id: I3045a4eb2a38234ef331c0662694656065590ae1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2003234 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 441b72f0 2020-01-16T14:48:39 Vulkan: Make ContextVk own ResourceUseList. This moves the resource use tracking functionality out of CommandGraph. Making the list a separate class helps the implementation avoid tricky circular include problems. Bug: angleproject:4029 Change-Id: I3288fc685b21e949f12b0796109a2b7bb117c249 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2002931 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 4ff1651e 2020-01-16T12:42:27 Vulkan: Add ResourceUseList helper. This abstracts away the ResourceUse tracking from CommandGraph. Pulling it out will allow us to more easily swap resource use tracking into ContextVk. The command graph is eventually going away so we need to move functionality out of CommandGraph. Bug: angleproject:4029 Change-Id: Icc3bcc824510b03e91f8ff010a82751a81516bfa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2002930 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 01c0d6bd 2020-01-12T13:41:31 Vulkan: Use dynamic buffers for staged updates Dynamic buffers are used to perform staged updates to BufferVk objects instead of recreating staging buffers for each update. Bug: angleproject:4292 Change-Id: I0f64c821c97e0e6014e9df1d4f99e2f495838025 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2001461 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 5e33e647 2020-01-09T14:20:09 Vulkan: Optimize getIndexRange This function was unconditionally calling finishImpl(). This is changed to finishToSerial() to only wait until the serial that actually used the buffer. Bug: angleproject:3072 Change-Id: Ida89bb119b4ba6420f12404b911af0e3b4583a51 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1993407 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Hyunchang Kim caa6eccd 2019-10-27T13:46:56 Vulkan: Implement Transform Feedback support via extension Implemented transform feedback extension path. Where VK_EXT_transform_feedback is supported, extension path will be taken over an emulation path. Extension path has advantages in terms of performance. BUG=angleproject:3206 Test: dEQP-GLES3.functional.transform_feedback.* angle_end2end_tests --gtest_filter=TransformFeedbackTest* Change-Id: Ia07c23afb289d9c67073469a97b714ec96f5265a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1882767 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi 27c89d2b 2019-11-25T10:22:01 Vulkan: fix BufferVk::map() synchronization 4398b2b6a2ac13034dff249d8c049c4047b5fed2 made finishToSerial() in BufferVk::map() conditional to whether the serial is in use to work around a performance regression. Notes: - Prior to 087f1384f233792921d34c0ca5b5a90fac75b070, finishToSerial already did that, but that check was inadvertently removed. - finishToSerial waits for the smallest serial that's bigger than or equal to the requested serial. - The flush() call in BufferVk::map() was conditional to whether the serial is in use, but it really meant to check whether the buffer has pending commands in the graph. The end result is that there was an unnecessary flush in BufferVk::map() if we had to wait for a previous serial to finish. This change makes the flush conditional to whether the buffer has pending commands in the graph, and the finishToSerial call to whether the serial is not yet finished. Bug: angleproject:3994 Change-Id: Idca436ef2439bcc8c59396a07b2591c1dfadd669 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1932341 Reviewed-by: Brandon Schade <b.schade@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 61c6aecc 2019-11-28T14:30:18 Vulkan: Fold read access into write flags on buffer writes This could lead to a subtle bug: Say we use a buffer as a storage buffer and write to it. We then must issue a memory barrier before using it as a uniform buffer. However we would set the SHADER_READ bit as a read mask on a storage buffer access. This seems like it could lead to a missing barrier. Bug: angleproject:4178 Change-Id: I486002739b7fb000ffacc0a1e996784b7875e7ba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1943034 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Tim Van Patten 2ed547a6 2019-10-15T17:34:09 Vulkan: Mark destination buffers dirty after a copy When a user performs a copy between GL buffers, we need to mark the destination buffer dirty in case that buffer data is used as vertex data and requires another conversion to be done. Bug: angleproject:3544 Test: dEQP-GLES3.functional.buffer.copy.* Change-Id: Ie3196db4feb0f01d0b25c8799312c5f57c1095a2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1863007 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Brandon Schade 4398b2b6 2019-10-10T16:39:33 Vulkan: finishToSerial only if the buffer is in use The call to flushImpl() was conditioned on the buffer being used but the call to finishToSerial() was outside. This caused an unconditional wait and unnecessary pipeline stall. The fix is to make sure to perform a flush and wait only when the buffer is in use. Bug: angleproject:3994 Change-Id: I1b297cf11a67f7611d37808cb111d6b52ac16f90 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1854881 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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>
Jamie Madill 33ffed01 2019-09-26T10:19:35 Vulkan: Clean up garbage APIs. Instead of dumping resources to a context, we use the release APIs consistently. Refactoring/cleanup change only. Should have very litte impact on runtime behaviour. Bug: angleproject:2464 Change-Id: I2dc7f8316c466f7ccfad50a7b792ba0ee7bc2e49 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1804883 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill b540da89 2019-09-19T14:19:12 Vulkan: Use ResourceUse to track object lifetime. With the new resource tracking scheme the CommandGraph, tracking a "Context serial" aka "current" serial is no longer necessary for CommandGraphResources. Serial tracking has been moved to the shared ResourceUse struct that gets updated on a command submission. Thus we don't need to store the serial as a current separate piece of info in BufferHelper/ImageHelper. Will lead to further redesign for the multi-threading support for Vulkan. Bug: angleproject:2464 Change-Id: I1ae4bcc27fcfb93422b4ab4c9682a458e482f295 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1785990 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill dd4a00a0 2019-09-19T14:19:11 Vulkan: Track resource usage via counter. This adds a small shared piece of memory that counts the number of times a resource is used in a command graph. This will enable more multi-threaded uses. The shared pointer is updated in the command graph during a submit and during graph construction. Bug: angleproject:2464 Change-Id: Id9d0319a6814825d02e865ba527c97b5f535ff31 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1785989 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tobin Ehlis 1d83e1e8 2019-08-21T09:00:33 Vulkan: Handle new validation errors With updated validation layers Vulkan backend is hitting two new errors. This CL fixes one and works around (WA) another. Fixes issue where a Buffer used in vkCmdDispatchIndirect() did not have VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT set so now setting that usage bit for all buffers. WA issue where invalid topologies enabled primitiveRestart so ignoring that VUID initially until complete fix is implemented. Bug: angleproject:3832 Change-Id: Ie3f681eaf9e2051c27bdf00a35dc50d8ad4a2528 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1763196 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com>
Jiacheng Lu 3e493c48 2019-07-29T16:27:01 Vulkan: Optimize memory allocation offset rounding Use bit operation to compute memory alignment round up. Tested with T-Rex, hotspot in roundUp resolved. Bug: angleproject:3744 Change-Id: I55db941f588401a1d2d3d93f4d6b810e6b1aa95f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1725118 Commit-Queue: Jiacheng Lu <lujc@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
James Dong 020abb8b 2019-07-24T11:33:49 Vulkan: invalidate translation buffers for SSBOs Translation buffers weren't being marked dirty after running a compute shader in which they are bound as SSBOs. This change invalidates all SSBOs after a draw or compute call. Bug: angleproject:3739 Change-Id: I66b56df7e619b55afc7e3da6b5613b6d050e06bb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1717144 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: James Dong <dongja@google.com>
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>
Shahbaz Youssefi 55efe37c 2019-07-03T11:52:21 Vulkan: Cleanup buffer dependencies onWrite now sets the dependency to make sure the order of setting dependency and adding memory barrier is correct. onReadByBuffer is added to handle buffer-to-buffer dependency and barrier setting correctly without causing a graph loop. onExternalWrite is added so that BufferVk doesn't have to track write access flags. Additionally, setting write dependencies now include both read and write flags. This is in preparation for SSBO support where the buffer can be used to read data in addition to write. Bug: angleproject:3561 Change-Id: I2028186ea14459cd159cf79f6d640df54538fc62 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1687119 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Shahbaz Youssefi 615ae1a7 2019-06-21T12:10:14 Vulkan: Improve copy buffer self-dependency The check in addReadDependency to avoid setting self-dependencies was causing the barrier set in `copySubData` to be potentially set earlier than the buffer's previous usage. This change allows buffer self-dependencies to be handled especially. Bug: angleproject:3194 Change-Id: I08f2c39f420f020ad5faa9735193e6b7142fa756 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1670952 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 9420fa06 2019-06-07T17:09:22 Vulkan: Implement copyBufferSubData Implement BufferVk::copySubData(). Bug: angleproject:3194 Test: dEQP-GLES3.functional.buffer.copy.* Test: dEQP-GLES3.functional.negative_api.buffer.copy_buffer_sub_data Test: angle_end2end_tests BufferDataTestES3 Change-Id: I220cd490eb1eb799604e217b3e377af3fd431d97 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1648669 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@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>
Shahbaz Youssefi b1c8dbf3 2019-06-14T23:57:26 Vulkan: Correct synchronization for buffer readback When mapping buffer memory, a flush is performed if the buffer has pending operations followed by a finishToSerial to make sure the buffer is no longer in use by the GPU. This also implements GLES 3.0 buffer mapping flags: GL_MAP_INVALIDATE_RANGE_BIT: No-op. Vulkan's vkMapMemory doesn't have such a feature. GL_MAP_INVALIDATE_BUFFER_BIT: Same GL_MAP_FLUSH_EXPLICIT_BIT: Vulkan automatically flushes host memory writes on vkQueueSubmit, so this is no-op as well. GL_MAP_UNSYNCHRONIZED_BIT: The flush+finishToSerial call is skipped in this case. Bug: angleproject:3213 Change-Id: I6bdb460dffbb57170649f4c9678afbfae331926c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1661252 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
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>
Shahbaz Youssefi d3e7a41b 2019-05-29T14:40:52 Vulkan: fix buffer copy barriers Bug: angleproject:3362 Change-Id: Ibf6520fb73bb1a9b76714cddd786569789c70430 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1635752 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@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>
Shahbaz Youssefi 216f73d0 2019-04-12T13:32:30 Vulkan: add uniform buffer object support Support for layout qualifiers in interface blocks are added. All interface blocks are adjusted to either be in std140 or std430. In the Vulkan backend, a new descriptor set is added for UBOs. A dirty bit is added for UBO updating and pipeline layouts and descriptor bindings are updated. Bug: angleproject:3199, angleproject:3220 Change-Id: I271fc34ac2e1e8b76dee75e54a7cff0fe15fe4ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1565061 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
Shahbaz Youssefi 2660b503 2019-03-21T12:08:40 Vulkan: Restore CommandBuffer to namespace vk Moved vk::CommandBuffer and vk::SecondaryCommandBuffer to vk::priv:: and aliased vk::CommandBuffer to one or the other. This allows the rest of the classes to continue seeing vk::CommandBuffer as they used to do. Used a special alias for the primary command buffer that gets submitted (vk::PrimaryCommandBuffer). Bug: angleproject:3136 Change-Id: I61236fd182230991db7395d05e3da3be5e3f45be Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1534456 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Tobin Ehlis 134425c7 2019-03-15T17:02:17 Vulkan:Integrate SecondaryCommandBuffers Integrate the custom SecondaryCommandBuffer type into the CommandGraph nodes by adding new ANGLE_USE_CUSTOM_VULKAN_CMD_BUFFERS define that can be set in the BUILD gn args with angle_enable_custom_vulkan_cmd_buffers set to "true." Initially the custom cmd buffers are disabled by default. This adds some support functions to SecondaryCommandBuffer to make the integration easier by matching the wrapped cmd buffer interface: initialize(), end(), valid(). Bug: angleproject:3136 Change-Id: Ib910554583192550757bb8ce89914e3ea8737988 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1526556 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tobin Ehlis e3981cf7 2019-02-27T11:05:15 Vulkan:Add SecondaryCommandBuffer class SecondaryCommandBuffer is a CPU-side command buffer construct intended to delay allocation/construction of GPU-side command buffers until absolutely necessary. Initially ANGLE was batching commands into Vulkan secondary command buffers and then submitting those command buffers when rendering was required. On at least some devices we saw two areas of overhead that SecondaryCommandBuffers are intended to reduce: 1. Commands in secondary cmd buffers taking longer than equivalent commands in a single primary cmd buffer. 2. Allocation/free/reset overhead of the secondary command buffers was a hotspot for some workloads. Bug: angleproject:3136 Change-Id: Ife8ffe2968eee423d89ff433d62596c432156661 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1492016 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@google.com>
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 1f750d1e 2019-01-16T13:27:16 Even more inlining and micro-optimization. Improves perf by about 3-4% on the Vulkan VBO state change test. Bug: angleproject:3014 Change-Id: If4415e503cd883cf7de6387bf1ebbca0e5fc994e Reviewed-on: https://chromium-review.googlesource.com/c/1393907 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@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 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>
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>
Yuly Novikov 27780295 2018-11-09T11:19:49 Vulkan: refactor WrappedObject descendants Methods receive VkDevice instead of Context and return VkResult instead of angle::Result now. Bug: angleproject:2657 Change-Id: I3eca8692ad0b3b6e96e31fd433ed14e04384990e Reviewed-on: https://chromium-review.googlesource.com/c/1330105 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@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 0ea96210 2018-10-30T15:14:51 Vulkan: Enable more perf tests. Also fixes the check for the correct UINT index extension that wasn't available on Vulkan. Also includes a workaround for the mock ICD not implementing buffer state for index ranges. Bug: angleproject:2923 Change-Id: Iab35809d15f890525a9e658d4148272c46cf1320 Reviewed-on: https://chromium-review.googlesource.com/c/1308733 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill ae108bd1 2018-10-18T15:00:38 Use angle::Result in front-end (Part 5) Refactors gl::Buffer and implementation. Bug: angleproject:2491 Change-Id: Ic6860dac2faf33067965e7117ea8e98dc6a8dc7a Reviewed-on: https://chromium-review.googlesource.com/c/1283310 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 06270c9e 2018-10-03T17:00:25 Vulkan: Safer struct initialization Using x = {}; before filling out each field, we can be sure any missing field is 0 initialized. This in turn helps us not have to specify certain fields that are generally unused (at the moment), such as pNext. Bug: angleproject:2860 Change-Id: Ia1fa2db3ecfb316673a02ac0c5e13e47e055a19f Reviewed-on: https://chromium-review.googlesource.com/c/1259764 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill c2116cd3 2018-10-02T09:31:40 Vulkan: Update pipeline barrier interface. This makes the vk::CommandBuffer class closer to an auto-generated wrapper class. Bug: angleproject:2828 Change-Id: I91ba03914a60d5612707dd240fcda25b86cf2c46 Reviewed-on: https://chromium-review.googlesource.com/1255505 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@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 50e6eaae 2018-09-27T08:24:32 Vulkan: Move LineLoopHelper graph work into BufferVk. Bug: angleproject:2828 Change-Id: Ie6bcdd10e2de415615db2bfb0b6fa17c392455b0 Reviewed-on: https://chromium-review.googlesource.com/1235655 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Tobin Ehlis f5aad063 2018-09-19T14:39:00 Avoid flush/invalidate of host-coherent memory For DynamicBuffer avoid calling vkFlushMappedMemoryRanges() or vkInvalidateMappedMemoryRanges() if the underlying memory is host- coherent. These calls are not required for host-coherent memory and may negatively impact performance. When currently allocating HOST_VISIBLE memory it's possible to also get HOST_COHERENT memory even though it's not explicitly requested. Because of this, the change updates the memory allocaiton interfaces through the stack to pass back the actual allocated memory properties so that it can be checked to see if it's host-coherent. Bug: angleproject:2804 Change-Id: Ife95c4b98115b16d16c087dd72dba7d9661fdb46 Reviewed-on: https://chromium-review.googlesource.com/1234276 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill e2d2270a 2018-09-19T08:11:48 Vulkan: Merge append/beginWriteResource. The new API is named 'recordCommands'. These two APIs were basically doing the same thing. We don't need to have an understanding of creating a new graph node to know that we want to record some Vulkan commands to a command buffer. The prior design was actually masking a bug where we would allow appending commands to a command graph node that had already started a render pass. Fix this by adding a render pass check to recordCommands. Also removes 'hasStartedWriteResource' since this method wasn't used anywhere. Also renames 'onResourceChanged' to 'finishCurrentCommands'. Bug: angleproject:2828 Change-Id: I00bd5b893fcfc37172b6c1706cb2f5fc57e79f54 Reviewed-on: https://chromium-review.googlesource.com/1235654 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Geoff Lang <geofflang@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>
Courtney Goeltzenleuchter 62114aae 2018-08-28T09:36:46 glBufferSubData: Exit early if size is zero glBufferSubData is calling vkMapMemory with a size of zero is invalid. Check for that and exit early if found. Bug: angleproject:2790 Change-Id: I965badeb3aa2cec1adc24dd7ff5695f8aa3e553d Reviewed-on: https://chromium-review.googlesource.com/1194610 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@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 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>
Luc Ferron a72ebeba 2018-06-28T11:16:58 Vulkan: Fix issue in DynamicBuffer - We weren't keeping track of mSize correctly, causing some very specific index buffer bindings to fail. The size returned when allocating the buffer can be a bit different than the size requested, and that extra space between mSize and the allocated size was not meant to be used, causing errors in the validation layers. Bug: angleproject:2580 Change-Id: I47eb7b8de6f4f657de14385b77ba6a459add599b Reviewed-on: https://chromium-review.googlesource.com/1118607 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
jchen10 2b06054d 2018-07-03T14:48:13 Vulkan: Insert a barrier after buffer copy According to the spec(section 18.1), all copy commands are treated as transfer operations for the purposes of synchronization barriers. Some tests are flaky on Intel platform without such barriers. Bug: angleproject:2663 Bug: angleproject:2664 Change-Id: Ic8bc9a0eb000670342c0df0449257324f04ad1f8 Reviewed-on: https://chromium-review.googlesource.com/1124103 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@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 57707e5f 2018-06-14T14:50:36 Vulkan: Fix a state notification change that was wrong That state change should really be in the frontend and not in each backend. Bug: angleproject:2594 Change-Id: I9d9396563ce42a41587b954892d6b4c6002c5072 Reviewed-on: https://chromium-review.googlesource.com/1101252 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Jamie Madill <jmadill@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 c57ee259 2018-05-30T19:53:48 Vulkan: Clean up object releasing APIs. This cleans up the confusing releaseResource/releaseObject pair in the RendererVk class. It also makes getQueueSerial private in ResourceVk but keeps a public isResourceInUse API for external use. Bug: angleproject:2539 Change-Id: I6b4f24db16e36130a85ef03fc2c3b26d8d9e1fba Reviewed-on: https://chromium-review.googlesource.com/1069291 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 5dca651f 2018-05-30T10:53:51 Vulkan: Make Resource's updateSerial private. This simplifies the API from the calling resource classes. This method is called internally instead. beginWriteResource and appendWriteResource both call updateSerial internally. Additionally this removes hasStartedRenderPass and instead returns a boolean from appendToStartedRenderPass indicating success. Bug: angleproject:2539 Change-Id: Idcf72e6a80dde90e83dabc64644051bb536c6b12 Reviewed-on: https://chromium-review.googlesource.com/1066554 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 8c361c7f 2018-05-18T14:36:06 Vulkan: Remove one API from CommandGraphResource. 'checkResourceInUseAndRefreshDeps' can be implemented using other APIs. This simplifies the API surface in CommandGraphResource. Bug: angleproject:2539 Change-Id: I55350ab352c50961736327a867e8403d3b38506b Reviewed-on: https://chromium-review.googlesource.com/1052070 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@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 d7518622 2018-03-27T09:44:31 Buffer11: Refactor Subject/Observer pattern. Instead of having a direct/static observer distinction, add two messages for 'Contents Changed' and 'Storage Changed'. This makes Buffer11 itself the subject with two different message handling cases in the onSubjectStateChange methods. Bug: angleproject:2389 Change-Id: I645cd4b7cc7ce51cb7f48a01c7fc72939cbe89fe Reviewed-on: https://chromium-review.googlesource.com/957940 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Luc Ferron 879f90d2 2018-03-01T11:45:20 Vulkan: Avoid recopying the data every time we draw line loops Use the Observer pattern to get notified when the BufferVk we've copied our data from is changing. We will only recopy the data if anything has changed, but otherwise we'll keep drawing with the same index buffer we've created previously. Bug: angleproject:2335 Change-Id: Ib65677b4d5ec90c46a5e3b975fffd1fddeed59e7 Reviewed-on: https://chromium-review.googlesource.com/948622 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@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 06a87ec8 2018-02-25T22:07:27 Vulkan: Fix offsets in BufferVk::setDataImpl. We were using a src offset instead of a dest offset. The staging buffer should always start at the zero offset, while the dest buffer (the real buffer) should use the offset argument to Buffer*Data. Bug: angleproject:2374 Change-Id: I9ee702709d9c15945935f4eae25f308b71e0d1e8 Reviewed-on: https://chromium-review.googlesource.com/937022 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Frank Henigman df4b6316 2018-01-18T18:22:19 Vulkan: Add unmap in BufferVk::getIndexRange. There was a map() without a corresponding unmap(). Add a test which does multiple indexed draws, triggering the problem. BUG=angleproject:2310 Change-Id: Id33d66f24de2005ec3f9958d33ab4c2630b49dc5 Reviewed-on: https://chromium-review.googlesource.com/875318 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Frank Henigman <fjhenigman@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>
Jamie Madill 57fbfd80 2018-02-14T12:45:34 Vulkan: Pass RendererVk to Allocate helpers. Passing the Renderer pointer instead of the Context pointer makes these methods a bit easier to work with from the "EGL" sections of the code. This is a refactoring-only change to aid the Depth/Stencil implementation. Bug: angleproject:2357 Change-Id: Icbcc72a1daff4edd947a21672744498781cfc064 Reviewed-on: https://chromium-review.googlesource.com/919523 Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 0e65454d 2018-02-07T14:50:06 Vulkan: Fix circular dependency with resource updates. The old implementation would try to keep recording draw commands to the same framebuffer write operation even if the vertex array buffer data changed. This would lead to a broken dependency graph. Fix this by forcing any current render operations to create a new node in this case, giving a correct command graph. Old design: - render (creates a CommandBufferNode A) - update buffer (creates a CommandBufferNode B which happens after A) - render (to CommandBuffer A, and gives a circular dependency with B) New design - render (CommandBufferNode A) - update buffer (CommandBufferNode B, happens after A) - render (CommandBufferNode C, happens after B) This also renames some methods to try to clarify them. Bug: angleproject:2350 Change-Id: I6559bed4ed3f58f68771662422c5bef6a505282b Reviewed-on: https://chromium-review.googlesource.com/907416 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 57dd97aa 2018-02-06T17:10:49 Vulkan: Add helper for allocating image memory. Also refactors some memory index searching code that was duplicated. This will lead the way to having more code reuse for our Renderbuffers implementation in Vulkan, and for other types of Texture. Bug: angleproject:2347 Change-Id: I49cbd77328c01f945d66f92e6ec4ba7c552abeff Reviewed-on: https://chromium-review.googlesource.com/904684 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@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 8a57b468 2017-12-28T12:25:03 Re-land "Vulkan: Roll loader/validation layers SDK. (2/2)" Second re-land fixes git.bat access on developer machines. Re-landing with upstream fixes to the layers so they no longer need to copy the parameter validation errors to the current working directory of the layer generation. Also includes fixes for the GCC build. This hasn't been updated in a while, so there are many changes. It should also include better validation for memory barriers. Also includes updated builds for SPIRV Tools and glslang. A few pull requests need to land before landing this in ANGLE. This second step re-enables Vulkan and includes the updated build. Includes a workaround for parameter_validation.h no longer being auto-generated, and the stale file clobbering the build. Also includes a fix for an incorrect memory barrier. Bug: angleproject:2237 Change-Id: Ic1a3ad7458bb743d7279a1af9334693ab6cb59d6 Reviewed-on: https://chromium-review.googlesource.com/845859 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Zhenyao Mo 06f86377 2017-12-22T19:28:35 Revert "Re-land "Vulkan: Roll loader/validation layers SDK. (2/2)"" This reverts commit 755a9317ff1ec983f2704fc9f4619cac49992960. Reason for revert: Broke local win build. crbug.com/797253 Original change's description: > Re-land "Vulkan: Roll loader/validation layers SDK. (2/2)" > > Re-landing with upstream fixes to the layers so they no longer > need to copy the parameter validation errors to the current > working directory of the layer generation. Also includes fixes > for the GCC build. > > This hasn't been updated in a while, so there are many changes. > It should also include better validation for memory barriers. > > Also includes updated builds for SPIRV Tools and glslang. > A few pull requests need to land before landing this in ANGLE. > > This second step re-enables Vulkan and includes the updated build. > > Includes a workaround for parameter_validation.h no longer being > auto-generated, and the stale file clobbering the build. > > Also includes a fix for an incorrect memory barrier. > > Bug: angleproject:2237 > Change-Id: I1ed87ecfa84f51ee1edf6a8581d9b3c8f9a6f26e > Reviewed-on: https://chromium-review.googlesource.com/834429 > Commit-Queue: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=fjhenigman@chromium.org,jmadill@chromium.org Change-Id: I605d72207d64c7d0853678595e255b74ad69d887 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:2237 Reviewed-on: https://chromium-review.googlesource.com/842918 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Jamie Madill 755a9317 2017-12-21T14:34:05 Re-land "Vulkan: Roll loader/validation layers SDK. (2/2)" Re-landing with upstream fixes to the layers so they no longer need to copy the parameter validation errors to the current working directory of the layer generation. Also includes fixes for the GCC build. This hasn't been updated in a while, so there are many changes. It should also include better validation for memory barriers. Also includes updated builds for SPIRV Tools and glslang. A few pull requests need to land before landing this in ANGLE. This second step re-enables Vulkan and includes the updated build. Includes a workaround for parameter_validation.h no longer being auto-generated, and the stale file clobbering the build. Also includes a fix for an incorrect memory barrier. Bug: angleproject:2237 Change-Id: I1ed87ecfa84f51ee1edf6a8581d9b3c8f9a6f26e Reviewed-on: https://chromium-review.googlesource.com/834429 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 647dca76 2017-12-15T21:31:00 Revert "Vulkan: Roll loader/validation layers SDK. (2/2)" This reverts commit f15f9cec318b5b0042cca7f819b1df9dbd1872ee. Reason for revert: Causing a compile failure on the Fuchsia config, due to a path difference. Will fix upstream and re-land, since it's breaking the auto-roller. https://chromium-review.googlesource.com/c/chromium/src/+/829878 FAILED: clang_x64/gen/third_party/angle/src/vulkan_support/angle/vulkan/parameter_validation.cpp python ../../third_party/vulkan-validation-layers/src/scripts/lvl_genvk.py -o clang_x64/gen/third_party/angle/src/vulkan_support/angle/vulkan -registry ../../third_party/vulkan-validation-layers/src/scripts/vk.xml parameter_validation.cpp -quiet Error: Could not find vk_validation_error_messages.h [906/1359] ACTION //third_party/angle/src/vulkan_support:vulkan_gen_object_tracker_cpp(//build/toolchain/linux:clang_x64) FAILED: clang_x64/gen/third_party/angle/src/vulkan_support/angle/vulkan/object_tracker.cpp python ../../third_party/vulkan-validation-layers/src/scripts/lvl_genvk.py -o clang_x64/gen/third_party/angle/src/vulkan_support/angle/vulkan -registry ../../third_party/vulkan-validation-layers/src/scripts/vk.xml object_tracker.cpp -quiet Error: Could not find vk_validation_error_messages.h Original change's description: > Vulkan: Roll loader/validation layers SDK. (2/2) > > This hasn't been updated in a while, so there are many changes. > It should also include better validation for memory barriers. > > Also includes updated builds for SPIRV Tools and glslang. > A few pull requests need to land before landing this in ANGLE. > > This second step re-enables Vulkan and includes the updated build. > > Includes a workaround for parameter_validation.h no longer being > auto-generated, and the stale file clobbering the build. > > Also includes a fix for an incorrect memory barrier. > > Bug: angleproject:2237 > Change-Id: Iae611764870281ed6aa7b187ec0c4e44226c722a > Reviewed-on: https://chromium-review.googlesource.com/759197 > Commit-Queue: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Frank Henigman <fjhenigman@chromium.org> TBR=fjhenigman@chromium.org,jmadill@chromium.org,cwallez@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: angleproject:2237 Change-Id: I9bc60860668c1da773b6e2fdb83ecc20215e9125 Reviewed-on: https://chromium-review.googlesource.com/830926 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill f15f9cec 2017-12-13T15:02:24 Vulkan: Roll loader/validation layers SDK. (2/2) This hasn't been updated in a while, so there are many changes. It should also include better validation for memory barriers. Also includes updated builds for SPIRV Tools and glslang. A few pull requests need to land before landing this in ANGLE. This second step re-enables Vulkan and includes the updated build. Includes a workaround for parameter_validation.h no longer being auto-generated, and the stale file clobbering the build. Also includes a fix for an incorrect memory barrier. Bug: angleproject:2237 Change-Id: Iae611764870281ed6aa7b187ec0c4e44226c722a Reviewed-on: https://chromium-review.googlesource.com/759197 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@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 7f738d4e 2017-11-20T17:06:27 Vulkan: Refactor CommandBuffer helper class. This makes the base vk::CommandBuffer class as close to the Vulkan API as possible. It moves the extra functionality and state tracking to a CommandBufferAndState helper class. Also no longer stores a reference to a CommandPool in a CommandBuffer. Eventually we won't need to free CommandBuffers explicitly, since they can be freed en-masse by deallocating the CommandPool on a flush. Bug: angleproject:2200 Change-Id: I5095fe89e8da935ff8273b1a402ccfd6a3ffe0df Reviewed-on: https://chromium-review.googlesource.com/778184 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6226b8df 2017-11-09T13:08:30 Vulkan: Fix missing index buffer usage. The newer validation layers picked up this missing bit. BUG=angleproject:2237 Change-Id: I5bb2f1db3a4e284c003de0f5b23f7f613056af3a Reviewed-on: https://chromium-review.googlesource.com/760637 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Corentin Wallez 336129f6 2017-10-17T15:55:40 Use a packed enum for buffer targets. BUG=angleproject:2169 Change-Id: I4e08973d0e16404b7b8ee2f119e29ac502e28669 Reviewed-on: https://chromium-review.googlesource.com/723865 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>