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