David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 1 | /* |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 2 | * Vulkan |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2014 LunarG, Inc. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the "Software"), |
| 8 | * to deal in the Software without restriction, including without limitation |
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 | * and/or sell copies of the Software, and to permit persons to whom the |
| 11 | * Software is furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included |
| 14 | * in all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 22 | * DEALINGS IN THE SOFTWARE. |
| 23 | */ |
| 24 | |
| 25 | #ifndef NULLDRV_H |
Mark Lobodzinski | 556f721 | 2015-04-17 14:11:39 -0500 | [diff] [blame] | 26 | #define NULLDRV_H |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 27 | #include <stdlib.h> |
| 28 | #include <stdbool.h> |
| 29 | #include <stdint.h> |
| 30 | #include <string.h> |
| 31 | #include <assert.h> |
| 32 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 33 | #include <vulkan.h> |
Courtney Goeltzenleuchter | 1c7c65d | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 34 | #include <vk_debug_report_lunarg.h> |
Tobin Ehlis | 2d1d970 | 2015-07-03 09:42:57 -0600 | [diff] [blame] | 35 | #include <vk_icd.h> |
Ian Elliott | 338dedb | 2015-08-21 15:09:33 -0600 | [diff] [blame] | 36 | #include "vk_ext_khr_swapchain.h" |
| 37 | #include "vk_ext_khr_device_swapchain.h" |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 38 | |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 39 | #include "icd.h" |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 40 | |
| 41 | #include "icd-format.h" |
| 42 | #include "icd-utils.h" |
| 43 | |
| 44 | struct nulldrv_base { |
| 45 | void *loader_data; |
| 46 | uint32_t magic; |
Tony Barbour | 426b905 | 2015-06-24 16:06:58 -0600 | [diff] [blame] | 47 | VkResult (*get_memory_requirements)(struct nulldrv_base *base, VkMemoryRequirements *pMemoryRequirements); |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | struct nulldrv_obj { |
| 51 | struct nulldrv_base base; |
| 52 | }; |
| 53 | |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 54 | enum nulldrv_ext_type { |
Ian Elliott | 338dedb | 2015-08-21 15:09:33 -0600 | [diff] [blame] | 55 | NULLDRV_EXT_KHR_SWAPCHAIN, |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 56 | NULLDRV_EXT_COUNT, |
| 57 | NULLDRV_EXT_INVALID = NULLDRV_EXT_COUNT, |
| 58 | }; |
| 59 | |
| 60 | |
| 61 | struct nulldrv_instance { |
| 62 | struct nulldrv_obj obj; |
| 63 | }; |
| 64 | |
| 65 | struct nulldrv_gpu { |
| 66 | void *loader_data; |
| 67 | }; |
| 68 | |
| 69 | struct nulldrv_dev { |
| 70 | struct nulldrv_base base; |
| 71 | bool exts[NULLDRV_EXT_COUNT]; |
Chia-I Wu | 8d24b3b | 2015-03-26 13:14:16 +0800 | [diff] [blame] | 72 | struct nulldrv_desc_ooxx *desc_ooxx; |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 73 | struct nulldrv_queue *queues[1]; |
| 74 | }; |
| 75 | |
Chia-I Wu | 8d24b3b | 2015-03-26 13:14:16 +0800 | [diff] [blame] | 76 | struct nulldrv_desc_ooxx { |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 77 | uint32_t surface_desc_size; |
| 78 | uint32_t sampler_desc_size; |
| 79 | }; |
| 80 | |
| 81 | |
| 82 | struct nulldrv_queue { |
| 83 | struct nulldrv_base base; |
| 84 | struct nulldrv_dev *dev; |
| 85 | }; |
| 86 | |
| 87 | struct nulldrv_rt_view { |
| 88 | struct nulldrv_obj obj; |
| 89 | }; |
| 90 | |
| 91 | struct nulldrv_fence { |
| 92 | struct nulldrv_obj obj; |
| 93 | }; |
| 94 | |
| 95 | struct nulldrv_img { |
| 96 | struct nulldrv_obj obj; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 97 | VkImageType type; |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 98 | int32_t depth; |
| 99 | uint32_t mip_levels; |
| 100 | uint32_t array_size; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 101 | VkFlags usage; |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 102 | uint32_t samples; |
| 103 | size_t total_size; |
| 104 | }; |
| 105 | |
| 106 | struct nulldrv_mem { |
| 107 | struct nulldrv_base base; |
| 108 | struct nulldrv_bo *bo; |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 109 | VkDeviceSize size; |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 110 | }; |
| 111 | |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 112 | struct nulldrv_sampler { |
| 113 | struct nulldrv_obj obj; |
| 114 | }; |
| 115 | |
| 116 | struct nulldrv_img_view { |
| 117 | struct nulldrv_obj obj; |
| 118 | struct nulldrv_img *img; |
| 119 | float min_lod; |
| 120 | uint32_t cmd_len; |
| 121 | }; |
| 122 | |
| 123 | struct nulldrv_buf { |
| 124 | struct nulldrv_obj obj; |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 125 | VkDeviceSize size; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 126 | VkFlags usage; |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 127 | }; |
| 128 | |
| 129 | struct nulldrv_desc_layout { |
| 130 | struct nulldrv_obj obj; |
| 131 | }; |
| 132 | |
Mark Lobodzinski | 556f721 | 2015-04-17 14:11:39 -0500 | [diff] [blame] | 133 | struct nulldrv_pipeline_layout { |
Chia-I Wu | 7732cb2 | 2015-03-26 15:27:55 +0800 | [diff] [blame] | 134 | struct nulldrv_obj obj; |
| 135 | }; |
| 136 | |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 137 | struct nulldrv_shader { |
| 138 | struct nulldrv_obj obj; |
| 139 | |
| 140 | }; |
| 141 | |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 142 | struct nulldrv_pipeline { |
| 143 | struct nulldrv_obj obj; |
| 144 | struct nulldrv_dev *dev; |
| 145 | }; |
| 146 | |
| 147 | struct nulldrv_dynamic_vp { |
| 148 | struct nulldrv_obj obj; |
| 149 | }; |
| 150 | |
Cody Northrop | e4bc694 | 2015-08-26 10:01:32 -0600 | [diff] [blame] | 151 | struct nulldrv_dynamic_line_width { |
Cody Northrop | f5bd225 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 152 | struct nulldrv_obj obj; |
| 153 | }; |
| 154 | |
Cody Northrop | e4bc694 | 2015-08-26 10:01:32 -0600 | [diff] [blame] | 155 | struct nulldrv_dynamic_depth_bias { |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 156 | struct nulldrv_obj obj; |
| 157 | }; |
| 158 | |
Cody Northrop | e4bc694 | 2015-08-26 10:01:32 -0600 | [diff] [blame] | 159 | struct nulldrv_dynamic_blend { |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 160 | struct nulldrv_obj obj; |
| 161 | }; |
| 162 | |
Cody Northrop | e4bc694 | 2015-08-26 10:01:32 -0600 | [diff] [blame] | 163 | struct nulldrv_dynamic_depth_bounds { |
Cody Northrop | 2605cb0 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 164 | struct nulldrv_obj obj; |
| 165 | }; |
| 166 | |
| 167 | struct nulldrv_dynamic_stencil { |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 168 | struct nulldrv_obj obj; |
| 169 | }; |
| 170 | |
| 171 | struct nulldrv_cmd { |
| 172 | struct nulldrv_obj obj; |
| 173 | }; |
| 174 | |
Chia-I Wu | 8d24b3b | 2015-03-26 13:14:16 +0800 | [diff] [blame] | 175 | struct nulldrv_desc_pool { |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 176 | struct nulldrv_obj obj; |
| 177 | struct nulldrv_dev *dev; |
| 178 | }; |
| 179 | |
| 180 | struct nulldrv_desc_set { |
| 181 | struct nulldrv_obj obj; |
Chia-I Wu | 8d24b3b | 2015-03-26 13:14:16 +0800 | [diff] [blame] | 182 | struct nulldrv_desc_ooxx *ooxx; |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 183 | const struct nulldrv_desc_layout *layout; |
| 184 | }; |
| 185 | |
| 186 | struct nulldrv_framebuffer { |
| 187 | struct nulldrv_obj obj; |
| 188 | }; |
| 189 | |
| 190 | struct nulldrv_render_pass { |
| 191 | struct nulldrv_obj obj; |
| 192 | }; |
| 193 | |
David Pinedo | 8e9cb3b | 2015-02-10 15:02:08 -0700 | [diff] [blame] | 194 | struct nulldrv_buf_view { |
| 195 | struct nulldrv_obj obj; |
| 196 | |
| 197 | struct nulldrv_buf *buf; |
| 198 | |
| 199 | /* SURFACE_STATE */ |
| 200 | uint32_t cmd[8]; |
| 201 | uint32_t fs_cmd[8]; |
| 202 | uint32_t cmd_len; |
| 203 | }; |
| 204 | |
Ian Elliott | 32536f9 | 2015-04-21 16:41:02 -0600 | [diff] [blame] | 205 | struct nulldrv_display { |
| 206 | struct nulldrv_base base; |
| 207 | struct nulldrv_dev *dev; |
| 208 | }; |
| 209 | |
Ian Elliott | 64a68e1 | 2015-04-16 11:57:46 -0600 | [diff] [blame] | 210 | struct nulldrv_swap_chain { |
| 211 | struct nulldrv_base base; |
| 212 | struct nulldrv_dev *dev; |
| 213 | }; |
| 214 | |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 215 | #endif /* NULLDRV_H */ |