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