• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 Google LLC
3  * SPDX-License-Identifier: MIT
4  *
5  * based in part on anv and radv which are:
6  * Copyright © 2015 Intel Corporation
7  * Copyright © 2016 Red Hat.
8  * Copyright © 2016 Bas Nieuwenhuizen
9  */
10 
11 #ifndef VN_COMMAND_BUFFER_H
12 #define VN_COMMAND_BUFFER_H
13 
14 #include "vn_common.h"
15 
16 #include "vn_cs.h"
17 
18 struct vn_command_pool {
19    struct vn_object_base base;
20 
21    VkAllocationCallbacks allocator;
22    uint32_t queue_family_index;
23 
24    struct list_head command_buffers;
25 };
26 VK_DEFINE_NONDISP_HANDLE_CASTS(vn_command_pool,
27                                base.base,
28                                VkCommandPool,
29                                VK_OBJECT_TYPE_COMMAND_POOL)
30 
31 enum vn_command_buffer_state {
32    VN_COMMAND_BUFFER_STATE_INITIAL,
33    VN_COMMAND_BUFFER_STATE_RECORDING,
34    VN_COMMAND_BUFFER_STATE_EXECUTABLE,
35    VN_COMMAND_BUFFER_STATE_INVALID,
36 };
37 
38 struct vn_command_buffer_builder {
39    /* for scrubbing VK_IMAGE_LAYOUT_PRESENT_SRC_KHR */
40    uint32_t image_barrier_count;
41    VkImageMemoryBarrier *image_barriers;
42 
43    const struct vn_render_pass *render_pass;
44    const struct vn_framebuffer *framebuffer;
45    const struct vn_image **present_src_images;
46 };
47 
48 struct vn_command_buffer {
49    struct vn_object_base base;
50 
51    struct vn_device *device;
52 
53    VkAllocationCallbacks allocator;
54    VkCommandBufferLevel level;
55    uint32_t queue_family_index;
56 
57    struct list_head head;
58 
59    struct vn_command_buffer_builder builder;
60 
61    enum vn_command_buffer_state state;
62    struct vn_cs_encoder cs;
63 
64    uint32_t draw_cmd_batched;
65 };
66 VK_DEFINE_HANDLE_CASTS(vn_command_buffer,
67                        base.base,
68                        VkCommandBuffer,
69                        VK_OBJECT_TYPE_COMMAND_BUFFER)
70 
71 #endif /* VN_COMMAND_BUFFER_H */
72