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