• Home
Name Date Size #Lines LOC

..--

android/03-May-2024-1,164764

doc/03-May-2024-814600

fuchsia/03-May-2024-205120

ggp/03-May-2024-196118

linux/03-May-2024-2,3601,606

mac/03-May-2024-602446

null/03-May-2024-10561

shaders/03-May-2024-35,50133,374

win32/03-May-2024-316217

AllocatorHelperPool.cppD03-May-20241.8 KiB6645

AllocatorHelperPool.hD03-May-20245.4 KiB161106

AllocatorHelperRing.cppD03-May-20243.4 KiB127100

AllocatorHelperRing.hD03-May-20245.2 KiB159113

BUILD.gnD03-May-20245.3 KiB171143

BufferVk.cppD03-May-202447.6 KiB1,235902

BufferVk.hD03-May-202410.7 KiB261195

CLCommandQueueVk.cppD03-May-2024510 208

CLCommandQueueVk.hD03-May-2024745 2914

CLContextVk.cppD03-May-2024451 186

CLContextVk.hD03-May-2024677 2814

CLDeviceVk.cppD03-May-20241.4 KiB5939

CLDeviceVk.hD03-May-20241.3 KiB4124

CLEventVk.cppD03-May-2024429 186

CLEventVk.hD03-May-2024651 2814

CLKernelVk.cppD03-May-2024440 186

CLKernelVk.hD03-May-2024664 2814

CLMemoryVk.cppD03-May-2024440 186

CLMemoryVk.hD03-May-2024664 2814

CLPlatformVk.cppD03-May-20243.1 KiB10983

CLPlatformVk.hD03-May-20241.5 KiB5332

CLProgramVk.cppD03-May-2024451 186

CLProgramVk.hD03-May-2024677 2814

CLSamplerVk.cppD03-May-2024451 186

CLSamplerVk.hD03-May-2024677 2814

CommandGraph.cppD03-May-202450.7 KiB1,3791,097

CommandGraph.hD03-May-202431 KiB814507

CommandProcessor.cppD03-May-202465.1 KiB1,8411,468

CommandProcessor.hD03-May-202426.6 KiB684487

CompilerVk.cppD03-May-2024537 2711

CompilerVk.hD03-May-2024735 3114

ContextVk.cppD03-May-2024351.7 KiB8,5226,340

ContextVk.hD03-May-202487 KiB1,7171,191

DebugAnnotatorVk.cppD03-May-20241.9 KiB6347

DebugAnnotatorVk.hD03-May-20241.1 KiB3621

DeviceVk.cppD03-May-20246.7 KiB223185

DeviceVk.hD03-May-20242.2 KiB6038

DisplayVk.cppD03-May-202421.3 KiB596474

DisplayVk.hD03-May-20246.1 KiB14195

DisplayVk_api.hD03-May-20242.1 KiB6541

FenceNVVk.cppD03-May-20241.4 KiB5434

FenceNVVk.hD03-May-2024960 3520

FramebufferVk.cppD03-May-2024141.7 KiB3,2662,419

FramebufferVk.hD03-May-202413.8 KiB305224

ImageVk.cppD03-May-20245.4 KiB172127

ImageVk.hD03-May-20241.6 KiB6136

MemoryObjectVk.cppD03-May-20249.2 KiB263207

MemoryObjectVk.hD03-May-20242.4 KiB6946

MemoryTracking.cppD03-May-202423.4 KiB608497

MemoryTracking.hD03-May-20247.6 KiB222160

OWNERSD03-May-202440 32

OverlayVk.cppD03-May-20247.1 KiB171123

OverlayVk.hD03-May-20241.2 KiB4727

PersistentCommandPool.cppD03-May-20243.6 KiB11979

PersistentCommandPool.hD03-May-20241.2 KiB5328

ProgramExecutableVk.cppD03-May-202478.2 KiB1,8741,448

ProgramExecutableVk.hD03-May-202421.6 KiB457341

ProgramPipelineVk.cppD03-May-20244.3 KiB11479

ProgramPipelineVk.hD03-May-20241.5 KiB5028

ProgramVk.cppD03-May-202422.1 KiB632496

ProgramVk.hD03-May-20246.9 KiB155124

QueryVk.cppD03-May-202423.2 KiB659465

QueryVk.hD03-May-20243.3 KiB8751

README.mdD03-May-20244.9 KiB9672

RenderTargetVk.cppD03-May-202414.5 KiB389300

RenderTargetVk.hD03-May-202410.3 KiB234119

RenderbufferVk.cppD03-May-202416.5 KiB412322

RenderbufferVk.hD03-May-20245.9 KiB13591

RendererVk.cppD03-May-2024251.8 KiB5,9864,266

RendererVk.hD03-May-202448.3 KiB1,162883

ResourceVk.cppD03-May-20242.7 KiB11080

ResourceVk.hD03-May-20248.7 KiB278193

SamplerVk.cppD03-May-20241.2 KiB4929

SamplerVk.hD03-May-20241 KiB4224

SecondaryCommandBuffer.cppD03-May-202439.6 KiB833807

SecondaryCommandBuffer.hD03-May-202469.5 KiB1,8851,595

SecondaryCommandPool.cppD03-May-20244 KiB12796

SecondaryCommandPool.hD03-May-20242.2 KiB7033

SemaphoreVk.cppD03-May-202410.3 KiB266180

SemaphoreVk.hD03-May-20241.6 KiB5030

ShaderInterfaceVariableInfoMap.cppD03-May-20245.6 KiB156125

ShaderInterfaceVariableInfoMap.hD03-May-20246.8 KiB166130

ShaderVk.cppD03-May-20244.2 KiB14095

ShaderVk.hD03-May-2024913 3417

ShareGroupVk.cppD03-May-202418 KiB515392

ShareGroupVk.hD03-May-20246.7 KiB173107

Suballocation.cppD03-May-20246.6 KiB203165

Suballocation.hD03-May-202413.6 KiB420336

SurfaceVk.cppD03-May-2024129.1 KiB3,2362,327

SurfaceVk.hD03-May-202425.4 KiB565338

SyncVk.cppD03-May-202420.4 KiB640473

SyncVk.hD03-May-20246.2 KiB188132

TextureVk.cppD03-May-2024169.2 KiB3,9372,897

TextureVk.hD03-May-202433 KiB680480

TransformFeedbackVk.cppD03-May-202412.2 KiB328264

TransformFeedbackVk.hD03-May-20244.8 KiB14197

UtilsVk.cppD03-May-2024186.4 KiB4,4123,242

UtilsVk.hD03-May-202427.2 KiB695547

VertexArrayVk.cppD03-May-202451.4 KiB1,127877

VertexArrayVk.hD03-May-20247.7 KiB183133

VkImageImageSiblingVk.cppD03-May-20244.6 KiB141102

VkImageImageSiblingVk.hD03-May-20241.6 KiB5431

VulkanSecondaryCommandBuffer.cppD03-May-20243.7 KiB11184

VulkanSecondaryCommandBuffer.hD03-May-202426.8 KiB661568

cl_types.hD03-May-2024518 2310

gen_vk_format_table.pyD03-May-20249.1 KiB288214

gen_vk_internal_shaders.pyD03-May-202429.3 KiB815562

gen_vk_mandatory_format_support_table.pyD03-May-20245.2 KiB147109

spv_utils.cppD03-May-2024196.5 KiB5,0183,626

spv_utils.hD03-May-20246 KiB14592

vk_cache_utils.cppD03-May-2024307.1 KiB7,2875,840

vk_cache_utils.hD03-May-2024101.4 KiB2,6091,846

vk_caps_utils.cppD03-May-202468.6 KiB1,397862

vk_caps_utils.hD03-May-20242.5 KiB8251

vk_command_buffer_utils.hD03-May-20241.6 KiB5833

vk_format_map.jsonD03-May-202422.7 KiB628623

vk_format_table_autogen.cppD03-May-2024149.1 KiB3,0712,742

vk_format_utils.cppD03-May-202421.5 KiB529405

vk_format_utils.hD03-May-20249.7 KiB262175

vk_helpers.cppD03-May-2024447.3 KiB11,0428,696

vk_helpers.hD03-May-2024150.2 KiB3,4932,556

vk_internal_shaders_autogen.cppD03-May-202432.7 KiB598554

vk_internal_shaders_autogen.gniD03-May-20247.2 KiB159157

vk_internal_shaders_autogen.hD03-May-20249.3 KiB291258

vk_mandatory_format_support_data.jsonD03-May-202417.7 KiB439439

vk_mandatory_format_support_table_autogen.cppD03-May-202414.1 KiB301283

vk_mem_alloc_wrapper.cppD03-May-202414.1 KiB354301

vk_mem_alloc_wrapper.hD03-May-20246.4 KiB151115

vk_utils.cppD03-May-202464.8 KiB1,7571,424

vk_utils.hD03-May-202443.2 KiB1,3341,006

vk_wrapper.hD03-May-202471.8 KiB2,0261,678

vulkan_backend.gniD03-May-20245.4 KiB235222

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