|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| android/ | | 03-May-2024 | - | 513 | 346 |
| doc/ | | 03-May-2024 | - | 568 | 421 |
| fuchsia/ | | 03-May-2024 | - | 201 | 117 |
| ggp/ | | 03-May-2024 | - | 201 | 122 |
| mac/ | | 03-May-2024 | - | 547 | 406 |
| shaders/ | | 03-May-2024 | - | 23,043 | 22,526 |
| win32/ | | 03-May-2024 | - | 305 | 209 |
| xcb/ | | 03-May-2024 | - | 265 | 170 |
| BUILD.gn | D | 03-May-2024 | 6.6 KiB | 275 | 248 |
| BufferVk.cpp | D | 03-May-2024 | 20.6 KiB | 583 | 412 |
| BufferVk.h | D | 03-May-2024 | 6.7 KiB | 185 | 132 |
| CommandGraph.cpp | D | 03-May-2024 | 50.7 KiB | 1,379 | 1,097 |
| CommandGraph.h | D | 03-May-2024 | 31 KiB | 814 | 507 |
| CompilerVk.cpp | D | 03-May-2024 | 536 | 27 | 11 |
| CompilerVk.h | D | 03-May-2024 | 735 | 31 | 14 |
| ContextVk.cpp | D | 03-May-2024 | 182.3 KiB | 4,774 | 3,652 |
| ContextVk.h | D | 03-May-2024 | 48.7 KiB | 1,119 | 784 |
| DeviceVk.cpp | D | 03-May-2024 | 843 | 45 | 26 |
| DeviceVk.h | D | 03-May-2024 | 889 | 35 | 19 |
| DisplayVk.cpp | D | 03-May-2024 | 8.7 KiB | 282 | 220 |
| DisplayVk.h | D | 03-May-2024 | 4.7 KiB | 119 | 76 |
| DisplayVk_api.h | D | 03-May-2024 | 1.6 KiB | 49 | 31 |
| FenceNVVk.cpp | D | 03-May-2024 | 1.4 KiB | 53 | 33 |
| FenceNVVk.h | D | 03-May-2024 | 960 | 35 | 20 |
| FramebufferVk.cpp | D | 03-May-2024 | 60.3 KiB | 1,468 | 1,113 |
| FramebufferVk.h | D | 03-May-2024 | 9.4 KiB | 204 | 148 |
| GlslangWrapperVk.cpp | D | 03-May-2024 | 3.6 KiB | 98 | 73 |
| GlslangWrapperVk.h | D | 03-May-2024 | 2.3 KiB | 56 | 37 |
| ImageVk.cpp | D | 03-May-2024 | 4.9 KiB | 154 | 114 |
| ImageVk.h | D | 03-May-2024 | 1.6 KiB | 62 | 37 |
| MemoryObjectVk.cpp | D | 03-May-2024 | 7.4 KiB | 233 | 186 |
| MemoryObjectVk.h | D | 03-May-2024 | 2 KiB | 61 | 40 |
| OWNERS | D | 03-May-2024 | 44 | 3 | 2 |
| OverlayVk.cpp | D | 03-May-2024 | 11.5 KiB | 279 | 199 |
| OverlayVk.h | D | 03-May-2024 | 1.7 KiB | 61 | 35 |
| PersistentCommandPool.cpp | D | 03-May-2024 | 3.1 KiB | 109 | 71 |
| PersistentCommandPool.h | D | 03-May-2024 | 1.2 KiB | 53 | 28 |
| ProgramExecutableVk.cpp | D | 03-May-2024 | 57.7 KiB | 1,441 | 1,109 |
| ProgramExecutableVk.h | D | 03-May-2024 | 10.4 KiB | 254 | 176 |
| ProgramPipelineVk.cpp | D | 03-May-2024 | 6.6 KiB | 181 | 131 |
| ProgramPipelineVk.h | D | 03-May-2024 | 1.9 KiB | 63 | 38 |
| ProgramVk.cpp | D | 03-May-2024 | 28 KiB | 796 | 625 |
| ProgramVk.h | D | 03-May-2024 | 8.9 KiB | 204 | 157 |
| QueryVk.cpp | D | 03-May-2024 | 9.6 KiB | 304 | 229 |
| QueryVk.h | D | 03-May-2024 | 2.2 KiB | 61 | 36 |
| README.md | D | 03-May-2024 | 4.1 KiB | 84 | 58 |
| RenderTargetVk.cpp | D | 03-May-2024 | 4.9 KiB | 164 | 127 |
| RenderTargetVk.h | D | 03-May-2024 | 3.2 KiB | 100 | 56 |
| RenderbufferVk.cpp | D | 03-May-2024 | 8.3 KiB | 230 | 178 |
| RenderbufferVk.h | D | 03-May-2024 | 3.1 KiB | 82 | 56 |
| RendererVk.cpp | D | 03-May-2024 | 82.6 KiB | 2,155 | 1,640 |
| RendererVk.h | D | 03-May-2024 | 13.8 KiB | 368 | 264 |
| ResourceVk.cpp | D | 03-May-2024 | 2.5 KiB | 118 | 80 |
| ResourceVk.h | D | 03-May-2024 | 5.5 KiB | 204 | 138 |
| SamplerVk.cpp | D | 03-May-2024 | 3.1 KiB | 82 | 57 |
| SamplerVk.h | D | 03-May-2024 | 1.2 KiB | 48 | 27 |
| SecondaryCommandBuffer.cpp | D | 03-May-2024 | 26.6 KiB | 566 | 541 |
| SecondaryCommandBuffer.h | D | 03-May-2024 | 50.2 KiB | 1,324 | 1,111 |
| SemaphoreVk.cpp | D | 03-May-2024 | 9.8 KiB | 268 | 189 |
| SemaphoreVk.h | D | 03-May-2024 | 1.6 KiB | 50 | 30 |
| ShaderVk.cpp | D | 03-May-2024 | 2.1 KiB | 76 | 48 |
| ShaderVk.h | D | 03-May-2024 | 911 | 34 | 17 |
| SurfaceVk.cpp | D | 03-May-2024 | 57.9 KiB | 1,559 | 1,148 |
| SurfaceVk.h | D | 03-May-2024 | 12.3 KiB | 314 | 214 |
| SyncVk.cpp | D | 03-May-2024 | 8.5 KiB | 300 | 224 |
| SyncVk.h | D | 03-May-2024 | 3.3 KiB | 108 | 75 |
| TextureVk.cpp | D | 03-May-2024 | 78.5 KiB | 1,861 | 1,415 |
| TextureVk.h | D | 03-May-2024 | 20.6 KiB | 439 | 326 |
| TransformFeedbackVk.cpp | D | 03-May-2024 | 13.2 KiB | 326 | 232 |
| TransformFeedbackVk.h | D | 03-May-2024 | 4.2 KiB | 109 | 72 |
| UtilsVk.cpp | D | 03-May-2024 | 83.3 KiB | 1,983 | 1,563 |
| UtilsVk.h | D | 03-May-2024 | 19.4 KiB | 484 | 364 |
| VertexArrayVk.cpp | D | 03-May-2024 | 39.5 KiB | 875 | 686 |
| VertexArrayVk.h | D | 03-May-2024 | 7.2 KiB | 170 | 126 |
| gen_vk_format_table.py | D | 03-May-2024 | 7.9 KiB | 245 | 181 |
| gen_vk_internal_shaders.py | D | 03-May-2024 | 25.9 KiB | 732 | 499 |
| gen_vk_mandatory_format_support_table.py | D | 03-May-2024 | 4.3 KiB | 144 | 103 |
| vk_cache_utils.cpp | D | 03-May-2024 | 81 KiB | 2,007 | 1,614 |
| vk_cache_utils.h | D | 03-May-2024 | 39.5 KiB | 989 | 687 |
| vk_caps_utils.cpp | D | 03-May-2024 | 36.6 KiB | 730 | 470 |
| vk_caps_utils.h | D | 03-May-2024 | 2.5 KiB | 83 | 51 |
| vk_ext_provoking_vertex.h | D | 03-May-2024 | 2.6 KiB | 66 | 43 |
| vk_format_map.json | D | 03-May-2024 | 18.6 KiB | 517 | 514 |
| vk_format_table_autogen.cpp | D | 03-May-2024 | 130.9 KiB | 2,609 | 2,305 |
| vk_format_utils.cpp | D | 03-May-2024 | 15.7 KiB | 407 | 309 |
| vk_format_utils.h | D | 03-May-2024 | 6.1 KiB | 175 | 107 |
| vk_helpers.cpp | D | 03-May-2024 | 157 KiB | 4,107 | 3,208 |
| vk_helpers.h | D | 03-May-2024 | 54.6 KiB | 1,345 | 915 |
| vk_internal_shaders_autogen.cpp | D | 03-May-2024 | 25.7 KiB | 475 | 439 |
| vk_internal_shaders_autogen.gni | D | 03-May-2024 | 5.8 KiB | 129 | 127 |
| vk_internal_shaders_autogen.h | D | 03-May-2024 | 8.4 KiB | 272 | 242 |
| 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 | 24.2 KiB | 610 | 404 |
| vk_mem_alloc_wrapper.cpp | D | 03-May-2024 | 4.4 KiB | 117 | 93 |
| vk_mem_alloc_wrapper.h | D | 03-May-2024 | 2 KiB | 58 | 36 |
| vk_utils.cpp | D | 03-May-2024 | 36.1 KiB | 1,033 | 886 |
| vk_utils.h | D | 03-May-2024 | 21.8 KiB | 730 | 546 |
| vk_wrapper.h | D | 03-May-2024 | 60.9 KiB | 1,710 | 1,410 |
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
27The back-end records commands into command buffers via the the following `ContextVk` APIs:
28
29 * `endRenderPassAndGetCommandBuffer`: returns a secondary command buffer *outside* a RenderPass instance.
30 * `flushAndBeginRenderPass`: returns a secondary command buffer *inside* a RenderPass instance.
31 * `flushAndGetPrimaryCommandBuffer`: returns the primary command buffer. You should rarely need this API.
32
33*Note*: All of these commands may write out (aka flush) prior pending commands into a primary
34command buffer. When a RenderPass is open `endRenderPassAndGetCommandBuffer` will flush the
35pending RenderPass commands. `flushAndBeginRenderPass` will flush out pending commands outside a
36RenderPass to a primary buffer. On submit ANGLE submits the primary command buffer to a `VkQueue`.
37
38If you need to record inside a RenderPass, use `flushAndBeginRenderPass`. Otherwise, use
39`endRenderPassAndGetCommandBuffer`. You should rarely need to call `flushAndGetPrimaryCommandBuffer`.
40It's there for commands like debug labels, barriers and queries that need to be recorded serially on
41the primary command buffer.
42
43The back-end usually records Image and Buffer barriers through additional `ContextVk` APIs:
44
45 * `onBufferRead` and `onBufferWrite` accumulate `VkBuffer` barriers.
46 * `onImageRead` and `onImageWrite` accumulate `VkImage` barriers.
47 * `onRenderPassImageWrite` is a special API for write barriers inside a RenderPass instance.
48
49After the back-end records commands to the primary buffer we flush (e.g. on swap) or when we call
50`ContextVk::finishToSerial`.
51
52See the [code][CommandAPIs] for more details.
53
54### Simple command recording example
55
56In this example we'll be recording a buffer copy command:
57
58```
59 # Ensure that ANGLE sets proper read and write barriers for the Buffers.
60 ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_TRANSFER_WRITE_BIT, destBuffer));
61 ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_TRANSFER_READ_BIT, srcBuffer));
62
63 # Get a pointer to a secondary command buffer for command recording. May "flush" the RP.
64 vk::CommandBuffer *commandBuffer;
65 ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
66
67 # Record the copy command into the secondary buffer. We're done!
68 commandBuffer->copyBuffer(srcBuffer->getBuffer(), destBuffer->getBuffer(), copyCount, copies);
69```
70
71## Additional Reading
72
73More implementation details can be found in the `doc` directory:
74
75- [Fast OpenGL State Transitions](doc/FastOpenGLStateTransitions.md)
76- [Shader Module Compilation](doc/ShaderModuleCompilation.md)
77- [OpenGL Line Segment Rasterization](doc/OpenGLLineSegmentRasterization.md)
78- [Format Tables and Emulation](doc/FormatTablesAndEmulation.md)
79
80[VkDevice]: https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkDevice.html
81[VkQueue]: https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkQueue.html
82[CommandAPIs]: https://chromium.googlesource.com/angle/angle/+/aa09ca69e4173cb14261e39be3b7bdf56bbd3840/src/libANGLE/renderer/vulkan/ContextVk.h#579
83
84