xref: /aosp_15_r20/external/mesa3d/src/virtio/vulkan/vn_pipeline.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
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_PIPELINE_H
12 #define VN_PIPELINE_H
13 
14 #include "vn_common.h"
15 
16 struct vn_shader_module {
17    struct vn_object_base base;
18 };
19 VK_DEFINE_NONDISP_HANDLE_CASTS(vn_shader_module,
20                                base.base,
21                                VkShaderModule,
22                                VK_OBJECT_TYPE_SHADER_MODULE)
23 
24 struct vn_pipeline_layout {
25    struct vn_object_base base;
26 
27    struct vn_descriptor_set_layout *push_descriptor_set_layout;
28    bool has_push_constant_ranges;
29    struct vn_refcount refcount;
30 };
31 VK_DEFINE_NONDISP_HANDLE_CASTS(vn_pipeline_layout,
32                                base.base,
33                                VkPipelineLayout,
34                                VK_OBJECT_TYPE_PIPELINE_LAYOUT)
35 
36 struct vn_pipeline_cache {
37    struct vn_object_base base;
38 };
39 VK_DEFINE_NONDISP_HANDLE_CASTS(vn_pipeline_cache,
40                                base.base,
41                                VkPipelineCache,
42                                VK_OBJECT_TYPE_PIPELINE_CACHE)
43 
44 enum vn_pipeline_type {
45    VN_PIPELINE_TYPE_GRAPHICS,
46    VN_PIPELINE_TYPE_COMPUTE,
47 };
48 
49 struct vn_pipeline {
50    struct vn_object_base base;
51    enum vn_pipeline_type type;
52 
53    /**
54     * The VkPipelineLayout provided directly (without linking) at pipeline
55     * creation. Null if none was provided.
56     *
57     * We track the pipeline layout here to extend its and its children's
58     * lifetime, NOT because this is the actual layout used by the pipeline.
59     *
60     * WARNING. This may not be the actual layout used by the pipeline. The
61     * Vulkan 1.3.254 spec says:
62     *
63     *    The final effective pipeline layout is effectively the union of the
64     *    linked pipeline layouts. When binding descriptor sets for this
65     *    pipeline, the pipeline layout used must be compatible with this
66     *    union.
67     */
68    struct vn_pipeline_layout *layout;
69 };
70 VK_DEFINE_NONDISP_HANDLE_CASTS(vn_pipeline,
71                                base.base,
72                                VkPipeline,
73                                VK_OBJECT_TYPE_PIPELINE)
74 
75 #endif /* VN_PIPELINE_H */
76