blob: 0aaafc5a11c93ec89e2ab7b9fbc963768905fe12 [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};
45
Mike Stroyan230e6252015-04-17 12:36:38 -060046static struct nulldrv_base *nulldrv_base(VkObject base)
David Pinedo0257fbf2015-02-02 18:02:40 -070047{
48 return (struct nulldrv_base *) base;
49}
50
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060051static VkResult nulldrv_base_get_info(struct nulldrv_base *base, int type,
David Pinedo0257fbf2015-02-02 18:02:40 -070052 size_t *size, void *data)
53{
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060054 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -070055 size_t s;
David Pinedo0257fbf2015-02-02 18:02:40 -070056
57 switch (type) {
Tony Barbour8205d902015-04-16 15:59:00 -060058 case VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS:
David Pinedo0257fbf2015-02-02 18:02:40 -070059 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060060 s = sizeof(VkMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -070061 *size = s;
62 if (data == NULL)
63 return ret;
64 memset(data, 0, s);
David Pinedo0257fbf2015-02-02 18:02:40 -070065 break;
66 }
David Pinedo0257fbf2015-02-02 18:02:40 -070067 default:
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060068 ret = VK_ERROR_INVALID_VALUE;
David Pinedo0257fbf2015-02-02 18:02:40 -070069 break;
70 }
71
72 return ret;
73}
74
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060075static struct nulldrv_base *nulldrv_base_create(
76 struct nulldrv_dev *dev,
77 size_t obj_size,
78 VkObjectType type)
David Pinedo0257fbf2015-02-02 18:02:40 -070079{
80 struct nulldrv_base *base;
81
82 if (!obj_size)
83 obj_size = sizeof(*base);
84
85 assert(obj_size >= sizeof(*base));
86
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060087 base = (struct nulldrv_base*)malloc(obj_size);
David Pinedo0257fbf2015-02-02 18:02:40 -070088 if (!base)
89 return NULL;
90
91 memset(base, 0, obj_size);
92
93 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbour11e76ac2015-04-20 16:28:46 -060094 set_loader_magic_value((VkObject) base);
David Pinedo0257fbf2015-02-02 18:02:40 -070095
96 if (dev == NULL) {
97 /*
98 * dev is NULL when we are creating the base device object
99 * Set dev now so that debug setup happens correctly
100 */
101 dev = (struct nulldrv_dev *) base;
102 }
103
104
105 base->get_info = NULL;
106
107 return base;
108}
109
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600110static VkResult nulldrv_gpu_add(int devid, const char *primary_node,
David Pinedo0257fbf2015-02-02 18:02:40 -0700111 const char *render_node, struct nulldrv_gpu **gpu_ret)
112{
113 struct nulldrv_gpu *gpu;
114
Chia-I Wu493a1752015-02-22 14:40:25 +0800115 gpu = malloc(sizeof(*gpu));
David Pinedo0257fbf2015-02-02 18:02:40 -0700116 if (!gpu)
Tony Barbour8205d902015-04-16 15:59:00 -0600117 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700118 memset(gpu, 0, sizeof(*gpu));
Mark Lobodzinski97dcd042015-04-16 08:52:00 -0500119
David Pinedo0257fbf2015-02-02 18:02:40 -0700120 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbour11e76ac2015-04-20 16:28:46 -0600121 set_loader_magic_value((VkObject) gpu);
David Pinedo0257fbf2015-02-02 18:02:40 -0700122
123 *gpu_ret = gpu;
124
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600125 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700126}
127
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600128static VkResult nulldrv_queue_create(struct nulldrv_dev *dev,
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700129 uint32_t node_index,
David Pinedo0257fbf2015-02-02 18:02:40 -0700130 struct nulldrv_queue **queue_ret)
131{
132 struct nulldrv_queue *queue;
133
134 queue = (struct nulldrv_queue *) nulldrv_base_create(dev, sizeof(*queue),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600135 VK_OBJECT_TYPE_QUEUE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700136 if (!queue)
Tony Barbour8205d902015-04-16 15:59:00 -0600137 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700138
139 queue->dev = dev;
140
141 *queue_ret = queue;
142
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600143 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700144}
145
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600146static VkResult dev_create_queues(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600147 const VkDeviceQueueCreateInfo *queues,
David Pinedo0257fbf2015-02-02 18:02:40 -0700148 uint32_t count)
149{
150 uint32_t i;
151
152 if (!count)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600153 return VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700154
155 for (i = 0; i < count; i++) {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600156 const VkDeviceQueueCreateInfo *q = &queues[i];
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600157 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700158
159 if (q->queueCount == 1 && !dev->queues[q->queueNodeIndex]) {
160 ret = nulldrv_queue_create(dev, q->queueNodeIndex,
161 &dev->queues[q->queueNodeIndex]);
162 }
163 else {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600164 ret = VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700165 }
166
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600167 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700168 return ret;
169 }
170 }
171
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600172 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700173}
174
175static enum nulldrv_ext_type nulldrv_gpu_lookup_extension(const struct nulldrv_gpu *gpu,
176 const char *ext)
177{
178 enum nulldrv_ext_type type;
179
180 for (type = 0; type < ARRAY_SIZE(nulldrv_gpu_exts); type++) {
181 if (nulldrv_gpu_exts[type] && strcmp(nulldrv_gpu_exts[type], ext) == 0)
182 break;
183 }
184
185 assert(type < NULLDRV_EXT_COUNT || type == NULLDRV_EXT_INVALID);
186
187 return type;
188}
189
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600190static VkResult nulldrv_desc_ooxx_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800191 struct nulldrv_desc_ooxx **ooxx_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700192{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800193 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700194
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800195 ooxx = malloc(sizeof(*ooxx));
196 if (!ooxx)
Tony Barbour8205d902015-04-16 15:59:00 -0600197 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700198
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800199 memset(ooxx, 0, sizeof(*ooxx));
David Pinedo0257fbf2015-02-02 18:02:40 -0700200
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800201 ooxx->surface_desc_size = 0;
202 ooxx->sampler_desc_size = 0;
David Pinedo0257fbf2015-02-02 18:02:40 -0700203
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800204 *ooxx_ret = ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700205
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600206 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700207}
208
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600209static VkResult nulldrv_dev_create(struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600210 const VkDeviceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700211 struct nulldrv_dev **dev_ret)
212{
213 struct nulldrv_dev *dev;
214 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600215 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -0700216
217 dev = (struct nulldrv_dev *) nulldrv_base_create(NULL, sizeof(*dev),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600218 VK_OBJECT_TYPE_DEVICE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700219 if (!dev)
Tony Barbour8205d902015-04-16 15:59:00 -0600220 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700221
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600222// for (i = 0; i < info->extensionCount; i++) {
223// const enum nulldrv_ext_type ext = nulldrv_gpu_lookup_extension(gpu,
224// info->ppEnabledExtensionNames[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700225
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600226// if (ext == NULLDRV_EXT_INVALID)
227// return VK_ERROR_INVALID_EXTENSION;
David Pinedo0257fbf2015-02-02 18:02:40 -0700228
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600229// dev->exts[ext] = true;
230// }
David Pinedo0257fbf2015-02-02 18:02:40 -0700231
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800232 ret = nulldrv_desc_ooxx_create(dev, &dev->desc_ooxx);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600233 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700234 return ret;
235 }
236
237 ret = dev_create_queues(dev, info->pRequestedQueues,
238 info->queueRecordCount);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600239 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700240 return ret;
241 }
242
243 *dev_ret = dev;
244
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600245 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700246}
247
Tony Barbour8205d902015-04-16 15:59:00 -0600248static struct nulldrv_gpu *nulldrv_gpu(VkPhysicalDevice gpu)
David Pinedo0257fbf2015-02-02 18:02:40 -0700249{
250 return (struct nulldrv_gpu *) gpu;
251}
252
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600253static VkResult nulldrv_rt_view_create(struct nulldrv_dev *dev,
254 const VkColorAttachmentViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700255 struct nulldrv_rt_view **view_ret)
256{
257 struct nulldrv_rt_view *view;
258
259 view = (struct nulldrv_rt_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600260 VK_OBJECT_TYPE_COLOR_ATTACHMENT_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700261 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600262 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700263
264 *view_ret = view;
265
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600266 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700267}
268
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600269static VkResult nulldrv_fence_create(struct nulldrv_dev *dev,
270 const VkFenceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700271 struct nulldrv_fence **fence_ret)
272{
273 struct nulldrv_fence *fence;
274
275 fence = (struct nulldrv_fence *) nulldrv_base_create(dev, sizeof(*fence),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600276 VK_OBJECT_TYPE_FENCE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700277 if (!fence)
Tony Barbour8205d902015-04-16 15:59:00 -0600278 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700279
280 *fence_ret = fence;
281
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600282 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700283}
284
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600285static struct nulldrv_dev *nulldrv_dev(VkDevice dev)
David Pinedo0257fbf2015-02-02 18:02:40 -0700286{
287 return (struct nulldrv_dev *) dev;
288}
289
290static struct nulldrv_img *nulldrv_img_from_base(struct nulldrv_base *base)
291{
292 return (struct nulldrv_img *) base;
293}
294
295
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600296static VkResult img_get_info(struct nulldrv_base *base, int type,
David Pinedo0257fbf2015-02-02 18:02:40 -0700297 size_t *size, void *data)
298{
299 struct nulldrv_img *img = nulldrv_img_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600300 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700301
302 switch (type) {
Tony Barbour8205d902015-04-16 15:59:00 -0600303 case VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS:
David Pinedo0257fbf2015-02-02 18:02:40 -0700304 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600305 VkMemoryRequirements *mem_req = data;
David Pinedo0257fbf2015-02-02 18:02:40 -0700306
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600307 *size = sizeof(VkMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -0700308 if (data == NULL)
309 return ret;
310 mem_req->size = img->total_size;
311 mem_req->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700312 }
313 break;
314 default:
315 ret = nulldrv_base_get_info(base, type, size, data);
316 break;
317 }
318
319 return ret;
320}
321
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600322static VkResult nulldrv_img_create(struct nulldrv_dev *dev,
323 const VkImageCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700324 bool scanout,
325 struct nulldrv_img **img_ret)
326{
327 struct nulldrv_img *img;
328
329 img = (struct nulldrv_img *) nulldrv_base_create(dev, sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600330 VK_OBJECT_TYPE_IMAGE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700331 if (!img)
Tony Barbour8205d902015-04-16 15:59:00 -0600332 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700333
334 img->type = info->imageType;
335 img->depth = info->extent.depth;
336 img->mip_levels = info->mipLevels;
337 img->array_size = info->arraySize;
338 img->usage = info->usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700339 img->samples = info->samples;
340
341 img->obj.base.get_info = img_get_info;
342
343 *img_ret = img;
344
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600345 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700346}
347
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600348static struct nulldrv_img *nulldrv_img(VkImage image)
David Pinedo0257fbf2015-02-02 18:02:40 -0700349{
350 return (struct nulldrv_img *) image;
351}
352
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600353static VkResult nulldrv_mem_alloc(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600354 const VkMemoryAllocInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700355 struct nulldrv_mem **mem_ret)
356{
357 struct nulldrv_mem *mem;
358
359 mem = (struct nulldrv_mem *) nulldrv_base_create(dev, sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600360 VK_OBJECT_TYPE_DEVICE_MEMORY);
David Pinedo0257fbf2015-02-02 18:02:40 -0700361 if (!mem)
Tony Barbour8205d902015-04-16 15:59:00 -0600362 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700363
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700364 mem->bo = malloc(info->allocationSize);
David Pinedo0257fbf2015-02-02 18:02:40 -0700365 if (!mem->bo) {
Tony Barbour8205d902015-04-16 15:59:00 -0600366 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700367 }
368
369 mem->size = info->allocationSize;
370
371 *mem_ret = mem;
372
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600373 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700374}
375
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600376static VkResult nulldrv_ds_view_create(struct nulldrv_dev *dev,
377 const VkDepthStencilViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700378 struct nulldrv_ds_view **view_ret)
379{
380 struct nulldrv_img *img = nulldrv_img(info->image);
381 struct nulldrv_ds_view *view;
382
383 view = (struct nulldrv_ds_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600384 VK_OBJECT_TYPE_DEPTH_STENCIL_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700385 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600386 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700387
388 view->img = img;
389
390 view->array_size = info->arraySize;
391
392 *view_ret = view;
393
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600394 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700395}
396
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600397static VkResult nulldrv_sampler_create(struct nulldrv_dev *dev,
398 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700399 struct nulldrv_sampler **sampler_ret)
400{
401 struct nulldrv_sampler *sampler;
402
403 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600404 sizeof(*sampler), VK_OBJECT_TYPE_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700405 if (!sampler)
Tony Barbour8205d902015-04-16 15:59:00 -0600406 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700407
408 *sampler_ret = sampler;
409
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600410 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700411}
412
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600413static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
414 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700415 struct nulldrv_img_view **view_ret)
416{
417 struct nulldrv_img *img = nulldrv_img(info->image);
418 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700419
420 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600421 VK_OBJECT_TYPE_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700422 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600423 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700424
425 view->img = img;
426 view->min_lod = info->minLod;
427
David Pinedo0257fbf2015-02-02 18:02:40 -0700428 view->cmd_len = 8;
429
430 *view_ret = view;
431
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600432 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700433}
434
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600435static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700436{
437 return mem->bo;
438}
439
Tony Barbour8205d902015-04-16 15:59:00 -0600440static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700441{
442 return (struct nulldrv_mem *) mem;
443}
444
445static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
446{
447 return (struct nulldrv_buf *) base;
448}
449
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600450static VkResult buf_get_info(struct nulldrv_base *base, int type,
David Pinedo0257fbf2015-02-02 18:02:40 -0700451 size_t *size, void *data)
452{
453 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600454 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700455
456 switch (type) {
Tony Barbour8205d902015-04-16 15:59:00 -0600457 case VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS:
David Pinedo0257fbf2015-02-02 18:02:40 -0700458 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600459 VkMemoryRequirements *mem_req = data;
David Pinedo0257fbf2015-02-02 18:02:40 -0700460
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600461 *size = sizeof(VkMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -0700462 if (data == NULL)
463 return ret;
464
465 mem_req->size = buf->size;
466 mem_req->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700467
468 }
469 break;
David Pinedo0257fbf2015-02-02 18:02:40 -0700470 default:
471 ret = nulldrv_base_get_info(base, type, size, data);
472 break;
473 }
474
475 return ret;
476}
477
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600478static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600479 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700480 struct nulldrv_buf **buf_ret)
481{
482 struct nulldrv_buf *buf;
483
484 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600485 VK_OBJECT_TYPE_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700486 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600487 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700488
489 buf->size = info->size;
490 buf->usage = info->usage;
491
492 buf->obj.base.get_info = buf_get_info;
493
494 *buf_ret = buf;
495
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600496 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700497}
498
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600499static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
500 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700501 struct nulldrv_desc_layout **layout_ret)
502{
503 struct nulldrv_desc_layout *layout;
504
505 layout = (struct nulldrv_desc_layout *)
506 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600507 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700508 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600509 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700510
511 *layout_ret = layout;
512
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600513 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700514}
515
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500516static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
517 const VkPipelineLayoutCreateInfo* pCreateInfo,
518 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800519{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500520 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800521
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500522 pipeline_layout = (struct nulldrv_pipeline_layout *)
523 nulldrv_base_create(dev, sizeof(*pipeline_layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600524 VK_OBJECT_TYPE_PIPELINE_LAYOUT);
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500525 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600526 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800527
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500528 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800529
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600530 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800531}
532
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600533static struct nulldrv_desc_layout *nulldrv_desc_layout(VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700534{
535 return (struct nulldrv_desc_layout *) layout;
536}
537
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600538static VkResult shader_create(struct nulldrv_dev *dev,
539 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700540 struct nulldrv_shader **sh_ret)
541{
David Pinedo0257fbf2015-02-02 18:02:40 -0700542 struct nulldrv_shader *sh;
543
544 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600545 VK_OBJECT_TYPE_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700546 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600547 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700548
549 *sh_ret = sh;
550
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600551 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700552}
553
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600554static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
555 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700556 struct nulldrv_pipeline **pipeline_ret)
557{
558 struct nulldrv_pipeline *pipeline;
559
560 pipeline = (struct nulldrv_pipeline *)
561 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600562 VK_OBJECT_TYPE_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700563 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600564 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700565
566 *pipeline_ret = pipeline;
567
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600568 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700569}
570
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600571static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
572 const VkDynamicVpStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700573 struct nulldrv_dynamic_vp **state_ret)
574{
575 struct nulldrv_dynamic_vp *state;
576
577 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600578 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_VP_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700579 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600580 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700581
582 *state_ret = state;
583
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600584 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700585}
586
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600587static VkResult nulldrv_raster_state_create(struct nulldrv_dev *dev,
588 const VkDynamicRsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700589 struct nulldrv_dynamic_rs **state_ret)
590{
591 struct nulldrv_dynamic_rs *state;
592
593 state = (struct nulldrv_dynamic_rs *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600594 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700595 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600596 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700597
598 *state_ret = state;
599
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600600 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700601}
602
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600603static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
604 const VkDynamicCbStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700605 struct nulldrv_dynamic_cb **state_ret)
606{
607 struct nulldrv_dynamic_cb *state;
608
609 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600610 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_CB_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700611 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600612 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700613
614 *state_ret = state;
615
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600616 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700617}
618
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600619static VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
620 const VkDynamicDsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700621 struct nulldrv_dynamic_ds **state_ret)
622{
623 struct nulldrv_dynamic_ds *state;
624
625 state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600626 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700627 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600628 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700629
630 *state_ret = state;
631
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600632 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700633}
634
635
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600636static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
637 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700638 struct nulldrv_cmd **cmd_ret)
639{
David Pinedo0257fbf2015-02-02 18:02:40 -0700640 struct nulldrv_cmd *cmd;
641
David Pinedo0257fbf2015-02-02 18:02:40 -0700642 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600643 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700644 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600645 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700646
647 *cmd_ret = cmd;
648
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600649 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700650}
651
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600652static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
653 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700654 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600655 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800656 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700657{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800658 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700659
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800660 pool = (struct nulldrv_desc_pool *)
661 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600662 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800663 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600664 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700665
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800666 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700667
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800668 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700669
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600670 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700671}
672
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600673static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800674 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600675 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700676 const struct nulldrv_desc_layout *layout,
677 struct nulldrv_desc_set **set_ret)
678{
679 struct nulldrv_desc_set *set;
680
681 set = (struct nulldrv_desc_set *)
682 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600683 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700684 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600685 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700686
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800687 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700688 set->layout = layout;
689 *set_ret = set;
690
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600691 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700692}
693
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600694static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700695{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800696 return (struct nulldrv_desc_pool *) pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700697}
698
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600699static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
700 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700701 struct nulldrv_framebuffer ** fb_ret)
702{
703
704 struct nulldrv_framebuffer *fb;
705 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600706 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700707 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600708 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700709
710 *fb_ret = fb;
711
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600712 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700713
714}
715
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600716static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
717 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700718 struct nulldrv_render_pass** rp_ret)
719{
720 struct nulldrv_render_pass *rp;
721 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600722 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700723 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600724 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700725
726 *rp_ret = rp;
727
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600728 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700729}
730
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600731static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700732{
733 return (struct nulldrv_buf *) buf;
734}
735
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600736static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600737 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700738 struct nulldrv_buf_view **view_ret)
739{
740 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
741 struct nulldrv_buf_view *view;
742
743 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600744 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700745 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600746 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700747
748 view->buf = buf;
749
750 *view_ret = view;
751
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600752 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700753}
754
David Pinedo0257fbf2015-02-02 18:02:40 -0700755
756//*********************************************
757// Driver entry points
758//*********************************************
759
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600760ICD_EXPORT VkResult VKAPI vkCreateBuffer(
761 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600762 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600763 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700764{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700765 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700766 struct nulldrv_dev *dev = nulldrv_dev(device);
767
768 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
769}
770
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600771ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
772 VkDevice device,
773 const VkCmdBufferCreateInfo* pCreateInfo,
774 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700775{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700776 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700777 struct nulldrv_dev *dev = nulldrv_dev(device);
778
779 return nulldrv_cmd_create(dev, pCreateInfo,
780 (struct nulldrv_cmd **) pCmdBuffer);
781}
782
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600783ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
784 VkCmdBuffer cmdBuffer,
785 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700786{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700787 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600788 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700789}
790
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600791ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
792 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700793{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700794 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600795 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700796}
797
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600798ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
799 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700800{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700801 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600802 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700803}
804
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600805ICD_EXPORT void VKAPI vkCmdInitAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600806 VkCmdBuffer cmdBuffer,
807 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700808 uint32_t startCounter,
809 uint32_t counterCount,
810 const uint32_t* pData)
811{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700812 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700813}
814
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600815ICD_EXPORT void VKAPI vkCmdLoadAtomicCounters(
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,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600820 VkBuffer srcBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600821 VkDeviceSize srcOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700822{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700823 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700824}
825
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600826ICD_EXPORT void VKAPI vkCmdSaveAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600827 VkCmdBuffer cmdBuffer,
828 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700829 uint32_t startCounter,
830 uint32_t counterCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600831 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600832 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700833{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700834 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700835}
836
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600837ICD_EXPORT void VKAPI vkCmdDbgMarkerBegin(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600838 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700839 const char* pMarker)
840{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700841 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700842}
843
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600844ICD_EXPORT void VKAPI vkCmdDbgMarkerEnd(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600845 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700846{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700847 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700848}
849
Ian Elliott64a68e12015-04-16 11:57:46 -0600850static const VkFormat nulldrv_presentable_formats[] = {
851 VK_FORMAT_B8G8R8A8_UNORM,
852};
853
854ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
855 VkDisplayWSI display,
856 VkDisplayInfoTypeWSI infoType,
857 size_t* pDataSize,
858 void* pData)
859{
860 VkResult ret = VK_SUCCESS;
861
862 NULLDRV_LOG_FUNC;
863
864 if (!pDataSize)
865 return VK_ERROR_INVALID_POINTER;
866
867 switch (infoType) {
868 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
869 {
870 VkDisplayFormatPropertiesWSI *dst = pData;
871 size_t size_ret;
872 uint32_t i;
873
874 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
875
876 if (dst && *pDataSize < size_ret)
877 return VK_ERROR_INVALID_VALUE;
878
879 *pDataSize = size_ret;
880 if (!dst)
881 return VK_SUCCESS;
882
883 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
884 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
885 }
886 break;
887 default:
888 ret = VK_ERROR_INVALID_VALUE;
889 break;
890 }
891
892 return ret;
893}
894
895ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
896 VkDevice device,
897 const VkSwapChainCreateInfoWSI* pCreateInfo,
898 VkSwapChainWSI* pSwapChain)
899{
900 NULLDRV_LOG_FUNC;
901 struct nulldrv_dev *dev = nulldrv_dev(device);
902 struct nulldrv_swap_chain *sc;
903
904 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600905 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600906 if (!sc) {
907 return VK_ERROR_OUT_OF_HOST_MEMORY;
908 }
909 sc->dev = dev;
910
Tony Barbour11e76ac2015-04-20 16:28:46 -0600911 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600912
913 return VK_SUCCESS;
914}
915
916ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
917 VkSwapChainWSI swapChain)
918{
919 NULLDRV_LOG_FUNC;
920 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
921
922 free(sc);
923
924 return VK_SUCCESS;
925}
926
927ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
928 VkSwapChainWSI swapChain,
929 VkSwapChainInfoTypeWSI infoType,
930 size_t* pDataSize,
931 void* pData)
932{
933 NULLDRV_LOG_FUNC;
934 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
935 struct nulldrv_dev *dev = sc->dev;
936 VkResult ret = VK_SUCCESS;
937
938 if (!pDataSize)
939 return VK_ERROR_INVALID_POINTER;
940
941 switch (infoType) {
942 case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
943 {
944 VkSwapChainImageInfoWSI *images;
945 const size_t size = sizeof(*images) * 2;
946 uint32_t i;
947
948 if (pData && *pDataSize < size)
949 return VK_ERROR_INVALID_VALUE;
950
951 *pDataSize = size;
952 if (!pData)
953 return VK_SUCCESS;
954
955 images = (VkSwapChainImageInfoWSI *) pData;
956 for (i = 0; i < 2; i++) {
957 struct nulldrv_img *img;
958 struct nulldrv_mem *mem;
959
960 img = (struct nulldrv_img *) nulldrv_base_create(dev,
961 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600962 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600963 if (!img)
964 return VK_ERROR_OUT_OF_HOST_MEMORY;
965
966 mem = (struct nulldrv_mem *) nulldrv_base_create(dev,
967 sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600968 VK_OBJECT_TYPE_DEVICE_MEMORY);
Ian Elliott64a68e12015-04-16 11:57:46 -0600969 if (!mem)
970 return VK_ERROR_OUT_OF_HOST_MEMORY;
971
972 images[i].image = (VkImage) img;
973 images[i].memory = (VkDeviceMemory) mem;
974 }
975 }
976 break;
977 default:
978 ret = VK_ERROR_INVALID_VALUE;
979 break;
980 }
981
982 return ret;
983}
984
985ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
986 VkQueue queue_,
987 const VkPresentInfoWSI* pPresentInfo)
988{
989 NULLDRV_LOG_FUNC;
990
991 return VK_SUCCESS;
992}
993
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600994ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600995 VkCmdBuffer cmdBuffer,
996 VkBuffer srcBuffer,
997 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700998 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600999 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001000{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001001 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001002}
1003
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001004ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001005 VkCmdBuffer cmdBuffer,
1006 VkImage srcImage,
1007 VkImageLayout srcImageLayout,
1008 VkImage destImage,
1009 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001010 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001011 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001012{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001013 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001014}
1015
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001016ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001017 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001018 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001019 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001020 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001021 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001022 uint32_t regionCount,
1023 const VkImageBlit* pRegions,
1024 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -06001025{
1026 NULLDRV_LOG_FUNC;
1027}
1028
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001029ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001030 VkCmdBuffer cmdBuffer,
1031 VkBuffer srcBuffer,
1032 VkImage destImage,
1033 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001034 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001035 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001036{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001037 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001038}
1039
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001040ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001041 VkCmdBuffer cmdBuffer,
1042 VkImage srcImage,
1043 VkImageLayout srcImageLayout,
1044 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001045 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001046 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001047{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001048 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001049}
1050
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001051ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001052 VkCmdBuffer cmdBuffer,
1053 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001054 VkDeviceSize destOffset,
1055 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001056 const uint32_t* pData)
1057{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001058 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001059}
1060
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001061ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001062 VkCmdBuffer cmdBuffer,
1063 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001064 VkDeviceSize destOffset,
1065 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001066 uint32_t data)
1067{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001068 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001069}
1070
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001071ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001072 VkCmdBuffer cmdBuffer,
1073 VkImage image,
1074 VkImageLayout imageLayout,
1075 const VkClearColor *pColor,
1076 uint32_t rangeCount,
1077 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001078{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001079 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001080}
1081
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001082ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001083 VkCmdBuffer cmdBuffer,
1084 VkImage image,
1085 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001086 float depth,
1087 uint32_t stencil,
1088 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001089 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001090{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001091 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001092}
1093
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001094ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001095 VkCmdBuffer cmdBuffer,
1096 VkImage srcImage,
1097 VkImageLayout srcImageLayout,
1098 VkImage destImage,
1099 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001100 uint32_t regionCount,
1101 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001102{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001103 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001104}
1105
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001106ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001107 VkCmdBuffer cmdBuffer,
1108 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001109 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001110 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001111{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001112 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001113}
1114
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001115ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001116 VkCmdBuffer cmdBuffer,
1117 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001118 uint32_t slot)
1119{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001120 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001121}
1122
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001123ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001124 VkCmdBuffer cmdBuffer,
1125 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001126 uint32_t startQuery,
1127 uint32_t queryCount)
1128{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001129 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001130}
1131
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001132ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001133 VkCmdBuffer cmdBuffer,
1134 VkEvent event_,
1135 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001136{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001137 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001138}
1139
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001140ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001141 VkCmdBuffer cmdBuffer,
1142 VkEvent event_,
1143 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001144{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001145 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001146}
1147
Ian Elliott63f1edb2015-04-16 18:10:19 -06001148ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1149 VkCmdBuffer cmdBuffer,
1150 VkQueryPool queryPool,
1151 uint32_t startQuery,
1152 uint32_t queryCount,
1153 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001154 VkDeviceSize destOffset,
1155 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001156 VkFlags flags)
1157{
1158 NULLDRV_LOG_FUNC;
1159}
1160
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001161ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001162 VkCmdBuffer cmdBuffer,
1163 VkTimestampType timestampType,
1164 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001165 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001166{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001167 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001168}
1169
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001170ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001171 VkCmdBuffer cmdBuffer,
1172 VkPipelineBindPoint pipelineBindPoint,
1173 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001174{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001175 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001176}
1177
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001178ICD_EXPORT void VKAPI vkCmdBindDynamicStateObject(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001179 VkCmdBuffer cmdBuffer,
1180 VkStateBindPoint stateBindPoint,
1181 VkDynamicStateObject state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001182{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001183 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001184}
1185
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001186ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001187 VkCmdBuffer cmdBuffer,
1188 VkPipelineBindPoint pipelineBindPoint,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001189 uint32_t firstSet,
1190 uint32_t setCount,
1191 const VkDescriptorSet* pDescriptorSets,
1192 uint32_t dynamicOffsetCount,
1193 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001194{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001195 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001196}
1197
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001198ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1199 VkCmdBuffer cmdBuffer,
1200 uint32_t startBinding,
1201 uint32_t bindingCount,
1202 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001203 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001204{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001205 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001206}
1207
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001208ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001209 VkCmdBuffer cmdBuffer,
1210 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001211 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001212 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001213{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001214 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001215}
1216
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001217ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001218 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001219 uint32_t firstVertex,
1220 uint32_t vertexCount,
1221 uint32_t firstInstance,
1222 uint32_t instanceCount)
1223{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001224 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001225}
1226
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001227ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001228 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001229 uint32_t firstIndex,
1230 uint32_t indexCount,
1231 int32_t vertexOffset,
1232 uint32_t firstInstance,
1233 uint32_t instanceCount)
1234{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001235 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001236}
1237
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001238ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001239 VkCmdBuffer cmdBuffer,
1240 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001241 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001242 uint32_t count,
1243 uint32_t stride)
1244{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001245 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001246}
1247
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001248ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001249 VkCmdBuffer cmdBuffer,
1250 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001251 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001252 uint32_t count,
1253 uint32_t stride)
1254{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001255 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001256}
1257
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001258ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001259 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001260 uint32_t x,
1261 uint32_t y,
1262 uint32_t z)
1263{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001264 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001265}
1266
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001267ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001268 VkCmdBuffer cmdBuffer,
1269 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001270 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001271{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001272 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001273}
1274
Tony Barbour8205d902015-04-16 15:59:00 -06001275void VKAPI vkCmdWaitEvents(
1276 VkCmdBuffer cmdBuffer,
1277 VkWaitEvent waitEvent,
1278 uint32_t eventCount,
1279 const VkEvent* pEvents,
1280 uint32_t memBarrierCount,
1281 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001282{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001283 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001284}
1285
Tony Barbour8205d902015-04-16 15:59:00 -06001286void VKAPI vkCmdPipelineBarrier(
1287 VkCmdBuffer cmdBuffer,
1288 VkWaitEvent waitEvent,
1289 uint32_t pipeEventCount,
1290 const VkPipeEvent* pPipeEvents,
1291 uint32_t memBarrierCount,
1292 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001293{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001294 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001295}
1296
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001297ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001298 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001299 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001300 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001301{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001302 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001303 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1304 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1305}
1306
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001307ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1308 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001309{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001310 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001311 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001312}
1313
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001314ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1315 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001316 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001317 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001318 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001319{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001320 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001321 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001322 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001323 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001324}
1325
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001326ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1327 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001328{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001329 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001330 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001331}
1332
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001333ICD_EXPORT VkResult VKAPI vkCreateEvent(
1334 VkDevice device,
1335 const VkEventCreateInfo* pCreateInfo,
1336 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001337{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001338 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001339 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001340}
1341
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001342ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001343 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001344 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001345{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001346 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001347 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001348}
1349
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001350ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001351 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001352 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001353{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001354 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001355 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001356}
1357
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001358ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001359 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001360 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001361{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001362 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001363 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001364}
1365
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001366ICD_EXPORT VkResult VKAPI vkCreateFence(
1367 VkDevice device,
1368 const VkFenceCreateInfo* pCreateInfo,
1369 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001370{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001371 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001372 struct nulldrv_dev *dev = nulldrv_dev(device);
1373
1374 return nulldrv_fence_create(dev, pCreateInfo,
1375 (struct nulldrv_fence **) pFence);
1376}
1377
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001378ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001379 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001380 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001381{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001382 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001383 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001384}
1385
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001386ICD_EXPORT VkResult VKAPI vkResetFences(
1387 VkDevice device,
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001388 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001389 VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001390{
1391 NULLDRV_LOG_FUNC;
1392 return VK_SUCCESS;
1393}
1394
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001395ICD_EXPORT VkResult VKAPI vkWaitForFences(
1396 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001397 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001398 const VkFence* pFences,
David Pinedo0257fbf2015-02-02 18:02:40 -07001399 bool32_t waitAll,
1400 uint64_t timeout)
1401{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001402 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001403 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001404}
1405
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001406ICD_EXPORT VkResult VKAPI vkGetFormatInfo(
1407 VkDevice device,
1408 VkFormat format,
1409 VkFormatInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001410 size_t* pDataSize,
1411 void* pData)
1412{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001413 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001414 VkFormatProperties *fmt = (VkFormatProperties *) pData;
1415 VkResult ret = VK_SUCCESS;
1416
1417 switch (infoType) {
1418 case VK_FORMAT_INFO_TYPE_PROPERTIES:
1419 *pDataSize = sizeof(VkFormatProperties);
1420 if (pData == NULL)
1421 return ret;
1422 fmt->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1423 fmt->optimalTilingFeatures = fmt->linearTilingFeatures;
1424 break;
1425 default:
1426 ret = VK_ERROR_INVALID_VALUE;
1427 break;
1428 }
1429
1430 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001431}
1432
Tony Barbour8205d902015-04-16 15:59:00 -06001433ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceInfo(
1434 VkPhysicalDevice gpu_,
1435 VkPhysicalDeviceInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001436 size_t* pDataSize,
1437 void* pData)
1438{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001439 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001440 VkResult ret = VK_SUCCESS;
1441
Ian Elliott32536f92015-04-21 16:41:02 -06001442 if (infoType == VK_PHYSICAL_DEVICE_INFO_TYPE_DISPLAY_PROPERTIES_WSI) {
1443 // NOTE: Handle this extension value as a special case:
1444 struct nulldrv_display *display;
1445 VkDisplayPropertiesWSI *props =
1446 (VkDisplayPropertiesWSI *) pData;
1447 *pDataSize = sizeof(VkDisplayPropertiesWSI);
1448 if (pData == NULL) {
1449 return ret;
1450 }
1451 display = (struct nulldrv_display *) nulldrv_base_create(NULL, sizeof(*display),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001452 /*VK_OBJECT_TYPE_SWAP_CHAIN_WSI*//* FIXME: DELETE THIS HACK: */ VK_OBJECT_TYPE_QUEUE);
Ian Elliott32536f92015-04-21 16:41:02 -06001453 props->display = (VkDisplayWSI) display;
1454 props->physicalResolution.width = 1920;
1455 props->physicalResolution.height = 1080;
1456
1457 return ret;
1458 }
1459
Ian Elliott64a68e12015-04-16 11:57:46 -06001460 switch (infoType) {
1461 case VK_PHYSICAL_DEVICE_INFO_TYPE_PROPERTIES:
1462 {
1463 VkPhysicalDeviceProperties *props =
1464 (VkPhysicalDeviceProperties *) pData;
1465 *pDataSize = sizeof(VkPhysicalDeviceProperties);
1466 if (pData == NULL) {
1467 return ret;
1468 }
1469 props->apiVersion = VK_API_VERSION;
1470 props->driverVersion = 0; // Appropriate that the nulldrv have 0's
1471 props->vendorId = 0;
1472 props->deviceId = 0;
1473 props->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1474 strncpy(props->deviceName, "nulldrv", strlen("nulldrv"));
1475 props->maxInlineMemoryUpdateSize = 0;
1476 props->maxBoundDescriptorSets = 0;
1477 props->maxThreadGroupSize = 0;
1478 props->timestampFrequency = 0;
1479 props->multiColorAttachmentClears = false;
1480 break;
1481 }
1482 case VK_PHYSICAL_DEVICE_INFO_TYPE_PERFORMANCE:
1483 {
1484 VkPhysicalDevicePerformance *perf =
1485 (VkPhysicalDevicePerformance *) pData;
1486 *pDataSize = sizeof(VkPhysicalDevicePerformance);
1487 if (pData == NULL) {
1488 return ret;
1489 }
1490 perf->maxDeviceClock = 1.0f;
1491 perf->aluPerClock = 1.0f;
1492 perf->texPerClock = 1.0f;
1493 perf->primsPerClock = 1.0f;
1494 perf->pixelsPerClock = 1.0f;
1495 break;
1496 }
1497 case VK_PHYSICAL_DEVICE_INFO_TYPE_QUEUE_PROPERTIES:
1498 {
1499 VkPhysicalDeviceQueueProperties *props =
1500 (VkPhysicalDeviceQueueProperties *) pData;
1501 *pDataSize = sizeof(VkPhysicalDeviceQueueProperties);
1502 if (pData == NULL) {
1503 return ret;
1504 }
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001505 props->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
Ian Elliott64a68e12015-04-16 11:57:46 -06001506 props->queueCount = 1;
1507 props->maxAtomicCounters = 1;
1508 props->supportsTimestamps = false;
Ian Elliott64a68e12015-04-16 11:57:46 -06001509 break;
1510 }
1511 default:
1512/* FIXME: WRITE THE REAL CODE*/return ret;
1513 break;
1514 }
1515
1516 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001517}
1518
Jon Ashburneb2728b2015-04-10 14:33:07 -06001519ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionInfo(
1520 VkExtensionInfoType infoType,
1521 uint32_t extensionIndex,
1522 size_t* pDataSize,
1523 void* pData)
1524{
Ian Elliott64a68e12015-04-16 11:57:46 -06001525 VkExtensionProperties *ext_props;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001526 uint32_t *count;
1527
1528 if (pDataSize == NULL)
1529 return VK_ERROR_INVALID_POINTER;
1530
1531 switch (infoType) {
1532 case VK_EXTENSION_INFO_TYPE_COUNT:
1533 *pDataSize = sizeof(uint32_t);
1534 if (pData == NULL)
1535 return VK_SUCCESS;
1536 count = (uint32_t *) pData;
Ian Elliott64a68e12015-04-16 11:57:46 -06001537 *count = 1;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001538 break;
1539 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
Ian Elliott64a68e12015-04-16 11:57:46 -06001540 *pDataSize = sizeof(VkExtensionProperties);
Jon Ashburneb2728b2015-04-10 14:33:07 -06001541 if (pData == NULL)
1542 return VK_SUCCESS;
Ian Elliott64a68e12015-04-16 11:57:46 -06001543 else {
1544 ext_props = (VkExtensionProperties *) pData;
1545 ext_props->version = VK_WSI_LUNARG_REVISION;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001546 strncpy(ext_props->name, VK_WSI_LUNARG_EXTENSION_NAME,
Jon Ashburncedc15f2015-05-21 18:13:33 -06001547 strlen(VK_WSI_LUNARG_EXTENSION_NAME)+1);
Ian Elliott64a68e12015-04-16 11:57:46 -06001548 return VK_SUCCESS;
1549 }
Jon Ashburneb2728b2015-04-10 14:33:07 -06001550 break;
1551 default:
1552 return VK_ERROR_INVALID_VALUE;
1553 };
1554
1555 return VK_SUCCESS;
1556}
1557
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001558VkResult VKAPI vkGetPhysicalDeviceExtensionInfo(
Tony Barbour8205d902015-04-16 15:59:00 -06001559 VkPhysicalDevice gpu,
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001560 VkExtensionInfoType infoType,
1561 uint32_t extensionIndex,
1562 size_t* pDataSize,
1563 void* pData)
David Pinedo0257fbf2015-02-02 18:02:40 -07001564{
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001565 uint32_t *count;
1566
1567 if (pDataSize == NULL)
1568 return VK_ERROR_INVALID_POINTER;
1569
1570 switch (infoType) {
1571 case VK_EXTENSION_INFO_TYPE_COUNT:
1572 *pDataSize = sizeof(uint32_t);
1573 if (pData == NULL)
1574 return VK_SUCCESS;
1575 count = (uint32_t *) pData;
1576 *count = 0;
1577 break;
1578 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
1579 *pDataSize = 0;
1580 if (pData == NULL)
1581 return VK_SUCCESS;
1582 return VK_ERROR_INVALID_EXTENSION;
1583 break;
1584 default:
1585 return VK_ERROR_INVALID_VALUE;
1586 };
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001587 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001588}
1589
Tony Barbour8205d902015-04-16 15:59:00 -06001590ICD_EXPORT VkResult VKAPI vkGetMultiDeviceCompatibility(
1591 VkPhysicalDevice gpu0_,
1592 VkPhysicalDevice gpu1_,
1593 VkPhysicalDeviceCompatibilityInfo* pInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001594{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001595 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001596 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001597}
1598
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001599ICD_EXPORT VkResult VKAPI vkOpenPeerImage(
1600 VkDevice device,
1601 const VkPeerImageOpenInfo* pOpenInfo,
1602 VkImage* pImage,
Tony Barbour8205d902015-04-16 15:59:00 -06001603 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001604{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001605 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001606 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001607}
1608
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001609ICD_EXPORT VkResult VKAPI vkCreateImage(
1610 VkDevice device,
1611 const VkImageCreateInfo* pCreateInfo,
1612 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001613{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001614 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001615 struct nulldrv_dev *dev = nulldrv_dev(device);
1616
1617 return nulldrv_img_create(dev, pCreateInfo, false,
1618 (struct nulldrv_img **) pImage);
1619}
1620
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001621ICD_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(
Mike Stroyan230e6252015-04-17 12:36:38 -06001622 VkDevice device,
1623 VkImage image,
1624 const VkImageSubresource* pSubresource,
1625 VkSubresourceInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001626 size_t* pDataSize,
1627 void* pData)
1628{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001629 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001630 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001631
1632 switch (infoType) {
Tony Barbour8205d902015-04-16 15:59:00 -06001633 case VK_SUBRESOURCE_INFO_TYPE_LAYOUT:
David Pinedo0257fbf2015-02-02 18:02:40 -07001634 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001635 VkSubresourceLayout *layout = (VkSubresourceLayout *) pData;
David Pinedo0257fbf2015-02-02 18:02:40 -07001636
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001637 *pDataSize = sizeof(VkSubresourceLayout);
David Pinedo0257fbf2015-02-02 18:02:40 -07001638
1639 if (pData == NULL)
1640 return ret;
1641 layout->offset = 0;
1642 layout->size = 1;
1643 layout->rowPitch = 4;
1644 layout->depthPitch = 4;
1645 }
1646 break;
1647 default:
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001648 ret = VK_ERROR_INVALID_VALUE;
David Pinedo0257fbf2015-02-02 18:02:40 -07001649 break;
1650 }
1651
1652 return ret;
1653}
1654
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001655ICD_EXPORT VkResult VKAPI vkAllocMemory(
1656 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001657 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001658 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001659{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001660 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001661 struct nulldrv_dev *dev = nulldrv_dev(device);
1662
1663 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1664}
1665
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001666ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001667 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001668 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001669{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001670 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001671 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001672}
1673
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001674ICD_EXPORT VkResult VKAPI vkSetMemoryPriority(
Mike Stroyan230e6252015-04-17 12:36:38 -06001675 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001676 VkDeviceMemory mem_,
Mike Stroyan230e6252015-04-17 12:36:38 -06001677 VkMemoryPriority priority)
David Pinedo0257fbf2015-02-02 18:02:40 -07001678{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001679 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001680 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001681}
1682
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001683ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001684 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001685 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001686 VkDeviceSize offset,
1687 VkDeviceSize size,
1688 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001689 void** ppData)
1690{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001691 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001692 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1693 void *ptr = nulldrv_mem_map(mem, flags);
1694
1695 *ppData = ptr;
1696
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001697 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001698}
1699
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001700ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001701 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001702 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001703{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001704 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001705 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001706}
1707
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001708ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001709 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001710 uint32_t memRangeCount,
1711 const VkMappedMemoryRange* pMemRanges)
1712{
1713 NULLDRV_LOG_FUNC;
1714 return VK_SUCCESS;
1715}
1716
1717ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1718 VkDevice device,
1719 uint32_t memRangeCount,
1720 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001721{
1722 NULLDRV_LOG_FUNC;
1723 return VK_SUCCESS;
1724}
1725
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001726ICD_EXPORT VkResult VKAPI vkPinSystemMemory(
1727 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001728 const void* pSysMem,
1729 size_t memSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001730 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001731{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001732 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001733 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001734}
1735
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001736ICD_EXPORT VkResult VKAPI vkOpenSharedMemory(
1737 VkDevice device,
1738 const VkMemoryOpenInfo* pOpenInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001739 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001740{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001741 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001742 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001743}
1744
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001745ICD_EXPORT VkResult VKAPI vkOpenPeerMemory(
1746 VkDevice device,
1747 const VkPeerMemoryOpenInfo* pOpenInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001748 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001749{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001750 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001751 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001752}
1753
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001754ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001755 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001756 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001757{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001758 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001759 struct nulldrv_instance *inst;
1760
1761 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001762 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001763 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001764 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001765
1766 inst->obj.base.get_info = NULL;
1767
Mike Stroyan230e6252015-04-17 12:36:38 -06001768 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001769
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001770 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001771}
1772
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001773ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1774 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001775{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001776 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001777 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001778}
1779
Tony Barbour8205d902015-04-16 15:59:00 -06001780ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001781 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001782 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001783 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001784{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001785 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001786 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001787 struct nulldrv_gpu *gpu;
1788 *pGpuCount = 1;
1789 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001790 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001791 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001792 return ret;
1793}
1794
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001795ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001796 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001797 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001798 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001799 char* const* pOutLayers,
1800 void* pReserved)
1801{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001802 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001803 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001804}
1805
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001806ICD_EXPORT VkResult VKAPI vkDestroyObject(
Mike Stroyan230e6252015-04-17 12:36:38 -06001807 VkDevice device,
1808 VkObjectType objType,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001809 VkObject object)
David Pinedo0257fbf2015-02-02 18:02:40 -07001810{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001811 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001812 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001813}
1814
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001815ICD_EXPORT VkResult VKAPI vkGetObjectInfo(
Mike Stroyan230e6252015-04-17 12:36:38 -06001816 VkDevice device,
1817 VkObjectType objType,
1818 VkObject object,
1819 VkObjectInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001820 size_t* pDataSize,
1821 void* pData)
1822{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001823 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001824 struct nulldrv_base *base = nulldrv_base(object);
1825
1826 return base->get_info(base, infoType, pDataSize, pData);
1827}
1828
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001829ICD_EXPORT VkResult VKAPI vkBindObjectMemory(
1830 VkDevice device,
Mike Stroyan230e6252015-04-17 12:36:38 -06001831 VkObjectType objType,
1832 VkObject object,
Tony Barbour8205d902015-04-16 15:59:00 -06001833 VkDeviceMemory mem_,
1834 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001835{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001836 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001837 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001838}
1839
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001840ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001841 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001842 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001843 VkDeviceSize rangeOffset,
1844 VkDeviceSize rangeSize,
1845 VkDeviceMemory mem,
1846 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001847{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001848 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001849 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001850}
1851
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001852ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001853 VkQueue queue,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001854 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001855 const VkImageMemoryBindInfo* pBindInfo,
1856 VkDeviceMemory mem,
1857 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001858{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001859 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001860 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001861}
1862
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001863ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(
1864 VkDevice device,
1865 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1866 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001867{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001868 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001869 struct nulldrv_dev *dev = nulldrv_dev(device);
1870
1871 return graphics_pipeline_create(dev, pCreateInfo,
1872 (struct nulldrv_pipeline **) pPipeline);
1873}
1874
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001875ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(
1876 VkDevice device,
1877 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1878 VkPipeline basePipeline,
1879 VkPipeline* pPipeline)
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001880{
1881 NULLDRV_LOG_FUNC;
1882 struct nulldrv_dev *dev = nulldrv_dev(device);
1883
1884 return graphics_pipeline_create(dev, pCreateInfo,
1885 (struct nulldrv_pipeline **) pPipeline);
1886}
1887
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001888ICD_EXPORT VkResult VKAPI vkCreateComputePipeline(
1889 VkDevice device,
1890 const VkComputePipelineCreateInfo* pCreateInfo,
1891 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001892{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001893 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001894 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001895}
1896
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001897ICD_EXPORT VkResult VKAPI vkStorePipeline(
Mike Stroyan230e6252015-04-17 12:36:38 -06001898 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001899 VkPipeline pipeline,
David Pinedo0257fbf2015-02-02 18:02:40 -07001900 size_t* pDataSize,
1901 void* pData)
1902{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001903 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001904 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001905}
1906
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001907ICD_EXPORT VkResult VKAPI vkLoadPipeline(
1908 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001909 size_t dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001910 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001911 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001912{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001913 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001914 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001915}
1916
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001917ICD_EXPORT VkResult VKAPI vkLoadPipelineDerivative(
1918 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001919 size_t dataSize,
1920 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001921 VkPipeline basePipeline,
1922 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001923{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001924 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001925 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001926}
1927
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001928ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1929 VkDevice device,
1930 const VkQueryPoolCreateInfo* pCreateInfo,
1931 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001932{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001933 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001934 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001935}
1936
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001937ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001938 VkDevice device,
1939 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001940 uint32_t startQuery,
1941 uint32_t queryCount,
1942 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001943 void* pData,
1944 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001945{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001946 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001947 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001948}
1949
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001950ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1951 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001952{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001953 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001954 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001955}
1956
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001957ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1958 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001959 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001960 const VkCmdBuffer* pCmdBuffers,
1961 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001962{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001963 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001964 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001965}
1966
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001967ICD_EXPORT VkResult VKAPI vkOpenSharedSemaphore(
1968 VkDevice device,
1969 const VkSemaphoreOpenInfo* pOpenInfo,
1970 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001971{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001972 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001973 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001974}
1975
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001976ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1977 VkDevice device,
1978 const VkSemaphoreCreateInfo* pCreateInfo,
1979 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001980{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001981 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001982 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001983}
1984
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001985ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1986 VkQueue queue,
1987 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001988{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001989 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001990 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001991}
1992
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001993ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1994 VkQueue queue,
1995 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001996{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001997 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001998 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001999}
2000
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002001ICD_EXPORT VkResult VKAPI vkCreateSampler(
2002 VkDevice device,
2003 const VkSamplerCreateInfo* pCreateInfo,
2004 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07002005{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002006 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002007 struct nulldrv_dev *dev = nulldrv_dev(device);
2008
2009 return nulldrv_sampler_create(dev, pCreateInfo,
2010 (struct nulldrv_sampler **) pSampler);
2011}
2012
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002013ICD_EXPORT VkResult VKAPI vkCreateShader(
2014 VkDevice device,
2015 const VkShaderCreateInfo* pCreateInfo,
2016 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002017{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002018 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002019 struct nulldrv_dev *dev = nulldrv_dev(device);
2020
2021 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2022}
2023
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002024ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2025 VkDevice device,
2026 const VkDynamicVpStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002027 VkDynamicVpState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002028{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002029 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002030 struct nulldrv_dev *dev = nulldrv_dev(device);
2031
2032 return nulldrv_viewport_state_create(dev, pCreateInfo,
2033 (struct nulldrv_dynamic_vp **) pState);
2034}
2035
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002036ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
2037 VkDevice device,
2038 const VkDynamicRsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002039 VkDynamicRsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002040{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002041 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002042 struct nulldrv_dev *dev = nulldrv_dev(device);
2043
2044 return nulldrv_raster_state_create(dev, pCreateInfo,
2045 (struct nulldrv_dynamic_rs **) pState);
2046}
2047
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002048ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
2049 VkDevice device,
2050 const VkDynamicCbStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002051 VkDynamicCbState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002052{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002053 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002054 struct nulldrv_dev *dev = nulldrv_dev(device);
2055
2056 return nulldrv_blend_state_create(dev, pCreateInfo,
2057 (struct nulldrv_dynamic_cb **) pState);
2058}
2059
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002060ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
2061 VkDevice device,
2062 const VkDynamicDsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002063 VkDynamicDsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002064{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002065 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002066 struct nulldrv_dev *dev = nulldrv_dev(device);
2067
2068 return nulldrv_ds_state_create(dev, pCreateInfo,
2069 (struct nulldrv_dynamic_ds **) pState);
2070}
2071
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002072ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2073 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002074 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002075 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002076{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002077 NULLDRV_LOG_FUNC;
2078 struct nulldrv_dev *dev = nulldrv_dev(device);
2079
2080 return nulldrv_buf_view_create(dev, pCreateInfo,
2081 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002082}
2083
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002084ICD_EXPORT VkResult VKAPI vkCreateImageView(
2085 VkDevice device,
2086 const VkImageViewCreateInfo* pCreateInfo,
2087 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002088{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002089 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002090 struct nulldrv_dev *dev = nulldrv_dev(device);
2091
2092 return nulldrv_img_view_create(dev, pCreateInfo,
2093 (struct nulldrv_img_view **) pView);
2094}
2095
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002096ICD_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
2097 VkDevice device,
2098 const VkColorAttachmentViewCreateInfo* pCreateInfo,
2099 VkColorAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002100{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002101 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002102 struct nulldrv_dev *dev = nulldrv_dev(device);
2103
2104 return nulldrv_rt_view_create(dev, pCreateInfo,
2105 (struct nulldrv_rt_view **) pView);
2106}
2107
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002108ICD_EXPORT VkResult VKAPI vkCreateDepthStencilView(
2109 VkDevice device,
2110 const VkDepthStencilViewCreateInfo* pCreateInfo,
2111 VkDepthStencilView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002112{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002113 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002114 struct nulldrv_dev *dev = nulldrv_dev(device);
2115
2116 return nulldrv_ds_view_create(dev, pCreateInfo,
2117 (struct nulldrv_ds_view **) pView);
2118
2119}
2120
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002121ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2122 VkDevice device,
2123 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2124 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002125{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002126 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002127 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002128
Chia-I Wu7732cb22015-03-26 15:27:55 +08002129 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002130 (struct nulldrv_desc_layout **) pSetLayout);
2131}
2132
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002133ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2134 VkDevice device,
2135 const VkPipelineLayoutCreateInfo* pCreateInfo,
2136 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002137{
2138 NULLDRV_LOG_FUNC;
2139 struct nulldrv_dev *dev = nulldrv_dev(device);
2140
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002141 return nulldrv_pipeline_layout_create(dev,
2142 pCreateInfo,
2143 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002144}
2145
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002146ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2147 VkDevice device,
2148 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002149 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002150 const VkDescriptorPoolCreateInfo* pCreateInfo,
2151 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002152{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002153 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002154 struct nulldrv_dev *dev = nulldrv_dev(device);
2155
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002156 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2157 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002158}
2159
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002160ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002161 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002162 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002163{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002164 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002165 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002166}
2167
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002168ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002169 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002170 VkDescriptorPool descriptorPool,
2171 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002172 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002173 const VkDescriptorSetLayout* pSetLayouts,
2174 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07002175 uint32_t* pCount)
2176{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002177 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002178 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2179 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002180 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002181 uint32_t i;
2182
2183 for (i = 0; i < count; i++) {
2184 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002185 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002186
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002187 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002188 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002189 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002190 break;
2191 }
2192
2193 if (pCount)
2194 *pCount = i;
2195
2196 return ret;
2197}
2198
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002199ICD_EXPORT void VKAPI vkClearDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002200 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002201 VkDescriptorPool descriptorPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07002202 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002203 const VkDescriptorSet* pDescriptorSets)
David Pinedo0257fbf2015-02-02 18:02:40 -07002204{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002205 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002206}
2207
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002208ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2209 VkDevice device,
2210 uint32_t writeCount,
2211 const VkWriteDescriptorSet* pDescriptorWrites,
2212 uint32_t copyCount,
2213 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002214{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002215 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002216 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002217}
2218
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002219ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2220 VkDevice device,
2221 const VkFramebufferCreateInfo* info,
2222 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002223{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002224 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002225 struct nulldrv_dev *dev = nulldrv_dev(device);
2226
2227 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2228}
2229
2230
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002231ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2232 VkDevice device,
2233 const VkRenderPassCreateInfo* info,
2234 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002235{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002236 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002237 struct nulldrv_dev *dev = nulldrv_dev(device);
2238
2239 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2240}
2241
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002242ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002243 VkCmdBuffer cmdBuffer,
2244 const VkRenderPassBegin* pRenderPassBegin)
David Pinedo0257fbf2015-02-02 18:02:40 -07002245{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002246 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002247}
2248
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002249ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002250 VkCmdBuffer cmdBuffer,
2251 VkRenderPass renderPass)
David Pinedo0257fbf2015-02-02 18:02:40 -07002252{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002253 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002254}
Ian Elliottf93069f2015-02-19 14:26:19 -07002255
2256ICD_EXPORT void* xcbCreateWindow(
2257 uint16_t width,
2258 uint16_t height)
2259{
2260 static uint32_t window; // Kludge to the max
2261 NULLDRV_LOG_FUNC;
2262 return &window;
2263}
2264
2265// May not be needed, if we stub out stuf in tri.c
2266ICD_EXPORT void xcbDestroyWindow()
2267{
2268 NULLDRV_LOG_FUNC;
2269}
2270
2271ICD_EXPORT int xcbGetMessage(void *msg)
2272{
2273 NULLDRV_LOG_FUNC;
2274 return 0;
2275}
2276
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002277ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002278{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002279 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002280}