|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| android/ | | 12-May-2024 | - | 997 | 654 |
| doc/ | | 12-May-2024 | - | 732 | 560 |
| fuchsia/ | | 12-May-2024 | - | 205 | 120 |
| ggp/ | | 12-May-2024 | - | 198 | 119 |
| linux/ | | 12-May-2024 | - | 1,425 | 954 |
| mac/ | | 12-May-2024 | - | 617 | 459 |
| null/ | | 12-May-2024 | - | 175 | 99 |
| shaders/ | | 12-May-2024 | - | 32,616 | 30,614 |
| win32/ | | 12-May-2024 | - | 315 | 216 |
| BUILD.gn | D | 12-May-2024 | 7.4 KiB | 303 | 277 |
| BufferVk.cpp | D | 12-May-2024 | 48 KiB | 1,217 | 875 |
| BufferVk.h | D | 12-May-2024 | 11.4 KiB | 267 | 198 |
| CLCommandQueueVk.cpp | D | 12-May-2024 | 510 | 20 | 8 |
| CLCommandQueueVk.h | D | 12-May-2024 | 745 | 29 | 14 |
| CLContextVk.cpp | D | 12-May-2024 | 451 | 18 | 6 |
| CLContextVk.h | D | 12-May-2024 | 677 | 28 | 14 |
| CLDeviceVk.cpp | D | 12-May-2024 | 1.4 KiB | 59 | 39 |
| CLDeviceVk.h | D | 12-May-2024 | 1.3 KiB | 41 | 24 |
| CLEventVk.cpp | D | 12-May-2024 | 429 | 18 | 6 |
| CLEventVk.h | D | 12-May-2024 | 651 | 28 | 14 |
| CLKernelVk.cpp | D | 12-May-2024 | 440 | 18 | 6 |
| CLKernelVk.h | D | 12-May-2024 | 664 | 28 | 14 |
| CLMemoryVk.cpp | D | 12-May-2024 | 440 | 18 | 6 |
| CLMemoryVk.h | D | 12-May-2024 | 664 | 28 | 14 |
| CLPlatformVk.cpp | D | 12-May-2024 | 3.1 KiB | 109 | 83 |
| CLPlatformVk.h | D | 12-May-2024 | 1.5 KiB | 53 | 32 |
| CLProgramVk.cpp | D | 12-May-2024 | 451 | 18 | 6 |
| CLProgramVk.h | D | 12-May-2024 | 677 | 28 | 14 |
| CLSamplerVk.cpp | D | 12-May-2024 | 451 | 18 | 6 |
| CLSamplerVk.h | D | 12-May-2024 | 677 | 28 | 14 |
| CommandProcessor.cpp | D | 12-May-2024 | 48.7 KiB | 1,402 | 1,129 |
| CommandProcessor.h | D | 12-May-2024 | 23.9 KiB | 608 | 439 |
| CompilerVk.cpp | D | 12-May-2024 | 537 | 27 | 11 |
| CompilerVk.h | D | 12-May-2024 | 735 | 31 | 14 |
| ContextVk.cpp | D | 12-May-2024 | 273.8 KiB | 6,694 | 4,998 |
| ContextVk.h | D | 12-May-2024 | 61.9 KiB | 1,300 | 902 |
| DebugAnnotatorVk.cpp | D | 12-May-2024 | 5.2 KiB | 145 | 125 |
| DebugAnnotatorVk.h | D | 12-May-2024 | 1.3 KiB | 43 | 25 |
| DeviceVk.cpp | D | 12-May-2024 | 3.2 KiB | 110 | 89 |
| DeviceVk.h | D | 12-May-2024 | 889 | 35 | 19 |
| DisplayVk.cpp | D | 12-May-2024 | 11.1 KiB | 347 | 268 |
| DisplayVk.h | D | 12-May-2024 | 6.4 KiB | 164 | 104 |
| DisplayVk_api.h | D | 12-May-2024 | 1.9 KiB | 59 | 37 |
| FenceNVVk.cpp | D | 12-May-2024 | 1.4 KiB | 54 | 34 |
| FenceNVVk.h | D | 12-May-2024 | 960 | 35 | 20 |
| FramebufferVk.cpp | D | 12-May-2024 | 123.6 KiB | 2,902 | 2,155 |
| FramebufferVk.h | D | 12-May-2024 | 12.7 KiB | 274 | 203 |
| GlslangWrapperVk.cpp | D | 12-May-2024 | 2.9 KiB | 72 | 51 |
| GlslangWrapperVk.h | D | 12-May-2024 | 1.8 KiB | 48 | 30 |
| ImageVk.cpp | D | 12-May-2024 | 6.1 KiB | 175 | 124 |
| ImageVk.h | D | 12-May-2024 | 1.7 KiB | 64 | 38 |
| MemoryObjectVk.cpp | D | 12-May-2024 | 9.2 KiB | 263 | 207 |
| MemoryObjectVk.h | D | 12-May-2024 | 2.4 KiB | 69 | 46 |
| OWNERS | D | 12-May-2024 | 61 | 4 | 3 |
| OverlayVk.cpp | D | 12-May-2024 | 12 KiB | 290 | 207 |
| OverlayVk.h | D | 12-May-2024 | 1.8 KiB | 62 | 36 |
| PersistentCommandPool.cpp | D | 12-May-2024 | 3.5 KiB | 118 | 78 |
| PersistentCommandPool.h | D | 12-May-2024 | 1.2 KiB | 53 | 28 |
| ProgramExecutableVk.cpp | D | 12-May-2024 | 83.8 KiB | 2,028 | 1,602 |
| ProgramExecutableVk.h | D | 12-May-2024 | 14.1 KiB | 329 | 246 |
| ProgramPipelineVk.cpp | D | 12-May-2024 | 10.7 KiB | 267 | 202 |
| ProgramPipelineVk.h | D | 12-May-2024 | 1.9 KiB | 62 | 37 |
| ProgramVk.cpp | D | 12-May-2024 | 30.1 KiB | 830 | 651 |
| ProgramVk.h | D | 12-May-2024 | 10.1 KiB | 230 | 187 |
| QueryVk.cpp | D | 12-May-2024 | 23.1 KiB | 682 | 486 |
| QueryVk.h | D | 12-May-2024 | 3.4 KiB | 88 | 52 |
| README.md | D | 12-May-2024 | 4.3 KiB | 88 | 64 |
| RenderTargetVk.cpp | D | 12-May-2024 | 14.8 KiB | 408 | 316 |
| RenderTargetVk.h | D | 12-May-2024 | 9.6 KiB | 222 | 113 |
| RenderbufferVk.cpp | D | 12-May-2024 | 14.8 KiB | 365 | 283 |
| RenderbufferVk.h | D | 12-May-2024 | 5.8 KiB | 132 | 89 |
| RendererVk.cpp | D | 12-May-2024 | 157.1 KiB | 3,845 | 2,909 |
| RendererVk.h | D | 12-May-2024 | 25.7 KiB | 679 | 514 |
| ResourceVk.cpp | D | 12-May-2024 | 4.8 KiB | 207 | 156 |
| ResourceVk.h | D | 12-May-2024 | 8.2 KiB | 277 | 184 |
| SamplerVk.cpp | D | 12-May-2024 | 1.2 KiB | 49 | 29 |
| SamplerVk.h | D | 12-May-2024 | 1 KiB | 42 | 24 |
| SecondaryCommandBuffer.cpp | D | 12-May-2024 | 29.5 KiB | 628 | 602 |
| SecondaryCommandBuffer.h | D | 12-May-2024 | 56.9 KiB | 1,520 | 1,271 |
| SemaphoreVk.cpp | D | 12-May-2024 | 9.8 KiB | 256 | 170 |
| SemaphoreVk.h | D | 12-May-2024 | 1.6 KiB | 50 | 30 |
| ShaderVk.cpp | D | 12-May-2024 | 3.7 KiB | 116 | 76 |
| ShaderVk.h | D | 12-May-2024 | 912 | 34 | 17 |
| SurfaceVk.cpp | D | 12-May-2024 | 84.2 KiB | 2,150 | 1,556 |
| SurfaceVk.h | D | 12-May-2024 | 16.8 KiB | 382 | 240 |
| SyncVk.cpp | D | 12-May-2024 | 18.5 KiB | 561 | 397 |
| SyncVk.h | D | 12-May-2024 | 4.5 KiB | 136 | 97 |
| TextureVk.cpp | D | 12-May-2024 | 147.2 KiB | 3,424 | 2,495 |
| TextureVk.h | D | 12-May-2024 | 28.8 KiB | 590 | 417 |
| TransformFeedbackVk.cpp | D | 12-May-2024 | 14.2 KiB | 366 | 283 |
| TransformFeedbackVk.h | D | 12-May-2024 | 5 KiB | 138 | 95 |
| UtilsVk.cpp | D | 12-May-2024 | 151.7 KiB | 3,613 | 2,613 |
| UtilsVk.h | D | 12-May-2024 | 24 KiB | 600 | 455 |
| VertexArrayVk.cpp | D | 12-May-2024 | 43.2 KiB | 940 | 738 |
| VertexArrayVk.h | D | 12-May-2024 | 7.2 KiB | 165 | 124 |
| VulkanSecondaryCommandBuffer.cpp | D | 12-May-2024 | 4.2 KiB | 117 | 89 |
| VulkanSecondaryCommandBuffer.h | D | 12-May-2024 | 26.3 KiB | 642 | 553 |
| cl_types.h | D | 12-May-2024 | 518 | 23 | 10 |
| gen_vk_format_table.py | D | 12-May-2024 | 9.1 KiB | 288 | 214 |
| gen_vk_internal_shaders.py | D | 12-May-2024 | 29.3 KiB | 815 | 562 |
| gen_vk_mandatory_format_support_table.py | D | 12-May-2024 | 5.2 KiB | 147 | 109 |
| vk_cache_utils.cpp | D | 12-May-2024 | 169.4 KiB | 4,021 | 3,092 |
| vk_cache_utils.h | D | 12-May-2024 | 67.6 KiB | 1,775 | 1,250 |
| vk_caps_utils.cpp | D | 12-May-2024 | 63.1 KiB | 1,307 | 812 |
| vk_caps_utils.h | D | 12-May-2024 | 2.5 KiB | 82 | 51 |
| vk_command_buffer_utils.h | D | 12-May-2024 | 1.2 KiB | 39 | 19 |
| vk_format_map.json | D | 12-May-2024 | 19.1 KiB | 510 | 507 |
| vk_format_table_autogen.cpp | D | 12-May-2024 | 139.9 KiB | 2,848 | 2,539 |
| vk_format_utils.cpp | D | 12-May-2024 | 19.8 KiB | 492 | 373 |
| vk_format_utils.h | D | 12-May-2024 | 9.8 KiB | 264 | 180 |
| vk_helpers.cpp | D | 12-May-2024 | 346.9 KiB | 8,686 | 6,838 |
| vk_helpers.h | D | 12-May-2024 | 120.1 KiB | 2,856 | 2,054 |
| vk_internal_shaders_autogen.cpp | D | 12-May-2024 | 30.1 KiB | 549 | 508 |
| vk_internal_shaders_autogen.gni | D | 12-May-2024 | 6.8 KiB | 151 | 149 |
| vk_internal_shaders_autogen.h | D | 12-May-2024 | 8.2 KiB | 267 | 237 |
| vk_mandatory_format_support_data.json | D | 12-May-2024 | 17.7 KiB | 439 | 439 |
| vk_mandatory_format_support_table_autogen.cpp | D | 12-May-2024 | 14.1 KiB | 301 | 283 |
| vk_mem_alloc_wrapper.cpp | D | 12-May-2024 | 7.4 KiB | 185 | 152 |
| vk_mem_alloc_wrapper.h | D | 12-May-2024 | 3 KiB | 79 | 53 |
| vk_utils.cpp | D | 12-May-2024 | 60.2 KiB | 1,673 | 1,357 |
| vk_utils.h | D | 12-May-2024 | 38.3 KiB | 1,212 | 908 |
| vk_wrapper.h | D | 12-May-2024 | 61.4 KiB | 1,767 | 1,453 |
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::CommandBuffer *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