• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2021 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // vk_command_buffer_utils:
7 //    Helpers for secondary command buffer implementations.
8 //
9 
10 #ifndef LIBANGLE_RENDERER_VULKAN_VK_COMMAND_BUFFER_UTILS_H_
11 #define LIBANGLE_RENDERER_VULKAN_VK_COMMAND_BUFFER_UTILS_H_
12 
13 namespace rx
14 {
15 namespace vk
16 {
17 
18 // A helper class to track commands recorded to a command buffer.
19 class CommandBufferCommandTracker
20 {
21   public:
onDraw()22     void onDraw() { ++mRenderPassWriteCommandCount; }
onClearAttachments()23     void onClearAttachments() { ++mRenderPassWriteCommandCount; }
getRenderPassWriteCommandCount()24     uint32_t getRenderPassWriteCommandCount() const { return mRenderPassWriteCommandCount; }
25 
reset()26     void reset() { *this = CommandBufferCommandTracker{}; }
27 
28   private:
29     // The number of commands recorded that can modify a render pass attachment, i.e.
30     // vkCmdClearAttachment and vkCmdDraw*.  Used to know if a command might have written to an
31     // attachment after it was invalidated.
32     uint32_t mRenderPassWriteCommandCount = 0;
33 };
34 
35 }  // namespace vk
36 }  // namespace rx
37 
38 #endif  // LIBANGLE_RENDERER_VULKAN_VK_COMMAND_BUFFER_UTILS_H_
39