Name Date Size #Lines LOC

..--

android/H25-Apr-2025-1,246836

doc/H25-Apr-2025-737541

fuchsia/H25-Apr-2025-205120

ggp/H25-Apr-2025-196118

linux/H25-Apr-2025-2,4891,691

mac/H25-Apr-2025-603447

null/H25-Apr-2025-9956

shaders/H25-Apr-2025-38,04235,841

win32/H25-Apr-2025-316217

AllocatorHelperPool.cppH A D25-Apr-20251.8 KiB6645

AllocatorHelperPool.hH A D25-Apr-20255.4 KiB161106

AllocatorHelperRing.cppH A D25-Apr-20253.4 KiB127100

AllocatorHelperRing.hH A D25-Apr-20255.2 KiB159113

BUILD.gnH A D25-Apr-20256.5 KiB212181

BufferVk.cppH A D25-Apr-202553.4 KiB1,4041,029

BufferVk.hH A D25-Apr-202513.5 KiB335253

CLCommandQueueVk.cppH A D25-Apr-202577 KiB1,8491,464

CLCommandQueueVk.hH A D25-Apr-202515.6 KiB333259

CLContextVk.cppH A D25-Apr-202512.7 KiB363315

CLContextVk.hH A D25-Apr-20255.9 KiB14297

CLDeviceVk.cppH A D25-Apr-202512.5 KiB294235

CLDeviceVk.hH A D25-Apr-20252 KiB5635

CLEventVk.cppH A D25-Apr-20255.8 KiB185132

CLEventVk.hH A D25-Apr-20252.2 KiB7348

CLKernelVk.cppH A D25-Apr-202513.5 KiB337276

CLKernelVk.hH A D25-Apr-20255.7 KiB172130

CLMemoryVk.cppH A D25-Apr-202528 KiB879771

CLMemoryVk.hH A D25-Apr-20257.5 KiB218167

CLPlatformVk.cppH A D25-Apr-20259.6 KiB301252

CLPlatformVk.hH A D25-Apr-20252.7 KiB8554

CLProgramVk.cppH A D25-Apr-202545.6 KiB1,075935

CLProgramVk.hH A D25-Apr-202514.8 KiB410338

CLSamplerVk.cppH A D25-Apr-20255.6 KiB188162

CLSamplerVk.hH A D25-Apr-20251.3 KiB4831

CommandGraph.cppH A D25-Apr-202550.7 KiB1,3791,097

CommandGraph.hH A D25-Apr-202531 KiB814507

CommandProcessor.cppH A D25-Apr-202569.8 KiB1,9601,575

CommandProcessor.hH A D25-Apr-202531.9 KiB811593

CompilerVk.cppH A D25-Apr-2025537 2711

CompilerVk.hH A D25-Apr-2025735 3114

ContextVk.cppH A D25-Apr-2025387.2 KiB9,2306,815

ContextVk.hH A D25-Apr-202593.6 KiB1,8371,290

DebugAnnotatorVk.cppH A D25-Apr-20251.9 KiB6347

DebugAnnotatorVk.hH A D25-Apr-20251.1 KiB3621

DeviceVk.cppH A D25-Apr-20256.9 KiB223182

DeviceVk.hH A D25-Apr-20252.1 KiB6140

DisplayVk.cppH A D25-Apr-202524.6 KiB680536

DisplayVk.hH A D25-Apr-20256.2 KiB14295

DisplayVk_api.hH A D25-Apr-20252.3 KiB6843

FenceNVVk.cppH A D25-Apr-20251.3 KiB5232

FenceNVVk.hH A D25-Apr-2025960 3520

FramebufferVk.cppH A D25-Apr-2025169.4 KiB3,9112,899

FramebufferVk.hH A D25-Apr-202516.6 KiB353263

ImageVk.cppH A D25-Apr-20256.6 KiB199148

ImageVk.hH A D25-Apr-20251.7 KiB6337

MemoryObjectVk.cppH A D25-Apr-20258.8 KiB257206

MemoryObjectVk.hH A D25-Apr-20252.4 KiB6946

MemoryTracking.cppH A D25-Apr-202523.6 KiB610499

MemoryTracking.hH A D25-Apr-20257.7 KiB227164

OWNERSH A D25-Apr-202540 32

OverlayVk.cppH A D25-Apr-20257.1 KiB173123

OverlayVk.hH A D25-Apr-20251.2 KiB4727

PersistentCommandPool.cppH A D25-Apr-20253.6 KiB11979

PersistentCommandPool.hH A D25-Apr-20251.2 KiB5328

ProgramExecutableVk.cppH A D25-Apr-2025101.3 KiB2,4311,889

ProgramExecutableVk.hH A D25-Apr-202528.9 KiB598480

ProgramPipelineVk.cppH A D25-Apr-20254.8 KiB11883

ProgramPipelineVk.hH A D25-Apr-20251.3 KiB4526

ProgramVk.cppH A D25-Apr-202515 KiB394277

ProgramVk.hH A D25-Apr-20251.9 KiB5738

QueryVk.cppH A D25-Apr-202523.3 KiB660466

QueryVk.hH A D25-Apr-20253.3 KiB8751

README.mdH A D25-Apr-20254.6 KiB9269

RenderTargetVk.cppH A D25-Apr-202518 KiB472366

RenderTargetVk.hH A D25-Apr-202513.6 KiB306178

RenderbufferVk.cppH A D25-Apr-202517.1 KiB424331

RenderbufferVk.hH A D25-Apr-20255.9 KiB13591

SamplerVk.cppH A D25-Apr-20251.1 KiB4929

SamplerVk.hH A D25-Apr-20251 KiB4325

SecondaryCommandBuffer.cppH A D25-Apr-202546 KiB949913

SecondaryCommandBuffer.hH A D25-Apr-202581.8 KiB2,3011,890

SecondaryCommandPool.cppH A D25-Apr-20254 KiB12796

SecondaryCommandPool.hH A D25-Apr-20252.2 KiB7134

SemaphoreVk.cppH A D25-Apr-202510.1 KiB261177

SemaphoreVk.hH A D25-Apr-20251.6 KiB5030

ShaderInterfaceVariableInfoMap.cppH A D25-Apr-20258.7 KiB255216

ShaderInterfaceVariableInfoMap.hH A D25-Apr-20257.4 KiB183147

ShaderVk.cppH A D25-Apr-20257.5 KiB251196

ShaderVk.hH A D25-Apr-2025980 3518

ShareGroupVk.cppH A D25-Apr-202513 KiB397296

ShareGroupVk.hH A D25-Apr-20256.7 KiB175101

Suballocation.cppH A D25-Apr-20256.6 KiB203165

Suballocation.hH A D25-Apr-202515.7 KiB494403

SurfaceVk.cppH A D25-Apr-2025134.8 KiB3,3452,372

SurfaceVk.hH A D25-Apr-202524.3 KiB540328

SyncVk.cppH A D25-Apr-202524.6 KiB728537

SyncVk.hH A D25-Apr-20257.2 KiB206146

TextureVk.cppH A D25-Apr-2025204.7 KiB4,7173,552

TextureVk.hH A D25-Apr-202537.7 KiB757542

TransformFeedbackVk.cppH A D25-Apr-202511.5 KiB306246

TransformFeedbackVk.hH A D25-Apr-20254.6 KiB13793

UtilsVk.cppH A D25-Apr-2025223.8 KiB5,2183,867

UtilsVk.hH A D25-Apr-202532.7 KiB820646

VertexArrayVk.cppH A D25-Apr-202566.3 KiB1,4741,164

VertexArrayVk.hH A D25-Apr-20259.2 KiB224165

VkImageImageSiblingVk.cppH A D25-Apr-20254.6 KiB142103

VkImageImageSiblingVk.hH A D25-Apr-20251.6 KiB5431

VulkanSecondaryCommandBuffer.cppH A D25-Apr-20254.5 KiB12696

VulkanSecondaryCommandBuffer.hH A D25-Apr-202530.7 KiB757651

cl_types.hH A D25-Apr-2025995 5738

clspv_utils.cppH A D25-Apr-202512.5 KiB367279

clspv_utils.hH A D25-Apr-20251.2 KiB4526

gen_vk_format_table.pyH A D25-Apr-20259.6 KiB300223

gen_vk_internal_shaders.pyH A D25-Apr-202529.1 KiB813563

gen_vk_mandatory_format_support_table.pyH A D25-Apr-20255.2 KiB147109

spv_utils.cppH A D25-Apr-2025212.7 KiB5,4353,957

spv_utils.hH A D25-Apr-20256.9 KiB180121

vk_cache_utils.cppH A D25-Apr-2025355.8 KiB8,4126,753

vk_cache_utils.hH A D25-Apr-2025112.2 KiB2,8932,068

vk_caps_utils.cppH A D25-Apr-202578.1 KiB1,6201,019

vk_caps_utils.hH A D25-Apr-20252.8 KiB8854

vk_cl_utils.cppH A D25-Apr-20253.2 KiB10878

vk_cl_utils.hH A D25-Apr-20251,008 3519

vk_command_buffer_utils.hH A D25-Apr-20251.6 KiB5833

vk_format_map.jsonH A D25-Apr-202523.3 KiB647642

vk_format_table_autogen.cppH A D25-Apr-2025155.1 KiB3,1912,850

vk_format_utils.cppH A D25-Apr-202530.7 KiB729576

vk_format_utils.hH A D25-Apr-202511.8 KiB305201

vk_helpers.cppH A D25-Apr-2025539.1 KiB13,19410,399

vk_helpers.hH A D25-Apr-2025181.2 KiB4,1153,002

vk_internal_shaders_autogen.cppH A D25-Apr-202532.5 KiB576528

vk_internal_shaders_autogen.gniH A D25-Apr-20257.1 KiB156154

vk_internal_shaders_autogen.hH A D25-Apr-202510.3 KiB324288

vk_mandatory_format_support_data.jsonH A D25-Apr-202517.7 KiB439439

vk_mandatory_format_support_table_autogen.cppH A D25-Apr-202514.4 KiB309291

vk_mem_alloc_wrapper.cppH A D25-Apr-202512.5 KiB314264

vk_mem_alloc_wrapper.hH A D25-Apr-20256.6 KiB155117

vk_ref_counted_event.cppH A D25-Apr-202514.7 KiB439362

vk_ref_counted_event.hH A D25-Apr-202520 KiB523353

vk_renderer.cppH A D25-Apr-2025301.6 KiB6,8924,780

vk_renderer.hH A D25-Apr-202552.1 KiB1,211901

vk_resource.cppH A D25-Apr-20252.7 KiB11080

vk_resource.hH A D25-Apr-202514.7 KiB428313

vk_utils.cppH A D25-Apr-202567.4 KiB1,8281,490

vk_utils.hH A D25-Apr-202555.1 KiB1,6791,269

vk_wrapper.hH A D25-Apr-202577.7 KiB2,1621,798

vulkan_backend.gniH A D25-Apr-20255.7 KiB245231

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. Compared to APIs like OpenGL
6or D3D11 explicit APIs can offer a number of significant benefits:
7
8 * Lower API call CPU overhead.
9 * A smaller API surface with more direct hardware control.
10 * Better support for multi-core programming.
11 * Vulkan in particular has open-source tooling and tests.
12
13## Back-end Design
14
15The [`vk::Renderer`](Renderer.cpp) class represents an `EGLDisplay`. `vk::Renderer` owns shared global
16resources like the [VkDevice][VkDevice], [VkQueue][VkQueue], the [Vulkan format tables](vk_format_utils.h)
17and [internal Vulkan shaders](shaders). The [ContextVk](ContextVk.cpp) class implements the back-end
18of a front-end OpenGL Context. ContextVk processes state changes and handles action commands like
19`glDrawArrays` and `glDrawElements`.
20
21## Command recording
22
23A render pass has three states: `unstarted`, started and active (we call it `active` in short),
24started but inactive (we call it `inactive` in short). The back-end records commands into command
25buffers via the following `ContextVk` APIs:
26
27 * `beginNewRenderPass`: Writes out (aka flushes) prior pending commands into a primary command
28   buffer, then starts a new render pass. Returns a secondary command buffer *inside* a render pass
29instance.
30 * `getOutsideRenderPassCommandBuffer`: May flush prior command buffers and close the render pass if
31   necessary, in addition to issuing the appropriate barriers. Returns a secondary command buffer
32*outside* a render pass instance.
33 * `getStartedRenderPassCommands`: Returns a reference to the currently open render pass' commands
34   buffer.
35 * `onRenderPassFinished`: Puts render pass into inactive state where you can not record more
36   commands into secondary command buffer, except in some special cases where ANGLE does some
37optimization internally.
38 * `flushCommandsAndEndRenderPassWithoutSubmit`: Marks the end of render pass. It flushes secondary
39   command buffer into vulkan's primary command buffer, puts secondary command buffer back to
40unstarted state and then goes into recycler for reuse.
41
42The back-end (mostly) records Image and Buffer barriers through additional `CommandBufferAccess`
43APIs, the result of which is passed to `getOutsideRenderPassCommandBuffer`.  Note that the barriers
44are not actually recorded until `getOutsideRenderPassCommandBuffer` is called:
45
46 * `onBufferTransferRead` and `onBufferComputeShaderRead` accumulate `VkBuffer` read barriers.
47 * `onBufferTransferWrite` and `onBufferComputeShaderWrite` accumulate `VkBuffer` write barriers.
48 * `onBuffferSelfCopy` is a special case for `VkBuffer` self copies. It behaves the same as write.
49 * `onImageTransferRead` and `onImageComputerShadeRead` accumulate `VkImage` read barriers.
50 * `onImageTransferWrite` and `onImageComputerShadeWrite` accumulate `VkImage` write barriers.
51 * `onImageRenderPassRead` and `onImageRenderPassWrite` accumulate `VkImage` barriers inside a
52   started RenderPass.
53
54After the back-end records commands to the primary buffer and we flush (e.g. on swap) or when we call
55`vk::Renderer::finishQueueSerial`, ANGLE submits the primary command buffer to a `VkQueue`.
56
57See the [code][CommandAPIs] for more details.
58
59### Simple command recording example
60
61In this example we'll be recording a buffer copy command:
62
63```
64    // Ensure that ANGLE sets proper read and write barriers for the Buffers.
65    vk::CommandBufferAccess access;
66    access.onBufferTransferWrite(dstBuffer);
67    access.onBufferTransferRead(srcBuffer);
68
69    // Get a pointer to a secondary command buffer for command recording.
70    vk::OutsideRenderPassCommandBuffer *commandBuffer;
71    ANGLE_TRY(contextVk->getOutsideRenderPassCommandBuffer(access, &commandBuffer));
72
73    // Record the copy command into the secondary buffer. We're done!
74    commandBuffer->copyBuffer(srcBuffer->getBuffer(), dstBuffer->getBuffer(), copyCount, copies);
75```
76
77## Additional Reading
78
79More implementation details can be found in the `doc` directory:
80
81- [Fast OpenGL State Transitions](doc/FastOpenGLStateTransitions.md)
82- [Shader Module Compilation](doc/ShaderModuleCompilation.md)
83- [Format Tables and Emulation](doc/FormatTablesAndEmulation.md)
84- [Deferred Clears](doc/DeferredClears.md)
85- [Queries](doc/Queries.md)
86- [Present Semaphores](doc/PresentSemaphores.md)
87
88[VkDevice]: https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkDevice.html
89[VkQueue]: https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkQueue.html
90[CommandAPIs]: https://chromium.googlesource.com/angle/angle/+/df31624eaf3df986a0bdf3f58a87b79b0cc8db5c/src/libANGLE/renderer/vulkan/ContextVk.h#620
91
92