blob: 48065212ebcf2c070bcc45db9fe282f8ee509c92 [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
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600984ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -0600985 VkCmdBuffer cmdBuffer,
986 VkImage image,
987 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +1200988 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -0600989 uint32_t rangeCount,
990 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -0700991{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700992 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700993}
994
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600995ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600996 VkCmdBuffer cmdBuffer,
997 VkImage image,
998 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700999 float depth,
1000 uint32_t stencil,
1001 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001002 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001003{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001004 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001005}
1006
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001007ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001008 VkCmdBuffer cmdBuffer,
1009 VkImage srcImage,
1010 VkImageLayout srcImageLayout,
1011 VkImage destImage,
1012 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001013 uint32_t regionCount,
1014 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001015{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001016 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001017}
1018
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001019ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001020 VkCmdBuffer cmdBuffer,
1021 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001022 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001023 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001024{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001025 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001026}
1027
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001028ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001029 VkCmdBuffer cmdBuffer,
1030 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001031 uint32_t slot)
1032{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001033 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001034}
1035
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001036ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001037 VkCmdBuffer cmdBuffer,
1038 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001039 uint32_t startQuery,
1040 uint32_t queryCount)
1041{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001042 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001043}
1044
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001045ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001046 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001047 VkEvent event_,
1048 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001049{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001050 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001051}
1052
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001053ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001054 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001055 VkEvent event_,
1056 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001057{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001058 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001059}
1060
Ian Elliott63f1edb2015-04-16 18:10:19 -06001061ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1062 VkCmdBuffer cmdBuffer,
1063 VkQueryPool queryPool,
1064 uint32_t startQuery,
1065 uint32_t queryCount,
1066 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001067 VkDeviceSize destOffset,
1068 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001069 VkFlags flags)
1070{
1071 NULLDRV_LOG_FUNC;
1072}
1073
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001074ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001075 VkCmdBuffer cmdBuffer,
1076 VkTimestampType timestampType,
1077 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001078 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001079{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001080 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001081}
1082
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001083ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001084 VkCmdBuffer cmdBuffer,
1085 VkPipelineBindPoint pipelineBindPoint,
1086 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001087{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001088 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001089}
1090
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001091ICD_EXPORT void VKAPI vkCmdBindDynamicStateObject(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001092 VkCmdBuffer cmdBuffer,
1093 VkStateBindPoint stateBindPoint,
1094 VkDynamicStateObject state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001095{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001096 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001097}
1098
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001099ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001100 VkCmdBuffer cmdBuffer,
1101 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001102 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001103 uint32_t firstSet,
1104 uint32_t setCount,
1105 const VkDescriptorSet* pDescriptorSets,
1106 uint32_t dynamicOffsetCount,
1107 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001108{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001109 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001110}
1111
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001112ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1113 VkCmdBuffer cmdBuffer,
1114 uint32_t startBinding,
1115 uint32_t bindingCount,
1116 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001117 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001118{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001119 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001120}
1121
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001122ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001123 VkCmdBuffer cmdBuffer,
1124 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001125 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001126 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001127{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001128 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001129}
1130
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001131ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001132 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001133 uint32_t firstVertex,
1134 uint32_t vertexCount,
1135 uint32_t firstInstance,
1136 uint32_t instanceCount)
1137{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001138 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001139}
1140
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001141ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001142 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001143 uint32_t firstIndex,
1144 uint32_t indexCount,
1145 int32_t vertexOffset,
1146 uint32_t firstInstance,
1147 uint32_t instanceCount)
1148{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001149 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001150}
1151
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001152ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001153 VkCmdBuffer cmdBuffer,
1154 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001155 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001156 uint32_t count,
1157 uint32_t stride)
1158{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001159 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001160}
1161
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001162ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001163 VkCmdBuffer cmdBuffer,
1164 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001165 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001166 uint32_t count,
1167 uint32_t stride)
1168{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001169 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001170}
1171
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001172ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001173 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001174 uint32_t x,
1175 uint32_t y,
1176 uint32_t z)
1177{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001178 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001179}
1180
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001181ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001182 VkCmdBuffer cmdBuffer,
1183 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001184 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001185{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001186 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001187}
1188
Tony Barbour8205d902015-04-16 15:59:00 -06001189void VKAPI vkCmdWaitEvents(
1190 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001191 uint32_t eventCount,
1192 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001193 VkPipelineStageFlags sourceStageMask,
1194 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001195 uint32_t memBarrierCount,
1196 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001197{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001198 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001199}
1200
Tony Barbour8205d902015-04-16 15:59:00 -06001201void VKAPI vkCmdPipelineBarrier(
1202 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001203 VkPipelineStageFlags sourceStageMask,
1204 VkPipelineStageFlags destStageMask,
1205 bool32_t byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001206 uint32_t memBarrierCount,
1207 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001208{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001209 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001210}
1211
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001212ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001213 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001214 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001215 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001216{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001217 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001218 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1219 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1220}
1221
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001222ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1223 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001224{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001225 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001226 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001227}
1228
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001229ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1230 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001231 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001232 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001233 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001234{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001235 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001236 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001237 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001238 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001239}
1240
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001241ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1242 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001243{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001244 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001245 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001246}
1247
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001248ICD_EXPORT VkResult VKAPI vkCreateEvent(
1249 VkDevice device,
1250 const VkEventCreateInfo* pCreateInfo,
1251 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001252{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001253 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001254 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001255}
1256
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001257ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001258 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001259 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001260{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001261 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001262 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001263}
1264
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001265ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001266 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001267 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001268{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001269 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001270 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001271}
1272
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001273ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001274 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001275 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001276{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001277 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001278 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001279}
1280
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001281ICD_EXPORT VkResult VKAPI vkCreateFence(
1282 VkDevice device,
1283 const VkFenceCreateInfo* pCreateInfo,
1284 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001285{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001286 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001287 struct nulldrv_dev *dev = nulldrv_dev(device);
1288
1289 return nulldrv_fence_create(dev, pCreateInfo,
1290 (struct nulldrv_fence **) pFence);
1291}
1292
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001293ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001294 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001295 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001296{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001297 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001298 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001299}
1300
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001301ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001302 VkDevice device,
1303 uint32_t fenceCount,
1304 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001305{
1306 NULLDRV_LOG_FUNC;
1307 return VK_SUCCESS;
1308}
1309
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001310ICD_EXPORT VkResult VKAPI vkWaitForFences(
1311 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001312 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001313 const VkFence* pFences,
David Pinedo0257fbf2015-02-02 18:02:40 -07001314 bool32_t waitAll,
1315 uint64_t timeout)
1316{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001317 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001318 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001319}
1320
Tony Barbour426b9052015-06-24 16:06:58 -06001321ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1322 VkPhysicalDevice gpu_,
1323 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001324{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001325 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001326 VkResult ret = VK_SUCCESS;
1327
Tony Barbour426b9052015-06-24 16:06:58 -06001328 pProperties->apiVersion = VK_API_VERSION;
1329 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1330 pProperties->vendorId = 0;
1331 pProperties->deviceId = 0;
1332 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1333 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001334
1335 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001336}
1337
Chris Forbesd7576302015-06-21 22:55:02 +12001338ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1339 VkPhysicalDevice physicalDevice,
1340 VkPhysicalDeviceFeatures* pFeatures)
1341{
1342 NULLDRV_LOG_FUNC;
1343 VkResult ret = VK_SUCCESS;
1344
1345 /* TODO: fill out features */
1346 memset(pFeatures, 0, sizeof(*pFeatures));
1347
1348 return ret;
1349}
1350
1351ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatInfo(
1352 VkPhysicalDevice physicalDevice,
1353 VkFormat format,
1354 VkFormatProperties* pFormatInfo)
1355{
1356 NULLDRV_LOG_FUNC;
1357 VkResult ret = VK_SUCCESS;
1358
1359 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1360 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1361
1362 return ret;
1363}
1364
1365ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1366 VkPhysicalDevice physicalDevice,
1367 VkPhysicalDeviceLimits* pLimits)
1368{
1369 NULLDRV_LOG_FUNC;
1370 VkResult ret = VK_SUCCESS;
1371
1372 /* TODO: fill out limits */
1373 memset(pLimits, 0, sizeof(*pLimits));
1374
1375 return ret;
1376}
1377
Tony Barbour426b9052015-06-24 16:06:58 -06001378ICD_EXPORT VkResult VKAPI vkGetPhysicalDevicePerformance(
1379 VkPhysicalDevice gpu_,
1380 VkPhysicalDevicePerformance* pPerformance)
Jon Ashburneb2728b2015-04-10 14:33:07 -06001381{
Tony Barbour426b9052015-06-24 16:06:58 -06001382 pPerformance->maxDeviceClock = 1.0f;
1383 pPerformance->aluPerClock = 1.0f;
1384 pPerformance->texPerClock = 1.0f;
1385 pPerformance->primsPerClock = 1.0f;
1386 pPerformance->pixelsPerClock = 1.0f;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001387
1388 return VK_SUCCESS;
1389}
1390
Tony Barbour426b9052015-06-24 16:06:58 -06001391ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueCount(
1392 VkPhysicalDevice gpu_,
1393 uint32_t* pCount)
David Pinedo0257fbf2015-02-02 18:02:40 -07001394{
Tony Barbour426b9052015-06-24 16:06:58 -06001395 *pCount = 1;
1396 return VK_SUCCESS;
1397}
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001398
Tony Barbour426b9052015-06-24 16:06:58 -06001399ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueProperties(
1400 VkPhysicalDevice gpu_,
1401 uint32_t count,
1402 VkPhysicalDeviceQueueProperties* pProperties)
1403 {
1404 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1405 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001406 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001407
Tony Barbour426b9052015-06-24 16:06:58 -06001408 return VK_SUCCESS;
1409}
1410
1411ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001412 const char* pLayerName,
1413 uint32_t* pCount,
1414 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001415{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001416 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001417
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001418 if (pCount == NULL) {
1419 return VK_ERROR_INVALID_POINTER;
1420 }
Tony Barbour426b9052015-06-24 16:06:58 -06001421
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001422 if (pProperties == NULL) {
1423 *pCount = NULLDRV_EXT_COUNT;
1424 return VK_SUCCESS;
1425 }
Tony Barbour426b9052015-06-24 16:06:58 -06001426
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001427 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1428 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1429 *pCount = copy_size;
1430 if (copy_size < NULLDRV_EXT_COUNT) {
1431 return VK_INCOMPLETE;
1432 }
Tony Barbour426b9052015-06-24 16:06:58 -06001433 return VK_SUCCESS;
1434}
1435
1436VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001437 VkPhysicalDevice physicalDevice,
1438 const char* pLayerName,
1439 uint32_t* pCount,
1440 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001441{
Tony Barbour426b9052015-06-24 16:06:58 -06001442
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001443 if (pCount == NULL) {
1444 return VK_ERROR_INVALID_POINTER;
1445 }
1446
Tony Barbour426b9052015-06-24 16:06:58 -06001447 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001448
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001449 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001450}
1451
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001452ICD_EXPORT VkResult VKAPI vkCreateImage(
1453 VkDevice device,
1454 const VkImageCreateInfo* pCreateInfo,
1455 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001456{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001457 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001458 struct nulldrv_dev *dev = nulldrv_dev(device);
1459
1460 return nulldrv_img_create(dev, pCreateInfo, false,
1461 (struct nulldrv_img **) pImage);
1462}
1463
Tony Barbour426b9052015-06-24 16:06:58 -06001464ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001465 VkDevice device,
1466 VkImage image,
1467 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001468 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001469{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001470 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001471
Tony Barbour426b9052015-06-24 16:06:58 -06001472 pLayout->offset = 0;
1473 pLayout->size = 1;
1474 pLayout->rowPitch = 4;
1475 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001476
Tony Barbour426b9052015-06-24 16:06:58 -06001477 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001478}
1479
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001480ICD_EXPORT VkResult VKAPI vkAllocMemory(
1481 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001482 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001483 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001484{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001485 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001486 struct nulldrv_dev *dev = nulldrv_dev(device);
1487
1488 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1489}
1490
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001491ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001492 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001493 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001494{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001495 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001496 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001497}
1498
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001499ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001500 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001501 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001502 VkDeviceSize offset,
1503 VkDeviceSize size,
1504 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001505 void** ppData)
1506{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001507 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001508 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1509 void *ptr = nulldrv_mem_map(mem, flags);
1510
1511 *ppData = ptr;
1512
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001513 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001514}
1515
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001516ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001517 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001518 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001519{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001520 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001521 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001522}
1523
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001524ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001525 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001526 uint32_t memRangeCount,
1527 const VkMappedMemoryRange* pMemRanges)
1528{
1529 NULLDRV_LOG_FUNC;
1530 return VK_SUCCESS;
1531}
1532
1533ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1534 VkDevice device,
1535 uint32_t memRangeCount,
1536 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001537{
1538 NULLDRV_LOG_FUNC;
1539 return VK_SUCCESS;
1540}
1541
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001542ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001543 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001544 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001545{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001546 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001547 struct nulldrv_instance *inst;
1548
1549 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001550 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001551 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001552 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001553
Tony Barbour426b9052015-06-24 16:06:58 -06001554 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001555
Mike Stroyan230e6252015-04-17 12:36:38 -06001556 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001557
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001558 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001559}
1560
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001561ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1562 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001563{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001564 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001565 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001566}
1567
Tony Barbour8205d902015-04-16 15:59:00 -06001568ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001569 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001570 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001571 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001572{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001573 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001574 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001575 struct nulldrv_gpu *gpu;
1576 *pGpuCount = 1;
1577 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001578 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001579 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001580 return ret;
1581}
1582
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001583ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001584 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001585 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001586 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001587 char* const* pOutLayers,
1588 void* pReserved)
1589{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001590 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001591 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001592}
1593
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001594ICD_EXPORT VkResult VKAPI vkDestroyObject(
Mike Stroyan230e6252015-04-17 12:36:38 -06001595 VkDevice device,
1596 VkObjectType objType,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001597 VkObject object)
David Pinedo0257fbf2015-02-02 18:02:40 -07001598{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001599 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001600 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001601}
1602
Tony Barbour426b9052015-06-24 16:06:58 -06001603ICD_EXPORT VkResult VKAPI vkGetObjectMemoryRequirements(
Mike Stroyan230e6252015-04-17 12:36:38 -06001604 VkDevice device,
1605 VkObjectType objType,
1606 VkObject object,
Tony Barbour426b9052015-06-24 16:06:58 -06001607 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -07001608{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001609 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001610 struct nulldrv_base *base = nulldrv_base(object);
1611
Tony Barbour426b9052015-06-24 16:06:58 -06001612 return base->get_memory_requirements(base, pMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -07001613}
1614
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001615ICD_EXPORT VkResult VKAPI vkBindObjectMemory(
1616 VkDevice device,
Mike Stroyan230e6252015-04-17 12:36:38 -06001617 VkObjectType objType,
1618 VkObject object,
Tony Barbour8205d902015-04-16 15:59:00 -06001619 VkDeviceMemory mem_,
1620 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001621{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001622 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001623 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001624}
1625
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001626ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001627 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001628 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001629 VkDeviceSize rangeOffset,
1630 VkDeviceSize rangeSize,
1631 VkDeviceMemory mem,
1632 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001633{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001634 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001635 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001636}
1637
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001638ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001639 VkQueue queue,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001640 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001641 const VkImageMemoryBindInfo* pBindInfo,
1642 VkDeviceMemory mem,
1643 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001644{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001645 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001646 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001647}
1648
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001649ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(
1650 VkDevice device,
1651 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1652 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001653{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001654 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001655 struct nulldrv_dev *dev = nulldrv_dev(device);
1656
1657 return graphics_pipeline_create(dev, pCreateInfo,
1658 (struct nulldrv_pipeline **) pPipeline);
1659}
1660
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001661ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(
1662 VkDevice device,
1663 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1664 VkPipeline basePipeline,
1665 VkPipeline* pPipeline)
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001666{
1667 NULLDRV_LOG_FUNC;
1668 struct nulldrv_dev *dev = nulldrv_dev(device);
1669
1670 return graphics_pipeline_create(dev, pCreateInfo,
1671 (struct nulldrv_pipeline **) pPipeline);
1672}
1673
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001674ICD_EXPORT VkResult VKAPI vkCreateComputePipeline(
1675 VkDevice device,
1676 const VkComputePipelineCreateInfo* pCreateInfo,
1677 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001678{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001679 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001680 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001681}
1682
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001683ICD_EXPORT VkResult VKAPI vkStorePipeline(
Mike Stroyan230e6252015-04-17 12:36:38 -06001684 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001685 VkPipeline pipeline,
David Pinedo0257fbf2015-02-02 18:02:40 -07001686 size_t* pDataSize,
1687 void* pData)
1688{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001689 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001690 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001691}
1692
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001693ICD_EXPORT VkResult VKAPI vkLoadPipeline(
1694 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001695 size_t dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001696 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001697 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001698{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001699 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001700 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001701}
1702
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001703ICD_EXPORT VkResult VKAPI vkLoadPipelineDerivative(
1704 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001705 size_t dataSize,
1706 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001707 VkPipeline basePipeline,
1708 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001709{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001710 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001711 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001712}
1713
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001714ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1715 VkDevice device,
1716 const VkQueryPoolCreateInfo* pCreateInfo,
1717 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001718{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001719 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001720 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001721}
1722
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001723ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001724 VkDevice device,
1725 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001726 uint32_t startQuery,
1727 uint32_t queryCount,
1728 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001729 void* pData,
1730 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001731{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001732 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001733 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001734}
1735
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001736ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1737 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001738{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001739 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001740 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001741}
1742
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001743ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1744 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001745 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001746 const VkCmdBuffer* pCmdBuffers,
1747 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001748{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001749 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001750 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001751}
1752
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001753ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1754 VkDevice device,
1755 const VkSemaphoreCreateInfo* pCreateInfo,
1756 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001757{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001758 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001759 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001760}
1761
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001762ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1763 VkQueue queue,
1764 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001765{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001766 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001767 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001768}
1769
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001770ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1771 VkQueue queue,
1772 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001773{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001774 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001775 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001776}
1777
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001778ICD_EXPORT VkResult VKAPI vkCreateSampler(
1779 VkDevice device,
1780 const VkSamplerCreateInfo* pCreateInfo,
1781 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07001782{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001783 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001784 struct nulldrv_dev *dev = nulldrv_dev(device);
1785
1786 return nulldrv_sampler_create(dev, pCreateInfo,
1787 (struct nulldrv_sampler **) pSampler);
1788}
1789
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001790ICD_EXPORT VkResult VKAPI vkCreateShader(
1791 VkDevice device,
1792 const VkShaderCreateInfo* pCreateInfo,
1793 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07001794{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001795 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001796 struct nulldrv_dev *dev = nulldrv_dev(device);
1797
1798 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
1799}
1800
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001801ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
1802 VkDevice device,
1803 const VkDynamicVpStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001804 VkDynamicVpState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001805{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001806 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001807 struct nulldrv_dev *dev = nulldrv_dev(device);
1808
1809 return nulldrv_viewport_state_create(dev, pCreateInfo,
1810 (struct nulldrv_dynamic_vp **) pState);
1811}
1812
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001813ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
1814 VkDevice device,
1815 const VkDynamicRsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001816 VkDynamicRsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001817{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001818 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001819 struct nulldrv_dev *dev = nulldrv_dev(device);
1820
1821 return nulldrv_raster_state_create(dev, pCreateInfo,
1822 (struct nulldrv_dynamic_rs **) pState);
1823}
1824
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001825ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
1826 VkDevice device,
1827 const VkDynamicCbStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001828 VkDynamicCbState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001829{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001830 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001831 struct nulldrv_dev *dev = nulldrv_dev(device);
1832
1833 return nulldrv_blend_state_create(dev, pCreateInfo,
1834 (struct nulldrv_dynamic_cb **) pState);
1835}
1836
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001837ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
1838 VkDevice device,
1839 const VkDynamicDsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001840 VkDynamicDsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001841{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001842 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001843 struct nulldrv_dev *dev = nulldrv_dev(device);
1844
1845 return nulldrv_ds_state_create(dev, pCreateInfo,
1846 (struct nulldrv_dynamic_ds **) pState);
1847}
1848
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001849ICD_EXPORT VkResult VKAPI vkCreateBufferView(
1850 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001851 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001852 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001853{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001854 NULLDRV_LOG_FUNC;
1855 struct nulldrv_dev *dev = nulldrv_dev(device);
1856
1857 return nulldrv_buf_view_create(dev, pCreateInfo,
1858 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07001859}
1860
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001861ICD_EXPORT VkResult VKAPI vkCreateImageView(
1862 VkDevice device,
1863 const VkImageViewCreateInfo* pCreateInfo,
1864 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001865{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001866 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001867 struct nulldrv_dev *dev = nulldrv_dev(device);
1868
1869 return nulldrv_img_view_create(dev, pCreateInfo,
1870 (struct nulldrv_img_view **) pView);
1871}
1872
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001873ICD_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
1874 VkDevice device,
1875 const VkColorAttachmentViewCreateInfo* pCreateInfo,
1876 VkColorAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001877{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001878 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001879 struct nulldrv_dev *dev = nulldrv_dev(device);
1880
1881 return nulldrv_rt_view_create(dev, pCreateInfo,
1882 (struct nulldrv_rt_view **) pView);
1883}
1884
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001885ICD_EXPORT VkResult VKAPI vkCreateDepthStencilView(
1886 VkDevice device,
1887 const VkDepthStencilViewCreateInfo* pCreateInfo,
1888 VkDepthStencilView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001889{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001890 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001891 struct nulldrv_dev *dev = nulldrv_dev(device);
1892
1893 return nulldrv_ds_view_create(dev, pCreateInfo,
1894 (struct nulldrv_ds_view **) pView);
1895
1896}
1897
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001898ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
1899 VkDevice device,
1900 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
1901 VkDescriptorSetLayout* pSetLayout)
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);
David Pinedo0257fbf2015-02-02 18:02:40 -07001905
Chia-I Wu7732cb22015-03-26 15:27:55 +08001906 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07001907 (struct nulldrv_desc_layout **) pSetLayout);
1908}
1909
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001910ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
1911 VkDevice device,
1912 const VkPipelineLayoutCreateInfo* pCreateInfo,
1913 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08001914{
1915 NULLDRV_LOG_FUNC;
1916 struct nulldrv_dev *dev = nulldrv_dev(device);
1917
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001918 return nulldrv_pipeline_layout_create(dev,
1919 pCreateInfo,
1920 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08001921}
1922
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001923ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
1924 VkDevice device,
1925 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07001926 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001927 const VkDescriptorPoolCreateInfo* pCreateInfo,
1928 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001929{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001930 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001931 struct nulldrv_dev *dev = nulldrv_dev(device);
1932
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001933 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
1934 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07001935}
1936
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001937ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06001938 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001939 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001940{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001941 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001942 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001943}
1944
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001945ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06001946 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001947 VkDescriptorPool descriptorPool,
1948 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07001949 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001950 const VkDescriptorSetLayout* pSetLayouts,
1951 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07001952 uint32_t* pCount)
1953{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001954 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001955 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
1956 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001957 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001958 uint32_t i;
1959
1960 for (i = 0; i < count; i++) {
1961 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001962 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07001963
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001964 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001965 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001966 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07001967 break;
1968 }
1969
1970 if (pCount)
1971 *pCount = i;
1972
1973 return ret;
1974}
1975
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08001976ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
1977 VkDevice device,
1978 uint32_t writeCount,
1979 const VkWriteDescriptorSet* pDescriptorWrites,
1980 uint32_t copyCount,
1981 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07001982{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001983 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08001984 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001985}
1986
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001987ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
1988 VkDevice device,
1989 const VkFramebufferCreateInfo* info,
1990 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07001991{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001992 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001993 struct nulldrv_dev *dev = nulldrv_dev(device);
1994
1995 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
1996}
1997
1998
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001999ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2000 VkDevice device,
2001 const VkRenderPassCreateInfo* info,
2002 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002003{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002004 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002005 struct nulldrv_dev *dev = nulldrv_dev(device);
2006
2007 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2008}
2009
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002010ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002011 VkCmdBuffer cmdBuffer,
2012 const VkRenderPassBegin* pRenderPassBegin)
David Pinedo0257fbf2015-02-02 18:02:40 -07002013{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002014 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002015}
2016
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002017ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002018 VkCmdBuffer cmdBuffer)
2019{
2020 NULLDRV_LOG_FUNC;
2021}
2022
2023ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2024 VkCmdBuffer cmdBuffer,
2025 uint32_t cmdBuffersCount,
2026 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002027{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002028 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002029}
Ian Elliottf93069f2015-02-19 14:26:19 -07002030
2031ICD_EXPORT void* xcbCreateWindow(
2032 uint16_t width,
2033 uint16_t height)
2034{
2035 static uint32_t window; // Kludge to the max
2036 NULLDRV_LOG_FUNC;
2037 return &window;
2038}
2039
2040// May not be needed, if we stub out stuf in tri.c
2041ICD_EXPORT void xcbDestroyWindow()
2042{
2043 NULLDRV_LOG_FUNC;
2044}
2045
2046ICD_EXPORT int xcbGetMessage(void *msg)
2047{
2048 NULLDRV_LOG_FUNC;
2049 return 0;
2050}
2051
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002052ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002053{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002054 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002055}