• Home
Name Date Size #Lines LOC

..--

android/03-May-2024-513346

doc/03-May-2024-603453

fuchsia/03-May-2024-204120

ggp/03-May-2024-201122

mac/03-May-2024-547406

shaders/03-May-2024-23,06322,545

win32/03-May-2024-305209

xcb/03-May-2024-272177

BUILD.gnD03-May-20246.3 KiB268244

BufferVk.cppD03-May-202423.8 KiB672475

BufferVk.hD03-May-20247.3 KiB198141

CommandProcessor.cppD03-May-20242.8 KiB7957

CommandProcessor.hD03-May-20242.5 KiB7538

CompilerVk.cppD03-May-2024536 2711

CompilerVk.hD03-May-2024735 3114

ContextVk.cppD03-May-2024170.5 KiB4,3903,358

ContextVk.hD03-May-202444.7 KiB984676

DeviceVk.cppD03-May-2024843 4526

DeviceVk.hD03-May-2024889 3519

DisplayVk.cppD03-May-20249 KiB292228

DisplayVk.hD03-May-20244.8 KiB12681

DisplayVk_api.hD03-May-20241.6 KiB4931

FenceNVVk.cppD03-May-20241.4 KiB5333

FenceNVVk.hD03-May-2024960 3520

FramebufferVk.cppD03-May-202472 KiB1,7641,345

FramebufferVk.hD03-May-202410.6 KiB229169

GlslangWrapperVk.cppD03-May-20243.7 KiB9974

GlslangWrapperVk.hD03-May-20242.4 KiB5738

ImageVk.cppD03-May-20244.9 KiB154114

ImageVk.hD03-May-20241.6 KiB6237

MemoryObjectVk.cppD03-May-20248.6 KiB255195

MemoryObjectVk.hD03-May-20242.1 KiB6441

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-202458.5 KiB1,4561,128

ProgramExecutableVk.hD03-May-202410.6 KiB256178

ProgramPipelineVk.cppD03-May-20246.9 KiB184131

ProgramPipelineVk.hD03-May-20241.9 KiB6338

ProgramVk.cppD03-May-202428 KiB797625

ProgramVk.hD03-May-20248.9 KiB204157

QueryVk.cppD03-May-20249.6 KiB304229

QueryVk.hD03-May-20242.2 KiB6136

README.mdD03-May-20244.2 KiB8458

RenderTargetVk.cppD03-May-20245.8 KiB191147

RenderTargetVk.hD03-May-20243.5 KiB10259

RenderbufferVk.cppD03-May-20248.9 KiB250194

RenderbufferVk.hD03-May-20243.4 KiB8758

RendererVk.cppD03-May-202485 KiB2,2101,670

RendererVk.hD03-May-202414.8 KiB392281

ResourceVk.cppD03-May-20242.5 KiB11880

ResourceVk.hD03-May-20245.5 KiB204138

SamplerVk.cppD03-May-20241.2 KiB5130

SamplerVk.hD03-May-20241.1 KiB4626

SecondaryCommandBuffer.cppD03-May-202429 KiB616589

SecondaryCommandBuffer.hD03-May-202453.7 KiB1,4071,174

SemaphoreVk.cppD03-May-202410.2 KiB274193

SemaphoreVk.hD03-May-20241.6 KiB5030

ShaderVk.cppD03-May-20242.1 KiB7648

ShaderVk.hD03-May-2024911 3417

SurfaceVk.cppD03-May-202461.8 KiB1,6641,226

SurfaceVk.hD03-May-202413.5 KiB331223

SyncVk.cppD03-May-202417.3 KiB512381

SyncVk.hD03-May-20244.7 KiB14399

TextureVk.cppD03-May-202479.7 KiB1,9031,447

TextureVk.hD03-May-202420.9 KiB442327

TransformFeedbackVk.cppD03-May-202413.3 KiB340246

TransformFeedbackVk.hD03-May-20244.4 KiB12386

UtilsVk.cppD03-May-202483.2 KiB1,9871,566

UtilsVk.hD03-May-202419.4 KiB484364

VertexArrayVk.cppD03-May-202439.4 KiB872683

VertexArrayVk.hD03-May-20247.1 KiB167125

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-202487.6 KiB2,1901,757

vk_cache_utils.hD03-May-202441.6 KiB1,063733

vk_caps_utils.cppD03-May-202437.9 KiB755484

vk_caps_utils.hD03-May-20242.5 KiB8251

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-202411.8 KiB322250

vk_google_filtering_precision.hD03-May-20242.2 KiB5330

vk_headers.hD03-May-20243.1 KiB8648

vk_helpers.cppD03-May-2024192 KiB4,9383,893

vk_helpers.hD03-May-202470.1 KiB1,7491,217

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-20245.9 KiB144115

vk_mem_alloc_wrapper.hD03-May-20242.5 KiB6643

vk_utils.cppD03-May-202444 KiB1,2361,036

vk_utils.hD03-May-202424.6 KiB809596

vk_wrapper.hD03-May-202465 KiB1,8131,496

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 * `onBufferTransferRead/onBufferComputeShaderRead` and `onBufferTransferWrite/onBufferComputeShaderWrite` 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->onBufferTransferWrite(destBuffer));
61    ANGLE_TRY(contextVk->onBufferTransferRead(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/+/df31624eaf3df986a0bdf3f58a87b79b0cc8db5c/src/libANGLE/renderer/vulkan/ContextVk.h#620
83
84