|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| android/ | | 03-May-2024 | - | 1,094 | 721 |
| doc/ | | 03-May-2024 | - | 726 | 556 |
| fuchsia/ | | 03-May-2024 | - | 205 | 120 |
| ggp/ | | 03-May-2024 | - | 198 | 119 |
| linux/ | | 03-May-2024 | - | 1,743 | 1,171 |
| mac/ | | 03-May-2024 | - | 614 | 456 |
| null/ | | 03-May-2024 | - | 105 | 61 |
| shaders/ | | 03-May-2024 | - | 31,166 | 29,203 |
| win32/ | | 03-May-2024 | - | 315 | 216 |
| BUILD.gn | D | 03-May-2024 | 8.3 KiB | 329 | 299 |
| BufferVk.cpp | D | 03-May-2024 | 39.2 KiB | 1,042 | 771 |
| BufferVk.h | D | 03-May-2024 | 9.8 KiB | 237 | 174 |
| 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 | 50.1 KiB | 1,447 | 1,168 |
| CommandProcessor.h | D | 03-May-2024 | 24.7 KiB | 648 | 472 |
| CompilerVk.cpp | D | 03-May-2024 | 537 | 27 | 11 |
| CompilerVk.h | D | 03-May-2024 | 735 | 31 | 14 |
| ContextVk.cpp | D | 03-May-2024 | 296.6 KiB | 7,250 | 5,400 |
| ContextVk.h | D | 03-May-2024 | 71 KiB | 1,452 | 1,021 |
| DebugAnnotatorVk.cpp | D | 03-May-2024 | 5.2 KiB | 145 | 125 |
| DebugAnnotatorVk.h | D | 03-May-2024 | 1.3 KiB | 43 | 25 |
| 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 | 17.7 KiB | 536 | 433 |
| DisplayVk.h | D | 03-May-2024 | 8.1 KiB | 195 | 123 |
| DisplayVk_api.h | D | 03-May-2024 | 2 KiB | 62 | 39 |
| 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 | 127.7 KiB | 3,005 | 2,229 |
| FramebufferVk.h | D | 03-May-2024 | 12.8 KiB | 276 | 204 |
| GlslangWrapperVk.cpp | D | 03-May-2024 | 2.9 KiB | 72 | 51 |
| GlslangWrapperVk.h | D | 03-May-2024 | 1.8 KiB | 48 | 30 |
| ImageVk.cpp | D | 03-May-2024 | 5.5 KiB | 171 | 124 |
| ImageVk.h | D | 03-May-2024 | 1.5 KiB | 60 | 35 |
| MemoryObjectVk.cpp | D | 03-May-2024 | 9.2 KiB | 263 | 207 |
| MemoryObjectVk.h | D | 03-May-2024 | 2.4 KiB | 69 | 46 |
| OWNERS | D | 03-May-2024 | 61 | 4 | 3 |
| OverlayVk.cpp | D | 03-May-2024 | 7 KiB | 169 | 121 |
| OverlayVk.h | D | 03-May-2024 | 1.2 KiB | 47 | 27 |
| PersistentCommandPool.cpp | D | 03-May-2024 | 3.5 KiB | 118 | 78 |
| PersistentCommandPool.h | D | 03-May-2024 | 1.2 KiB | 53 | 28 |
| ProgramExecutableVk.cpp | D | 03-May-2024 | 93.6 KiB | 2,221 | 1,773 |
| ProgramExecutableVk.h | D | 03-May-2024 | 20.9 KiB | 441 | 348 |
| ProgramPipelineVk.cpp | D | 03-May-2024 | 4.4 KiB | 113 | 79 |
| ProgramPipelineVk.h | D | 03-May-2024 | 1.4 KiB | 47 | 26 |
| ProgramVk.cpp | D | 03-May-2024 | 24.1 KiB | 671 | 523 |
| ProgramVk.h | D | 03-May-2024 | 6.7 KiB | 154 | 124 |
| QueryVk.cpp | D | 03-May-2024 | 23.1 KiB | 682 | 486 |
| QueryVk.h | D | 03-May-2024 | 3.4 KiB | 88 | 52 |
| README.md | D | 03-May-2024 | 4.3 KiB | 88 | 64 |
| RenderTargetVk.cpp | D | 03-May-2024 | 14.2 KiB | 381 | 292 |
| RenderTargetVk.h | D | 03-May-2024 | 9.7 KiB | 219 | 109 |
| RenderbufferVk.cpp | D | 03-May-2024 | 15.2 KiB | 381 | 296 |
| RenderbufferVk.h | D | 03-May-2024 | 5.8 KiB | 132 | 89 |
| RendererVk.cpp | D | 03-May-2024 | 181 KiB | 4,385 | 3,278 |
| RendererVk.h | D | 03-May-2024 | 29.7 KiB | 764 | 570 |
| ResourceVk.cpp | D | 03-May-2024 | 5.4 KiB | 230 | 174 |
| ResourceVk.h | D | 03-May-2024 | 9.5 KiB | 309 | 212 |
| 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 | 29.5 KiB | 626 | 604 |
| SecondaryCommandBuffer.h | D | 03-May-2024 | 57.2 KiB | 1,522 | 1,273 |
| SemaphoreVk.cpp | D | 03-May-2024 | 9.7 KiB | 254 | 168 |
| SemaphoreVk.h | D | 03-May-2024 | 1.6 KiB | 50 | 30 |
| ShaderVk.cpp | D | 03-May-2024 | 3.8 KiB | 121 | 80 |
| ShaderVk.h | D | 03-May-2024 | 912 | 34 | 17 |
| SurfaceVk.cpp | D | 03-May-2024 | 97.6 KiB | 2,490 | 1,839 |
| SurfaceVk.h | D | 03-May-2024 | 18.5 KiB | 432 | 276 |
| SyncVk.cpp | D | 03-May-2024 | 18.4 KiB | 558 | 396 |
| SyncVk.h | D | 03-May-2024 | 4.5 KiB | 136 | 97 |
| TextureVk.cpp | D | 03-May-2024 | 150.7 KiB | 3,518 | 2,561 |
| TextureVk.h | D | 03-May-2024 | 30.1 KiB | 616 | 436 |
| TransformFeedbackVk.cpp | D | 03-May-2024 | 15.4 KiB | 399 | 312 |
| TransformFeedbackVk.h | D | 03-May-2024 | 5.6 KiB | 152 | 106 |
| UtilsVk.cpp | D | 03-May-2024 | 150.6 KiB | 3,556 | 2,572 |
| UtilsVk.h | D | 03-May-2024 | 23.2 KiB | 576 | 441 |
| VertexArrayVk.cpp | D | 03-May-2024 | 45.8 KiB | 1,032 | 796 |
| VertexArrayVk.h | D | 03-May-2024 | 6.9 KiB | 164 | 119 |
| VkImageImageSiblingVk.cpp | D | 03-May-2024 | 4.6 KiB | 142 | 103 |
| VkImageImageSiblingVk.h | D | 03-May-2024 | 1.6 KiB | 54 | 31 |
| VulkanSecondaryCommandBuffer.cpp | D | 03-May-2024 | 4.2 KiB | 117 | 89 |
| VulkanSecondaryCommandBuffer.h | D | 03-May-2024 | 26.3 KiB | 642 | 553 |
| 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 |
| vk_cache_utils.cpp | D | 03-May-2024 | 179.3 KiB | 4,188 | 3,237 |
| vk_cache_utils.h | D | 03-May-2024 | 72 KiB | 1,881 | 1,332 |
| vk_caps_utils.cpp | D | 03-May-2024 | 64.4 KiB | 1,351 | 842 |
| vk_caps_utils.h | D | 03-May-2024 | 2.5 KiB | 82 | 51 |
| vk_command_buffer_utils.h | D | 03-May-2024 | 1.2 KiB | 39 | 19 |
| vk_format_map.json | D | 03-May-2024 | 19.3 KiB | 510 | 507 |
| vk_format_table_autogen.cpp | D | 03-May-2024 | 141.3 KiB | 2,870 | 2,561 |
| vk_format_utils.cpp | D | 03-May-2024 | 19.6 KiB | 489 | 370 |
| vk_format_utils.h | D | 03-May-2024 | 9.6 KiB | 259 | 175 |
| vk_helpers.cpp | D | 03-May-2024 | 391.5 KiB | 9,806 | 7,699 |
| vk_helpers.h | D | 03-May-2024 | 130.5 KiB | 3,041 | 2,210 |
| vk_internal_shaders_autogen.cpp | D | 03-May-2024 | 29.3 KiB | 537 | 496 |
| vk_internal_shaders_autogen.gni | D | 03-May-2024 | 6.5 KiB | 145 | 143 |
| vk_internal_shaders_autogen.h | D | 03-May-2024 | 7.9 KiB | 251 | 221 |
| 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 | 10.4 KiB | 270 | 224 |
| vk_mem_alloc_wrapper.h | D | 03-May-2024 | 5.1 KiB | 128 | 94 |
| vk_utils.cpp | D | 03-May-2024 | 60.4 KiB | 1,682 | 1,360 |
| vk_utils.h | D | 03-May-2024 | 47.5 KiB | 1,515 | 1,156 |
| vk_wrapper.h | D | 03-May-2024 | 65.4 KiB | 1,856 | 1,529 |
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 following `ContextVk` APIs:
28
29 * `beginNewRenderPass`: Writes out (aka flushes) prior pending commands into a primary command
30 buffer, then starts a new render pass. Returns a secondary command buffer *inside* a render pass
31 instance.
32 * `getOutsideRenderPassCommandBuffer`: May flush prior command buffers and close the render pass if
33 necessary, in addition to issuing the appropriate barriers. Returns a secondary command buffer
34 *outside* a render pass instance.
35 * `getStartedRenderPassCommands`: Returns a reference to the currently open render pass' commands
36 buffer.
37
38The back-end (mostly) records Image and Buffer barriers through additional `CommandBufferAccess`
39APIs, the result of which is passed to `getOutsideRenderPassCommandBuffer`. Note that the
40barriers are not actually recorded until `getOutsideRenderPassCommandBuffer` is called:
41
42 * `onBufferTransferRead` and `onBufferComputeShaderRead` accumulate `VkBuffer` read barriers.
43 * `onBufferTransferWrite` and `onBufferComputeShaderWrite` accumulate `VkBuffer` write barriers.
44 * `onBuffferSelfCopy` is a special case for `VkBuffer` self copies. It behaves the same as write.
45 * `onImageTransferRead` and `onImageComputerShadeRead` accumulate `VkImage` read barriers.
46 * `onImageTransferWrite` and `onImageComputerShadeWrite` accumulate `VkImage` write barriers.
47 * `onImageRenderPassRead` and `onImageRenderPassWrite` accumulate `VkImage` barriers inside a
48 started RenderPass.
49
50After the back-end records commands to the primary buffer and we flush (e.g. on swap) or when we call
51`ContextVk::finishToSerial`, ANGLE submits the primary command buffer to a `VkQueue`.
52
53See the [code][CommandAPIs] for more details.
54
55### Simple command recording example
56
57In this example we'll be recording a buffer copy command:
58
59```
60 // Ensure that ANGLE sets proper read and write barriers for the Buffers.
61 vk::CommandBufferAccess access;
62 access.onBufferTransferWrite(dstBuffer);
63 access.onBufferTransferRead(srcBuffer);
64
65 // Get a pointer to a secondary command buffer for command recording.
66 vk::OutsideRenderPassCommandBuffer *commandBuffer;
67 ANGLE_TRY(contextVk->getOutsideRenderPassCommandBuffer(access, &commandBuffer));
68
69 // Record the copy command into the secondary buffer. We're done!
70 commandBuffer->copyBuffer(srcBuffer->getBuffer(), dstBuffer->getBuffer(), copyCount, copies);
71```
72
73## Additional Reading
74
75More implementation details can be found in the `doc` directory:
76
77- [Fast OpenGL State Transitions](doc/FastOpenGLStateTransitions.md)
78- [Shader Module Compilation](doc/ShaderModuleCompilation.md)
79- [OpenGL Line Segment Rasterization](doc/OpenGLLineSegmentRasterization.md)
80- [Format Tables and Emulation](doc/FormatTablesAndEmulation.md)
81- [Deferred Clears](doc/DeferredClears.md)
82- [Queries](doc/Queries.md)
83
84[VkDevice]: https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkDevice.html
85[VkQueue]: https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkQueue.html
86[CommandAPIs]: https://chromium.googlesource.com/angle/angle/+/df31624eaf3df986a0bdf3f58a87b79b0cc8db5c/src/libANGLE/renderer/vulkan/ContextVk.h#620
87
88