zink: implement Vk_EXT_index_type_uint8
[mesa.git] / src / gallium / drivers / zink / zink_screen.h
1 /*
2 * Copyright 2018 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 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the 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 NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24 #ifndef ZINK_SCREEN_H
25 #define ZINK_SCREEN_H
26
27 #include "pipe/p_screen.h"
28 #include "util/slab.h"
29
30 #include <vulkan/vulkan.h>
31
32 extern uint32_t zink_debug;
33
34 #define ZINK_DEBUG_NIR 0x1
35 #define ZINK_DEBUG_SPIRV 0x2
36 #define ZINK_DEBUG_TGSI 0x4
37
38 struct zink_screen {
39 struct pipe_screen base;
40
41 struct sw_winsys *winsys;
42
43 struct slab_parent_pool transfer_pool;
44
45 VkInstance instance;
46 VkPhysicalDevice pdev;
47
48 VkPhysicalDeviceProperties props;
49 VkPhysicalDeviceFeatures feats;
50 VkPhysicalDeviceMemoryProperties mem_props;
51 VkPhysicalDeviceTransformFeedbackPropertiesEXT tf_props;
52
53 bool have_KHR_maintenance1;
54 bool have_KHR_external_memory_fd;
55 bool have_EXT_conditional_rendering;
56 bool have_EXT_transform_feedback;
57 bool have_EXT_index_type_uint8;
58
59 bool have_X8_D24_UNORM_PACK32;
60 bool have_D24_UNORM_S8_UINT;
61
62 uint32_t gfx_queue;
63 VkDevice dev;
64
65 PFN_vkGetMemoryFdKHR vk_GetMemoryFdKHR;
66 PFN_vkCmdBeginConditionalRenderingEXT vk_CmdBeginConditionalRenderingEXT;
67 PFN_vkCmdEndConditionalRenderingEXT vk_CmdEndConditionalRenderingEXT;
68
69 PFN_vkCmdBindTransformFeedbackBuffersEXT vk_CmdBindTransformFeedbackBuffersEXT;
70 PFN_vkCmdBeginTransformFeedbackEXT vk_CmdBeginTransformFeedbackEXT;
71 PFN_vkCmdEndTransformFeedbackEXT vk_CmdEndTransformFeedbackEXT;
72 PFN_vkCmdBeginQueryIndexedEXT vk_CmdBeginQueryIndexedEXT;
73 PFN_vkCmdEndQueryIndexedEXT vk_CmdEndQueryIndexedEXT;
74 PFN_vkCmdDrawIndirectByteCountEXT vk_CmdDrawIndirectByteCountEXT;
75 };
76
77 static inline struct zink_screen *
78 zink_screen(struct pipe_screen *pipe)
79 {
80 return (struct zink_screen *)pipe;
81 }
82
83 VkFormat
84 zink_get_format(struct zink_screen *screen, enum pipe_format format);
85
86 bool
87 zink_is_depth_format_supported(struct zink_screen *screen, VkFormat format);
88
89 #endif