• Home
Name Date Size #Lines LOC

..--

android/03-May-2024-1,094721

doc/03-May-2024-726556

fuchsia/03-May-2024-205120

ggp/03-May-2024-198119

linux/03-May-2024-1,7431,171

mac/03-May-2024-614456

null/03-May-2024-10561

shaders/03-May-2024-31,16629,203

win32/03-May-2024-315216

BUILD.gnD03-May-20248.3 KiB329299

BufferVk.cppD03-May-202439.2 KiB1,042771

BufferVk.hD03-May-20249.8 KiB237174

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-202450.1 KiB1,4471,168

CommandProcessor.hD03-May-202424.7 KiB648472

CompilerVk.cppD03-May-2024537 2711

CompilerVk.hD03-May-2024735 3114

ContextVk.cppD03-May-2024296.6 KiB7,2505,400

ContextVk.hD03-May-202471 KiB1,4521,021

DebugAnnotatorVk.cppD03-May-20245.2 KiB145125

DebugAnnotatorVk.hD03-May-20241.3 KiB4325

DeviceVk.cppD03-May-20246.7 KiB223185

DeviceVk.hD03-May-20242.2 KiB6038

DisplayVk.cppD03-May-202417.7 KiB536433

DisplayVk.hD03-May-20248.1 KiB195123

DisplayVk_api.hD03-May-20242 KiB6239

FenceNVVk.cppD03-May-20241.4 KiB5434

FenceNVVk.hD03-May-2024960 3520

FramebufferVk.cppD03-May-2024127.7 KiB3,0052,229

FramebufferVk.hD03-May-202412.8 KiB276204

GlslangWrapperVk.cppD03-May-20242.9 KiB7251

GlslangWrapperVk.hD03-May-20241.8 KiB4830

ImageVk.cppD03-May-20245.5 KiB171124

ImageVk.hD03-May-20241.5 KiB6035

MemoryObjectVk.cppD03-May-20249.2 KiB263207

MemoryObjectVk.hD03-May-20242.4 KiB6946

OWNERSD03-May-202461 43

OverlayVk.cppD03-May-20247 KiB169121

OverlayVk.hD03-May-20241.2 KiB4727

PersistentCommandPool.cppD03-May-20243.5 KiB11878

PersistentCommandPool.hD03-May-20241.2 KiB5328

ProgramExecutableVk.cppD03-May-202493.6 KiB2,2211,773

ProgramExecutableVk.hD03-May-202420.9 KiB441348

ProgramPipelineVk.cppD03-May-20244.4 KiB11379

ProgramPipelineVk.hD03-May-20241.4 KiB4726

ProgramVk.cppD03-May-202424.1 KiB671523

ProgramVk.hD03-May-20246.7 KiB154124

QueryVk.cppD03-May-202423.1 KiB682486

QueryVk.hD03-May-20243.4 KiB8852

README.mdD03-May-20244.3 KiB8864

RenderTargetVk.cppD03-May-202414.2 KiB381292

RenderTargetVk.hD03-May-20249.7 KiB219109

RenderbufferVk.cppD03-May-202415.2 KiB381296

RenderbufferVk.hD03-May-20245.8 KiB13289

RendererVk.cppD03-May-2024181 KiB4,3853,278

RendererVk.hD03-May-202429.7 KiB764570

ResourceVk.cppD03-May-20245.4 KiB230174

ResourceVk.hD03-May-20249.5 KiB309212

SamplerVk.cppD03-May-20241.2 KiB4929

SamplerVk.hD03-May-20241 KiB4224

SecondaryCommandBuffer.cppD03-May-202429.5 KiB626604

SecondaryCommandBuffer.hD03-May-202457.2 KiB1,5221,273

SemaphoreVk.cppD03-May-20249.7 KiB254168

SemaphoreVk.hD03-May-20241.6 KiB5030

ShaderVk.cppD03-May-20243.8 KiB12180

ShaderVk.hD03-May-2024912 3417

SurfaceVk.cppD03-May-202497.6 KiB2,4901,839

SurfaceVk.hD03-May-202418.5 KiB432276

SyncVk.cppD03-May-202418.4 KiB558396

SyncVk.hD03-May-20244.5 KiB13697

TextureVk.cppD03-May-2024150.7 KiB3,5182,561

TextureVk.hD03-May-202430.1 KiB616436

TransformFeedbackVk.cppD03-May-202415.4 KiB399312

TransformFeedbackVk.hD03-May-20245.6 KiB152106

UtilsVk.cppD03-May-2024150.6 KiB3,5562,572

UtilsVk.hD03-May-202423.2 KiB576441

VertexArrayVk.cppD03-May-202445.8 KiB1,032796

VertexArrayVk.hD03-May-20246.9 KiB164119

VkImageImageSiblingVk.cppD03-May-20244.6 KiB142103

VkImageImageSiblingVk.hD03-May-20241.6 KiB5431

VulkanSecondaryCommandBuffer.cppD03-May-20244.2 KiB11789

VulkanSecondaryCommandBuffer.hD03-May-202426.3 KiB642553

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

vk_cache_utils.cppD03-May-2024179.3 KiB4,1883,237

vk_cache_utils.hD03-May-202472 KiB1,8811,332

vk_caps_utils.cppD03-May-202464.4 KiB1,351842

vk_caps_utils.hD03-May-20242.5 KiB8251

vk_command_buffer_utils.hD03-May-20241.2 KiB3919

vk_format_map.jsonD03-May-202419.3 KiB510507

vk_format_table_autogen.cppD03-May-2024141.3 KiB2,8702,561

vk_format_utils.cppD03-May-202419.6 KiB489370

vk_format_utils.hD03-May-20249.6 KiB259175

vk_helpers.cppD03-May-2024391.5 KiB9,8067,699

vk_helpers.hD03-May-2024130.5 KiB3,0412,210

vk_internal_shaders_autogen.cppD03-May-202429.3 KiB537496

vk_internal_shaders_autogen.gniD03-May-20246.5 KiB145143

vk_internal_shaders_autogen.hD03-May-20247.9 KiB251221

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-202410.4 KiB270224

vk_mem_alloc_wrapper.hD03-May-20245.1 KiB12894

vk_utils.cppD03-May-202460.4 KiB1,6821,360

vk_utils.hD03-May-202447.5 KiB1,5151,156

vk_wrapper.hD03-May-202465.4 KiB1,8561,529

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 following `ContextVk` APIs:
28
29 * `beginNewRenderPass`: Writes out (aka flushes) prior pending commands into a primary command
30   buffer, then starts a new render pass. Returns a secondary command buffer *inside* a render pass
31   instance.
32 * `getOutsideRenderPassCommandBuffer`: May flush prior command buffers and close the render pass if
33   necessary, in addition to issuing the appropriate barriers. Returns a secondary command buffer
34   *outside* a render pass instance.
35 * `getStartedRenderPassCommands`: Returns a reference to the currently open render pass' commands
36   buffer.
37
38The back-end (mostly) records Image and Buffer barriers through additional `CommandBufferAccess`
39APIs, the result of which is passed to `getOutsideRenderPassCommandBuffer`.  Note that the
40barriers are not actually recorded until `getOutsideRenderPassCommandBuffer` is called:
41
42 * `onBufferTransferRead` and `onBufferComputeShaderRead` accumulate `VkBuffer` read barriers.
43 * `onBufferTransferWrite` and `onBufferComputeShaderWrite` accumulate `VkBuffer` write barriers.
44 * `onBuffferSelfCopy` is a special case for `VkBuffer` self copies. It behaves the same as write.
45 * `onImageTransferRead` and `onImageComputerShadeRead` accumulate `VkImage` read barriers.
46 * `onImageTransferWrite` and `onImageComputerShadeWrite` accumulate `VkImage` write barriers.
47 * `onImageRenderPassRead` and `onImageRenderPassWrite` accumulate `VkImage` barriers inside a
48   started RenderPass.
49
50After the back-end records commands to the primary buffer and we flush (e.g. on swap) or when we call
51`ContextVk::finishToSerial`, ANGLE submits the primary command buffer to a `VkQueue`.
52
53See the [code][CommandAPIs] for more details.
54
55### Simple command recording example
56
57In this example we'll be recording a buffer copy command:
58
59```
60    // Ensure that ANGLE sets proper read and write barriers for the Buffers.
61    vk::CommandBufferAccess access;
62    access.onBufferTransferWrite(dstBuffer);
63    access.onBufferTransferRead(srcBuffer);
64
65    // Get a pointer to a secondary command buffer for command recording.
66    vk::OutsideRenderPassCommandBuffer *commandBuffer;
67    ANGLE_TRY(contextVk->getOutsideRenderPassCommandBuffer(access, &commandBuffer));
68
69    // Record the copy command into the secondary buffer. We're done!
70    commandBuffer->copyBuffer(srcBuffer->getBuffer(), dstBuffer->getBuffer(), copyCount, copies);
71```
72
73## Additional Reading
74
75More implementation details can be found in the `doc` directory:
76
77- [Fast OpenGL State Transitions](doc/FastOpenGLStateTransitions.md)
78- [Shader Module Compilation](doc/ShaderModuleCompilation.md)
79- [OpenGL Line Segment Rasterization](doc/OpenGLLineSegmentRasterization.md)
80- [Format Tables and Emulation](doc/FormatTablesAndEmulation.md)
81- [Deferred Clears](doc/DeferredClears.md)
82- [Queries](doc/Queries.md)
83
84[VkDevice]: https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkDevice.html
85[VkQueue]: https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkQueue.html
86[CommandAPIs]: https://chromium.googlesource.com/angle/angle/+/df31624eaf3df986a0bdf3f58a87b79b0cc8db5c/src/libANGLE/renderer/vulkan/ContextVk.h#620
87
88