| Flutter Impeller |

barrier_vk.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_BARRIER_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_BARRIER_VK_H_
7
8 #include "impeller/renderer/backend/vulkan/vk.h"
9
10 namespace impeller {
11
12 //------------------------------------------------------------------------------
13 /// @brief Defines an operations and memory access barrier on a resource.
14 ///
15 /// For further reading, see
16 /// https://www.khronos.org/events/vulkan-how-to-use-synchronisation-validation-across-multiple-queues-and-command-buffers
17 /// and the Vulkan spec. The docs for the various member of this
18 /// class are based on verbiage in the spec.
19 ///
20 /// A useful mnemonic for building a mental model of how to add
21 /// these barriers is to build a sentence like so; "All commands
22 /// before this barrier may continue till they encounter a <src
23 /// access> in the <src pipeline stage>. And, all commands after
24 /// this barrier may proceed till <dst access> in the <dst pipeline
25 /// stage>."
26 ///
27 struct BarrierVK {
28 vk::CommandBuffer cmd_buffer = {};
29 vk::ImageLayout new_layout = vk::ImageLayout::eUndefined;
30
31 // The first synchronization scope defines what operations the barrier waits
32 // for to be done. In the Vulkan spec, this is usually referred to as the src
33 // scope.
34 vk::PipelineStageFlags src_stage = vk::PipelineStageFlagBits::eNone;
35
36 // The first access scope defines what memory operations are guaranteed to
37 // happen before the barrier. In the Vulkan spec, this is usually referred to
38 // as the src scope.
39 vk::AccessFlags src_access = vk::AccessFlagBits::eNone;
40
41 // The second synchronization scope defines what operations wait for the
42 // barrier to be done. In the Vulkan spec, this is usually referred to as the
43 // dst scope.
44 vk::PipelineStageFlags dst_stage = vk::PipelineStageFlagBits::eNone;
45
46 // The second access scope defines what memory operations are prevented from
47 // running till after the barrier. In the Vulkan spec, this is usually
48 // referred to as the dst scope.
49 vk::AccessFlags dst_access = vk::AccessFlagBits::eNone;
50 };
51
52 } // namespace impeller
53
54 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_BARRIER_VK_H_
impeller::BarrierVK::dst_access
vk::AccessFlags dst_access
Definition: barrier_vk.h:49
impeller::BarrierVK::new_layout
vk::ImageLayout new_layout
Definition: barrier_vk.h:29
impeller::BarrierVK::cmd_buffer
vk::CommandBuffer cmd_buffer
Definition: barrier_vk.h:28
vk.h
impeller::BarrierVK
Defines an operations and memory access barrier on a resource.
Definition: barrier_vk.h:27
impeller::BarrierVK::src_access
vk::AccessFlags src_access
Definition: barrier_vk.h:39
impeller::BarrierVK::dst_stage
vk::PipelineStageFlags dst_stage
Definition: barrier_vk.h:44
impeller
Definition: allocation.cc:12
impeller::BarrierVK::src_stage
vk::PipelineStageFlags src_stage
Definition: barrier_vk.h:34