|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| android/ | | 03-May-2024 | - | 1,164 | 764 |
| doc/ | | 03-May-2024 | - | 814 | 600 |
| fuchsia/ | | 03-May-2024 | - | 205 | 120 |
| ggp/ | | 03-May-2024 | - | 196 | 118 |
| linux/ | | 03-May-2024 | - | 2,360 | 1,606 |
| mac/ | | 03-May-2024 | - | 602 | 446 |
| null/ | | 03-May-2024 | - | 105 | 61 |
| shaders/ | | 03-May-2024 | - | 35,501 | 33,374 |
| win32/ | | 03-May-2024 | - | 316 | 217 |
| AllocatorHelperPool.cpp | D | 03-May-2024 | 1.8 KiB | 66 | 45 |
| AllocatorHelperPool.h | D | 03-May-2024 | 5.4 KiB | 161 | 106 |
| AllocatorHelperRing.cpp | D | 03-May-2024 | 3.4 KiB | 127 | 100 |
| AllocatorHelperRing.h | D | 03-May-2024 | 5.2 KiB | 159 | 113 |
| BUILD.gn | D | 03-May-2024 | 5.3 KiB | 171 | 143 |
| BufferVk.cpp | D | 03-May-2024 | 47.6 KiB | 1,235 | 902 |
| BufferVk.h | D | 03-May-2024 | 10.7 KiB | 261 | 195 |
| CLCommandQueueVk.cpp | D | 03-May-2024 | 510 | 20 | 8 |
| CLCommandQueueVk.h | D | 03-May-2024 | 745 | 29 | 14 |
| CLContextVk.cpp | D | 03-May-2024 | 451 | 18 | 6 |
| CLContextVk.h | D | 03-May-2024 | 677 | 28 | 14 |
| CLDeviceVk.cpp | D | 03-May-2024 | 1.4 KiB | 59 | 39 |
| CLDeviceVk.h | D | 03-May-2024 | 1.3 KiB | 41 | 24 |
| CLEventVk.cpp | D | 03-May-2024 | 429 | 18 | 6 |
| CLEventVk.h | D | 03-May-2024 | 651 | 28 | 14 |
| CLKernelVk.cpp | D | 03-May-2024 | 440 | 18 | 6 |
| CLKernelVk.h | D | 03-May-2024 | 664 | 28 | 14 |
| CLMemoryVk.cpp | D | 03-May-2024 | 440 | 18 | 6 |
| CLMemoryVk.h | D | 03-May-2024 | 664 | 28 | 14 |
| CLPlatformVk.cpp | D | 03-May-2024 | 3.1 KiB | 109 | 83 |
| CLPlatformVk.h | D | 03-May-2024 | 1.5 KiB | 53 | 32 |
| CLProgramVk.cpp | D | 03-May-2024 | 451 | 18 | 6 |
| CLProgramVk.h | D | 03-May-2024 | 677 | 28 | 14 |
| CLSamplerVk.cpp | D | 03-May-2024 | 451 | 18 | 6 |
| CLSamplerVk.h | D | 03-May-2024 | 677 | 28 | 14 |
| CommandGraph.cpp | D | 03-May-2024 | 50.7 KiB | 1,379 | 1,097 |
| CommandGraph.h | D | 03-May-2024 | 31 KiB | 814 | 507 |
| CommandProcessor.cpp | D | 03-May-2024 | 65.1 KiB | 1,841 | 1,468 |
| CommandProcessor.h | D | 03-May-2024 | 26.6 KiB | 684 | 487 |
| CompilerVk.cpp | D | 03-May-2024 | 537 | 27 | 11 |
| CompilerVk.h | D | 03-May-2024 | 735 | 31 | 14 |
| ContextVk.cpp | D | 03-May-2024 | 351.7 KiB | 8,522 | 6,340 |
| ContextVk.h | D | 03-May-2024 | 87 KiB | 1,717 | 1,191 |
| DebugAnnotatorVk.cpp | D | 03-May-2024 | 1.9 KiB | 63 | 47 |
| DebugAnnotatorVk.h | D | 03-May-2024 | 1.1 KiB | 36 | 21 |
| DeviceVk.cpp | D | 03-May-2024 | 6.7 KiB | 223 | 185 |
| DeviceVk.h | D | 03-May-2024 | 2.2 KiB | 60 | 38 |
| DisplayVk.cpp | D | 03-May-2024 | 21.3 KiB | 596 | 474 |
| DisplayVk.h | D | 03-May-2024 | 6.1 KiB | 141 | 95 |
| DisplayVk_api.h | D | 03-May-2024 | 2.1 KiB | 65 | 41 |
| FenceNVVk.cpp | D | 03-May-2024 | 1.4 KiB | 54 | 34 |
| FenceNVVk.h | D | 03-May-2024 | 960 | 35 | 20 |
| FramebufferVk.cpp | D | 03-May-2024 | 141.7 KiB | 3,266 | 2,419 |
| FramebufferVk.h | D | 03-May-2024 | 13.8 KiB | 305 | 224 |
| ImageVk.cpp | D | 03-May-2024 | 5.4 KiB | 172 | 127 |
| ImageVk.h | D | 03-May-2024 | 1.6 KiB | 61 | 36 |
| MemoryObjectVk.cpp | D | 03-May-2024 | 9.2 KiB | 263 | 207 |
| MemoryObjectVk.h | D | 03-May-2024 | 2.4 KiB | 69 | 46 |
| MemoryTracking.cpp | D | 03-May-2024 | 23.4 KiB | 608 | 497 |
| MemoryTracking.h | D | 03-May-2024 | 7.6 KiB | 222 | 160 |
| OWNERS | D | 03-May-2024 | 40 | 3 | 2 |
| OverlayVk.cpp | D | 03-May-2024 | 7.1 KiB | 171 | 123 |
| OverlayVk.h | D | 03-May-2024 | 1.2 KiB | 47 | 27 |
| PersistentCommandPool.cpp | D | 03-May-2024 | 3.6 KiB | 119 | 79 |
| PersistentCommandPool.h | D | 03-May-2024 | 1.2 KiB | 53 | 28 |
| ProgramExecutableVk.cpp | D | 03-May-2024 | 78.2 KiB | 1,874 | 1,448 |
| ProgramExecutableVk.h | D | 03-May-2024 | 21.6 KiB | 457 | 341 |
| ProgramPipelineVk.cpp | D | 03-May-2024 | 4.3 KiB | 114 | 79 |
| ProgramPipelineVk.h | D | 03-May-2024 | 1.5 KiB | 50 | 28 |
| ProgramVk.cpp | D | 03-May-2024 | 22.1 KiB | 632 | 496 |
| ProgramVk.h | D | 03-May-2024 | 6.9 KiB | 155 | 124 |
| QueryVk.cpp | D | 03-May-2024 | 23.2 KiB | 659 | 465 |
| QueryVk.h | D | 03-May-2024 | 3.3 KiB | 87 | 51 |
| README.md | D | 03-May-2024 | 4.9 KiB | 96 | 72 |
| RenderTargetVk.cpp | D | 03-May-2024 | 14.5 KiB | 389 | 300 |
| RenderTargetVk.h | D | 03-May-2024 | 10.3 KiB | 234 | 119 |
| RenderbufferVk.cpp | D | 03-May-2024 | 16.5 KiB | 412 | 322 |
| RenderbufferVk.h | D | 03-May-2024 | 5.9 KiB | 135 | 91 |
| RendererVk.cpp | D | 03-May-2024 | 251.8 KiB | 5,986 | 4,266 |
| RendererVk.h | D | 03-May-2024 | 48.3 KiB | 1,162 | 883 |
| ResourceVk.cpp | D | 03-May-2024 | 2.7 KiB | 110 | 80 |
| ResourceVk.h | D | 03-May-2024 | 8.7 KiB | 278 | 193 |
| SamplerVk.cpp | D | 03-May-2024 | 1.2 KiB | 49 | 29 |
| SamplerVk.h | D | 03-May-2024 | 1 KiB | 42 | 24 |
| SecondaryCommandBuffer.cpp | D | 03-May-2024 | 39.6 KiB | 833 | 807 |
| SecondaryCommandBuffer.h | D | 03-May-2024 | 69.5 KiB | 1,885 | 1,595 |
| SecondaryCommandPool.cpp | D | 03-May-2024 | 4 KiB | 127 | 96 |
| SecondaryCommandPool.h | D | 03-May-2024 | 2.2 KiB | 70 | 33 |
| SemaphoreVk.cpp | D | 03-May-2024 | 10.3 KiB | 266 | 180 |
| SemaphoreVk.h | D | 03-May-2024 | 1.6 KiB | 50 | 30 |
| ShaderInterfaceVariableInfoMap.cpp | D | 03-May-2024 | 5.6 KiB | 156 | 125 |
| ShaderInterfaceVariableInfoMap.h | D | 03-May-2024 | 6.8 KiB | 166 | 130 |
| ShaderVk.cpp | D | 03-May-2024 | 4.2 KiB | 140 | 95 |
| ShaderVk.h | D | 03-May-2024 | 913 | 34 | 17 |
| ShareGroupVk.cpp | D | 03-May-2024 | 18 KiB | 515 | 392 |
| ShareGroupVk.h | D | 03-May-2024 | 6.7 KiB | 173 | 107 |
| Suballocation.cpp | D | 03-May-2024 | 6.6 KiB | 203 | 165 |
| Suballocation.h | D | 03-May-2024 | 13.6 KiB | 420 | 336 |
| SurfaceVk.cpp | D | 03-May-2024 | 129.1 KiB | 3,236 | 2,327 |
| SurfaceVk.h | D | 03-May-2024 | 25.4 KiB | 565 | 338 |
| SyncVk.cpp | D | 03-May-2024 | 20.4 KiB | 640 | 473 |
| SyncVk.h | D | 03-May-2024 | 6.2 KiB | 188 | 132 |
| TextureVk.cpp | D | 03-May-2024 | 169.2 KiB | 3,937 | 2,897 |
| TextureVk.h | D | 03-May-2024 | 33 KiB | 680 | 480 |
| TransformFeedbackVk.cpp | D | 03-May-2024 | 12.2 KiB | 328 | 264 |
| TransformFeedbackVk.h | D | 03-May-2024 | 4.8 KiB | 141 | 97 |
| UtilsVk.cpp | D | 03-May-2024 | 186.4 KiB | 4,412 | 3,242 |
| UtilsVk.h | D | 03-May-2024 | 27.2 KiB | 695 | 547 |
| VertexArrayVk.cpp | D | 03-May-2024 | 51.4 KiB | 1,127 | 877 |
| VertexArrayVk.h | D | 03-May-2024 | 7.7 KiB | 183 | 133 |
| VkImageImageSiblingVk.cpp | D | 03-May-2024 | 4.6 KiB | 141 | 102 |
| VkImageImageSiblingVk.h | D | 03-May-2024 | 1.6 KiB | 54 | 31 |
| VulkanSecondaryCommandBuffer.cpp | D | 03-May-2024 | 3.7 KiB | 111 | 84 |
| VulkanSecondaryCommandBuffer.h | D | 03-May-2024 | 26.8 KiB | 661 | 568 |
| cl_types.h | D | 03-May-2024 | 518 | 23 | 10 |
| gen_vk_format_table.py | D | 03-May-2024 | 9.1 KiB | 288 | 214 |
| gen_vk_internal_shaders.py | D | 03-May-2024 | 29.3 KiB | 815 | 562 |
| gen_vk_mandatory_format_support_table.py | D | 03-May-2024 | 5.2 KiB | 147 | 109 |
| spv_utils.cpp | D | 03-May-2024 | 196.5 KiB | 5,018 | 3,626 |
| spv_utils.h | D | 03-May-2024 | 6 KiB | 145 | 92 |
| vk_cache_utils.cpp | D | 03-May-2024 | 307.1 KiB | 7,287 | 5,840 |
| vk_cache_utils.h | D | 03-May-2024 | 101.4 KiB | 2,609 | 1,846 |
| vk_caps_utils.cpp | D | 03-May-2024 | 68.6 KiB | 1,397 | 862 |
| vk_caps_utils.h | D | 03-May-2024 | 2.5 KiB | 82 | 51 |
| vk_command_buffer_utils.h | D | 03-May-2024 | 1.6 KiB | 58 | 33 |
| vk_format_map.json | D | 03-May-2024 | 22.7 KiB | 628 | 623 |
| vk_format_table_autogen.cpp | D | 03-May-2024 | 149.1 KiB | 3,071 | 2,742 |
| vk_format_utils.cpp | D | 03-May-2024 | 21.5 KiB | 529 | 405 |
| vk_format_utils.h | D | 03-May-2024 | 9.7 KiB | 262 | 175 |
| vk_helpers.cpp | D | 03-May-2024 | 447.3 KiB | 11,042 | 8,696 |
| vk_helpers.h | D | 03-May-2024 | 150.2 KiB | 3,493 | 2,556 |
| vk_internal_shaders_autogen.cpp | D | 03-May-2024 | 32.7 KiB | 598 | 554 |
| vk_internal_shaders_autogen.gni | D | 03-May-2024 | 7.2 KiB | 159 | 157 |
| vk_internal_shaders_autogen.h | D | 03-May-2024 | 9.3 KiB | 291 | 258 |
| vk_mandatory_format_support_data.json | D | 03-May-2024 | 17.7 KiB | 439 | 439 |
| vk_mandatory_format_support_table_autogen.cpp | D | 03-May-2024 | 14.1 KiB | 301 | 283 |
| vk_mem_alloc_wrapper.cpp | D | 03-May-2024 | 14.1 KiB | 354 | 301 |
| vk_mem_alloc_wrapper.h | D | 03-May-2024 | 6.4 KiB | 151 | 115 |
| vk_utils.cpp | D | 03-May-2024 | 64.8 KiB | 1,757 | 1,424 |
| vk_utils.h | D | 03-May-2024 | 43.2 KiB | 1,334 | 1,006 |
| vk_wrapper.h | D | 03-May-2024 | 71.8 KiB | 2,026 | 1,678 |
| vulkan_backend.gni | D | 03-May-2024 | 5.4 KiB | 235 | 222 |
README.md
1# ANGLE: Vulkan Back-end
2
3ANGLE's Vulkan back-end implementation lives in this folder.
4
5[Vulkan](https://www.khronos.org/vulkan/) is an explicit graphics API. It has a lot in common with
6other explicit APIs such as Microsoft's [D3D12][D3D12 Guide] and Apple's
7[Metal](https://developer.apple.com/metal/). Compared to APIs like OpenGL or D3D11 explicit APIs can
8offer a number of significant benefits:
9
10 * Lower API call CPU overhead.
11 * A smaller API surface with more direct hardware control.
12 * Better support for multi-core programming.
13 * Vulkan in particular has open-source tooling and tests.
14
15[D3D12 Guide]: https://docs.microsoft.com/en-us/windows/desktop/direct3d12/directx-12-programming-guide
16
17## Back-end Design
18
19The [`RendererVk`](RendererVk.cpp) class represents an `EGLDisplay`. `RendererVk` owns shared global
20resources like the [VkDevice][VkDevice], [VkQueue][VkQueue], the [Vulkan format tables](vk_format_utils.h)
21and [internal Vulkan shaders](shaders). The [ContextVk](ContextVk.cpp) class implements the back-end
22of a front-end OpenGL Context. ContextVk processes state changes and handles action commands like
23`glDrawArrays` and `glDrawElements`.
24
25## Command recording
26
27A render pass has three states: `unstarted`, started and active (we call it `active` in short),
28started but inactive (we call it `inactive` in short). The back-end records commands into command
29buffers via the following `ContextVk` APIs:
30
31 * `beginNewRenderPass`: Writes out (aka flushes) prior pending commands into a primary command
32 buffer, then starts a new render pass. Returns a secondary command buffer *inside* a render pass
33instance.
34 * `getOutsideRenderPassCommandBuffer`: May flush prior command buffers and close the render pass if
35 necessary, in addition to issuing the appropriate barriers. Returns a secondary command buffer
36*outside* a render pass instance.
37 * `getStartedRenderPassCommands`: Returns a reference to the currently open render pass' commands
38 buffer.
39 * `onRenderPassFinished`: Puts render pass into inactive state where you can not record more
40 commands into secondary command buffer, except in some special cases where ANGLE does some
41optimization internally.
42 * `flushCommandsAndEndRenderPassWithoutSubmit`: Marks the end of render pass. It flushes secondary
43 command buffer into vulkan's primary command buffer, puts secondary command buffer back to
44unstarted state and then goes into recycler for reuse.
45
46The back-end (mostly) records Image and Buffer barriers through additional `CommandBufferAccess`
47APIs, the result of which is passed to `getOutsideRenderPassCommandBuffer`. Note that the barriers
48are not actually recorded until `getOutsideRenderPassCommandBuffer` is called:
49
50 * `onBufferTransferRead` and `onBufferComputeShaderRead` accumulate `VkBuffer` read barriers.
51 * `onBufferTransferWrite` and `onBufferComputeShaderWrite` accumulate `VkBuffer` write barriers.
52 * `onBuffferSelfCopy` is a special case for `VkBuffer` self copies. It behaves the same as write.
53 * `onImageTransferRead` and `onImageComputerShadeRead` accumulate `VkImage` read barriers.
54 * `onImageTransferWrite` and `onImageComputerShadeWrite` accumulate `VkImage` write barriers.
55 * `onImageRenderPassRead` and `onImageRenderPassWrite` accumulate `VkImage` barriers inside a
56 started RenderPass.
57
58After the back-end records commands to the primary buffer and we flush (e.g. on swap) or when we call
59`RendererVk::finishQueueSerial`, ANGLE submits the primary command buffer to a `VkQueue`.
60
61See the [code][CommandAPIs] for more details.
62
63### Simple command recording example
64
65In this example we'll be recording a buffer copy command:
66
67```
68 // Ensure that ANGLE sets proper read and write barriers for the Buffers.
69 vk::CommandBufferAccess access;
70 access.onBufferTransferWrite(dstBuffer);
71 access.onBufferTransferRead(srcBuffer);
72
73 // Get a pointer to a secondary command buffer for command recording.
74 vk::OutsideRenderPassCommandBuffer *commandBuffer;
75 ANGLE_TRY(contextVk->getOutsideRenderPassCommandBuffer(access, &commandBuffer));
76
77 // Record the copy command into the secondary buffer. We're done!
78 commandBuffer->copyBuffer(srcBuffer->getBuffer(), dstBuffer->getBuffer(), copyCount, copies);
79```
80
81## Additional Reading
82
83More implementation details can be found in the `doc` directory:
84
85- [Fast OpenGL State Transitions](doc/FastOpenGLStateTransitions.md)
86- [Shader Module Compilation](doc/ShaderModuleCompilation.md)
87- [OpenGL Line Segment Rasterization](doc/OpenGLLineSegmentRasterization.md)
88- [Format Tables and Emulation](doc/FormatTablesAndEmulation.md)
89- [Deferred Clears](doc/DeferredClears.md)
90- [Queries](doc/Queries.md)
91
92[VkDevice]: https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkDevice.html
93[VkQueue]: https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkQueue.html
94[CommandAPIs]: https://chromium.googlesource.com/angle/angle/+/df31624eaf3df986a0bdf3f58a87b79b0cc8db5c/src/libANGLE/renderer/vulkan/ContextVk.h#620
95
96