• Home
Name Date Size #Lines LOC

..--

android/04-Jul-2025-1,268854

doc/04-Jul-2025-737541

fuchsia/04-Jul-2025-206121

linux/04-Jul-2025-2,4411,653

mac/04-Jul-2025-604448

null/04-Jul-2025-9956

shaders/04-Jul-2025-38,17735,976

win32/04-Jul-2025-318219

AllocatorHelperPool.cppD04-Jul-20251.8 KiB6645

AllocatorHelperPool.hD04-Jul-20255.4 KiB161106

AllocatorHelperRing.cppD04-Jul-20253.4 KiB127100

AllocatorHelperRing.hD04-Jul-20255.2 KiB161113

BUILD.gnD04-Jul-20256.8 KiB217186

BufferVk.cppD04-Jul-202553.3 KiB1,3991,024

BufferVk.hD04-Jul-202513.5 KiB336254

CLCommandQueueVk.cppD04-Jul-202594.9 KiB2,2741,815

CLCommandQueueVk.hD04-Jul-202518 KiB429325

CLContextVk.cppD04-Jul-202513.3 KiB378328

CLContextVk.hD04-Jul-20256.5 KiB160109

CLDeviceVk.cppD04-Jul-202513.6 KiB317257

CLDeviceVk.hD04-Jul-20252.1 KiB5937

CLEventVk.cppD04-Jul-20256.9 KiB215159

CLEventVk.hD04-Jul-20252.6 KiB8458

CLKernelVk.cppD04-Jul-202516.3 KiB411349

CLKernelVk.hD04-Jul-20255.7 KiB175128

CLMemoryVk.cppD04-Jul-202530 KiB930818

CLMemoryVk.hD04-Jul-20258 KiB226175

CLPlatformVk.cppD04-Jul-20259.2 KiB294244

CLPlatformVk.hD04-Jul-20252.7 KiB8554

CLProgramVk.cppD04-Jul-202546.5 KiB1,082939

CLProgramVk.hD04-Jul-202514.1 KiB394326

CLSamplerVk.cppD04-Jul-20255.6 KiB188162

CLSamplerVk.hD04-Jul-20251.3 KiB4831

CommandGraph.cppD04-Jul-202550.7 KiB1,3791,097

CommandGraph.hD04-Jul-202531 KiB814507

CommandQueue.cppD04-Jul-202545.9 KiB1,3391,063

CommandQueue.hD04-Jul-202523.4 KiB604445

CompilerVk.cppD04-Jul-2025537 2711

CompilerVk.hD04-Jul-2025735 3114

ContextVk.cppD04-Jul-2025389 KiB9,2496,806

ContextVk.hD04-Jul-202593.1 KiB1,8241,279

DebugAnnotatorVk.cppD04-Jul-20251.9 KiB6347

DebugAnnotatorVk.hD04-Jul-20251.1 KiB3621

DeviceVk.cppD04-Jul-20256.6 KiB218181

DeviceVk.hD04-Jul-20252.1 KiB6140

DisplayVk.cppD04-Jul-202528.2 KiB764606

DisplayVk.hD04-Jul-20256.6 KiB151102

DisplayVk_api.hD04-Jul-20252.1 KiB6339

FenceNVVk.cppD04-Jul-20251.3 KiB5232

FenceNVVk.hD04-Jul-2025960 3520

FramebufferVk.cppD04-Jul-2025171.7 KiB3,9472,911

FramebufferVk.hD04-Jul-202516.9 KiB362270

ImageVk.cppD04-Jul-20256.7 KiB199148

ImageVk.hD04-Jul-20251.7 KiB6337

MemoryObjectVk.cppD04-Jul-20258.8 KiB257206

MemoryObjectVk.hD04-Jul-20252.4 KiB6946

MemoryTracking.cppD04-Jul-202523.9 KiB620507

MemoryTracking.hD04-Jul-20257.9 KiB230165

OWNERSD04-Jul-202540 32

OverlayVk.cppD04-Jul-20257.1 KiB173123

OverlayVk.hD04-Jul-20251.2 KiB4727

PersistentCommandPool.cppD04-Jul-20253.6 KiB11979

PersistentCommandPool.hD04-Jul-20251.3 KiB5530

ProgramExecutableVk.cppD04-Jul-2025102.3 KiB2,4491,900

ProgramExecutableVk.hD04-Jul-202528.9 KiB597479

ProgramPipelineVk.cppD04-Jul-20254.8 KiB11883

ProgramPipelineVk.hD04-Jul-20251.3 KiB4526

ProgramVk.cppD04-Jul-202514.8 KiB389274

ProgramVk.hD04-Jul-20251.9 KiB5738

QueryVk.cppD04-Jul-202523.3 KiB659465

QueryVk.hD04-Jul-20253.3 KiB8751

README.mdD04-Jul-20254.6 KiB9269

RenderTargetVk.cppD04-Jul-202518.1 KiB471366

RenderTargetVk.hD04-Jul-202513.7 KiB308179

RenderbufferVk.cppD04-Jul-202516.3 KiB405317

RenderbufferVk.hD04-Jul-20255.9 KiB13591

SamplerVk.cppD04-Jul-20251.1 KiB4929

SamplerVk.hD04-Jul-20251 KiB4325

SecondaryCommandBuffer.cppD04-Jul-202546 KiB949913

SecondaryCommandBuffer.hD04-Jul-202581.8 KiB2,3021,891

SecondaryCommandPool.cppD04-Jul-20254.1 KiB12897

SecondaryCommandPool.hD04-Jul-20252.2 KiB7236

SemaphoreVk.cppD04-Jul-20259.4 KiB247174

SemaphoreVk.hD04-Jul-20251.6 KiB5030

ShaderInterfaceVariableInfoMap.cppD04-Jul-20258.8 KiB259219

ShaderInterfaceVariableInfoMap.hD04-Jul-20257.4 KiB183147

ShaderVk.cppD04-Jul-20257.5 KiB251196

ShaderVk.hD04-Jul-2025980 3518

ShareGroupVk.cppD04-Jul-202512.8 KiB392293

ShareGroupVk.hD04-Jul-20255.9 KiB15991

Suballocation.cppD04-Jul-20258 KiB237193

Suballocation.hD04-Jul-202514.4 KiB460372

SurfaceVk.cppD04-Jul-2025141.8 KiB3,5382,524

SurfaceVk.hD04-Jul-202524.8 KiB556341

SyncVk.cppD04-Jul-202524.1 KiB720535

SyncVk.hD04-Jul-20257.4 KiB212152

TextureVk.cppD04-Jul-2025204 KiB4,7153,544

TextureVk.hD04-Jul-202537.3 KiB750537

TransformFeedbackVk.cppD04-Jul-202511.2 KiB299241

TransformFeedbackVk.hD04-Jul-20254.6 KiB13793

UtilsVk.cppD04-Jul-2025223 KiB5,1883,838

UtilsVk.hD04-Jul-202532.7 KiB821647

VertexArrayVk.cppD04-Jul-202566.3 KiB1,4721,163

VertexArrayVk.hD04-Jul-20259.2 KiB224165

VkImageImageSiblingVk.cppD04-Jul-20254.6 KiB142103

VkImageImageSiblingVk.hD04-Jul-20251.6 KiB5431

VulkanSecondaryCommandBuffer.cppD04-Jul-20254.5 KiB12696

VulkanSecondaryCommandBuffer.hD04-Jul-202530.7 KiB758652

cl_types.hD04-Jul-2025995 5738

clspv_utils.cppD04-Jul-202521.8 KiB648505

clspv_utils.hD04-Jul-20252.3 KiB8455

gen_vk_format_table.pyD04-Jul-20259.6 KiB300223

gen_vk_internal_shaders.pyD04-Jul-202529.1 KiB813563

gen_vk_mandatory_format_support_table.pyD04-Jul-20255.2 KiB147109

spv_utils.cppD04-Jul-2025221.5 KiB5,6564,129

spv_utils.hD04-Jul-20256.9 KiB181122

vk_cache_utils.cppD04-Jul-2025362.5 KiB8,6006,891

vk_cache_utils.hD04-Jul-2025117.9 KiB3,0452,175

vk_caps_utils.cppD04-Jul-202580.5 KiB1,6671,042

vk_caps_utils.hD04-Jul-20252.8 KiB8854

vk_cl_utils.cppD04-Jul-20253.2 KiB10878

vk_cl_utils.hD04-Jul-20251,008 3519

vk_command_buffer_utils.hD04-Jul-20251.6 KiB5833

vk_format_map.jsonD04-Jul-202523.3 KiB647642

vk_format_table_autogen.cppD04-Jul-2025155.1 KiB3,1912,850

vk_format_utils.cppD04-Jul-202530.7 KiB729576

vk_format_utils.hD04-Jul-202511.8 KiB305201

vk_helpers.cppD04-Jul-2025554.3 KiB13,54410,684

vk_helpers.hD04-Jul-2025187.3 KiB4,2413,088

vk_internal_shaders_autogen.cppD04-Jul-202532.6 KiB576528

vk_internal_shaders_autogen.gniD04-Jul-20257.1 KiB156154

vk_internal_shaders_autogen.hD04-Jul-202510.4 KiB324288

vk_mandatory_format_support_data.jsonD04-Jul-202517.7 KiB439439

vk_mandatory_format_support_table_autogen.cppD04-Jul-202514.4 KiB309291

vk_mem_alloc_wrapper.cppD04-Jul-202511.9 KiB296248

vk_mem_alloc_wrapper.hD04-Jul-20256.3 KiB149112

vk_ref_counted_event.cppD04-Jul-202515.1 KiB489408

vk_ref_counted_event.hD04-Jul-202523.9 KiB653461

vk_renderer.cppD04-Jul-2025319.3 KiB7,2845,075

vk_renderer.hD04-Jul-202550.4 KiB1,144841

vk_resource.cppD04-Jul-20252.7 KiB11080

vk_resource.hD04-Jul-202514.6 KiB428313

vk_utils.cppD04-Jul-202571.8 KiB1,9221,576

vk_utils.hD04-Jul-202555.5 KiB1,6891,279

vk_wrapper.hD04-Jul-202577.9 KiB2,1651,798

vulkan_backend.gniD04-Jul-20255.5 KiB236223

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