src/libANGLE/renderer/vulkan/VertexArrayVk.cpp


Log

Author Commit Date CI Message
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>
Jamie Madill a2f043d8 2018-07-10T17:21:20 dEQP: Implement platform error handling. Also downgrades several Vulkan UNIMPLEMENTED() to WARN(). Also downgrades a couple D3D-specific errors to warnings. Also downgrades an undefined behaviour integer clear error to warning. Also includes suppressions for failing D3D11 ES 3.1 SSBO tests. Also includes suppressions for failing Android GLES format tests. Also includes suppressions for failing Android Vulkan buffer tests. Bug: angleproject:2552 Bug: angleproject:2567 Bug: angleproject:1951 Bug: angleproject:2405 Change-Id: Ie619085021d42012cd578b669f7ff4252ca41a58 Reviewed-on: https://chromium-review.googlesource.com/1062791 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Luc Ferron fa5d84be 2018-06-28T10:40:04 Vulkan: Fix offset handling for vertex buffers Bug: angleproject:2580 Change-Id: I22f62a8549e998275224a6b1f9c133cf31ebb5b9 Reviewed-on: https://chromium-review.googlesource.com/1118419 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Frank Henigman 8c379f36 2018-06-21T19:55:05 Vulkan: enable some vertex data tests. Enable tests that don't use fixed or unnormalized short/byte vertex data, with some exceptions for Android and AMD. BUG=angleproject:2405 Change-Id: I9e37ebca3a873617f11fee065b7a0ba67f80998c Reviewed-on: https://chromium-review.googlesource.com/1111317 Commit-Queue: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
Rafael Cintron 05a449a7 2018-06-20T18:08:04 Replace reinterpret_cast with safer or no cast When casting types to one another in C++, the weaker the cast, the better. This change replaces instances of reinterpret_cast with static_cast or no cast where it safe and correct to do so. BUG=angleproject:2683 Change-Id: I99c9033614a65282ae1d78cf0f4b80fabd75877a Reviewed-on: https://chromium-review.googlesource.com/1109396 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Frank Henigman 2ad498eb 2018-06-20T13:19:01 Vulkan: get vertex formats from format table. Use the Vulkan format table to look up the Vulkan format for vertex data. This will let us support more vertex formats by adding them to the table. It also eliminates one usage of gl::VertexFormatType. No functional change. BUG=angleproject:2405 BUG=angleproject:2531 Change-Id: I73eb69ccac50d427de3e7d5479f92bb17c49aed3 Reviewed-on: https://chromium-review.googlesource.com/1051028 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org> Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
Luc Ferron 6ed167a9 2018-06-13T13:45:55 Vulkan: Implement conversion to uint16 for drawElements with ubytes Bug: angleproject:2646 Bug: angleproject:2659 Change-Id: If3c7a2b77d6acd18c8ca2522a427a43e10ed6db2 Reviewed-on: https://chromium-review.googlesource.com/1099420 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Luc Ferron 49aacad5 2018-06-12T08:33:59 Vulkan: Support the indices offset in drawElements calls Also fixes an issue in buffer copy synchronization. Bug: angleproject:2645 Change-Id: Ibca7052daaf1e6fe37913c8a8216ec33c66426b6 Reviewed-on: https://chromium-review.googlesource.com/1096911 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
Luc Ferron 3e313805 2018-06-11T14:44:33 Vulkan: Line loop edge case with ubyte indices Bug: angleproject:2637 Change-Id: I2cec129ed1aa0e55e0dbf1d353caa65a51c528a3 Reviewed-on: https://chromium-review.googlesource.com/1096017 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Luc Ferron 387b3b36 2018-05-28T10:11:57 Vulkan: Fix a line loop edge case causing validation errors Bug: angleproject:2563 Change-Id: I6e908fbd3e5725dc3f355f8b0561f2177b61dff6 Reviewed-on: https://chromium-review.googlesource.com/1075291 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 316c6065 2018-05-29T10:49:45 Vulkan: Call GraphResource instead of GraphNode. We don't need to use the CommandGraphNode class directly. This CL consolidates our code so we never call the GraphNodes class directly. Instead we call operations on GraphResource. This should simplify the interaction with APIs from the various graph and dependency management classes in the Vulkan back-end. A new concept of 'starting' vs 'appending' commands is introduced. Appending tries to avoid starting new command buffers when possible. Should not change how the graphs are constructed, and mostly be a refactoring change. There may be minor behaviour changes to some commands. Bug: angleproject:2539 Change-Id: Ia971e5cacb1164b9b3b22fa4a0a55b954d81f10e Reviewed-on: https://chromium-review.googlesource.com/1052068 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 493f9571 2018-05-24T19:52:15 Add PrimitiveMode packed GLenum. Bug: angleproject:2574 Change-Id: I3d7bd7ca0d69a364a611dc04799ea34906fc4a6c Reviewed-on: https://chromium-review.googlesource.com/1067114 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Luc Ferron a9ab0f37 2018-05-17T17:03:55 Vulkan: Fix DynamicBuffer usages, need to use specific alignment The alignment used to allocate VkBuffers in the VkBuffer needs to be at least the size of the nonCoherentAtomSize defined in the limits of the VkDevicePhysicalProperties. The latest roll of the vulkan-validation-layers added that check and caused a bunch of errors. This is fixing them. Bug: angleproject:2565 Change-Id: Ia2ad506dce7966adb6220c52ea891903922c47d0 Reviewed-on: https://chromium-review.googlesource.com/1064950 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 18e323ab 2018-05-11T16:54:17 D3D11: Fix out-of-range access with robust access. When using a vertex buffer with DYNAMIC usage, with robust buffer access enabled, we would sometimes read out-of-bounds when using very large values for the index range. An unchecked signed addition would overflow and lead to reading a negative offset. Fix this problem by keeping the value size_t whenever possible. Also do clamped casts when converting to a smaller values. Also adds a regression test. Bug: chromium:842028 Change-Id: Ie630ac857c6acfc0bace849a03eebfbaa2fbe89a Reviewed-on: https://chromium-review.googlesource.com/1055928 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Luc Ferron 61859817 2018-05-09T14:17:39 Vulkan: Fix use-after-free with DynamicBuffer. The implementation of DynamicBuffer before my changes could have some issues in the following use case: - Allocate buffer 1 for Texture 1 (with size as big as the full buffer size) - Allocate buffer 2 for Texture 2 (triggers creation of a new underlying BufferVk and releases the buffer 1 to the Renderer) - Render with Texture 2 (texture 1 hasn't been flushed yet) - swap buffers (causes garbage in the renderer to be cleaned up) - Try rendering with Texture 1, and you'll get an error stating that the buffer we're trying to copy is not valid (because its already been freed). This set of changes: - Add a new test that specifically triggers this case. - enables the texture.filtering.cube* tests in dEQP. - Fixes the issue by adding a manual releasing pattern of the buffers in DynamicBuffer. Bug: angleproject:2505 Change-Id: I207ce4a694016766f008cca67d82b252f460e0df Reviewed-on: https://chromium-review.googlesource.com/1052551 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
Luc Ferron a4fa9c27 2018-04-13T07:00:56 Vulkan: drawElements with GL_LINE_LOOP and an offset Also enables a test in LineLoopTest that validates this case. Bug: angleproject:2473 Change-Id: Icb4c5735c11be40cdeceaa051f5a5cef33fd22c6 Reviewed-on: https://chromium-review.googlesource.com/1011669 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill bcef3224 2018-04-13T15:19:11 Move client attribs mask to front-end. The Vulkan and GL back-ends both had a client attributes mask. This consolidates them into the front-end, where it can also be used in the validation layer. Also includes a fix which was incorrectly setting the enabled mask in setVertexAttribFormatImpl. Bug: angleproject:1391 Change-Id: I5e45c1e2a56b30a36dec1482d170592c30a16d40 Reviewed-on: https://chromium-review.googlesource.com/1008272 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
Luc Ferron a912046d 2018-04-12T13:11:03 Vulkan: DrawElements with line loops client side memory support - Also enables 6 new tests in LineLoopTests.cpp in angle_end2end Bug: angleproject:2458 Change-Id: I4aec12b0ac780e81e6811f1199a5acaf17d9b982 Reviewed-on: https://chromium-review.googlesource.com/1010411 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
Luc Ferron 983c429f 2018-04-10T13:05:45 Vulkan: Lineloops edge base bugfix and new tests The dynamic buffer we are using in the LineLoopHelper wasn't able to support switching between different allocation sizes. Fix this by simply using a min alignment of the maximum allocation size we can reach. Adds 2 new tests to validate these calls in StateChangeTest.cpp Bug: angleproject:2458 Change-Id: I9d224e7dcfcd7627010832ca30dd9e1b9eceea4e Reviewed-on: https://chromium-review.googlesource.com/1007335 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>