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 |
| 26 | #define NULLDRV_H |
| 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> |
| 34 | #include <vkDbg.h> |
| 35 | #include <vkIcd.h> |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 36 | |
| 37 | #if defined(PLATFORM_LINUX) |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 38 | #include <vkWsiX11Ext.h> |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 39 | #else |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 40 | #include <vkWsiWinExt.h> |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 41 | #endif |
| 42 | |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 43 | #include "icd.h" |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 44 | |
| 45 | #include "icd-format.h" |
| 46 | #include "icd-utils.h" |
| 47 | |
| 48 | struct nulldrv_base { |
| 49 | void *loader_data; |
| 50 | uint32_t magic; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 51 | VkResult (*get_info)(struct nulldrv_base *base, int type1, |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 52 | size_t *size, void *data); |
| 53 | }; |
| 54 | |
| 55 | struct nulldrv_obj { |
| 56 | struct nulldrv_base base; |
| 57 | }; |
| 58 | |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 59 | enum nulldrv_ext_type { |
| 60 | NULLDRV_EXT_WSI_X11, |
| 61 | NULLDRV_EXT_WSI_WINDOWS, |
| 62 | NULLDRV_EXT_COUNT, |
| 63 | NULLDRV_EXT_INVALID = NULLDRV_EXT_COUNT, |
| 64 | }; |
| 65 | |
| 66 | |
| 67 | struct nulldrv_instance { |
| 68 | struct nulldrv_obj obj; |
| 69 | }; |
| 70 | |
| 71 | struct nulldrv_gpu { |
| 72 | void *loader_data; |
| 73 | }; |
| 74 | |
| 75 | struct nulldrv_dev { |
| 76 | struct nulldrv_base base; |
| 77 | bool exts[NULLDRV_EXT_COUNT]; |
Chia-I Wu | 8d24b3b | 2015-03-26 13:14:16 +0800 | [diff] [blame] | 78 | struct nulldrv_desc_ooxx *desc_ooxx; |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 79 | struct nulldrv_queue *queues[1]; |
| 80 | }; |
| 81 | |
Chia-I Wu | 8d24b3b | 2015-03-26 13:14:16 +0800 | [diff] [blame] | 82 | struct nulldrv_desc_ooxx { |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 83 | uint32_t surface_desc_size; |
| 84 | uint32_t sampler_desc_size; |
| 85 | }; |
| 86 | |
| 87 | |
| 88 | struct nulldrv_queue { |
| 89 | struct nulldrv_base base; |
| 90 | struct nulldrv_dev *dev; |
| 91 | }; |
| 92 | |
| 93 | struct nulldrv_rt_view { |
| 94 | struct nulldrv_obj obj; |
| 95 | }; |
| 96 | |
| 97 | struct nulldrv_fence { |
| 98 | struct nulldrv_obj obj; |
| 99 | }; |
| 100 | |
| 101 | struct nulldrv_img { |
| 102 | struct nulldrv_obj obj; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 103 | VkImageType type; |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 104 | int32_t depth; |
| 105 | uint32_t mip_levels; |
| 106 | uint32_t array_size; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 107 | VkFlags usage; |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 108 | uint32_t samples; |
| 109 | size_t total_size; |
| 110 | }; |
| 111 | |
| 112 | struct nulldrv_mem { |
| 113 | struct nulldrv_base base; |
| 114 | struct nulldrv_bo *bo; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 115 | VkGpuSize size; |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 116 | }; |
| 117 | |
| 118 | struct nulldrv_ds_view { |
| 119 | struct nulldrv_obj obj; |
| 120 | struct nulldrv_img *img; |
| 121 | uint32_t array_size; |
| 122 | }; |
| 123 | |
| 124 | struct nulldrv_sampler { |
| 125 | struct nulldrv_obj obj; |
| 126 | }; |
| 127 | |
| 128 | struct nulldrv_img_view { |
| 129 | struct nulldrv_obj obj; |
| 130 | struct nulldrv_img *img; |
| 131 | float min_lod; |
| 132 | uint32_t cmd_len; |
| 133 | }; |
| 134 | |
| 135 | struct nulldrv_buf { |
| 136 | struct nulldrv_obj obj; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 137 | VkGpuSize size; |
| 138 | VkFlags usage; |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 139 | }; |
| 140 | |
| 141 | struct nulldrv_desc_layout { |
| 142 | struct nulldrv_obj obj; |
| 143 | }; |
| 144 | |
Chia-I Wu | 7732cb2 | 2015-03-26 15:27:55 +0800 | [diff] [blame] | 145 | struct nulldrv_desc_layout_chain { |
| 146 | struct nulldrv_obj obj; |
| 147 | }; |
| 148 | |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 149 | struct nulldrv_shader { |
| 150 | struct nulldrv_obj obj; |
| 151 | |
| 152 | }; |
| 153 | |
| 154 | |
| 155 | struct nulldrv_pipeline { |
| 156 | struct nulldrv_obj obj; |
| 157 | struct nulldrv_dev *dev; |
| 158 | }; |
| 159 | |
| 160 | struct nulldrv_dynamic_vp { |
| 161 | struct nulldrv_obj obj; |
| 162 | }; |
| 163 | |
| 164 | struct nulldrv_dynamic_rs { |
| 165 | struct nulldrv_obj obj; |
| 166 | }; |
| 167 | |
| 168 | struct nulldrv_dynamic_cb { |
| 169 | struct nulldrv_obj obj; |
| 170 | }; |
| 171 | |
| 172 | struct nulldrv_dynamic_ds { |
| 173 | struct nulldrv_obj obj; |
| 174 | }; |
| 175 | |
| 176 | struct nulldrv_cmd { |
| 177 | struct nulldrv_obj obj; |
| 178 | }; |
| 179 | |
Chia-I Wu | 8d24b3b | 2015-03-26 13:14:16 +0800 | [diff] [blame] | 180 | struct nulldrv_desc_pool { |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 181 | struct nulldrv_obj obj; |
| 182 | struct nulldrv_dev *dev; |
| 183 | }; |
| 184 | |
| 185 | struct nulldrv_desc_set { |
| 186 | struct nulldrv_obj obj; |
Chia-I Wu | 8d24b3b | 2015-03-26 13:14:16 +0800 | [diff] [blame] | 187 | struct nulldrv_desc_ooxx *ooxx; |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 188 | const struct nulldrv_desc_layout *layout; |
| 189 | }; |
| 190 | |
| 191 | struct nulldrv_framebuffer { |
| 192 | struct nulldrv_obj obj; |
| 193 | }; |
| 194 | |
| 195 | struct nulldrv_render_pass { |
| 196 | struct nulldrv_obj obj; |
| 197 | }; |
| 198 | |
David Pinedo | 8e9cb3b | 2015-02-10 15:02:08 -0700 | [diff] [blame] | 199 | struct nulldrv_buf_view { |
| 200 | struct nulldrv_obj obj; |
| 201 | |
| 202 | struct nulldrv_buf *buf; |
| 203 | |
| 204 | /* SURFACE_STATE */ |
| 205 | uint32_t cmd[8]; |
| 206 | uint32_t fs_cmd[8]; |
| 207 | uint32_t cmd_len; |
| 208 | }; |
| 209 | |
David Pinedo | 0257fbf | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 210 | #endif /* NULLDRV_H */ |