• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 Collabora Ltd.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 #ifndef PANVK_CS_H
25 #define PANVK_CS_H
26 
27 #include "pan_encoder.h"
28 
29 #include <vulkan/vulkan.h>
30 
31 #include "compiler/shader_enums.h"
32 #include "pan_desc.h"
33 #include "panfrost-job.h"
34 
35 #include "vk_util.h"
36 
37 #include "panvk_private.h"
38 
39 struct pan_blend_state;
40 struct pan_shader_info;
41 struct panfrost_ptr;
42 struct pan_pool;
43 
44 union panvk_sysval_data;
45 struct panvk_framebuffer;
46 struct panvk_cmd_state;
47 struct panvk_compute_dim;
48 struct panvk_device;
49 struct panvk_batch;
50 struct panvk_varyings_info;
51 struct panvk_attrib_buf;
52 struct panvk_attribs_info;
53 struct panvk_pipeline;
54 struct panvk_draw_info;
55 struct panvk_descriptor_state;
56 struct panvk_subpass;
57 struct panvk_clear_value;
58 
59 #ifdef PAN_ARCH
60 static inline enum mali_func
panvk_per_arch(translate_compare_func)61 panvk_per_arch(translate_compare_func)(VkCompareOp comp)
62 {
63    STATIC_ASSERT(VK_COMPARE_OP_NEVER == (VkCompareOp)MALI_FUNC_NEVER);
64    STATIC_ASSERT(VK_COMPARE_OP_LESS == (VkCompareOp)MALI_FUNC_LESS);
65    STATIC_ASSERT(VK_COMPARE_OP_EQUAL == (VkCompareOp)MALI_FUNC_EQUAL);
66    STATIC_ASSERT(VK_COMPARE_OP_LESS_OR_EQUAL == (VkCompareOp)MALI_FUNC_LEQUAL);
67    STATIC_ASSERT(VK_COMPARE_OP_GREATER == (VkCompareOp)MALI_FUNC_GREATER);
68    STATIC_ASSERT(VK_COMPARE_OP_NOT_EQUAL == (VkCompareOp)MALI_FUNC_NOT_EQUAL);
69    STATIC_ASSERT(VK_COMPARE_OP_GREATER_OR_EQUAL ==
70                  (VkCompareOp)MALI_FUNC_GEQUAL);
71    STATIC_ASSERT(VK_COMPARE_OP_ALWAYS == (VkCompareOp)MALI_FUNC_ALWAYS);
72 
73    return (enum mali_func)comp;
74 }
75 
76 static inline enum mali_func
panvk_per_arch(translate_sampler_compare_func)77 panvk_per_arch(translate_sampler_compare_func)(
78    const VkSamplerCreateInfo *pCreateInfo)
79 {
80    if (!pCreateInfo->compareEnable)
81       return MALI_FUNC_NEVER;
82 
83    enum mali_func f =
84       panvk_per_arch(translate_compare_func)(pCreateInfo->compareOp);
85    return panfrost_flip_compare_func(f);
86 }
87 #endif
88 
89 void panvk_sysval_upload_viewport_scale(const VkViewport *viewport,
90                                         union panvk_sysval_vec4 *data);
91 
92 void panvk_sysval_upload_viewport_offset(const VkViewport *viewport,
93                                          union panvk_sysval_vec4 *data);
94 
95 #endif
96