src/libANGLE/renderer/vulkan/RenderTargetVk.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi 9fa248e1 2019-05-06T14:55:18 Vulkan: Implement EXT_draw_buffers In GLES, color attachments are referenced by their indices. These indices match between the API and GLSL. For example, if a shader has: layout(location=0) out color; layout(location=3) out roughness; Then GLES would bind and enable GL_COLOR_ATTACHMENT0 and GL_COLOR_ATTACHMENT3. In Vulkan, the framebuffer object and the corresponding renderpass define the color attachments, and they don't allow gaps in color attachments as GLES does. A render subpass creates the mapping between the color attachments as defined in the framebuffer and the attachments used by the shader (with possible gaps). This change packs the enabled GL color attachments for the sake of the framebuffer, and sets the subpass up in such a way that the shaders continue to use the same color output indices as GLES. In the example above, we have the attachment indices as follows: Status | GLES | GLSL | RenderPass | Subpass enabled 0 0 0 0 disabled 1 - VK_ATTACHMENT_UNUSED disabled 2 - VK_ATTACHMENT_UNUSED enabled 3 3 1 1 That is, the array of color attachments in the Vulkan framebuffer/renderpass is: [0] = GL color attachment 0 [1] = GL color attachment 3 And the array of color attachment references in the Vulkan render subpass is: [0] = 0 (index 0 of the renderpass attachment array) [1] = VK_ATTACHMENT_UNUSED [2] = VK_ATTACHMENT_UNUSED [3] = 1 (index 1 of the renderpass attachment array) Bug: angleproject:2394 Change-Id: Ib6cd2b60882643ea152986eee453270d09cd4aed Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1595442 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 0631e19b 2019-04-18T16:09:12 Vulkan: Rename Vulkan "Texture" format to "Image" Also adds some comments to vk_format_utils.h. Bug: angleproject:3372 Change-Id: I529b9b189e4cdfd400c3c981a47139727d9954ab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1565062 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 65d10f3b 2019-03-21T16:30:31 Vulkan: Implement robust resource initialization If a texture or renderbuffer needs to be cleared for robust access or due to having emulated channels, it is immediately cleared. The former relies on a front-end feature that optimizes robust access clears only to levels and layers that are not fully initialized through data upload. Bug: angleproject:2722 Change-Id: Icdab856eb4ffe963f78569b6d80d9ff5cb27ff9b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1535056 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Courtney Goeltzenleuchter 5a604a5f 2019-03-27T14:22:50 Ensure framebuffer is up-to-date before drawing The dEQP-GLES2.functional.fbo.render.texsubimage.between_render_tex2d* test was failing because a TexSubImage call modifying the framebuffer wasn't being applied before a subsequent DrawElements call and thus getting an incorrect result. Bug: angleproject:3249 Test: angle_deqp_gles2_tests --gtest_filter=dEQP.GLES2/functional_fbo_render_texsubimage_between_render_tex2d_rgb --use-angle=vulkan Change-Id: I90f791957e6536c5c62fb731d52cd486ab5c05c1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1542361 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 6854940d 2019-03-25T23:30:49 Vulkan: Correct RenderTargetVk extents to image mip RenderTargetVk::getImageExtents() was always returning the base level extents of the image it was viewing. This resulted in incorrect extents being provided to various framebuffer- and renderpass-related declarations. The function is renamed to `getExtents()` and returns the appropriate mip extents. Bug: angleproject:2361 Change-Id: I059a8d19fcb140c9095107d935aa3e5cb1852fc2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1537327 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@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>
Shahbaz Youssefi 028df5f5 2019-02-13T12:57:10 Vulkan: Implement transfer path for texture copy This is primarily in preparation for compressed texture copy, but has the following side effect: - When transfer is possible, it's faster than draw - When texture format does not support draw (but transfer is possible), it will avoid copying through CPU. Bug: angleproject:2670 Change-Id: I49e1b51e6ccec875db3f971106687c7d48c4916f Reviewed-on: https://chromium-review.googlesource.com/c/1470595 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Geoff Lang 4a298703 2019-01-18T10:49:36 Vulkan: Support creating EGL images from non-zero mipmaps of textures. Store a mip offset in TextureVK to apply to all operations on the ImageHelper. There is no need to store the mip offset in RenderbufferVk because it creates the resource with the mip offset on the call to setStorageEGLImageTarget. Store a mipmap level in the RenderTargetVk object so that clear operations will target the correct mipmap of the image. BUG=angleproject:2668 Change-Id: Ie976e3dd3a8de8135a7fbb8c84bd51eec0dddce8 Reviewed-on: https://chromium-review.googlesource.com/c/1422059 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 7dafe3eb 2019-01-28T11:39:15 Vulkan: optimize image memory barriers Each image was tracking its current layout, but not the pipeline stage it was used. Additionally, the barrier access masks were inferred from the layout. This incurred two inefficiencies: - The src pipeline stage mask often included all stages, causing unnecessarily heavy barriers. - The access masks included all possible accesses by a layout, which in some cases was overkill, like VK_ACCESS_MEMORY_WRITE_BIT for VK_IMAGE_LAYOUT_GENERAL (which will eventually used for compute shader output). This change instead creates an enum where each element represents the layout, the stage and access masks when transitioning into the layout and the stage and access masks when transitioning out of that layout. The image will instead track a value of this enum (instead of VkImageLayout), which allows it to create the layout transition barriers as tight as possible, since it includes all the necessary information. Bug: angleproject:2999 Change-Id: I91535ce06d10530a6fc217ad3b94b7e288521e25 Reviewed-on: https://chromium-review.googlesource.com/c/1440074 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang f3e823db 2019-01-14T12:40:34 Vulkan: Store ImageHelper as a pointer in TextureVk and RenderbufferVk Storing ImageHelper as a pointer allows the storage to be swapped or shared with other objects. BUG=angleproject:2668 Change-Id: I2e51f24737be59ffe9f472e9b0b592774a792cd1 Reviewed-on: https://chromium-review.googlesource.com/c/1409404 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi c81e7bfe 2019-01-18T15:35:55 Vulkan: refactor CommandGraphResource Merged back RecordableGraphResource into CommandGraphResource. Queries didn't really need to be a resource, as they always inserted separate single-command nodes in the graph. The CommandGraph class is augmented with a few functions that generate such nodes. This is in preparation for debug markers, as they too require such nodes. Bug: angleproject:2853 Change-Id: I5251a0e0fdd42ed1126921b4acc13687a14af9cd Reviewed-on: https://chromium-review.googlesource.com/c/1422549 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 29b49417 2019-01-07T14:03:06 Make copy texture test more extensive By doing the copy multiple times, we exercise both paths where the destination is already initialized and when it's not. This adds tests for all combinations of formats and flags. Bug: angleproject:2958 Change-Id: I56afb44496acd1b4d5a8527f4dbee29afbac9c81 Reviewed-on: https://chromium-review.googlesource.com/c/1398643 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi f83a28a6 2018-12-09T03:48:34 Vulkan: Shader path for framebuffer-to-texture copy Part 1 in a series of changes to perform image copies on the GPU. Bug: angleproject:2958 Change-Id: I6264a880865c4738c0866f2dc71af63425fc4118 Reviewed-on: https://chromium-review.googlesource.com/c/1370724 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 502d2e21 2018-11-01T11:06:23 Vulkan: Crunch RenderPassDesc. This reduces the size of the RenderPass desc from 64 to 12 bytes. Bug: angleproject:2522 Change-Id: Iff2df87ba65be0bd976bba81c76c285cb0fa1ceb Reviewed-on: https://chromium-review.googlesource.com/c/1308459 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 193a284d 2018-10-30T17:28:41 Vulkan: Split vk::CommandGraphResource. This adds two subclasses: RecordableGraphResource and QueryGraphResource. Each specializes for Buffer/Image/Frambuffer use cases and Query use cases respectively. No virtual functions are added to keep best performance. We also change the CommandGraph API slightly to optimize away the check for a barrier resource. This requires exposing the set current barrier API on the CommandGraph. Bug: angleproject:2828 Change-Id: I1c23f52bfe04cc682a00b245d63c3ac9a651615d Reviewed-on: https://chromium-review.googlesource.com/c/1305994 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 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 3f3b358f 2018-09-14T10:38:44 Vulkan: Fix cube map attachment clears and readpixels. These were both missing the correct layer offset. Cache the layer inside the RenderTargetVk for easy access. Bug: angleproject:2470 Change-Id: I690dbf0702d7ec52f44ba0a9429b6ef0e51baf6b Reviewed-on: https://chromium-review.googlesource.com/1225910 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 71bb0267 2018-09-12T11:09:42 Vulkan: Implement cube map render targets. Each TextureVk now stores vectors of RenderTargetVks and ImageViews associated with the image faces. They are initialized lazily when the RenderTarget is queried in getAttachmentRenderTarget. There's still one missing edge case for handling clear with the Framebuffer when using cube maps. Also one additional test failure on Android. Bug: angleproject:2470 Change-Id: Ib959a3434a992cef010a11940cf2ee49e118ac17 Reviewed-on: https://chromium-review.googlesource.com/1220727 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Luc Ferron 1617e69e 2018-07-11T11:08:19 Vulkan: Implement depth/stencil blit with flip of the viewport - This makes all end2end tests pass successfully on Win/Nvidia with viewport flipping enabled. Bug: angleproject:2673 Change-Id: I031c0a0f5fb0aede58b59479e57c2c127bcb964c Reviewed-on: https://chromium-review.googlesource.com/1133703 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
Jamie Madill e4e2d0c5 2018-06-22T08:25:05 Vulkan: Add RenderTargetVk::getImageForRead. This helper method will also transition the Image to the correct read layout. We will need to revisit the implementation when working on simulatenous read. Bug: angleproject:2539 Change-Id: Id61404460f3ef0dbb054e6ac2dfc0b59adb78402 Reviewed-on: https://chromium-review.googlesource.com/1108378 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
Luc Ferron 5bdf8bd1 2018-06-20T09:51:37 Vulkan: enable the rest of dEQP tests in fbo.render.* Vulkan does not support separate depth and stencil attachments. Adding this check to checkStatus skips the relevant tests to that. There was also a bug in FramebufferVk::clear where we were not checking the number of bits for depth/stencil attachments before setting the aspects for clearing. Bug: angleproject:2597 Change-Id: Iabe9f77a51fc7aca08b8faf3cecc3df9f99a7f1e Reviewed-on: https://chromium-review.googlesource.com/1107847 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 bcf467f2 2018-05-23T09:46:00 Vulkan: Encapsulate RenderTargetVk. This makes the members private and adds more functionality. This moves more responsibility out of vk::CommandGraphNode and also makes the RenderPass init in the CommandGraphNode class better encapsulated. Bug: angleproject:2539 Change-Id: Ia16f3f39cf011548c6473805b8b28e284808e856 Reviewed-on: https://chromium-review.googlesource.com/1040279 Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill bc54342b 2018-03-30T10:43:19 Vulkan: Make RenderTargetVk use ImageHelper. Bug: angleproject:2318 Change-Id: I9bc4bb7f5bcd3029a31c8570809f253cf5e4b12a Reviewed-on: https://chromium-review.googlesource.com/980773 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Geoff Lang bd6ae4aa 2018-01-29T15:51:18 Vulkan: Don't create zero-sized textures. Make sure the old resources are deleted but do not create new resources. BUG=angleproject:2161 Change-Id: Ia6685e5c67b160d9bcd503983aee9607b2bd402c Reviewed-on: https://chromium-review.googlesource.com/891644 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 4c26fc2f 2017-02-24T11:04:10 Vulkan: Initial command queueing implementation. This removes the sychronous operation of the command buffers. It also introduces a serial type for assigning ids to queue operations. This gives us the ability to manage lifetimes of resources and track when they're no longer in use on the device. BUG=angleproject:1898 Change-Id: I91a4836d3098f1d7bd06cd389d88601a3a4826ab Reviewed-on: https://chromium-review.googlesource.com/428352 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 7b57b9d7 2017-01-13T09:33:38 Vulkan: Implement basic Clear and ReadPixels. This enables the simple operations clear test on Vulkan. The current implementation is very synchronous - it will block and finish the current command buffer if there is any possibility of a race. BUG=angleproject:1319 Change-Id: If01fe9a19ed6f539639a38786193d3626164cada Reviewed-on: https://chromium-review.googlesource.com/367754 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>