xref: /aosp_15_r20/external/mesa3d/src/imagination/vulkan/pvr_limits.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2022 Imagination Technologies Ltd.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * 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 THE
18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  */
23 
24 /**
25  * Constants for VkPhysicalDeviceLimits.
26  */
27 
28 #ifndef PVR_LIMITS_H
29 #define PVR_LIMITS_H
30 
31 #include "hwdef/rogue_hw_defs.h"
32 #include "pvr_device_info.h"
33 #include "util/u_math.h"
34 
35 #define PVR_MAX_COLOR_ATTACHMENTS PVR_NUM_PBE_EMIT_REGS
36 #define PVR_MAX_QUEUES 2U
37 #define PVR_MAX_VIEWPORTS 1U
38 #define PVR_MAX_NEG_OFFSCREEN_OFFSET 4096U
39 
40 #define PVR_MAX_PUSH_CONSTANTS_SIZE 256U
41 
42 #define PVR_MAX_TEXTURE_EXTENT_Z \
43    (PVRX(TEXSTATE_IMAGE_WORD1_DEPTH_MAX_SIZE) + 1U)
44 
45 #define PVR_MAX_ARRAY_LAYERS (PVRX(TEXSTATE_IMAGE_WORD1_DEPTH_MAX_SIZE) + 1U)
46 
47 #define PVR_MAX_DESCRIPTOR_SETS 4U
48 #define PVR_MAX_DESCRIPTOR_SET_UNIFORM_DYNAMIC_BUFFERS 8U
49 #define PVR_MAX_DESCRIPTOR_SET_STORAGE_DYNAMIC_BUFFERS 8U
50 
51 #define PVR_MAX_FRAMEBUFFER_LAYERS PVR_MAX_ARRAY_LAYERS
52 
53 /* The limit is somewhat arbitrary, it just translates into more pds code
54  * and larger arrays, 32 appears to be the popular (and highest choice) across
55  * other implementations.
56  */
57 #define PVR_MAX_VERTEX_INPUT_BINDINGS 16U
58 
59 /* We need one RenderTarget per supported MSAA mode as each render target
60  * contains state that is dependent on the sample count of the render that is
61  * rendering to it.
62  *
63  * As we do not know the sample count until we know the renderpass framebuffer
64  * combination being used, we create one per supported sample mode.
65  */
66 #define PVR_RENDER_TARGETS_PER_FRAMEBUFFER(dev_info)                         \
67    ({                                                                        \
68       uint32_t __ret = PVR_GET_FEATURE_VALUE(dev_info, max_multisample, 4U); \
69       util_logbase2(__ret) + 1;                                              \
70    })
71 
72 #endif
73