blob: 05c9acb73f98d051bc1707fee8ef3417b360d85e [file] [log] [blame]
David Pinedo0257fbf2015-02-02 18:02:40 -07001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan null driver
David Pinedo0257fbf2015-02-02 18:02:40 -07003 *
4 * Copyright (C) 2015 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
26#include "nulldrv.h"
David Pinedo8e9cb3b2015-02-10 15:02:08 -070027#include <stdio.h>
David Pinedo0257fbf2015-02-02 18:02:40 -070028
David Pinedo8e9cb3b2015-02-10 15:02:08 -070029#if 0
30#define NULLDRV_LOG_FUNC \
31 do { \
32 fflush(stdout); \
33 fflush(stderr); \
34 printf("null driver: %s\n", __FUNCTION__); \
35 fflush(stdout); \
36 } while (0)
37#else
38 #define NULLDRV_LOG_FUNC do { } while (0)
39#endif
40
41// The null driver supports all WSI extenstions ... for now ...
David Pinedo0257fbf2015-02-02 18:02:40 -070042static const char * const nulldrv_gpu_exts[NULLDRV_EXT_COUNT] = {
Jon Ashburncedc15f2015-05-21 18:13:33 -060043 [NULLDRV_EXT_WSI_LUNARG] = VK_WSI_LUNARG_EXTENSION_NAME,
David Pinedo0257fbf2015-02-02 18:02:40 -070044};
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060045static const VkExtensionProperties intel_gpu_exts[NULLDRV_EXT_COUNT] = {
46 {
47 .sType = VK_STRUCTURE_TYPE_EXTENSION_PROPERTIES,
48 .name = VK_WSI_LUNARG_EXTENSION_NAME,
49 .version = VK_WSI_LUNARG_REVISION,
50 .description = "Null driver",
51 }
52};
David Pinedo0257fbf2015-02-02 18:02:40 -070053
Mike Stroyan230e6252015-04-17 12:36:38 -060054static struct nulldrv_base *nulldrv_base(VkObject base)
David Pinedo0257fbf2015-02-02 18:02:40 -070055{
56 return (struct nulldrv_base *) base;
57}
58
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060059static VkResult nulldrv_base_get_info(struct nulldrv_base *base, int type,
David Pinedo0257fbf2015-02-02 18:02:40 -070060 size_t *size, void *data)
61{
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060062 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -070063 size_t s;
David Pinedo0257fbf2015-02-02 18:02:40 -070064
65 switch (type) {
Tony Barbour8205d902015-04-16 15:59:00 -060066 case VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS:
David Pinedo0257fbf2015-02-02 18:02:40 -070067 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060068 s = sizeof(VkMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -070069 *size = s;
70 if (data == NULL)
71 return ret;
72 memset(data, 0, s);
David Pinedo0257fbf2015-02-02 18:02:40 -070073 break;
74 }
David Pinedo0257fbf2015-02-02 18:02:40 -070075 default:
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060076 ret = VK_ERROR_INVALID_VALUE;
David Pinedo0257fbf2015-02-02 18:02:40 -070077 break;
78 }
79
80 return ret;
81}
82
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060083static struct nulldrv_base *nulldrv_base_create(
84 struct nulldrv_dev *dev,
85 size_t obj_size,
86 VkObjectType type)
David Pinedo0257fbf2015-02-02 18:02:40 -070087{
88 struct nulldrv_base *base;
89
90 if (!obj_size)
91 obj_size = sizeof(*base);
92
93 assert(obj_size >= sizeof(*base));
94
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060095 base = (struct nulldrv_base*)malloc(obj_size);
David Pinedo0257fbf2015-02-02 18:02:40 -070096 if (!base)
97 return NULL;
98
99 memset(base, 0, obj_size);
100
101 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbour11e76ac2015-04-20 16:28:46 -0600102 set_loader_magic_value((VkObject) base);
David Pinedo0257fbf2015-02-02 18:02:40 -0700103
104 if (dev == NULL) {
105 /*
106 * dev is NULL when we are creating the base device object
107 * Set dev now so that debug setup happens correctly
108 */
109 dev = (struct nulldrv_dev *) base;
110 }
111
112
113 base->get_info = NULL;
114
115 return base;
116}
117
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600118static VkResult nulldrv_gpu_add(int devid, const char *primary_node,
David Pinedo0257fbf2015-02-02 18:02:40 -0700119 const char *render_node, struct nulldrv_gpu **gpu_ret)
120{
121 struct nulldrv_gpu *gpu;
122
Chia-I Wu493a1752015-02-22 14:40:25 +0800123 gpu = malloc(sizeof(*gpu));
David Pinedo0257fbf2015-02-02 18:02:40 -0700124 if (!gpu)
Tony Barbour8205d902015-04-16 15:59:00 -0600125 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700126 memset(gpu, 0, sizeof(*gpu));
Mark Lobodzinski97dcd042015-04-16 08:52:00 -0500127
David Pinedo0257fbf2015-02-02 18:02:40 -0700128 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbour11e76ac2015-04-20 16:28:46 -0600129 set_loader_magic_value((VkObject) gpu);
David Pinedo0257fbf2015-02-02 18:02:40 -0700130
131 *gpu_ret = gpu;
132
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600133 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700134}
135
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600136static VkResult nulldrv_queue_create(struct nulldrv_dev *dev,
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700137 uint32_t node_index,
David Pinedo0257fbf2015-02-02 18:02:40 -0700138 struct nulldrv_queue **queue_ret)
139{
140 struct nulldrv_queue *queue;
141
142 queue = (struct nulldrv_queue *) nulldrv_base_create(dev, sizeof(*queue),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600143 VK_OBJECT_TYPE_QUEUE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700144 if (!queue)
Tony Barbour8205d902015-04-16 15:59:00 -0600145 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700146
147 queue->dev = dev;
148
149 *queue_ret = queue;
150
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600151 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700152}
153
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600154static VkResult dev_create_queues(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600155 const VkDeviceQueueCreateInfo *queues,
David Pinedo0257fbf2015-02-02 18:02:40 -0700156 uint32_t count)
157{
158 uint32_t i;
159
160 if (!count)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600161 return VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700162
163 for (i = 0; i < count; i++) {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600164 const VkDeviceQueueCreateInfo *q = &queues[i];
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600165 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700166
167 if (q->queueCount == 1 && !dev->queues[q->queueNodeIndex]) {
168 ret = nulldrv_queue_create(dev, q->queueNodeIndex,
169 &dev->queues[q->queueNodeIndex]);
170 }
171 else {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600172 ret = VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700173 }
174
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600175 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700176 return ret;
177 }
178 }
179
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600180 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700181}
182
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600183static enum nulldrv_ext_type nulldrv_gpu_lookup_extension(
184 const struct nulldrv_gpu *gpu,
185 const VkExtensionProperties *ext)
David Pinedo0257fbf2015-02-02 18:02:40 -0700186{
187 enum nulldrv_ext_type type;
188
189 for (type = 0; type < ARRAY_SIZE(nulldrv_gpu_exts); type++) {
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600190 if (memcmp(&nulldrv_gpu_exts[type], ext, sizeof(VkExtensionProperties)) == 0)
David Pinedo0257fbf2015-02-02 18:02:40 -0700191 break;
192 }
193
194 assert(type < NULLDRV_EXT_COUNT || type == NULLDRV_EXT_INVALID);
195
196 return type;
197}
198
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600199static VkResult nulldrv_desc_ooxx_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800200 struct nulldrv_desc_ooxx **ooxx_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700201{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800202 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700203
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800204 ooxx = malloc(sizeof(*ooxx));
205 if (!ooxx)
Tony Barbour8205d902015-04-16 15:59:00 -0600206 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700207
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800208 memset(ooxx, 0, sizeof(*ooxx));
David Pinedo0257fbf2015-02-02 18:02:40 -0700209
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800210 ooxx->surface_desc_size = 0;
211 ooxx->sampler_desc_size = 0;
David Pinedo0257fbf2015-02-02 18:02:40 -0700212
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800213 *ooxx_ret = ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700214
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600215 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700216}
217
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600218static VkResult nulldrv_dev_create(struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600219 const VkDeviceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700220 struct nulldrv_dev **dev_ret)
221{
222 struct nulldrv_dev *dev;
223 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600224 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -0700225
226 dev = (struct nulldrv_dev *) nulldrv_base_create(NULL, sizeof(*dev),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600227 VK_OBJECT_TYPE_DEVICE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700228 if (!dev)
Tony Barbour8205d902015-04-16 15:59:00 -0600229 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700230
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600231 for (i = 0; i < info->extensionCount; i++) {
232 const enum nulldrv_ext_type ext = nulldrv_gpu_lookup_extension(
233 gpu,
234 &info->pEnabledExtensions[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700235
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600236 if (ext == NULLDRV_EXT_INVALID)
237 return VK_ERROR_INVALID_EXTENSION;
David Pinedo0257fbf2015-02-02 18:02:40 -0700238
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600239 dev->exts[ext] = true;
240 }
David Pinedo0257fbf2015-02-02 18:02:40 -0700241
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800242 ret = nulldrv_desc_ooxx_create(dev, &dev->desc_ooxx);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600243 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700244 return ret;
245 }
246
247 ret = dev_create_queues(dev, info->pRequestedQueues,
248 info->queueRecordCount);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600249 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700250 return ret;
251 }
252
253 *dev_ret = dev;
254
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600255 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700256}
257
Tony Barbour8205d902015-04-16 15:59:00 -0600258static struct nulldrv_gpu *nulldrv_gpu(VkPhysicalDevice gpu)
David Pinedo0257fbf2015-02-02 18:02:40 -0700259{
260 return (struct nulldrv_gpu *) gpu;
261}
262
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600263static VkResult nulldrv_rt_view_create(struct nulldrv_dev *dev,
264 const VkColorAttachmentViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700265 struct nulldrv_rt_view **view_ret)
266{
267 struct nulldrv_rt_view *view;
268
269 view = (struct nulldrv_rt_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600270 VK_OBJECT_TYPE_COLOR_ATTACHMENT_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700271 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600272 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700273
274 *view_ret = view;
275
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600276 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700277}
278
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600279static VkResult nulldrv_fence_create(struct nulldrv_dev *dev,
280 const VkFenceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700281 struct nulldrv_fence **fence_ret)
282{
283 struct nulldrv_fence *fence;
284
285 fence = (struct nulldrv_fence *) nulldrv_base_create(dev, sizeof(*fence),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600286 VK_OBJECT_TYPE_FENCE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700287 if (!fence)
Tony Barbour8205d902015-04-16 15:59:00 -0600288 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700289
290 *fence_ret = fence;
291
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600292 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700293}
294
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600295static struct nulldrv_dev *nulldrv_dev(VkDevice dev)
David Pinedo0257fbf2015-02-02 18:02:40 -0700296{
297 return (struct nulldrv_dev *) dev;
298}
299
300static struct nulldrv_img *nulldrv_img_from_base(struct nulldrv_base *base)
301{
302 return (struct nulldrv_img *) base;
303}
304
305
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600306static VkResult img_get_info(struct nulldrv_base *base, int type,
David Pinedo0257fbf2015-02-02 18:02:40 -0700307 size_t *size, void *data)
308{
309 struct nulldrv_img *img = nulldrv_img_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600310 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700311
312 switch (type) {
Tony Barbour8205d902015-04-16 15:59:00 -0600313 case VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS:
David Pinedo0257fbf2015-02-02 18:02:40 -0700314 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600315 VkMemoryRequirements *mem_req = data;
David Pinedo0257fbf2015-02-02 18:02:40 -0700316
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600317 *size = sizeof(VkMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -0700318 if (data == NULL)
319 return ret;
320 mem_req->size = img->total_size;
321 mem_req->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700322 }
323 break;
324 default:
325 ret = nulldrv_base_get_info(base, type, size, data);
326 break;
327 }
328
329 return ret;
330}
331
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600332static VkResult nulldrv_img_create(struct nulldrv_dev *dev,
333 const VkImageCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700334 bool scanout,
335 struct nulldrv_img **img_ret)
336{
337 struct nulldrv_img *img;
338
339 img = (struct nulldrv_img *) nulldrv_base_create(dev, sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600340 VK_OBJECT_TYPE_IMAGE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700341 if (!img)
Tony Barbour8205d902015-04-16 15:59:00 -0600342 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700343
344 img->type = info->imageType;
345 img->depth = info->extent.depth;
346 img->mip_levels = info->mipLevels;
347 img->array_size = info->arraySize;
348 img->usage = info->usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700349 img->samples = info->samples;
350
351 img->obj.base.get_info = img_get_info;
352
353 *img_ret = img;
354
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600355 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700356}
357
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600358static struct nulldrv_img *nulldrv_img(VkImage image)
David Pinedo0257fbf2015-02-02 18:02:40 -0700359{
360 return (struct nulldrv_img *) image;
361}
362
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600363static VkResult nulldrv_mem_alloc(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600364 const VkMemoryAllocInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700365 struct nulldrv_mem **mem_ret)
366{
367 struct nulldrv_mem *mem;
368
369 mem = (struct nulldrv_mem *) nulldrv_base_create(dev, sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600370 VK_OBJECT_TYPE_DEVICE_MEMORY);
David Pinedo0257fbf2015-02-02 18:02:40 -0700371 if (!mem)
Tony Barbour8205d902015-04-16 15:59:00 -0600372 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700373
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700374 mem->bo = malloc(info->allocationSize);
David Pinedo0257fbf2015-02-02 18:02:40 -0700375 if (!mem->bo) {
Tony Barbour8205d902015-04-16 15:59:00 -0600376 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700377 }
378
379 mem->size = info->allocationSize;
380
381 *mem_ret = mem;
382
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600383 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700384}
385
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600386static VkResult nulldrv_ds_view_create(struct nulldrv_dev *dev,
387 const VkDepthStencilViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700388 struct nulldrv_ds_view **view_ret)
389{
390 struct nulldrv_img *img = nulldrv_img(info->image);
391 struct nulldrv_ds_view *view;
392
393 view = (struct nulldrv_ds_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600394 VK_OBJECT_TYPE_DEPTH_STENCIL_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700395 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600396 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700397
398 view->img = img;
399
400 view->array_size = info->arraySize;
401
402 *view_ret = view;
403
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600404 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700405}
406
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600407static VkResult nulldrv_sampler_create(struct nulldrv_dev *dev,
408 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700409 struct nulldrv_sampler **sampler_ret)
410{
411 struct nulldrv_sampler *sampler;
412
413 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600414 sizeof(*sampler), VK_OBJECT_TYPE_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700415 if (!sampler)
Tony Barbour8205d902015-04-16 15:59:00 -0600416 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700417
418 *sampler_ret = sampler;
419
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600420 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700421}
422
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600423static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
424 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700425 struct nulldrv_img_view **view_ret)
426{
427 struct nulldrv_img *img = nulldrv_img(info->image);
428 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700429
430 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600431 VK_OBJECT_TYPE_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700432 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600433 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700434
435 view->img = img;
436 view->min_lod = info->minLod;
437
David Pinedo0257fbf2015-02-02 18:02:40 -0700438 view->cmd_len = 8;
439
440 *view_ret = view;
441
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600442 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700443}
444
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600445static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700446{
447 return mem->bo;
448}
449
Tony Barbour8205d902015-04-16 15:59:00 -0600450static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700451{
452 return (struct nulldrv_mem *) mem;
453}
454
455static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
456{
457 return (struct nulldrv_buf *) base;
458}
459
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600460static VkResult buf_get_info(struct nulldrv_base *base, int type,
David Pinedo0257fbf2015-02-02 18:02:40 -0700461 size_t *size, void *data)
462{
463 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600464 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700465
466 switch (type) {
Tony Barbour8205d902015-04-16 15:59:00 -0600467 case VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS:
David Pinedo0257fbf2015-02-02 18:02:40 -0700468 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600469 VkMemoryRequirements *mem_req = data;
David Pinedo0257fbf2015-02-02 18:02:40 -0700470
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600471 *size = sizeof(VkMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -0700472 if (data == NULL)
473 return ret;
474
475 mem_req->size = buf->size;
476 mem_req->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700477
478 }
479 break;
David Pinedo0257fbf2015-02-02 18:02:40 -0700480 default:
481 ret = nulldrv_base_get_info(base, type, size, data);
482 break;
483 }
484
485 return ret;
486}
487
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600488static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600489 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700490 struct nulldrv_buf **buf_ret)
491{
492 struct nulldrv_buf *buf;
493
494 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600495 VK_OBJECT_TYPE_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700496 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600497 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700498
499 buf->size = info->size;
500 buf->usage = info->usage;
501
502 buf->obj.base.get_info = buf_get_info;
503
504 *buf_ret = buf;
505
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600506 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700507}
508
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600509static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
510 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700511 struct nulldrv_desc_layout **layout_ret)
512{
513 struct nulldrv_desc_layout *layout;
514
515 layout = (struct nulldrv_desc_layout *)
516 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600517 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700518 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600519 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700520
521 *layout_ret = layout;
522
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600523 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700524}
525
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500526static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
527 const VkPipelineLayoutCreateInfo* pCreateInfo,
528 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800529{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500530 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800531
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500532 pipeline_layout = (struct nulldrv_pipeline_layout *)
533 nulldrv_base_create(dev, sizeof(*pipeline_layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600534 VK_OBJECT_TYPE_PIPELINE_LAYOUT);
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500535 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600536 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800537
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500538 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800539
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600540 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800541}
542
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600543static struct nulldrv_desc_layout *nulldrv_desc_layout(VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700544{
545 return (struct nulldrv_desc_layout *) layout;
546}
547
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600548static VkResult shader_create(struct nulldrv_dev *dev,
549 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700550 struct nulldrv_shader **sh_ret)
551{
David Pinedo0257fbf2015-02-02 18:02:40 -0700552 struct nulldrv_shader *sh;
553
554 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600555 VK_OBJECT_TYPE_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700556 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600557 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700558
559 *sh_ret = sh;
560
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600561 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700562}
563
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600564static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
565 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700566 struct nulldrv_pipeline **pipeline_ret)
567{
568 struct nulldrv_pipeline *pipeline;
569
570 pipeline = (struct nulldrv_pipeline *)
571 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600572 VK_OBJECT_TYPE_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700573 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600574 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700575
576 *pipeline_ret = pipeline;
577
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600578 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700579}
580
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600581static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
582 const VkDynamicVpStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700583 struct nulldrv_dynamic_vp **state_ret)
584{
585 struct nulldrv_dynamic_vp *state;
586
587 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600588 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_VP_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700589 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600590 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700591
592 *state_ret = state;
593
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600594 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700595}
596
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600597static VkResult nulldrv_raster_state_create(struct nulldrv_dev *dev,
598 const VkDynamicRsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700599 struct nulldrv_dynamic_rs **state_ret)
600{
601 struct nulldrv_dynamic_rs *state;
602
603 state = (struct nulldrv_dynamic_rs *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600604 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700605 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600606 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700607
608 *state_ret = state;
609
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600610 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700611}
612
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600613static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
614 const VkDynamicCbStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700615 struct nulldrv_dynamic_cb **state_ret)
616{
617 struct nulldrv_dynamic_cb *state;
618
619 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600620 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_CB_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700621 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600622 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700623
624 *state_ret = state;
625
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600626 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700627}
628
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600629static VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
630 const VkDynamicDsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700631 struct nulldrv_dynamic_ds **state_ret)
632{
633 struct nulldrv_dynamic_ds *state;
634
635 state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600636 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700637 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600638 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700639
640 *state_ret = state;
641
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600642 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700643}
644
645
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600646static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
647 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700648 struct nulldrv_cmd **cmd_ret)
649{
David Pinedo0257fbf2015-02-02 18:02:40 -0700650 struct nulldrv_cmd *cmd;
651
David Pinedo0257fbf2015-02-02 18:02:40 -0700652 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600653 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700654 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600655 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700656
657 *cmd_ret = cmd;
658
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600659 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700660}
661
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600662static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
663 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700664 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600665 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800666 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700667{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800668 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700669
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800670 pool = (struct nulldrv_desc_pool *)
671 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600672 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800673 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600674 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700675
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800676 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700677
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800678 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700679
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600680 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700681}
682
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600683static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800684 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600685 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700686 const struct nulldrv_desc_layout *layout,
687 struct nulldrv_desc_set **set_ret)
688{
689 struct nulldrv_desc_set *set;
690
691 set = (struct nulldrv_desc_set *)
692 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600693 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700694 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600695 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700696
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800697 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700698 set->layout = layout;
699 *set_ret = set;
700
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600701 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700702}
703
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600704static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700705{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800706 return (struct nulldrv_desc_pool *) pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700707}
708
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600709static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
710 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700711 struct nulldrv_framebuffer ** fb_ret)
712{
713
714 struct nulldrv_framebuffer *fb;
715 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600716 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700717 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600718 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700719
720 *fb_ret = fb;
721
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600722 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700723
724}
725
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600726static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
727 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700728 struct nulldrv_render_pass** rp_ret)
729{
730 struct nulldrv_render_pass *rp;
731 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600732 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700733 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600734 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700735
736 *rp_ret = rp;
737
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600738 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700739}
740
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600741static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700742{
743 return (struct nulldrv_buf *) buf;
744}
745
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600746static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600747 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700748 struct nulldrv_buf_view **view_ret)
749{
750 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
751 struct nulldrv_buf_view *view;
752
753 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600754 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700755 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600756 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700757
758 view->buf = buf;
759
760 *view_ret = view;
761
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600762 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700763}
764
David Pinedo0257fbf2015-02-02 18:02:40 -0700765
766//*********************************************
767// Driver entry points
768//*********************************************
769
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600770ICD_EXPORT VkResult VKAPI vkCreateBuffer(
771 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600772 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600773 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700774{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700775 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700776 struct nulldrv_dev *dev = nulldrv_dev(device);
777
778 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
779}
780
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600781ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
782 VkDevice device,
783 const VkCmdBufferCreateInfo* pCreateInfo,
784 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700785{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700786 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700787 struct nulldrv_dev *dev = nulldrv_dev(device);
788
789 return nulldrv_cmd_create(dev, pCreateInfo,
790 (struct nulldrv_cmd **) pCmdBuffer);
791}
792
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600793ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
794 VkCmdBuffer cmdBuffer,
795 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700796{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700797 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600798 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700799}
800
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600801ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
802 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700803{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700804 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600805 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700806}
807
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600808ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
809 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700810{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700811 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600812 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700813}
814
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600815ICD_EXPORT void VKAPI vkCmdInitAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600816 VkCmdBuffer cmdBuffer,
817 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700818 uint32_t startCounter,
819 uint32_t counterCount,
820 const uint32_t* pData)
821{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700822 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700823}
824
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600825ICD_EXPORT void VKAPI vkCmdLoadAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600826 VkCmdBuffer cmdBuffer,
827 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700828 uint32_t startCounter,
829 uint32_t counterCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600830 VkBuffer srcBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600831 VkDeviceSize srcOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700832{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700833 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700834}
835
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600836ICD_EXPORT void VKAPI vkCmdSaveAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600837 VkCmdBuffer cmdBuffer,
838 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700839 uint32_t startCounter,
840 uint32_t counterCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600841 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600842 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700843{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700844 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700845}
846
David Pinedo0257fbf2015-02-02 18:02:40 -0700847
Ian Elliott64a68e12015-04-16 11:57:46 -0600848static const VkFormat nulldrv_presentable_formats[] = {
849 VK_FORMAT_B8G8R8A8_UNORM,
850};
851
852ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
853 VkDisplayWSI display,
854 VkDisplayInfoTypeWSI infoType,
855 size_t* pDataSize,
856 void* pData)
857{
858 VkResult ret = VK_SUCCESS;
859
860 NULLDRV_LOG_FUNC;
861
862 if (!pDataSize)
863 return VK_ERROR_INVALID_POINTER;
864
865 switch (infoType) {
866 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
867 {
868 VkDisplayFormatPropertiesWSI *dst = pData;
869 size_t size_ret;
870 uint32_t i;
871
872 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
873
874 if (dst && *pDataSize < size_ret)
875 return VK_ERROR_INVALID_VALUE;
876
877 *pDataSize = size_ret;
878 if (!dst)
879 return VK_SUCCESS;
880
881 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
882 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
883 }
884 break;
885 default:
886 ret = VK_ERROR_INVALID_VALUE;
887 break;
888 }
889
890 return ret;
891}
892
893ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
894 VkDevice device,
895 const VkSwapChainCreateInfoWSI* pCreateInfo,
896 VkSwapChainWSI* pSwapChain)
897{
898 NULLDRV_LOG_FUNC;
899 struct nulldrv_dev *dev = nulldrv_dev(device);
900 struct nulldrv_swap_chain *sc;
901
902 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600903 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600904 if (!sc) {
905 return VK_ERROR_OUT_OF_HOST_MEMORY;
906 }
907 sc->dev = dev;
908
Tony Barbour11e76ac2015-04-20 16:28:46 -0600909 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600910
911 return VK_SUCCESS;
912}
913
914ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
915 VkSwapChainWSI swapChain)
916{
917 NULLDRV_LOG_FUNC;
918 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
919
920 free(sc);
921
922 return VK_SUCCESS;
923}
924
925ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
926 VkSwapChainWSI swapChain,
927 VkSwapChainInfoTypeWSI infoType,
928 size_t* pDataSize,
929 void* pData)
930{
931 NULLDRV_LOG_FUNC;
932 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
933 struct nulldrv_dev *dev = sc->dev;
934 VkResult ret = VK_SUCCESS;
935
936 if (!pDataSize)
937 return VK_ERROR_INVALID_POINTER;
938
939 switch (infoType) {
940 case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
941 {
942 VkSwapChainImageInfoWSI *images;
943 const size_t size = sizeof(*images) * 2;
944 uint32_t i;
945
946 if (pData && *pDataSize < size)
947 return VK_ERROR_INVALID_VALUE;
948
949 *pDataSize = size;
950 if (!pData)
951 return VK_SUCCESS;
952
953 images = (VkSwapChainImageInfoWSI *) pData;
954 for (i = 0; i < 2; i++) {
955 struct nulldrv_img *img;
956 struct nulldrv_mem *mem;
957
958 img = (struct nulldrv_img *) nulldrv_base_create(dev,
959 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600960 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600961 if (!img)
962 return VK_ERROR_OUT_OF_HOST_MEMORY;
963
964 mem = (struct nulldrv_mem *) nulldrv_base_create(dev,
965 sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600966 VK_OBJECT_TYPE_DEVICE_MEMORY);
Ian Elliott64a68e12015-04-16 11:57:46 -0600967 if (!mem)
968 return VK_ERROR_OUT_OF_HOST_MEMORY;
969
970 images[i].image = (VkImage) img;
971 images[i].memory = (VkDeviceMemory) mem;
972 }
973 }
974 break;
975 default:
976 ret = VK_ERROR_INVALID_VALUE;
977 break;
978 }
979
980 return ret;
981}
982
983ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
984 VkQueue queue_,
985 const VkPresentInfoWSI* pPresentInfo)
986{
987 NULLDRV_LOG_FUNC;
988
989 return VK_SUCCESS;
990}
991
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600992ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600993 VkCmdBuffer cmdBuffer,
994 VkBuffer srcBuffer,
995 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700996 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600997 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700998{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700999 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001000}
1001
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001002ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001003 VkCmdBuffer cmdBuffer,
1004 VkImage srcImage,
1005 VkImageLayout srcImageLayout,
1006 VkImage destImage,
1007 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001008 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001009 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001010{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001011 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001012}
1013
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001014ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001015 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001016 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001017 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001018 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001019 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001020 uint32_t regionCount,
1021 const VkImageBlit* pRegions,
1022 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -06001023{
1024 NULLDRV_LOG_FUNC;
1025}
1026
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001027ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001028 VkCmdBuffer cmdBuffer,
1029 VkBuffer srcBuffer,
1030 VkImage destImage,
1031 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001032 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001033 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001034{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001035 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001036}
1037
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001038ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001039 VkCmdBuffer cmdBuffer,
1040 VkImage srcImage,
1041 VkImageLayout srcImageLayout,
1042 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001043 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001044 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001045{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001046 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001047}
1048
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001049ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001050 VkCmdBuffer cmdBuffer,
1051 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001052 VkDeviceSize destOffset,
1053 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001054 const uint32_t* pData)
1055{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001056 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001057}
1058
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001059ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001060 VkCmdBuffer cmdBuffer,
1061 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001062 VkDeviceSize destOffset,
1063 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001064 uint32_t data)
1065{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001066 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001067}
1068
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001069ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001070 VkCmdBuffer cmdBuffer,
1071 VkImage image,
1072 VkImageLayout imageLayout,
1073 const VkClearColor *pColor,
1074 uint32_t rangeCount,
1075 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001076{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001077 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001078}
1079
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001080ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001081 VkCmdBuffer cmdBuffer,
1082 VkImage image,
1083 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001084 float depth,
1085 uint32_t stencil,
1086 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001087 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001088{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001089 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001090}
1091
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001092ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001093 VkCmdBuffer cmdBuffer,
1094 VkImage srcImage,
1095 VkImageLayout srcImageLayout,
1096 VkImage destImage,
1097 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001098 uint32_t regionCount,
1099 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001100{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001101 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001102}
1103
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001104ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001105 VkCmdBuffer cmdBuffer,
1106 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001107 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001108 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001109{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001110 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001111}
1112
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001113ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001114 VkCmdBuffer cmdBuffer,
1115 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001116 uint32_t slot)
1117{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001118 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001119}
1120
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001121ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001122 VkCmdBuffer cmdBuffer,
1123 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001124 uint32_t startQuery,
1125 uint32_t queryCount)
1126{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001127 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001128}
1129
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001130ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001131 VkCmdBuffer cmdBuffer,
1132 VkEvent event_,
1133 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001134{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001135 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001136}
1137
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001138ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001139 VkCmdBuffer cmdBuffer,
1140 VkEvent event_,
1141 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001142{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001143 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001144}
1145
Ian Elliott63f1edb2015-04-16 18:10:19 -06001146ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1147 VkCmdBuffer cmdBuffer,
1148 VkQueryPool queryPool,
1149 uint32_t startQuery,
1150 uint32_t queryCount,
1151 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001152 VkDeviceSize destOffset,
1153 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001154 VkFlags flags)
1155{
1156 NULLDRV_LOG_FUNC;
1157}
1158
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001159ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001160 VkCmdBuffer cmdBuffer,
1161 VkTimestampType timestampType,
1162 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001163 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001164{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001165 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001166}
1167
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001168ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001169 VkCmdBuffer cmdBuffer,
1170 VkPipelineBindPoint pipelineBindPoint,
1171 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001172{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001173 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001174}
1175
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001176ICD_EXPORT void VKAPI vkCmdBindDynamicStateObject(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001177 VkCmdBuffer cmdBuffer,
1178 VkStateBindPoint stateBindPoint,
1179 VkDynamicStateObject state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001180{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001181 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001182}
1183
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001184ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001185 VkCmdBuffer cmdBuffer,
1186 VkPipelineBindPoint pipelineBindPoint,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001187 uint32_t firstSet,
1188 uint32_t setCount,
1189 const VkDescriptorSet* pDescriptorSets,
1190 uint32_t dynamicOffsetCount,
1191 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001192{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001193 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001194}
1195
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001196ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1197 VkCmdBuffer cmdBuffer,
1198 uint32_t startBinding,
1199 uint32_t bindingCount,
1200 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001201 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001202{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001203 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001204}
1205
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001206ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001207 VkCmdBuffer cmdBuffer,
1208 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001209 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001210 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001211{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001212 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001213}
1214
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001215ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001216 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001217 uint32_t firstVertex,
1218 uint32_t vertexCount,
1219 uint32_t firstInstance,
1220 uint32_t instanceCount)
1221{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001222 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001223}
1224
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001225ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001226 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001227 uint32_t firstIndex,
1228 uint32_t indexCount,
1229 int32_t vertexOffset,
1230 uint32_t firstInstance,
1231 uint32_t instanceCount)
1232{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001233 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001234}
1235
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001236ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001237 VkCmdBuffer cmdBuffer,
1238 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001239 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001240 uint32_t count,
1241 uint32_t stride)
1242{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001243 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001244}
1245
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001246ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001247 VkCmdBuffer cmdBuffer,
1248 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001249 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001250 uint32_t count,
1251 uint32_t stride)
1252{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001253 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001254}
1255
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001256ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001257 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001258 uint32_t x,
1259 uint32_t y,
1260 uint32_t z)
1261{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001262 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001263}
1264
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001265ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001266 VkCmdBuffer cmdBuffer,
1267 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001268 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001269{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001270 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001271}
1272
Tony Barbour8205d902015-04-16 15:59:00 -06001273void VKAPI vkCmdWaitEvents(
1274 VkCmdBuffer cmdBuffer,
1275 VkWaitEvent waitEvent,
1276 uint32_t eventCount,
1277 const VkEvent* pEvents,
1278 uint32_t memBarrierCount,
1279 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001280{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001281 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001282}
1283
Tony Barbour8205d902015-04-16 15:59:00 -06001284void VKAPI vkCmdPipelineBarrier(
1285 VkCmdBuffer cmdBuffer,
1286 VkWaitEvent waitEvent,
1287 uint32_t pipeEventCount,
1288 const VkPipeEvent* pPipeEvents,
1289 uint32_t memBarrierCount,
1290 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001291{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001292 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001293}
1294
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001295ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001296 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001297 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001298 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001299{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001300 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001301 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1302 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1303}
1304
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001305ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1306 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001307{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001308 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001309 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001310}
1311
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001312ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1313 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001314 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001315 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001316 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001317{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001318 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001319 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001320 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001321 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001322}
1323
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001324ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1325 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001326{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001327 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001328 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001329}
1330
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001331ICD_EXPORT VkResult VKAPI vkCreateEvent(
1332 VkDevice device,
1333 const VkEventCreateInfo* pCreateInfo,
1334 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001335{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001336 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001337 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001338}
1339
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001340ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001341 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001342 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001343{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001344 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001345 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001346}
1347
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001348ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001349 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001350 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001351{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001352 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001353 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001354}
1355
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001356ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001357 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001358 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001359{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001360 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001361 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001362}
1363
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001364ICD_EXPORT VkResult VKAPI vkCreateFence(
1365 VkDevice device,
1366 const VkFenceCreateInfo* pCreateInfo,
1367 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001368{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001369 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001370 struct nulldrv_dev *dev = nulldrv_dev(device);
1371
1372 return nulldrv_fence_create(dev, pCreateInfo,
1373 (struct nulldrv_fence **) pFence);
1374}
1375
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001376ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001377 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001378 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001379{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001380 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001381 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001382}
1383
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001384ICD_EXPORT VkResult VKAPI vkResetFences(
1385 VkDevice device,
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001386 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001387 VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001388{
1389 NULLDRV_LOG_FUNC;
1390 return VK_SUCCESS;
1391}
1392
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001393ICD_EXPORT VkResult VKAPI vkWaitForFences(
1394 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001395 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001396 const VkFence* pFences,
David Pinedo0257fbf2015-02-02 18:02:40 -07001397 bool32_t waitAll,
1398 uint64_t timeout)
1399{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001400 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001401 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001402}
1403
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001404ICD_EXPORT VkResult VKAPI vkGetFormatInfo(
1405 VkDevice device,
1406 VkFormat format,
1407 VkFormatInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001408 size_t* pDataSize,
1409 void* pData)
1410{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001411 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001412 VkFormatProperties *fmt = (VkFormatProperties *) pData;
1413 VkResult ret = VK_SUCCESS;
1414
1415 switch (infoType) {
1416 case VK_FORMAT_INFO_TYPE_PROPERTIES:
1417 *pDataSize = sizeof(VkFormatProperties);
1418 if (pData == NULL)
1419 return ret;
1420 fmt->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1421 fmt->optimalTilingFeatures = fmt->linearTilingFeatures;
1422 break;
1423 default:
1424 ret = VK_ERROR_INVALID_VALUE;
1425 break;
1426 }
1427
1428 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001429}
1430
Tony Barbour8205d902015-04-16 15:59:00 -06001431ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceInfo(
1432 VkPhysicalDevice gpu_,
1433 VkPhysicalDeviceInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001434 size_t* pDataSize,
1435 void* pData)
1436{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001437 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001438 VkResult ret = VK_SUCCESS;
1439
Ian Elliott32536f92015-04-21 16:41:02 -06001440 if (infoType == VK_PHYSICAL_DEVICE_INFO_TYPE_DISPLAY_PROPERTIES_WSI) {
1441 // NOTE: Handle this extension value as a special case:
1442 struct nulldrv_display *display;
1443 VkDisplayPropertiesWSI *props =
1444 (VkDisplayPropertiesWSI *) pData;
1445 *pDataSize = sizeof(VkDisplayPropertiesWSI);
1446 if (pData == NULL) {
1447 return ret;
1448 }
1449 display = (struct nulldrv_display *) nulldrv_base_create(NULL, sizeof(*display),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001450 /*VK_OBJECT_TYPE_SWAP_CHAIN_WSI*//* FIXME: DELETE THIS HACK: */ VK_OBJECT_TYPE_QUEUE);
Ian Elliott32536f92015-04-21 16:41:02 -06001451 props->display = (VkDisplayWSI) display;
1452 props->physicalResolution.width = 1920;
1453 props->physicalResolution.height = 1080;
1454
1455 return ret;
1456 }
1457
Ian Elliott64a68e12015-04-16 11:57:46 -06001458 switch (infoType) {
1459 case VK_PHYSICAL_DEVICE_INFO_TYPE_PROPERTIES:
1460 {
1461 VkPhysicalDeviceProperties *props =
1462 (VkPhysicalDeviceProperties *) pData;
1463 *pDataSize = sizeof(VkPhysicalDeviceProperties);
1464 if (pData == NULL) {
1465 return ret;
1466 }
1467 props->apiVersion = VK_API_VERSION;
1468 props->driverVersion = 0; // Appropriate that the nulldrv have 0's
1469 props->vendorId = 0;
1470 props->deviceId = 0;
1471 props->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1472 strncpy(props->deviceName, "nulldrv", strlen("nulldrv"));
1473 props->maxInlineMemoryUpdateSize = 0;
1474 props->maxBoundDescriptorSets = 0;
1475 props->maxThreadGroupSize = 0;
1476 props->timestampFrequency = 0;
1477 props->multiColorAttachmentClears = false;
1478 break;
1479 }
1480 case VK_PHYSICAL_DEVICE_INFO_TYPE_PERFORMANCE:
1481 {
1482 VkPhysicalDevicePerformance *perf =
1483 (VkPhysicalDevicePerformance *) pData;
1484 *pDataSize = sizeof(VkPhysicalDevicePerformance);
1485 if (pData == NULL) {
1486 return ret;
1487 }
1488 perf->maxDeviceClock = 1.0f;
1489 perf->aluPerClock = 1.0f;
1490 perf->texPerClock = 1.0f;
1491 perf->primsPerClock = 1.0f;
1492 perf->pixelsPerClock = 1.0f;
1493 break;
1494 }
1495 case VK_PHYSICAL_DEVICE_INFO_TYPE_QUEUE_PROPERTIES:
1496 {
1497 VkPhysicalDeviceQueueProperties *props =
1498 (VkPhysicalDeviceQueueProperties *) pData;
1499 *pDataSize = sizeof(VkPhysicalDeviceQueueProperties);
1500 if (pData == NULL) {
1501 return ret;
1502 }
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001503 props->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
Ian Elliott64a68e12015-04-16 11:57:46 -06001504 props->queueCount = 1;
1505 props->maxAtomicCounters = 1;
1506 props->supportsTimestamps = false;
Ian Elliott64a68e12015-04-16 11:57:46 -06001507 break;
1508 }
1509 default:
1510/* FIXME: WRITE THE REAL CODE*/return ret;
1511 break;
1512 }
1513
1514 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001515}
1516
Jon Ashburneb2728b2015-04-10 14:33:07 -06001517ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionInfo(
1518 VkExtensionInfoType infoType,
1519 uint32_t extensionIndex,
1520 size_t* pDataSize,
1521 void* pData)
1522{
1523 uint32_t *count;
1524
1525 if (pDataSize == NULL)
1526 return VK_ERROR_INVALID_POINTER;
1527
1528 switch (infoType) {
1529 case VK_EXTENSION_INFO_TYPE_COUNT:
1530 *pDataSize = sizeof(uint32_t);
1531 if (pData == NULL)
1532 return VK_SUCCESS;
1533 count = (uint32_t *) pData;
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -06001534 *count = NULLDRV_EXT_COUNT;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001535 break;
1536 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
Ian Elliott64a68e12015-04-16 11:57:46 -06001537 *pDataSize = sizeof(VkExtensionProperties);
Jon Ashburneb2728b2015-04-10 14:33:07 -06001538 if (pData == NULL)
1539 return VK_SUCCESS;
Ian Elliott64a68e12015-04-16 11:57:46 -06001540 else {
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -06001541 if (extensionIndex >= NULLDRV_EXT_COUNT)
1542 return VK_ERROR_INVALID_VALUE;
1543
1544 memcpy((VkExtensionProperties *) pData, &intel_gpu_exts[extensionIndex], sizeof(VkExtensionProperties));
Ian Elliott64a68e12015-04-16 11:57:46 -06001545 return VK_SUCCESS;
1546 }
Jon Ashburneb2728b2015-04-10 14:33:07 -06001547 break;
1548 default:
1549 return VK_ERROR_INVALID_VALUE;
1550 };
1551
1552 return VK_SUCCESS;
1553}
1554
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001555VkResult VKAPI vkGetPhysicalDeviceExtensionInfo(
Tony Barbour8205d902015-04-16 15:59:00 -06001556 VkPhysicalDevice gpu,
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001557 VkExtensionInfoType infoType,
1558 uint32_t extensionIndex,
1559 size_t* pDataSize,
1560 void* pData)
David Pinedo0257fbf2015-02-02 18:02:40 -07001561{
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001562 uint32_t *count;
1563
1564 if (pDataSize == NULL)
1565 return VK_ERROR_INVALID_POINTER;
1566
1567 switch (infoType) {
1568 case VK_EXTENSION_INFO_TYPE_COUNT:
1569 *pDataSize = sizeof(uint32_t);
1570 if (pData == NULL)
1571 return VK_SUCCESS;
1572 count = (uint32_t *) pData;
1573 *count = 0;
1574 break;
1575 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
1576 *pDataSize = 0;
1577 if (pData == NULL)
1578 return VK_SUCCESS;
1579 return VK_ERROR_INVALID_EXTENSION;
1580 break;
1581 default:
1582 return VK_ERROR_INVALID_VALUE;
1583 };
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001584 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001585}
1586
Tony Barbour8205d902015-04-16 15:59:00 -06001587ICD_EXPORT VkResult VKAPI vkGetMultiDeviceCompatibility(
1588 VkPhysicalDevice gpu0_,
1589 VkPhysicalDevice gpu1_,
1590 VkPhysicalDeviceCompatibilityInfo* pInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001591{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001592 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001593 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001594}
1595
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001596ICD_EXPORT VkResult VKAPI vkOpenPeerImage(
1597 VkDevice device,
1598 const VkPeerImageOpenInfo* pOpenInfo,
1599 VkImage* pImage,
Tony Barbour8205d902015-04-16 15:59:00 -06001600 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001601{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001602 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001603 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001604}
1605
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001606ICD_EXPORT VkResult VKAPI vkCreateImage(
1607 VkDevice device,
1608 const VkImageCreateInfo* pCreateInfo,
1609 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001610{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001611 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001612 struct nulldrv_dev *dev = nulldrv_dev(device);
1613
1614 return nulldrv_img_create(dev, pCreateInfo, false,
1615 (struct nulldrv_img **) pImage);
1616}
1617
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001618ICD_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(
Mike Stroyan230e6252015-04-17 12:36:38 -06001619 VkDevice device,
1620 VkImage image,
1621 const VkImageSubresource* pSubresource,
1622 VkSubresourceInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001623 size_t* pDataSize,
1624 void* pData)
1625{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001626 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001627 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001628
1629 switch (infoType) {
Tony Barbour8205d902015-04-16 15:59:00 -06001630 case VK_SUBRESOURCE_INFO_TYPE_LAYOUT:
David Pinedo0257fbf2015-02-02 18:02:40 -07001631 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001632 VkSubresourceLayout *layout = (VkSubresourceLayout *) pData;
David Pinedo0257fbf2015-02-02 18:02:40 -07001633
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001634 *pDataSize = sizeof(VkSubresourceLayout);
David Pinedo0257fbf2015-02-02 18:02:40 -07001635
1636 if (pData == NULL)
1637 return ret;
1638 layout->offset = 0;
1639 layout->size = 1;
1640 layout->rowPitch = 4;
1641 layout->depthPitch = 4;
1642 }
1643 break;
1644 default:
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001645 ret = VK_ERROR_INVALID_VALUE;
David Pinedo0257fbf2015-02-02 18:02:40 -07001646 break;
1647 }
1648
1649 return ret;
1650}
1651
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001652ICD_EXPORT VkResult VKAPI vkAllocMemory(
1653 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001654 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001655 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001656{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001657 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001658 struct nulldrv_dev *dev = nulldrv_dev(device);
1659
1660 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1661}
1662
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001663ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001664 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001665 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001666{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001667 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001668 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001669}
1670
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001671ICD_EXPORT VkResult VKAPI vkSetMemoryPriority(
Mike Stroyan230e6252015-04-17 12:36:38 -06001672 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001673 VkDeviceMemory mem_,
Mike Stroyan230e6252015-04-17 12:36:38 -06001674 VkMemoryPriority priority)
David Pinedo0257fbf2015-02-02 18:02:40 -07001675{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001676 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001677 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001678}
1679
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001680ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001681 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001682 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001683 VkDeviceSize offset,
1684 VkDeviceSize size,
1685 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001686 void** ppData)
1687{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001688 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001689 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1690 void *ptr = nulldrv_mem_map(mem, flags);
1691
1692 *ppData = ptr;
1693
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001694 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001695}
1696
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001697ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001698 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001699 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001700{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001701 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001702 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001703}
1704
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001705ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001706 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001707 uint32_t memRangeCount,
1708 const VkMappedMemoryRange* pMemRanges)
1709{
1710 NULLDRV_LOG_FUNC;
1711 return VK_SUCCESS;
1712}
1713
1714ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1715 VkDevice device,
1716 uint32_t memRangeCount,
1717 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001718{
1719 NULLDRV_LOG_FUNC;
1720 return VK_SUCCESS;
1721}
1722
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001723ICD_EXPORT VkResult VKAPI vkPinSystemMemory(
1724 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001725 const void* pSysMem,
1726 size_t memSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001727 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001728{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001729 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001730 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001731}
1732
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001733ICD_EXPORT VkResult VKAPI vkOpenSharedMemory(
1734 VkDevice device,
1735 const VkMemoryOpenInfo* pOpenInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001736 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001737{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001738 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001739 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001740}
1741
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001742ICD_EXPORT VkResult VKAPI vkOpenPeerMemory(
1743 VkDevice device,
1744 const VkPeerMemoryOpenInfo* pOpenInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001745 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001746{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001747 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001748 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001749}
1750
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001751ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001752 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001753 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001754{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001755 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001756 struct nulldrv_instance *inst;
1757
1758 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001759 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001760 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001761 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001762
1763 inst->obj.base.get_info = NULL;
1764
Mike Stroyan230e6252015-04-17 12:36:38 -06001765 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001766
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001767 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001768}
1769
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001770ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1771 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001772{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001773 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001774 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001775}
1776
Tony Barbour8205d902015-04-16 15:59:00 -06001777ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001778 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001779 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001780 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001781{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001782 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001783 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001784 struct nulldrv_gpu *gpu;
1785 *pGpuCount = 1;
1786 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001787 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001788 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001789 return ret;
1790}
1791
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001792ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001793 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001794 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001795 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001796 char* const* pOutLayers,
1797 void* pReserved)
1798{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001799 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001800 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001801}
1802
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001803ICD_EXPORT VkResult VKAPI vkDestroyObject(
Mike Stroyan230e6252015-04-17 12:36:38 -06001804 VkDevice device,
1805 VkObjectType objType,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001806 VkObject object)
David Pinedo0257fbf2015-02-02 18:02:40 -07001807{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001808 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001809 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001810}
1811
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001812ICD_EXPORT VkResult VKAPI vkGetObjectInfo(
Mike Stroyan230e6252015-04-17 12:36:38 -06001813 VkDevice device,
1814 VkObjectType objType,
1815 VkObject object,
1816 VkObjectInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001817 size_t* pDataSize,
1818 void* pData)
1819{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001820 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001821 struct nulldrv_base *base = nulldrv_base(object);
1822
1823 return base->get_info(base, infoType, pDataSize, pData);
1824}
1825
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001826ICD_EXPORT VkResult VKAPI vkBindObjectMemory(
1827 VkDevice device,
Mike Stroyan230e6252015-04-17 12:36:38 -06001828 VkObjectType objType,
1829 VkObject object,
Tony Barbour8205d902015-04-16 15:59:00 -06001830 VkDeviceMemory mem_,
1831 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001832{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001833 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001834 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001835}
1836
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001837ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001838 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001839 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001840 VkDeviceSize rangeOffset,
1841 VkDeviceSize rangeSize,
1842 VkDeviceMemory mem,
1843 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001844{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001845 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001846 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001847}
1848
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001849ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001850 VkQueue queue,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001851 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001852 const VkImageMemoryBindInfo* pBindInfo,
1853 VkDeviceMemory mem,
1854 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001855{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001856 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001857 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001858}
1859
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001860ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(
1861 VkDevice device,
1862 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1863 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001864{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001865 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001866 struct nulldrv_dev *dev = nulldrv_dev(device);
1867
1868 return graphics_pipeline_create(dev, pCreateInfo,
1869 (struct nulldrv_pipeline **) pPipeline);
1870}
1871
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001872ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(
1873 VkDevice device,
1874 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1875 VkPipeline basePipeline,
1876 VkPipeline* pPipeline)
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001877{
1878 NULLDRV_LOG_FUNC;
1879 struct nulldrv_dev *dev = nulldrv_dev(device);
1880
1881 return graphics_pipeline_create(dev, pCreateInfo,
1882 (struct nulldrv_pipeline **) pPipeline);
1883}
1884
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001885ICD_EXPORT VkResult VKAPI vkCreateComputePipeline(
1886 VkDevice device,
1887 const VkComputePipelineCreateInfo* pCreateInfo,
1888 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001889{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001890 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001891 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001892}
1893
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001894ICD_EXPORT VkResult VKAPI vkStorePipeline(
Mike Stroyan230e6252015-04-17 12:36:38 -06001895 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001896 VkPipeline pipeline,
David Pinedo0257fbf2015-02-02 18:02:40 -07001897 size_t* pDataSize,
1898 void* pData)
1899{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001900 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001901 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001902}
1903
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001904ICD_EXPORT VkResult VKAPI vkLoadPipeline(
1905 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001906 size_t dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001907 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001908 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001909{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001910 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001911 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001912}
1913
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001914ICD_EXPORT VkResult VKAPI vkLoadPipelineDerivative(
1915 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001916 size_t dataSize,
1917 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001918 VkPipeline basePipeline,
1919 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001920{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001921 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001922 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001923}
1924
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001925ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1926 VkDevice device,
1927 const VkQueryPoolCreateInfo* pCreateInfo,
1928 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001929{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001930 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001931 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001932}
1933
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001934ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001935 VkDevice device,
1936 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001937 uint32_t startQuery,
1938 uint32_t queryCount,
1939 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001940 void* pData,
1941 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001942{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001943 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001944 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001945}
1946
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001947ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1948 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001949{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001950 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001951 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001952}
1953
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001954ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1955 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001956 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001957 const VkCmdBuffer* pCmdBuffers,
1958 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001959{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001960 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001961 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001962}
1963
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001964ICD_EXPORT VkResult VKAPI vkOpenSharedSemaphore(
1965 VkDevice device,
1966 const VkSemaphoreOpenInfo* pOpenInfo,
1967 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001968{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001969 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001970 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001971}
1972
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001973ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1974 VkDevice device,
1975 const VkSemaphoreCreateInfo* pCreateInfo,
1976 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001977{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001978 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001979 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001980}
1981
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001982ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1983 VkQueue queue,
1984 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001985{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001986 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001987 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001988}
1989
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001990ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1991 VkQueue queue,
1992 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001993{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001994 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001995 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001996}
1997
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001998ICD_EXPORT VkResult VKAPI vkCreateSampler(
1999 VkDevice device,
2000 const VkSamplerCreateInfo* pCreateInfo,
2001 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07002002{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002003 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002004 struct nulldrv_dev *dev = nulldrv_dev(device);
2005
2006 return nulldrv_sampler_create(dev, pCreateInfo,
2007 (struct nulldrv_sampler **) pSampler);
2008}
2009
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002010ICD_EXPORT VkResult VKAPI vkCreateShader(
2011 VkDevice device,
2012 const VkShaderCreateInfo* pCreateInfo,
2013 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002014{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002015 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002016 struct nulldrv_dev *dev = nulldrv_dev(device);
2017
2018 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2019}
2020
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002021ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2022 VkDevice device,
2023 const VkDynamicVpStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002024 VkDynamicVpState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002025{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002026 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002027 struct nulldrv_dev *dev = nulldrv_dev(device);
2028
2029 return nulldrv_viewport_state_create(dev, pCreateInfo,
2030 (struct nulldrv_dynamic_vp **) pState);
2031}
2032
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002033ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
2034 VkDevice device,
2035 const VkDynamicRsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002036 VkDynamicRsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002037{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002038 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002039 struct nulldrv_dev *dev = nulldrv_dev(device);
2040
2041 return nulldrv_raster_state_create(dev, pCreateInfo,
2042 (struct nulldrv_dynamic_rs **) pState);
2043}
2044
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002045ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
2046 VkDevice device,
2047 const VkDynamicCbStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002048 VkDynamicCbState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002049{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002050 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002051 struct nulldrv_dev *dev = nulldrv_dev(device);
2052
2053 return nulldrv_blend_state_create(dev, pCreateInfo,
2054 (struct nulldrv_dynamic_cb **) pState);
2055}
2056
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002057ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
2058 VkDevice device,
2059 const VkDynamicDsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002060 VkDynamicDsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002061{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002062 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002063 struct nulldrv_dev *dev = nulldrv_dev(device);
2064
2065 return nulldrv_ds_state_create(dev, pCreateInfo,
2066 (struct nulldrv_dynamic_ds **) pState);
2067}
2068
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002069ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2070 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002071 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002072 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002073{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002074 NULLDRV_LOG_FUNC;
2075 struct nulldrv_dev *dev = nulldrv_dev(device);
2076
2077 return nulldrv_buf_view_create(dev, pCreateInfo,
2078 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002079}
2080
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002081ICD_EXPORT VkResult VKAPI vkCreateImageView(
2082 VkDevice device,
2083 const VkImageViewCreateInfo* pCreateInfo,
2084 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002085{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002086 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002087 struct nulldrv_dev *dev = nulldrv_dev(device);
2088
2089 return nulldrv_img_view_create(dev, pCreateInfo,
2090 (struct nulldrv_img_view **) pView);
2091}
2092
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002093ICD_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
2094 VkDevice device,
2095 const VkColorAttachmentViewCreateInfo* pCreateInfo,
2096 VkColorAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002097{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002098 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002099 struct nulldrv_dev *dev = nulldrv_dev(device);
2100
2101 return nulldrv_rt_view_create(dev, pCreateInfo,
2102 (struct nulldrv_rt_view **) pView);
2103}
2104
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002105ICD_EXPORT VkResult VKAPI vkCreateDepthStencilView(
2106 VkDevice device,
2107 const VkDepthStencilViewCreateInfo* pCreateInfo,
2108 VkDepthStencilView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002109{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002110 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002111 struct nulldrv_dev *dev = nulldrv_dev(device);
2112
2113 return nulldrv_ds_view_create(dev, pCreateInfo,
2114 (struct nulldrv_ds_view **) pView);
2115
2116}
2117
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002118ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2119 VkDevice device,
2120 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2121 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002122{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002123 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002124 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002125
Chia-I Wu7732cb22015-03-26 15:27:55 +08002126 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002127 (struct nulldrv_desc_layout **) pSetLayout);
2128}
2129
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002130ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2131 VkDevice device,
2132 const VkPipelineLayoutCreateInfo* pCreateInfo,
2133 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002134{
2135 NULLDRV_LOG_FUNC;
2136 struct nulldrv_dev *dev = nulldrv_dev(device);
2137
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002138 return nulldrv_pipeline_layout_create(dev,
2139 pCreateInfo,
2140 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002141}
2142
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002143ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2144 VkDevice device,
2145 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002146 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002147 const VkDescriptorPoolCreateInfo* pCreateInfo,
2148 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002149{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002150 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002151 struct nulldrv_dev *dev = nulldrv_dev(device);
2152
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002153 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2154 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002155}
2156
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002157ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002158 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002159 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002160{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002161 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002162 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002163}
2164
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002165ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002166 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002167 VkDescriptorPool descriptorPool,
2168 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002169 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002170 const VkDescriptorSetLayout* pSetLayouts,
2171 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07002172 uint32_t* pCount)
2173{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002174 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002175 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2176 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002177 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002178 uint32_t i;
2179
2180 for (i = 0; i < count; i++) {
2181 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002182 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002183
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002184 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002185 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002186 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002187 break;
2188 }
2189
2190 if (pCount)
2191 *pCount = i;
2192
2193 return ret;
2194}
2195
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002196ICD_EXPORT void VKAPI vkClearDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002197 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002198 VkDescriptorPool descriptorPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07002199 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002200 const VkDescriptorSet* pDescriptorSets)
David Pinedo0257fbf2015-02-02 18:02:40 -07002201{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002202 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002203}
2204
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002205ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2206 VkDevice device,
2207 uint32_t writeCount,
2208 const VkWriteDescriptorSet* pDescriptorWrites,
2209 uint32_t copyCount,
2210 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002211{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002212 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002213 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002214}
2215
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002216ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2217 VkDevice device,
2218 const VkFramebufferCreateInfo* info,
2219 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002220{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002221 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002222 struct nulldrv_dev *dev = nulldrv_dev(device);
2223
2224 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2225}
2226
2227
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002228ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2229 VkDevice device,
2230 const VkRenderPassCreateInfo* info,
2231 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002232{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002233 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002234 struct nulldrv_dev *dev = nulldrv_dev(device);
2235
2236 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2237}
2238
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002239ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002240 VkCmdBuffer cmdBuffer,
2241 const VkRenderPassBegin* pRenderPassBegin)
David Pinedo0257fbf2015-02-02 18:02:40 -07002242{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002243 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002244}
2245
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002246ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002247 VkCmdBuffer cmdBuffer,
2248 VkRenderPass renderPass)
David Pinedo0257fbf2015-02-02 18:02:40 -07002249{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002250 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002251}
Ian Elliottf93069f2015-02-19 14:26:19 -07002252
2253ICD_EXPORT void* xcbCreateWindow(
2254 uint16_t width,
2255 uint16_t height)
2256{
2257 static uint32_t window; // Kludge to the max
2258 NULLDRV_LOG_FUNC;
2259 return &window;
2260}
2261
2262// May not be needed, if we stub out stuf in tri.c
2263ICD_EXPORT void xcbDestroyWindow()
2264{
2265 NULLDRV_LOG_FUNC;
2266}
2267
2268ICD_EXPORT int xcbGetMessage(void *msg)
2269{
2270 NULLDRV_LOG_FUNC;
2271 return 0;
2272}
2273
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002274ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002275{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002276 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002277}