• Home
Name Date Size #Lines LOC

..--

android/03-May-2024-513346

doc/03-May-2024-568421

fuchsia/03-May-2024-201117

ggp/03-May-2024-201122

mac/03-May-2024-547406

shaders/03-May-2024-23,04322,526

win32/03-May-2024-305209

xcb/03-May-2024-265170

BUILD.gnD03-May-20246.6 KiB275248

BufferVk.cppD03-May-202420.6 KiB583412

BufferVk.hD03-May-20246.7 KiB185132

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

CommandGraph.hD03-May-202431 KiB814507

CompilerVk.cppD03-May-2024536 2711

CompilerVk.hD03-May-2024735 3114

ContextVk.cppD03-May-2024182.3 KiB4,7743,652

ContextVk.hD03-May-202448.7 KiB1,119784

DeviceVk.cppD03-May-2024843 4526

DeviceVk.hD03-May-2024889 3519

DisplayVk.cppD03-May-20248.7 KiB282220

DisplayVk.hD03-May-20244.7 KiB11976

DisplayVk_api.hD03-May-20241.6 KiB4931

FenceNVVk.cppD03-May-20241.4 KiB5333

FenceNVVk.hD03-May-2024960 3520

FramebufferVk.cppD03-May-202460.3 KiB1,4681,113

FramebufferVk.hD03-May-20249.4 KiB204148

GlslangWrapperVk.cppD03-May-20243.6 KiB9873

GlslangWrapperVk.hD03-May-20242.3 KiB5637

ImageVk.cppD03-May-20244.9 KiB154114

ImageVk.hD03-May-20241.6 KiB6237

MemoryObjectVk.cppD03-May-20247.4 KiB233186

MemoryObjectVk.hD03-May-20242 KiB6140

OWNERSD03-May-202444 32

OverlayVk.cppD03-May-202411.5 KiB279199

OverlayVk.hD03-May-20241.7 KiB6135

PersistentCommandPool.cppD03-May-20243.1 KiB10971

PersistentCommandPool.hD03-May-20241.2 KiB5328

ProgramExecutableVk.cppD03-May-202457.7 KiB1,4411,109

ProgramExecutableVk.hD03-May-202410.4 KiB254176

ProgramPipelineVk.cppD03-May-20246.6 KiB181131

ProgramPipelineVk.hD03-May-20241.9 KiB6338

ProgramVk.cppD03-May-202428 KiB796625

ProgramVk.hD03-May-20248.9 KiB204157

QueryVk.cppD03-May-20249.6 KiB304229

QueryVk.hD03-May-20242.2 KiB6136

README.mdD03-May-20244.1 KiB8458

RenderTargetVk.cppD03-May-20244.9 KiB164127

RenderTargetVk.hD03-May-20243.2 KiB10056

RenderbufferVk.cppD03-May-20248.3 KiB230178

RenderbufferVk.hD03-May-20243.1 KiB8256

RendererVk.cppD03-May-202482.6 KiB2,1551,640

RendererVk.hD03-May-202413.8 KiB368264

ResourceVk.cppD03-May-20242.5 KiB11880

ResourceVk.hD03-May-20245.5 KiB204138

SamplerVk.cppD03-May-20243.1 KiB8257

SamplerVk.hD03-May-20241.2 KiB4827

SecondaryCommandBuffer.cppD03-May-202426.6 KiB566541

SecondaryCommandBuffer.hD03-May-202450.2 KiB1,3241,111

SemaphoreVk.cppD03-May-20249.8 KiB268189

SemaphoreVk.hD03-May-20241.6 KiB5030

ShaderVk.cppD03-May-20242.1 KiB7648

ShaderVk.hD03-May-2024911 3417

SurfaceVk.cppD03-May-202457.9 KiB1,5591,148

SurfaceVk.hD03-May-202412.3 KiB314214

SyncVk.cppD03-May-20248.5 KiB300224

SyncVk.hD03-May-20243.3 KiB10875

TextureVk.cppD03-May-202478.5 KiB1,8611,415

TextureVk.hD03-May-202420.6 KiB439326

TransformFeedbackVk.cppD03-May-202413.2 KiB326232

TransformFeedbackVk.hD03-May-20244.2 KiB10972

UtilsVk.cppD03-May-202483.3 KiB1,9831,563

UtilsVk.hD03-May-202419.4 KiB484364

VertexArrayVk.cppD03-May-202439.5 KiB875686

VertexArrayVk.hD03-May-20247.2 KiB170126

gen_vk_format_table.pyD03-May-20247.9 KiB245181

gen_vk_internal_shaders.pyD03-May-202425.9 KiB732499

gen_vk_mandatory_format_support_table.pyD03-May-20244.3 KiB144103

vk_cache_utils.cppD03-May-202481 KiB2,0071,614

vk_cache_utils.hD03-May-202439.5 KiB989687

vk_caps_utils.cppD03-May-202436.6 KiB730470

vk_caps_utils.hD03-May-20242.5 KiB8351

vk_ext_provoking_vertex.hD03-May-20242.6 KiB6643

vk_format_map.jsonD03-May-202418.6 KiB517514

vk_format_table_autogen.cppD03-May-2024130.9 KiB2,6092,305

vk_format_utils.cppD03-May-202415.7 KiB407309

vk_format_utils.hD03-May-20246.1 KiB175107

vk_helpers.cppD03-May-2024157 KiB4,1073,208

vk_helpers.hD03-May-202454.6 KiB1,345915

vk_internal_shaders_autogen.cppD03-May-202425.7 KiB475439

vk_internal_shaders_autogen.gniD03-May-20245.8 KiB129127

vk_internal_shaders_autogen.hD03-May-20248.4 KiB272242

vk_mandatory_format_support_data.jsonD03-May-202417.7 KiB439439

vk_mandatory_format_support_table_autogen.cppD03-May-202424.2 KiB610404

vk_mem_alloc_wrapper.cppD03-May-20244.4 KiB11793

vk_mem_alloc_wrapper.hD03-May-20242 KiB5836

vk_utils.cppD03-May-202436.1 KiB1,033886

vk_utils.hD03-May-202421.8 KiB730546

vk_wrapper.hD03-May-202460.9 KiB1,7101,410

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 the following `ContextVk` APIs:
28
29 * `endRenderPassAndGetCommandBuffer`: returns a secondary command buffer *outside* a RenderPass instance.
30 * `flushAndBeginRenderPass`: returns a secondary command buffer *inside* a RenderPass instance.
31 * `flushAndGetPrimaryCommandBuffer`: returns the primary command buffer. You should rarely need this API.
32
33*Note*: All of these commands may write out (aka flush) prior pending commands into a primary
34command buffer. When a RenderPass is open `endRenderPassAndGetCommandBuffer` will flush the
35pending RenderPass commands. `flushAndBeginRenderPass` will flush out pending commands outside a
36RenderPass to a primary buffer. On submit ANGLE submits the primary command buffer to a `VkQueue`.
37
38If you need to record inside a RenderPass, use `flushAndBeginRenderPass`. Otherwise, use
39`endRenderPassAndGetCommandBuffer`. You should rarely need to call `flushAndGetPrimaryCommandBuffer`.
40It's there for commands like debug labels, barriers and queries that need to be recorded serially on
41the primary command buffer.
42
43The back-end usually records Image and Buffer barriers through additional `ContextVk` APIs:
44
45 * `onBufferRead` and `onBufferWrite` accumulate `VkBuffer` barriers.
46 * `onImageRead` and `onImageWrite` accumulate `VkImage` barriers.
47 * `onRenderPassImageWrite` is a special API for write barriers inside a RenderPass instance.
48
49After the back-end records commands to the primary buffer we flush (e.g. on swap) or when we call
50`ContextVk::finishToSerial`.
51
52See the [code][CommandAPIs] for more details.
53
54### Simple command recording example
55
56In this example we'll be recording a buffer copy command:
57
58```
59    # Ensure that ANGLE sets proper read and write barriers for the Buffers.
60    ANGLE_TRY(contextVk->onBufferWrite(VK_ACCESS_TRANSFER_WRITE_BIT, destBuffer));
61    ANGLE_TRY(contextVk->onBufferRead(VK_ACCESS_TRANSFER_READ_BIT, srcBuffer));
62
63    # Get a pointer to a secondary command buffer for command recording. May "flush" the RP.
64    vk::CommandBuffer *commandBuffer;
65    ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
66
67    # Record the copy command into the secondary buffer. We're done!
68    commandBuffer->copyBuffer(srcBuffer->getBuffer(), destBuffer->getBuffer(), copyCount, copies);
69```
70
71## Additional Reading
72
73More implementation details can be found in the `doc` directory:
74
75- [Fast OpenGL State Transitions](doc/FastOpenGLStateTransitions.md)
76- [Shader Module Compilation](doc/ShaderModuleCompilation.md)
77- [OpenGL Line Segment Rasterization](doc/OpenGLLineSegmentRasterization.md)
78- [Format Tables and Emulation](doc/FormatTablesAndEmulation.md)
79
80[VkDevice]: https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkDevice.html
81[VkQueue]: https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkQueue.html
82[CommandAPIs]: https://chromium.googlesource.com/angle/angle/+/aa09ca69e4173cb14261e39be3b7bdf56bbd3840/src/libANGLE/renderer/vulkan/ContextVk.h#579
83
84