blob: 32b8f5f6db737d27509f6172896c36d228c0f01c [file] [log] [blame]
David Pinedo0257fbf2015-02-02 18:02:40 -07001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan null driver
David Pinedo0257fbf2015-02-02 18:02:40 -07003 *
4 * Copyright (C) 2015 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 */
25
26#include "nulldrv.h"
David Pinedo8e9cb3b2015-02-10 15:02:08 -070027#include <stdio.h>
David Pinedo0257fbf2015-02-02 18:02:40 -070028
David Pinedo8e9cb3b2015-02-10 15:02:08 -070029#if 0
30#define NULLDRV_LOG_FUNC \
31 do { \
32 fflush(stdout); \
33 fflush(stderr); \
34 printf("null driver: %s\n", __FUNCTION__); \
35 fflush(stdout); \
36 } while (0)
37#else
38 #define NULLDRV_LOG_FUNC do { } while (0)
39#endif
40
41// The null driver supports all WSI extenstions ... for now ...
David Pinedo0257fbf2015-02-02 18:02:40 -070042static const char * const nulldrv_gpu_exts[NULLDRV_EXT_COUNT] = {
Jon Ashburncedc15f2015-05-21 18:13:33 -060043 [NULLDRV_EXT_WSI_LUNARG] = VK_WSI_LUNARG_EXTENSION_NAME,
David Pinedo0257fbf2015-02-02 18:02:40 -070044};
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060045static const VkExtensionProperties intel_gpu_exts[NULLDRV_EXT_COUNT] = {
46 {
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -060047 .extName = VK_WSI_LUNARG_EXTENSION_NAME,
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060048 .version = VK_WSI_LUNARG_REVISION,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -060049 .specVersion = VK_API_VERSION,
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060050 }
51};
David Pinedo0257fbf2015-02-02 18:02:40 -070052
Mike Stroyan230e6252015-04-17 12:36:38 -060053static struct nulldrv_base *nulldrv_base(VkObject base)
David Pinedo0257fbf2015-02-02 18:02:40 -070054{
55 return (struct nulldrv_base *) base;
56}
57
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060058static struct nulldrv_base *nulldrv_base_create(
59 struct nulldrv_dev *dev,
60 size_t obj_size,
61 VkObjectType type)
David Pinedo0257fbf2015-02-02 18:02:40 -070062{
63 struct nulldrv_base *base;
64
65 if (!obj_size)
66 obj_size = sizeof(*base);
67
68 assert(obj_size >= sizeof(*base));
69
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060070 base = (struct nulldrv_base*)malloc(obj_size);
David Pinedo0257fbf2015-02-02 18:02:40 -070071 if (!base)
72 return NULL;
73
74 memset(base, 0, obj_size);
75
76 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbour11e76ac2015-04-20 16:28:46 -060077 set_loader_magic_value((VkObject) base);
David Pinedo0257fbf2015-02-02 18:02:40 -070078
79 if (dev == NULL) {
80 /*
81 * dev is NULL when we are creating the base device object
82 * Set dev now so that debug setup happens correctly
83 */
84 dev = (struct nulldrv_dev *) base;
85 }
86
87
Tony Barbour426b9052015-06-24 16:06:58 -060088 base->get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -070089
90 return base;
91}
92
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060093static VkResult nulldrv_gpu_add(int devid, const char *primary_node,
David Pinedo0257fbf2015-02-02 18:02:40 -070094 const char *render_node, struct nulldrv_gpu **gpu_ret)
95{
96 struct nulldrv_gpu *gpu;
97
Chia-I Wu493a1752015-02-22 14:40:25 +080098 gpu = malloc(sizeof(*gpu));
David Pinedo0257fbf2015-02-02 18:02:40 -070099 if (!gpu)
Tony Barbour8205d902015-04-16 15:59:00 -0600100 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700101 memset(gpu, 0, sizeof(*gpu));
Mark Lobodzinski97dcd042015-04-16 08:52:00 -0500102
David Pinedo0257fbf2015-02-02 18:02:40 -0700103 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbour11e76ac2015-04-20 16:28:46 -0600104 set_loader_magic_value((VkObject) gpu);
David Pinedo0257fbf2015-02-02 18:02:40 -0700105
106 *gpu_ret = gpu;
107
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600108 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700109}
110
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600111static VkResult nulldrv_queue_create(struct nulldrv_dev *dev,
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700112 uint32_t node_index,
David Pinedo0257fbf2015-02-02 18:02:40 -0700113 struct nulldrv_queue **queue_ret)
114{
115 struct nulldrv_queue *queue;
116
117 queue = (struct nulldrv_queue *) nulldrv_base_create(dev, sizeof(*queue),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600118 VK_OBJECT_TYPE_QUEUE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700119 if (!queue)
Tony Barbour8205d902015-04-16 15:59:00 -0600120 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700121
122 queue->dev = dev;
123
124 *queue_ret = queue;
125
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600126 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700127}
128
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600129static VkResult dev_create_queues(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600130 const VkDeviceQueueCreateInfo *queues,
David Pinedo0257fbf2015-02-02 18:02:40 -0700131 uint32_t count)
132{
133 uint32_t i;
134
135 if (!count)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600136 return VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700137
138 for (i = 0; i < count; i++) {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600139 const VkDeviceQueueCreateInfo *q = &queues[i];
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600140 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700141
142 if (q->queueCount == 1 && !dev->queues[q->queueNodeIndex]) {
143 ret = nulldrv_queue_create(dev, q->queueNodeIndex,
144 &dev->queues[q->queueNodeIndex]);
145 }
146 else {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600147 ret = VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700148 }
149
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600150 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700151 return ret;
152 }
153 }
154
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600155 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700156}
157
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600158static enum nulldrv_ext_type nulldrv_gpu_lookup_extension(
159 const struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600160 const char* extName)
David Pinedo0257fbf2015-02-02 18:02:40 -0700161{
162 enum nulldrv_ext_type type;
163
164 for (type = 0; type < ARRAY_SIZE(nulldrv_gpu_exts); type++) {
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600165 if (strcmp(nulldrv_gpu_exts[type], extName) == 0)
David Pinedo0257fbf2015-02-02 18:02:40 -0700166 break;
167 }
168
169 assert(type < NULLDRV_EXT_COUNT || type == NULLDRV_EXT_INVALID);
170
171 return type;
172}
173
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600174static VkResult nulldrv_desc_ooxx_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800175 struct nulldrv_desc_ooxx **ooxx_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700176{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800177 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700178
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800179 ooxx = malloc(sizeof(*ooxx));
180 if (!ooxx)
Tony Barbour8205d902015-04-16 15:59:00 -0600181 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700182
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800183 memset(ooxx, 0, sizeof(*ooxx));
David Pinedo0257fbf2015-02-02 18:02:40 -0700184
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800185 ooxx->surface_desc_size = 0;
186 ooxx->sampler_desc_size = 0;
David Pinedo0257fbf2015-02-02 18:02:40 -0700187
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800188 *ooxx_ret = ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700189
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600190 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700191}
192
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600193static VkResult nulldrv_dev_create(struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600194 const VkDeviceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700195 struct nulldrv_dev **dev_ret)
196{
197 struct nulldrv_dev *dev;
198 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600199 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -0700200
201 dev = (struct nulldrv_dev *) nulldrv_base_create(NULL, sizeof(*dev),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600202 VK_OBJECT_TYPE_DEVICE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700203 if (!dev)
Tony Barbour8205d902015-04-16 15:59:00 -0600204 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700205
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600206 for (i = 0; i < info->extensionCount; i++) {
207 const enum nulldrv_ext_type ext = nulldrv_gpu_lookup_extension(
208 gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600209 info->ppEnabledExtensionNames[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700210
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600211 if (ext == NULLDRV_EXT_INVALID)
212 return VK_ERROR_INVALID_EXTENSION;
David Pinedo0257fbf2015-02-02 18:02:40 -0700213
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600214 dev->exts[ext] = true;
215 }
David Pinedo0257fbf2015-02-02 18:02:40 -0700216
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800217 ret = nulldrv_desc_ooxx_create(dev, &dev->desc_ooxx);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600218 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700219 return ret;
220 }
221
222 ret = dev_create_queues(dev, info->pRequestedQueues,
223 info->queueRecordCount);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600224 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700225 return ret;
226 }
227
228 *dev_ret = dev;
229
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600230 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700231}
232
Tony Barbour8205d902015-04-16 15:59:00 -0600233static struct nulldrv_gpu *nulldrv_gpu(VkPhysicalDevice gpu)
David Pinedo0257fbf2015-02-02 18:02:40 -0700234{
235 return (struct nulldrv_gpu *) gpu;
236}
237
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600238static VkResult nulldrv_rt_view_create(struct nulldrv_dev *dev,
239 const VkColorAttachmentViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700240 struct nulldrv_rt_view **view_ret)
241{
242 struct nulldrv_rt_view *view;
243
244 view = (struct nulldrv_rt_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600245 VK_OBJECT_TYPE_COLOR_ATTACHMENT_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700246 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600247 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700248
249 *view_ret = view;
250
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600251 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700252}
253
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600254static VkResult nulldrv_fence_create(struct nulldrv_dev *dev,
255 const VkFenceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700256 struct nulldrv_fence **fence_ret)
257{
258 struct nulldrv_fence *fence;
259
260 fence = (struct nulldrv_fence *) nulldrv_base_create(dev, sizeof(*fence),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600261 VK_OBJECT_TYPE_FENCE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700262 if (!fence)
Tony Barbour8205d902015-04-16 15:59:00 -0600263 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700264
265 *fence_ret = fence;
266
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600267 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700268}
269
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600270static struct nulldrv_dev *nulldrv_dev(VkDevice dev)
David Pinedo0257fbf2015-02-02 18:02:40 -0700271{
272 return (struct nulldrv_dev *) dev;
273}
274
275static struct nulldrv_img *nulldrv_img_from_base(struct nulldrv_base *base)
276{
277 return (struct nulldrv_img *) base;
278}
279
280
Tony Barbour426b9052015-06-24 16:06:58 -0600281static VkResult img_get_memory_requirements(struct nulldrv_base *base,
282 VkMemoryRequirements *pRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700283{
284 struct nulldrv_img *img = nulldrv_img_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600285 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700286
Tony Barbour426b9052015-06-24 16:06:58 -0600287 pRequirements->size = img->total_size;
288 pRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700289
290 return ret;
291}
292
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600293static VkResult nulldrv_img_create(struct nulldrv_dev *dev,
294 const VkImageCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700295 bool scanout,
296 struct nulldrv_img **img_ret)
297{
298 struct nulldrv_img *img;
299
300 img = (struct nulldrv_img *) nulldrv_base_create(dev, sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600301 VK_OBJECT_TYPE_IMAGE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700302 if (!img)
Tony Barbour8205d902015-04-16 15:59:00 -0600303 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700304
305 img->type = info->imageType;
306 img->depth = info->extent.depth;
307 img->mip_levels = info->mipLevels;
308 img->array_size = info->arraySize;
309 img->usage = info->usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700310 img->samples = info->samples;
311
Tony Barbour426b9052015-06-24 16:06:58 -0600312 img->obj.base.get_memory_requirements = img_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700313
314 *img_ret = img;
315
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600316 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700317}
318
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600319static struct nulldrv_img *nulldrv_img(VkImage image)
David Pinedo0257fbf2015-02-02 18:02:40 -0700320{
321 return (struct nulldrv_img *) image;
322}
323
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600324static VkResult nulldrv_mem_alloc(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600325 const VkMemoryAllocInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700326 struct nulldrv_mem **mem_ret)
327{
328 struct nulldrv_mem *mem;
329
330 mem = (struct nulldrv_mem *) nulldrv_base_create(dev, sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600331 VK_OBJECT_TYPE_DEVICE_MEMORY);
David Pinedo0257fbf2015-02-02 18:02:40 -0700332 if (!mem)
Tony Barbour8205d902015-04-16 15:59:00 -0600333 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700334
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700335 mem->bo = malloc(info->allocationSize);
David Pinedo0257fbf2015-02-02 18:02:40 -0700336 if (!mem->bo) {
Tony Barbour8205d902015-04-16 15:59:00 -0600337 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700338 }
339
340 mem->size = info->allocationSize;
341
342 *mem_ret = mem;
343
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600344 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700345}
346
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600347static VkResult nulldrv_ds_view_create(struct nulldrv_dev *dev,
348 const VkDepthStencilViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700349 struct nulldrv_ds_view **view_ret)
350{
351 struct nulldrv_img *img = nulldrv_img(info->image);
352 struct nulldrv_ds_view *view;
353
354 view = (struct nulldrv_ds_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600355 VK_OBJECT_TYPE_DEPTH_STENCIL_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700356 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600357 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700358
359 view->img = img;
360
361 view->array_size = info->arraySize;
362
363 *view_ret = view;
364
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600365 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700366}
367
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600368static VkResult nulldrv_sampler_create(struct nulldrv_dev *dev,
369 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700370 struct nulldrv_sampler **sampler_ret)
371{
372 struct nulldrv_sampler *sampler;
373
374 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600375 sizeof(*sampler), VK_OBJECT_TYPE_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700376 if (!sampler)
Tony Barbour8205d902015-04-16 15:59:00 -0600377 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700378
379 *sampler_ret = sampler;
380
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600381 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700382}
383
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600384static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
385 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700386 struct nulldrv_img_view **view_ret)
387{
388 struct nulldrv_img *img = nulldrv_img(info->image);
389 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700390
391 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600392 VK_OBJECT_TYPE_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700393 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600394 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700395
396 view->img = img;
David Pinedo0257fbf2015-02-02 18:02:40 -0700397
David Pinedo0257fbf2015-02-02 18:02:40 -0700398 view->cmd_len = 8;
399
400 *view_ret = view;
401
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600402 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700403}
404
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600405static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700406{
407 return mem->bo;
408}
409
Tony Barbour8205d902015-04-16 15:59:00 -0600410static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700411{
412 return (struct nulldrv_mem *) mem;
413}
414
415static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
416{
417 return (struct nulldrv_buf *) base;
418}
419
Tony Barbour426b9052015-06-24 16:06:58 -0600420static VkResult buf_get_memory_requirements(struct nulldrv_base *base,
421 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700422{
423 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
David Pinedo0257fbf2015-02-02 18:02:40 -0700424
Tony Barbour426b9052015-06-24 16:06:58 -0600425 if (pMemoryRequirements == NULL)
426 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700427
Tony Barbour426b9052015-06-24 16:06:58 -0600428 pMemoryRequirements->size = buf->size;
429 pMemoryRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700430
Tony Barbour426b9052015-06-24 16:06:58 -0600431 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700432}
433
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600434static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600435 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700436 struct nulldrv_buf **buf_ret)
437{
438 struct nulldrv_buf *buf;
439
440 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600441 VK_OBJECT_TYPE_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700442 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600443 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700444
445 buf->size = info->size;
446 buf->usage = info->usage;
447
Tony Barbour426b9052015-06-24 16:06:58 -0600448 buf->obj.base.get_memory_requirements = buf_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700449
450 *buf_ret = buf;
451
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600452 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700453}
454
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600455static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
456 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700457 struct nulldrv_desc_layout **layout_ret)
458{
459 struct nulldrv_desc_layout *layout;
460
461 layout = (struct nulldrv_desc_layout *)
462 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600463 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700464 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600465 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700466
467 *layout_ret = layout;
468
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600469 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700470}
471
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500472static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
473 const VkPipelineLayoutCreateInfo* pCreateInfo,
474 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800475{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500476 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800477
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500478 pipeline_layout = (struct nulldrv_pipeline_layout *)
479 nulldrv_base_create(dev, sizeof(*pipeline_layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600480 VK_OBJECT_TYPE_PIPELINE_LAYOUT);
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500481 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600482 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800483
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500484 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800485
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600486 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800487}
488
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600489static struct nulldrv_desc_layout *nulldrv_desc_layout(VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700490{
491 return (struct nulldrv_desc_layout *) layout;
492}
493
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600494static VkResult shader_create(struct nulldrv_dev *dev,
495 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700496 struct nulldrv_shader **sh_ret)
497{
David Pinedo0257fbf2015-02-02 18:02:40 -0700498 struct nulldrv_shader *sh;
499
500 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600501 VK_OBJECT_TYPE_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700502 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600503 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700504
505 *sh_ret = sh;
506
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600507 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700508}
509
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600510static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
511 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700512 struct nulldrv_pipeline **pipeline_ret)
513{
514 struct nulldrv_pipeline *pipeline;
515
516 pipeline = (struct nulldrv_pipeline *)
517 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600518 VK_OBJECT_TYPE_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700519 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600520 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700521
522 *pipeline_ret = pipeline;
523
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600524 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700525}
526
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600527static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
528 const VkDynamicVpStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700529 struct nulldrv_dynamic_vp **state_ret)
530{
531 struct nulldrv_dynamic_vp *state;
532
533 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600534 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_VP_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700535 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600536 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700537
538 *state_ret = state;
539
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600540 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700541}
542
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600543static VkResult nulldrv_raster_state_create(struct nulldrv_dev *dev,
544 const VkDynamicRsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700545 struct nulldrv_dynamic_rs **state_ret)
546{
547 struct nulldrv_dynamic_rs *state;
548
549 state = (struct nulldrv_dynamic_rs *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600550 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700551 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600552 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700553
554 *state_ret = state;
555
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600556 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700557}
558
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600559static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
560 const VkDynamicCbStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700561 struct nulldrv_dynamic_cb **state_ret)
562{
563 struct nulldrv_dynamic_cb *state;
564
565 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600566 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_CB_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700567 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600568 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700569
570 *state_ret = state;
571
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600572 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700573}
574
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600575static VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
576 const VkDynamicDsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700577 struct nulldrv_dynamic_ds **state_ret)
578{
579 struct nulldrv_dynamic_ds *state;
580
581 state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600582 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700583 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600584 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700585
586 *state_ret = state;
587
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600588 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700589}
590
591
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600592static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
593 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700594 struct nulldrv_cmd **cmd_ret)
595{
David Pinedo0257fbf2015-02-02 18:02:40 -0700596 struct nulldrv_cmd *cmd;
597
David Pinedo0257fbf2015-02-02 18:02:40 -0700598 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600599 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700600 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600601 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700602
603 *cmd_ret = cmd;
604
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600605 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700606}
607
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600608static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
609 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700610 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600611 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800612 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700613{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800614 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700615
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800616 pool = (struct nulldrv_desc_pool *)
617 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600618 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800619 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600620 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700621
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800622 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700623
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800624 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700625
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600626 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700627}
628
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600629static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800630 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600631 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700632 const struct nulldrv_desc_layout *layout,
633 struct nulldrv_desc_set **set_ret)
634{
635 struct nulldrv_desc_set *set;
636
637 set = (struct nulldrv_desc_set *)
638 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600639 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700640 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600641 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700642
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800643 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700644 set->layout = layout;
645 *set_ret = set;
646
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600647 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700648}
649
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600650static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700651{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800652 return (struct nulldrv_desc_pool *) pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700653}
654
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600655static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
656 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700657 struct nulldrv_framebuffer ** fb_ret)
658{
659
660 struct nulldrv_framebuffer *fb;
661 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600662 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700663 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600664 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700665
666 *fb_ret = fb;
667
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600668 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700669
670}
671
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600672static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
673 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700674 struct nulldrv_render_pass** rp_ret)
675{
676 struct nulldrv_render_pass *rp;
677 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600678 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700679 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600680 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700681
682 *rp_ret = rp;
683
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600684 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700685}
686
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600687static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700688{
689 return (struct nulldrv_buf *) buf;
690}
691
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600692static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600693 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700694 struct nulldrv_buf_view **view_ret)
695{
696 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
697 struct nulldrv_buf_view *view;
698
699 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600700 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700701 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600702 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700703
704 view->buf = buf;
705
706 *view_ret = view;
707
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600708 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700709}
710
David Pinedo0257fbf2015-02-02 18:02:40 -0700711
712//*********************************************
713// Driver entry points
714//*********************************************
715
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600716ICD_EXPORT VkResult VKAPI vkCreateBuffer(
717 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600718 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600719 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700720{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700721 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700722 struct nulldrv_dev *dev = nulldrv_dev(device);
723
724 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
725}
726
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600727ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
728 VkDevice device,
729 const VkCmdBufferCreateInfo* pCreateInfo,
730 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700731{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700732 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700733 struct nulldrv_dev *dev = nulldrv_dev(device);
734
735 return nulldrv_cmd_create(dev, pCreateInfo,
736 (struct nulldrv_cmd **) pCmdBuffer);
737}
738
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600739ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
740 VkCmdBuffer cmdBuffer,
741 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700742{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700743 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600744 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700745}
746
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600747ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
748 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700749{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700750 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600751 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700752}
753
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600754ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
755 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700756{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700757 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600758 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700759}
760
Ian Elliott64a68e12015-04-16 11:57:46 -0600761static const VkFormat nulldrv_presentable_formats[] = {
762 VK_FORMAT_B8G8R8A8_UNORM,
763};
764
Jon Ashburnba4a1952015-06-16 12:44:51 -0600765#if 0
Ian Elliott64a68e12015-04-16 11:57:46 -0600766ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
767 VkDisplayWSI display,
768 VkDisplayInfoTypeWSI infoType,
769 size_t* pDataSize,
770 void* pData)
771{
772 VkResult ret = VK_SUCCESS;
773
774 NULLDRV_LOG_FUNC;
775
776 if (!pDataSize)
777 return VK_ERROR_INVALID_POINTER;
778
779 switch (infoType) {
780 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
781 {
782 VkDisplayFormatPropertiesWSI *dst = pData;
783 size_t size_ret;
784 uint32_t i;
785
786 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
787
788 if (dst && *pDataSize < size_ret)
789 return VK_ERROR_INVALID_VALUE;
790
791 *pDataSize = size_ret;
792 if (!dst)
793 return VK_SUCCESS;
794
795 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
796 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
797 }
798 break;
799 default:
800 ret = VK_ERROR_INVALID_VALUE;
801 break;
802 }
803
804 return ret;
805}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600806#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600807
808ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
809 VkDevice device,
810 const VkSwapChainCreateInfoWSI* pCreateInfo,
811 VkSwapChainWSI* pSwapChain)
812{
813 NULLDRV_LOG_FUNC;
814 struct nulldrv_dev *dev = nulldrv_dev(device);
815 struct nulldrv_swap_chain *sc;
816
817 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600818 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600819 if (!sc) {
820 return VK_ERROR_OUT_OF_HOST_MEMORY;
821 }
822 sc->dev = dev;
823
Tony Barbour11e76ac2015-04-20 16:28:46 -0600824 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600825
826 return VK_SUCCESS;
827}
828
829ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
830 VkSwapChainWSI swapChain)
831{
832 NULLDRV_LOG_FUNC;
833 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
834
835 free(sc);
836
837 return VK_SUCCESS;
838}
839
840ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
841 VkSwapChainWSI swapChain,
842 VkSwapChainInfoTypeWSI infoType,
843 size_t* pDataSize,
844 void* pData)
845{
846 NULLDRV_LOG_FUNC;
847 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
848 struct nulldrv_dev *dev = sc->dev;
849 VkResult ret = VK_SUCCESS;
850
851 if (!pDataSize)
852 return VK_ERROR_INVALID_POINTER;
853
854 switch (infoType) {
855 case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
856 {
857 VkSwapChainImageInfoWSI *images;
858 const size_t size = sizeof(*images) * 2;
859 uint32_t i;
860
861 if (pData && *pDataSize < size)
862 return VK_ERROR_INVALID_VALUE;
863
864 *pDataSize = size;
865 if (!pData)
866 return VK_SUCCESS;
867
868 images = (VkSwapChainImageInfoWSI *) pData;
869 for (i = 0; i < 2; i++) {
870 struct nulldrv_img *img;
871 struct nulldrv_mem *mem;
872
873 img = (struct nulldrv_img *) nulldrv_base_create(dev,
874 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600875 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600876 if (!img)
877 return VK_ERROR_OUT_OF_HOST_MEMORY;
878
879 mem = (struct nulldrv_mem *) nulldrv_base_create(dev,
880 sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600881 VK_OBJECT_TYPE_DEVICE_MEMORY);
Ian Elliott64a68e12015-04-16 11:57:46 -0600882 if (!mem)
883 return VK_ERROR_OUT_OF_HOST_MEMORY;
884
885 images[i].image = (VkImage) img;
886 images[i].memory = (VkDeviceMemory) mem;
887 }
888 }
889 break;
890 default:
891 ret = VK_ERROR_INVALID_VALUE;
892 break;
893 }
894
895 return ret;
896}
897
898ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
899 VkQueue queue_,
900 const VkPresentInfoWSI* pPresentInfo)
901{
902 NULLDRV_LOG_FUNC;
903
904 return VK_SUCCESS;
905}
906
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600907ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600908 VkCmdBuffer cmdBuffer,
909 VkBuffer srcBuffer,
910 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700911 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600912 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700913{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700914 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700915}
916
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600917ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600918 VkCmdBuffer cmdBuffer,
919 VkImage srcImage,
920 VkImageLayout srcImageLayout,
921 VkImage destImage,
922 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700923 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600924 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700925{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700926 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700927}
928
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600929ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600930 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500931 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600932 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500933 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600934 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500935 uint32_t regionCount,
936 const VkImageBlit* pRegions,
937 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600938{
939 NULLDRV_LOG_FUNC;
940}
941
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600942ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600943 VkCmdBuffer cmdBuffer,
944 VkBuffer srcBuffer,
945 VkImage destImage,
946 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700947 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600948 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700949{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700950 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700951}
952
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600953ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600954 VkCmdBuffer cmdBuffer,
955 VkImage srcImage,
956 VkImageLayout srcImageLayout,
957 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700958 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600959 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700960{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700961 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700962}
963
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600964ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600965 VkCmdBuffer cmdBuffer,
966 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600967 VkDeviceSize destOffset,
968 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700969 const uint32_t* pData)
970{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700971 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700972}
973
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600974ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600975 VkCmdBuffer cmdBuffer,
976 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600977 VkDeviceSize destOffset,
978 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700979 uint32_t data)
980{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700981 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700982}
983
Ian Elliotte924ab22015-07-08 13:24:30 -0600984ICD_EXPORT void VKAPI vkCmdClearDepthStencilImage(
985 VkCmdBuffer cmdBuffer,
986 VkImage image,
987 VkImageLayout imageLayout,
988 float depth,
989 uint32_t stencil,
990 uint32_t rangeCount,
991 const VkImageSubresourceRange* pRanges)
992{
993 NULLDRV_LOG_FUNC;
994}
995
996ICD_EXPORT void VKAPI vkCmdClearColorAttachment(
997 VkCmdBuffer cmdBuffer,
998 uint32_t colorAttachment,
999 VkImageLayout imageLayout,
1000 const VkClearColorValue *pColor,
1001 uint32_t rectCount,
1002 const VkRect3D *pRects)
1003{
1004 NULLDRV_LOG_FUNC;
1005}
1006
1007ICD_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(
1008 VkCmdBuffer cmdBuffer,
1009 VkImageAspectFlags imageAspectMask,
1010 VkImageLayout imageLayout,
1011 float depth,
1012 uint32_t stencil,
1013 uint32_t rectCount,
1014 const VkRect3D *pRects)
1015{
1016 NULLDRV_LOG_FUNC;
1017}
1018
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001019ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001020 VkCmdBuffer cmdBuffer,
1021 VkImage image,
1022 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +12001023 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001024 uint32_t rangeCount,
1025 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001026{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001027 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001028}
1029
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001030ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001031 VkCmdBuffer cmdBuffer,
1032 VkImage image,
1033 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001034 float depth,
1035 uint32_t stencil,
1036 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001037 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001038{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001039 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001040}
1041
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001042ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001043 VkCmdBuffer cmdBuffer,
1044 VkImage srcImage,
1045 VkImageLayout srcImageLayout,
1046 VkImage destImage,
1047 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001048 uint32_t regionCount,
1049 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001050{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001051 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001052}
1053
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001054ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001055 VkCmdBuffer cmdBuffer,
1056 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001057 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001058 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001059{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001060 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001061}
1062
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001063ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001064 VkCmdBuffer cmdBuffer,
1065 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001066 uint32_t slot)
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 vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001072 VkCmdBuffer cmdBuffer,
1073 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001074 uint32_t startQuery,
1075 uint32_t queryCount)
1076{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001077 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001078}
1079
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001080ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001081 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001082 VkEvent event_,
1083 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001084{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001085 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001086}
1087
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001088ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001089 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001090 VkEvent event_,
1091 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001092{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001093 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001094}
1095
Ian Elliott63f1edb2015-04-16 18:10:19 -06001096ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1097 VkCmdBuffer cmdBuffer,
1098 VkQueryPool queryPool,
1099 uint32_t startQuery,
1100 uint32_t queryCount,
1101 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001102 VkDeviceSize destOffset,
1103 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001104 VkFlags flags)
1105{
1106 NULLDRV_LOG_FUNC;
1107}
1108
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001109ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001110 VkCmdBuffer cmdBuffer,
1111 VkTimestampType timestampType,
1112 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001113 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001114{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001115 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001116}
1117
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001118ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001119 VkCmdBuffer cmdBuffer,
1120 VkPipelineBindPoint pipelineBindPoint,
1121 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001122{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001123 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001124}
1125
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001126ICD_EXPORT void VKAPI vkCmdBindDynamicStateObject(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001127 VkCmdBuffer cmdBuffer,
1128 VkStateBindPoint stateBindPoint,
1129 VkDynamicStateObject state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001130{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001131 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001132}
1133
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001134ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001135 VkCmdBuffer cmdBuffer,
1136 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001137 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001138 uint32_t firstSet,
1139 uint32_t setCount,
1140 const VkDescriptorSet* pDescriptorSets,
1141 uint32_t dynamicOffsetCount,
1142 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001143{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001144 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001145}
1146
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001147ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1148 VkCmdBuffer cmdBuffer,
1149 uint32_t startBinding,
1150 uint32_t bindingCount,
1151 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001152 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001153{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001154 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001155}
1156
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001157ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001158 VkCmdBuffer cmdBuffer,
1159 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001160 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001161 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001162{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001163 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001164}
1165
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001166ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001167 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001168 uint32_t firstVertex,
1169 uint32_t vertexCount,
1170 uint32_t firstInstance,
1171 uint32_t instanceCount)
1172{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001173 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001174}
1175
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001176ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001177 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001178 uint32_t firstIndex,
1179 uint32_t indexCount,
1180 int32_t vertexOffset,
1181 uint32_t firstInstance,
1182 uint32_t instanceCount)
1183{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001184 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001185}
1186
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001187ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001188 VkCmdBuffer cmdBuffer,
1189 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001190 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001191 uint32_t count,
1192 uint32_t stride)
1193{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001194 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001195}
1196
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001197ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001198 VkCmdBuffer cmdBuffer,
1199 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001200 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001201 uint32_t count,
1202 uint32_t stride)
1203{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001204 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001205}
1206
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001207ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001208 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001209 uint32_t x,
1210 uint32_t y,
1211 uint32_t z)
1212{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001213 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001214}
1215
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001216ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001217 VkCmdBuffer cmdBuffer,
1218 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001219 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001220{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001221 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001222}
1223
Tony Barbour8205d902015-04-16 15:59:00 -06001224void VKAPI vkCmdWaitEvents(
1225 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001226 uint32_t eventCount,
1227 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001228 VkPipelineStageFlags sourceStageMask,
1229 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001230 uint32_t memBarrierCount,
1231 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001232{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001233 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001234}
1235
Tony Barbour8205d902015-04-16 15:59:00 -06001236void VKAPI vkCmdPipelineBarrier(
1237 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001238 VkPipelineStageFlags sourceStageMask,
1239 VkPipelineStageFlags destStageMask,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001240 VkBool32 byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001241 uint32_t memBarrierCount,
1242 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001243{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001244 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001245}
1246
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001247ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001248 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001249 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001250 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001251{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001252 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001253 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1254 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1255}
1256
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001257ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1258 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001259{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001260 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001261 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001262}
1263
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001264ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1265 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001266 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001267 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001268 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001269{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001270 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001271 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001272 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001273 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001274}
1275
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001276ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1277 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001278{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001279 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001280 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001281}
1282
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001283ICD_EXPORT VkResult VKAPI vkCreateEvent(
1284 VkDevice device,
1285 const VkEventCreateInfo* pCreateInfo,
1286 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001287{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001288 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001289 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001290}
1291
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001292ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001293 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001294 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001295{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001296 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001297 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001298}
1299
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001300ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001301 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001302 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001303{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001304 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001305 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001306}
1307
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001308ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001309 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001310 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001311{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001312 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001313 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001314}
1315
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001316ICD_EXPORT VkResult VKAPI vkCreateFence(
1317 VkDevice device,
1318 const VkFenceCreateInfo* pCreateInfo,
1319 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001320{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001321 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001322 struct nulldrv_dev *dev = nulldrv_dev(device);
1323
1324 return nulldrv_fence_create(dev, pCreateInfo,
1325 (struct nulldrv_fence **) pFence);
1326}
1327
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001328ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001329 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001330 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001331{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001332 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001333 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001334}
1335
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001336ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001337 VkDevice device,
1338 uint32_t fenceCount,
1339 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001340{
1341 NULLDRV_LOG_FUNC;
1342 return VK_SUCCESS;
1343}
1344
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001345ICD_EXPORT VkResult VKAPI vkWaitForFences(
1346 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001347 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001348 const VkFence* pFences,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001349 VkBool32 waitAll,
David Pinedo0257fbf2015-02-02 18:02:40 -07001350 uint64_t timeout)
1351{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001352 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001353 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001354}
1355
Tony Barbour426b9052015-06-24 16:06:58 -06001356ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1357 VkPhysicalDevice gpu_,
1358 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001359{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001360 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001361 VkResult ret = VK_SUCCESS;
1362
Tony Barbour426b9052015-06-24 16:06:58 -06001363 pProperties->apiVersion = VK_API_VERSION;
1364 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1365 pProperties->vendorId = 0;
1366 pProperties->deviceId = 0;
1367 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1368 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001369
1370 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001371}
1372
Chris Forbesd7576302015-06-21 22:55:02 +12001373ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1374 VkPhysicalDevice physicalDevice,
1375 VkPhysicalDeviceFeatures* pFeatures)
1376{
1377 NULLDRV_LOG_FUNC;
1378 VkResult ret = VK_SUCCESS;
1379
1380 /* TODO: fill out features */
1381 memset(pFeatures, 0, sizeof(*pFeatures));
1382
1383 return ret;
1384}
1385
1386ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatInfo(
1387 VkPhysicalDevice physicalDevice,
1388 VkFormat format,
1389 VkFormatProperties* pFormatInfo)
1390{
1391 NULLDRV_LOG_FUNC;
1392 VkResult ret = VK_SUCCESS;
1393
1394 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1395 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1396
1397 return ret;
1398}
1399
1400ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1401 VkPhysicalDevice physicalDevice,
1402 VkPhysicalDeviceLimits* pLimits)
1403{
1404 NULLDRV_LOG_FUNC;
1405 VkResult ret = VK_SUCCESS;
1406
1407 /* TODO: fill out limits */
1408 memset(pLimits, 0, sizeof(*pLimits));
1409
1410 return ret;
1411}
1412
Tony Barbour426b9052015-06-24 16:06:58 -06001413ICD_EXPORT VkResult VKAPI vkGetPhysicalDevicePerformance(
1414 VkPhysicalDevice gpu_,
1415 VkPhysicalDevicePerformance* pPerformance)
Jon Ashburneb2728b2015-04-10 14:33:07 -06001416{
Tony Barbour426b9052015-06-24 16:06:58 -06001417 pPerformance->maxDeviceClock = 1.0f;
1418 pPerformance->aluPerClock = 1.0f;
1419 pPerformance->texPerClock = 1.0f;
1420 pPerformance->primsPerClock = 1.0f;
1421 pPerformance->pixelsPerClock = 1.0f;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001422
1423 return VK_SUCCESS;
1424}
1425
Tony Barbour426b9052015-06-24 16:06:58 -06001426ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueCount(
1427 VkPhysicalDevice gpu_,
1428 uint32_t* pCount)
David Pinedo0257fbf2015-02-02 18:02:40 -07001429{
Tony Barbour426b9052015-06-24 16:06:58 -06001430 *pCount = 1;
1431 return VK_SUCCESS;
1432}
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001433
Tony Barbour426b9052015-06-24 16:06:58 -06001434ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueProperties(
1435 VkPhysicalDevice gpu_,
1436 uint32_t count,
1437 VkPhysicalDeviceQueueProperties* pProperties)
1438 {
1439 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1440 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001441 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001442
Tony Barbour426b9052015-06-24 16:06:58 -06001443 return VK_SUCCESS;
1444}
1445
Ian Elliotte924ab22015-07-08 13:24:30 -06001446ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(
1447 VkPhysicalDevice gpu_,
1448 VkPhysicalDeviceMemoryProperties* pProperties)
1449{
1450 // TODO: Fill in with real data
1451 return VK_SUCCESS;
1452}
1453
1454ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLayerProperties(
1455 VkPhysicalDevice physicalDevice,
1456 uint32_t* pCount,
1457 VkLayerProperties* pProperties)
1458{
1459 // TODO: Fill in with real data
1460 return VK_SUCCESS;
1461}
1462
Tony Barbour426b9052015-06-24 16:06:58 -06001463ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001464 const char* pLayerName,
1465 uint32_t* pCount,
1466 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001467{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001468 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001469
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001470 if (pCount == NULL) {
1471 return VK_ERROR_INVALID_POINTER;
1472 }
Tony Barbour426b9052015-06-24 16:06:58 -06001473
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001474 if (pProperties == NULL) {
1475 *pCount = NULLDRV_EXT_COUNT;
1476 return VK_SUCCESS;
1477 }
Tony Barbour426b9052015-06-24 16:06:58 -06001478
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001479 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1480 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1481 *pCount = copy_size;
1482 if (copy_size < NULLDRV_EXT_COUNT) {
1483 return VK_INCOMPLETE;
1484 }
Tony Barbour426b9052015-06-24 16:06:58 -06001485 return VK_SUCCESS;
1486}
Ian Elliotte924ab22015-07-08 13:24:30 -06001487ICD_EXPORT VkResult VKAPI vkGetGlobalLayerProperties(
1488 uint32_t* pCount,
1489 VkLayerProperties* pProperties)
1490{
1491 // TODO: Fill in with real data
1492 return VK_SUCCESS;
1493}
Tony Barbour426b9052015-06-24 16:06:58 -06001494
1495VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001496 VkPhysicalDevice physicalDevice,
1497 const char* pLayerName,
1498 uint32_t* pCount,
1499 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001500{
Tony Barbour426b9052015-06-24 16:06:58 -06001501
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001502 if (pCount == NULL) {
1503 return VK_ERROR_INVALID_POINTER;
1504 }
1505
Tony Barbour426b9052015-06-24 16:06:58 -06001506 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001507
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001508 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001509}
1510
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001511ICD_EXPORT VkResult VKAPI vkCreateImage(
1512 VkDevice device,
1513 const VkImageCreateInfo* pCreateInfo,
1514 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001515{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001516 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001517 struct nulldrv_dev *dev = nulldrv_dev(device);
1518
1519 return nulldrv_img_create(dev, pCreateInfo, false,
1520 (struct nulldrv_img **) pImage);
1521}
1522
Tony Barbour426b9052015-06-24 16:06:58 -06001523ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001524 VkDevice device,
1525 VkImage image,
1526 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001527 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001528{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001529 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001530
Tony Barbour426b9052015-06-24 16:06:58 -06001531 pLayout->offset = 0;
1532 pLayout->size = 1;
1533 pLayout->rowPitch = 4;
1534 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001535
Tony Barbour426b9052015-06-24 16:06:58 -06001536 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001537}
1538
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001539ICD_EXPORT VkResult VKAPI vkAllocMemory(
1540 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001541 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001542 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001543{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001544 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001545 struct nulldrv_dev *dev = nulldrv_dev(device);
1546
1547 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1548}
1549
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001550ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001551 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001552 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001553{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001554 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001555 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001556}
1557
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001558ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001559 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001560 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001561 VkDeviceSize offset,
1562 VkDeviceSize size,
1563 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001564 void** ppData)
1565{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001566 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001567 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1568 void *ptr = nulldrv_mem_map(mem, flags);
1569
1570 *ppData = ptr;
1571
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001572 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001573}
1574
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001575ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001576 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001577 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001578{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001579 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001580 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001581}
1582
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001583ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001584 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001585 uint32_t memRangeCount,
1586 const VkMappedMemoryRange* pMemRanges)
1587{
1588 NULLDRV_LOG_FUNC;
1589 return VK_SUCCESS;
1590}
1591
1592ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1593 VkDevice device,
1594 uint32_t memRangeCount,
1595 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001596{
1597 NULLDRV_LOG_FUNC;
1598 return VK_SUCCESS;
1599}
1600
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001601ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001602 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001603 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001604{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001605 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001606 struct nulldrv_instance *inst;
1607
1608 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001609 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001610 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001611 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001612
Tony Barbour426b9052015-06-24 16:06:58 -06001613 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001614
Mike Stroyan230e6252015-04-17 12:36:38 -06001615 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001616
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001617 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001618}
1619
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001620ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1621 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001622{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001623 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001624 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001625}
1626
Tony Barbour8205d902015-04-16 15:59:00 -06001627ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001628 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001629 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001630 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001631{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001632 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001633 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001634 struct nulldrv_gpu *gpu;
1635 *pGpuCount = 1;
1636 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001637 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001638 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001639 return ret;
1640}
1641
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001642ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001643 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001644 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001645 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001646 char* const* pOutLayers,
1647 void* pReserved)
1648{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001649 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001650 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001651}
1652
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001653ICD_EXPORT VkResult VKAPI vkDestroyObject(
Mike Stroyan230e6252015-04-17 12:36:38 -06001654 VkDevice device,
1655 VkObjectType objType,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001656 VkObject object)
David Pinedo0257fbf2015-02-02 18:02:40 -07001657{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001658 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001659 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001660}
1661
Tony Barbour426b9052015-06-24 16:06:58 -06001662ICD_EXPORT VkResult VKAPI vkGetObjectMemoryRequirements(
Mike Stroyan230e6252015-04-17 12:36:38 -06001663 VkDevice device,
1664 VkObjectType objType,
1665 VkObject object,
Tony Barbour426b9052015-06-24 16:06:58 -06001666 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -07001667{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001668 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001669 struct nulldrv_base *base = nulldrv_base(object);
1670
Tony Barbour426b9052015-06-24 16:06:58 -06001671 return base->get_memory_requirements(base, pMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -07001672}
1673
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001674ICD_EXPORT VkResult VKAPI vkBindObjectMemory(
1675 VkDevice device,
Mike Stroyan230e6252015-04-17 12:36:38 -06001676 VkObjectType objType,
1677 VkObject object,
Tony Barbour8205d902015-04-16 15:59:00 -06001678 VkDeviceMemory mem_,
1679 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001680{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001681 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001682 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001683}
1684
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001685ICD_EXPORT VkResult VKAPI vkGetImageSparseMemoryRequirements(
1686 VkDevice device,
1687 VkImage image,
1688 uint32_t* pNumRequirements,
1689 VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
1690{
1691 NULLDRV_LOG_FUNC;
1692 return VK_SUCCESS;
1693}
1694
1695ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(
1696 VkPhysicalDevice physicalDevice,
1697 VkFormat format,
1698 VkImageType type,
1699 uint32_t samples,
1700 VkImageUsageFlags usage,
1701 VkImageTiling tiling,
1702 uint32_t* pNumProperties,
1703 VkSparseImageFormatProperties* pProperties)
1704{
1705 NULLDRV_LOG_FUNC;
1706 return VK_SUCCESS;
1707}
1708
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001709ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001710 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001711 VkBuffer buffer,
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001712 uint32_t numBindings,
1713 const VkSparseMemoryBindInfo* pBindInfo)
1714{
1715 NULLDRV_LOG_FUNC;
1716 return VK_SUCCESS;
1717}
1718
1719ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageOpaqueMemory(
1720 VkQueue queue,
1721 VkImage image,
1722 uint32_t numBindings,
1723 const VkSparseMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001724{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001725 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001726 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001727}
1728
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001729ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001730 VkQueue queue,
1731 VkImage image,
1732 uint32_t numBindings,
1733 const VkSparseImageMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001734{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001735 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001736 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001737}
Jon Ashburn0e249962015-07-10 09:41:15 -07001738ICD_EXPORT VkResult VKAPI vkCreatePipelineCache(
1739 VkDevice device,
1740 const VkPipelineCacheCreateInfo* pCreateInfo,
1741 VkPipelineCache* pPipelineCache)
1742{
David Pinedo0257fbf2015-02-02 18:02:40 -07001743
Jon Ashburn0e249962015-07-10 09:41:15 -07001744 NULLDRV_LOG_FUNC;
1745 return VK_SUCCESS;
1746}
1747
1748VkResult VKAPI vkDestroyPipelineCache(
1749 VkDevice device,
1750 VkPipelineCache pipelineCache)
1751{
1752 NULLDRV_LOG_FUNC;
1753 return VK_SUCCESS;
1754}
1755
1756ICD_EXPORT size_t VKAPI vkGetPipelineCacheSize(
1757 VkDevice device,
1758 VkPipelineCache pipelineCache)
1759{
1760 NULLDRV_LOG_FUNC;
1761 return VK_ERROR_UNAVAILABLE;
1762}
1763
1764ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
1765 VkDevice device,
1766 VkPipelineCache pipelineCache,
1767 void* pData)
1768{
1769 NULLDRV_LOG_FUNC;
1770 return VK_ERROR_UNAVAILABLE;
1771}
1772
1773ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
1774 VkDevice device,
1775 VkPipelineCache destCache,
1776 uint32_t srcCacheCount,
1777 const VkPipelineCache* pSrcCaches)
1778{
1779 NULLDRV_LOG_FUNC;
1780 return VK_ERROR_UNAVAILABLE;
1781}
1782ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001783 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001784 VkPipelineCache pipelineCache,
1785 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001786 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1787 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001788{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001789 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001790 struct nulldrv_dev *dev = nulldrv_dev(device);
1791
1792 return graphics_pipeline_create(dev, pCreateInfo,
1793 (struct nulldrv_pipeline **) pPipeline);
1794}
1795
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001796
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001797
Jon Ashburn0e249962015-07-10 09:41:15 -07001798ICD_EXPORT VkResult VKAPI vkCreateComputePipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001799 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001800 VkPipelineCache pipelineCache,
1801 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001802 const VkComputePipelineCreateInfo* pCreateInfo,
1803 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001804{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001805 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001806 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001807}
1808
David Pinedo0257fbf2015-02-02 18:02:40 -07001809
David Pinedo0257fbf2015-02-02 18:02:40 -07001810
Jon Ashburn0e249962015-07-10 09:41:15 -07001811
David Pinedo0257fbf2015-02-02 18:02:40 -07001812
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001813ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1814 VkDevice device,
1815 const VkQueryPoolCreateInfo* pCreateInfo,
1816 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001817{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001818 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001819 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001820}
1821
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001822ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001823 VkDevice device,
1824 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001825 uint32_t startQuery,
1826 uint32_t queryCount,
1827 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001828 void* pData,
1829 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001830{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001831 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001832 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001833}
1834
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001835ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1836 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001837{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001838 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001839 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001840}
1841
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001842ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1843 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001844 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001845 const VkCmdBuffer* pCmdBuffers,
1846 VkFence fence_)
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
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001852ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1853 VkDevice device,
1854 const VkSemaphoreCreateInfo* pCreateInfo,
1855 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001856{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001857 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001858 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001859}
1860
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001861ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1862 VkQueue queue,
1863 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001864{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001865 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001866 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001867}
1868
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001869ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1870 VkQueue queue,
1871 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001872{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001873 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001874 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001875}
1876
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001877ICD_EXPORT VkResult VKAPI vkCreateSampler(
1878 VkDevice device,
1879 const VkSamplerCreateInfo* pCreateInfo,
1880 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07001881{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001882 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001883 struct nulldrv_dev *dev = nulldrv_dev(device);
1884
1885 return nulldrv_sampler_create(dev, pCreateInfo,
1886 (struct nulldrv_sampler **) pSampler);
1887}
1888
Ian Elliotte924ab22015-07-08 13:24:30 -06001889ICD_EXPORT VkResult VKAPI vkCreateShaderModule(
1890 VkDevice device,
1891 const VkShaderModuleCreateInfo* pCreateInfo,
1892 VkShaderModule* pShaderModule)
1893{
1894 // TODO: Fill in with real data
1895 return VK_SUCCESS;
1896}
1897
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001898ICD_EXPORT VkResult VKAPI vkCreateShader(
1899 VkDevice device,
1900 const VkShaderCreateInfo* pCreateInfo,
1901 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07001902{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001903 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001904 struct nulldrv_dev *dev = nulldrv_dev(device);
1905
1906 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
1907}
1908
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001909ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
1910 VkDevice device,
1911 const VkDynamicVpStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001912 VkDynamicVpState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001913{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001914 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001915 struct nulldrv_dev *dev = nulldrv_dev(device);
1916
1917 return nulldrv_viewport_state_create(dev, pCreateInfo,
1918 (struct nulldrv_dynamic_vp **) pState);
1919}
1920
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001921ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
1922 VkDevice device,
1923 const VkDynamicRsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001924 VkDynamicRsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001925{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001926 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001927 struct nulldrv_dev *dev = nulldrv_dev(device);
1928
1929 return nulldrv_raster_state_create(dev, pCreateInfo,
1930 (struct nulldrv_dynamic_rs **) pState);
1931}
1932
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001933ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
1934 VkDevice device,
1935 const VkDynamicCbStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001936 VkDynamicCbState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001937{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001938 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001939 struct nulldrv_dev *dev = nulldrv_dev(device);
1940
1941 return nulldrv_blend_state_create(dev, pCreateInfo,
1942 (struct nulldrv_dynamic_cb **) pState);
1943}
1944
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001945ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
1946 VkDevice device,
1947 const VkDynamicDsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001948 VkDynamicDsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001949{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001950 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001951 struct nulldrv_dev *dev = nulldrv_dev(device);
1952
1953 return nulldrv_ds_state_create(dev, pCreateInfo,
1954 (struct nulldrv_dynamic_ds **) pState);
1955}
1956
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001957ICD_EXPORT VkResult VKAPI vkCreateBufferView(
1958 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001959 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001960 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001961{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001962 NULLDRV_LOG_FUNC;
1963 struct nulldrv_dev *dev = nulldrv_dev(device);
1964
1965 return nulldrv_buf_view_create(dev, pCreateInfo,
1966 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07001967}
1968
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001969ICD_EXPORT VkResult VKAPI vkCreateImageView(
1970 VkDevice device,
1971 const VkImageViewCreateInfo* pCreateInfo,
1972 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001973{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001974 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001975 struct nulldrv_dev *dev = nulldrv_dev(device);
1976
1977 return nulldrv_img_view_create(dev, pCreateInfo,
1978 (struct nulldrv_img_view **) pView);
1979}
1980
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001981ICD_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
1982 VkDevice device,
1983 const VkColorAttachmentViewCreateInfo* pCreateInfo,
1984 VkColorAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001985{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001986 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001987 struct nulldrv_dev *dev = nulldrv_dev(device);
1988
1989 return nulldrv_rt_view_create(dev, pCreateInfo,
1990 (struct nulldrv_rt_view **) pView);
1991}
1992
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001993ICD_EXPORT VkResult VKAPI vkCreateDepthStencilView(
1994 VkDevice device,
1995 const VkDepthStencilViewCreateInfo* pCreateInfo,
1996 VkDepthStencilView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001997{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001998 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001999 struct nulldrv_dev *dev = nulldrv_dev(device);
2000
2001 return nulldrv_ds_view_create(dev, pCreateInfo,
2002 (struct nulldrv_ds_view **) pView);
2003
2004}
2005
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002006ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2007 VkDevice device,
2008 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2009 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002010{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002011 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002012 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002013
Chia-I Wu7732cb22015-03-26 15:27:55 +08002014 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002015 (struct nulldrv_desc_layout **) pSetLayout);
2016}
2017
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002018ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2019 VkDevice device,
2020 const VkPipelineLayoutCreateInfo* pCreateInfo,
2021 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002022{
2023 NULLDRV_LOG_FUNC;
2024 struct nulldrv_dev *dev = nulldrv_dev(device);
2025
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002026 return nulldrv_pipeline_layout_create(dev,
2027 pCreateInfo,
2028 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002029}
2030
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002031ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2032 VkDevice device,
2033 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002034 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002035 const VkDescriptorPoolCreateInfo* pCreateInfo,
2036 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002037{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002038 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002039 struct nulldrv_dev *dev = nulldrv_dev(device);
2040
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002041 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2042 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002043}
2044
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002045ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002046 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002047 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002048{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002049 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002050 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002051}
2052
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002053ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002054 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002055 VkDescriptorPool descriptorPool,
2056 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002057 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002058 const VkDescriptorSetLayout* pSetLayouts,
2059 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07002060 uint32_t* pCount)
2061{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002062 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002063 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2064 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002065 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002066 uint32_t i;
2067
2068 for (i = 0; i < count; i++) {
2069 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002070 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002071
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002072 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002073 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002074 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002075 break;
2076 }
2077
2078 if (pCount)
2079 *pCount = i;
2080
2081 return ret;
2082}
2083
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002084ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2085 VkDevice device,
2086 uint32_t writeCount,
2087 const VkWriteDescriptorSet* pDescriptorWrites,
2088 uint32_t copyCount,
2089 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002090{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002091 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002092 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002093}
2094
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002095ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2096 VkDevice device,
2097 const VkFramebufferCreateInfo* info,
2098 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002099{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002100 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002101 struct nulldrv_dev *dev = nulldrv_dev(device);
2102
2103 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2104}
2105
2106
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002107ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2108 VkDevice device,
2109 const VkRenderPassCreateInfo* info,
2110 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002111{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002112 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002113 struct nulldrv_dev *dev = nulldrv_dev(device);
2114
2115 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2116}
2117
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002118ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002119 VkCmdBuffer cmdBuffer,
2120 const VkRenderPassBegin* pRenderPassBegin)
David Pinedo0257fbf2015-02-02 18:02:40 -07002121{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002122 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002123}
2124
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002125ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002126 VkCmdBuffer cmdBuffer)
2127{
2128 NULLDRV_LOG_FUNC;
2129}
2130
2131ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2132 VkCmdBuffer cmdBuffer,
2133 uint32_t cmdBuffersCount,
2134 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002135{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002136 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002137}
Ian Elliottf93069f2015-02-19 14:26:19 -07002138
2139ICD_EXPORT void* xcbCreateWindow(
2140 uint16_t width,
2141 uint16_t height)
2142{
2143 static uint32_t window; // Kludge to the max
2144 NULLDRV_LOG_FUNC;
2145 return &window;
2146}
2147
2148// May not be needed, if we stub out stuf in tri.c
2149ICD_EXPORT void xcbDestroyWindow()
2150{
2151 NULLDRV_LOG_FUNC;
2152}
2153
2154ICD_EXPORT int xcbGetMessage(void *msg)
2155{
2156 NULLDRV_LOG_FUNC;
2157 return 0;
2158}
2159
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002160ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002161{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002162 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002163}