blob: 6e4ea00d5f106ede175512fb946d300d84cd2a66 [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,
Chia-I Wuc278df82015-07-07 11:50:03 +0800239 const VkAttachmentViewCreateInfo *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),
Chia-I Wuc278df82015-07-07 11:50:03 +0800245 VK_OBJECT_TYPE_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_sampler_create(struct nulldrv_dev *dev,
348 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700349 struct nulldrv_sampler **sampler_ret)
350{
351 struct nulldrv_sampler *sampler;
352
353 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600354 sizeof(*sampler), VK_OBJECT_TYPE_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700355 if (!sampler)
Tony Barbour8205d902015-04-16 15:59:00 -0600356 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700357
358 *sampler_ret = sampler;
359
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600360 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700361}
362
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600363static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
364 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700365 struct nulldrv_img_view **view_ret)
366{
367 struct nulldrv_img *img = nulldrv_img(info->image);
368 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700369
370 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600371 VK_OBJECT_TYPE_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700372 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600373 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700374
375 view->img = img;
David Pinedo0257fbf2015-02-02 18:02:40 -0700376
David Pinedo0257fbf2015-02-02 18:02:40 -0700377 view->cmd_len = 8;
378
379 *view_ret = view;
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 void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700385{
386 return mem->bo;
387}
388
Tony Barbour8205d902015-04-16 15:59:00 -0600389static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700390{
391 return (struct nulldrv_mem *) mem;
392}
393
394static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
395{
396 return (struct nulldrv_buf *) base;
397}
398
Tony Barbour426b9052015-06-24 16:06:58 -0600399static VkResult buf_get_memory_requirements(struct nulldrv_base *base,
400 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700401{
402 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
David Pinedo0257fbf2015-02-02 18:02:40 -0700403
Tony Barbour426b9052015-06-24 16:06:58 -0600404 if (pMemoryRequirements == NULL)
405 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700406
Tony Barbour426b9052015-06-24 16:06:58 -0600407 pMemoryRequirements->size = buf->size;
408 pMemoryRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700409
Tony Barbour426b9052015-06-24 16:06:58 -0600410 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700411}
412
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600413static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600414 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700415 struct nulldrv_buf **buf_ret)
416{
417 struct nulldrv_buf *buf;
418
419 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600420 VK_OBJECT_TYPE_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700421 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600422 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700423
424 buf->size = info->size;
425 buf->usage = info->usage;
426
Tony Barbour426b9052015-06-24 16:06:58 -0600427 buf->obj.base.get_memory_requirements = buf_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700428
429 *buf_ret = buf;
430
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600431 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700432}
433
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600434static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
435 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700436 struct nulldrv_desc_layout **layout_ret)
437{
438 struct nulldrv_desc_layout *layout;
439
440 layout = (struct nulldrv_desc_layout *)
441 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600442 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700443 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600444 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700445
446 *layout_ret = layout;
447
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600448 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700449}
450
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500451static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
452 const VkPipelineLayoutCreateInfo* pCreateInfo,
453 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800454{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500455 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800456
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500457 pipeline_layout = (struct nulldrv_pipeline_layout *)
458 nulldrv_base_create(dev, sizeof(*pipeline_layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600459 VK_OBJECT_TYPE_PIPELINE_LAYOUT);
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500460 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600461 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800462
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500463 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800464
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600465 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800466}
467
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600468static struct nulldrv_desc_layout *nulldrv_desc_layout(VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700469{
470 return (struct nulldrv_desc_layout *) layout;
471}
472
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600473static VkResult shader_create(struct nulldrv_dev *dev,
474 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700475 struct nulldrv_shader **sh_ret)
476{
David Pinedo0257fbf2015-02-02 18:02:40 -0700477 struct nulldrv_shader *sh;
478
479 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600480 VK_OBJECT_TYPE_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700481 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600482 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700483
484 *sh_ret = sh;
485
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600486 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700487}
488
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600489static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
490 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700491 struct nulldrv_pipeline **pipeline_ret)
492{
493 struct nulldrv_pipeline *pipeline;
494
495 pipeline = (struct nulldrv_pipeline *)
496 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600497 VK_OBJECT_TYPE_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700498 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600499 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700500
501 *pipeline_ret = pipeline;
502
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600503 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700504}
505
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600506static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
507 const VkDynamicVpStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700508 struct nulldrv_dynamic_vp **state_ret)
509{
510 struct nulldrv_dynamic_vp *state;
511
512 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600513 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_VP_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700514 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600515 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700516
517 *state_ret = state;
518
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600519 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700520}
521
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600522static VkResult nulldrv_raster_state_create(struct nulldrv_dev *dev,
523 const VkDynamicRsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700524 struct nulldrv_dynamic_rs **state_ret)
525{
526 struct nulldrv_dynamic_rs *state;
527
528 state = (struct nulldrv_dynamic_rs *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600529 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700530 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600531 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700532
533 *state_ret = state;
534
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600535 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700536}
537
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600538static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
539 const VkDynamicCbStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700540 struct nulldrv_dynamic_cb **state_ret)
541{
542 struct nulldrv_dynamic_cb *state;
543
544 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600545 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_CB_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700546 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600547 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700548
549 *state_ret = state;
550
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600551 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700552}
553
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600554static VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
555 const VkDynamicDsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700556 struct nulldrv_dynamic_ds **state_ret)
557{
558 struct nulldrv_dynamic_ds *state;
559
560 state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600561 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700562 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600563 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700564
565 *state_ret = state;
566
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600567 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700568}
569
570
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600571static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
572 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700573 struct nulldrv_cmd **cmd_ret)
574{
David Pinedo0257fbf2015-02-02 18:02:40 -0700575 struct nulldrv_cmd *cmd;
576
David Pinedo0257fbf2015-02-02 18:02:40 -0700577 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600578 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700579 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600580 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700581
582 *cmd_ret = cmd;
583
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600584 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700585}
586
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600587static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
588 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700589 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600590 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800591 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700592{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800593 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700594
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800595 pool = (struct nulldrv_desc_pool *)
596 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600597 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800598 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600599 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700600
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800601 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700602
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800603 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700604
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_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800609 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600610 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700611 const struct nulldrv_desc_layout *layout,
612 struct nulldrv_desc_set **set_ret)
613{
614 struct nulldrv_desc_set *set;
615
616 set = (struct nulldrv_desc_set *)
617 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600618 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700619 if (!set)
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 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700623 set->layout = layout;
624 *set_ret = set;
625
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600626 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700627}
628
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600629static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700630{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800631 return (struct nulldrv_desc_pool *) pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700632}
633
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600634static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
635 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700636 struct nulldrv_framebuffer ** fb_ret)
637{
638
639 struct nulldrv_framebuffer *fb;
640 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600641 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700642 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600643 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700644
645 *fb_ret = fb;
646
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600647 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700648
649}
650
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600651static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
652 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700653 struct nulldrv_render_pass** rp_ret)
654{
655 struct nulldrv_render_pass *rp;
656 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600657 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700658 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600659 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700660
661 *rp_ret = rp;
662
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600663 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700664}
665
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600666static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700667{
668 return (struct nulldrv_buf *) buf;
669}
670
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600671static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600672 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700673 struct nulldrv_buf_view **view_ret)
674{
675 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
676 struct nulldrv_buf_view *view;
677
678 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600679 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700680 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600681 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700682
683 view->buf = buf;
684
685 *view_ret = view;
686
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600687 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700688}
689
David Pinedo0257fbf2015-02-02 18:02:40 -0700690
691//*********************************************
692// Driver entry points
693//*********************************************
694
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600695ICD_EXPORT VkResult VKAPI vkCreateBuffer(
696 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600697 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600698 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700699{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700700 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700701 struct nulldrv_dev *dev = nulldrv_dev(device);
702
703 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
704}
705
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600706ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
707 VkDevice device,
708 const VkCmdBufferCreateInfo* pCreateInfo,
709 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700710{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700711 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700712 struct nulldrv_dev *dev = nulldrv_dev(device);
713
714 return nulldrv_cmd_create(dev, pCreateInfo,
715 (struct nulldrv_cmd **) pCmdBuffer);
716}
717
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600718ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
719 VkCmdBuffer cmdBuffer,
720 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700721{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700722 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600723 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700724}
725
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600726ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
727 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700728{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700729 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600730 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700731}
732
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600733ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
734 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700735{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700736 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600737 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700738}
739
Ian Elliott64a68e12015-04-16 11:57:46 -0600740static const VkFormat nulldrv_presentable_formats[] = {
741 VK_FORMAT_B8G8R8A8_UNORM,
742};
743
Jon Ashburnba4a1952015-06-16 12:44:51 -0600744#if 0
Ian Elliott64a68e12015-04-16 11:57:46 -0600745ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
746 VkDisplayWSI display,
747 VkDisplayInfoTypeWSI infoType,
748 size_t* pDataSize,
749 void* pData)
750{
751 VkResult ret = VK_SUCCESS;
752
753 NULLDRV_LOG_FUNC;
754
755 if (!pDataSize)
756 return VK_ERROR_INVALID_POINTER;
757
758 switch (infoType) {
759 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
760 {
761 VkDisplayFormatPropertiesWSI *dst = pData;
762 size_t size_ret;
763 uint32_t i;
764
765 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
766
767 if (dst && *pDataSize < size_ret)
768 return VK_ERROR_INVALID_VALUE;
769
770 *pDataSize = size_ret;
771 if (!dst)
772 return VK_SUCCESS;
773
774 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
775 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
776 }
777 break;
778 default:
779 ret = VK_ERROR_INVALID_VALUE;
780 break;
781 }
782
783 return ret;
784}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600785#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600786
787ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
788 VkDevice device,
789 const VkSwapChainCreateInfoWSI* pCreateInfo,
790 VkSwapChainWSI* pSwapChain)
791{
792 NULLDRV_LOG_FUNC;
793 struct nulldrv_dev *dev = nulldrv_dev(device);
794 struct nulldrv_swap_chain *sc;
795
796 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600797 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600798 if (!sc) {
799 return VK_ERROR_OUT_OF_HOST_MEMORY;
800 }
801 sc->dev = dev;
802
Tony Barbour11e76ac2015-04-20 16:28:46 -0600803 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600804
805 return VK_SUCCESS;
806}
807
808ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
809 VkSwapChainWSI swapChain)
810{
811 NULLDRV_LOG_FUNC;
812 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
813
814 free(sc);
815
816 return VK_SUCCESS;
817}
818
819ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
820 VkSwapChainWSI swapChain,
821 VkSwapChainInfoTypeWSI infoType,
822 size_t* pDataSize,
823 void* pData)
824{
825 NULLDRV_LOG_FUNC;
826 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
827 struct nulldrv_dev *dev = sc->dev;
828 VkResult ret = VK_SUCCESS;
829
830 if (!pDataSize)
831 return VK_ERROR_INVALID_POINTER;
832
833 switch (infoType) {
834 case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
835 {
836 VkSwapChainImageInfoWSI *images;
837 const size_t size = sizeof(*images) * 2;
838 uint32_t i;
839
840 if (pData && *pDataSize < size)
841 return VK_ERROR_INVALID_VALUE;
842
843 *pDataSize = size;
844 if (!pData)
845 return VK_SUCCESS;
846
847 images = (VkSwapChainImageInfoWSI *) pData;
848 for (i = 0; i < 2; i++) {
849 struct nulldrv_img *img;
850 struct nulldrv_mem *mem;
851
852 img = (struct nulldrv_img *) nulldrv_base_create(dev,
853 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600854 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600855 if (!img)
856 return VK_ERROR_OUT_OF_HOST_MEMORY;
857
858 mem = (struct nulldrv_mem *) nulldrv_base_create(dev,
859 sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600860 VK_OBJECT_TYPE_DEVICE_MEMORY);
Ian Elliott64a68e12015-04-16 11:57:46 -0600861 if (!mem)
862 return VK_ERROR_OUT_OF_HOST_MEMORY;
863
864 images[i].image = (VkImage) img;
865 images[i].memory = (VkDeviceMemory) mem;
866 }
867 }
868 break;
869 default:
870 ret = VK_ERROR_INVALID_VALUE;
871 break;
872 }
873
874 return ret;
875}
876
877ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
878 VkQueue queue_,
879 const VkPresentInfoWSI* pPresentInfo)
880{
881 NULLDRV_LOG_FUNC;
882
883 return VK_SUCCESS;
884}
885
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600886ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600887 VkCmdBuffer cmdBuffer,
888 VkBuffer srcBuffer,
889 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700890 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600891 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700892{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700893 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700894}
895
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600896ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600897 VkCmdBuffer cmdBuffer,
898 VkImage srcImage,
899 VkImageLayout srcImageLayout,
900 VkImage destImage,
901 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700902 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600903 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700904{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700905 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700906}
907
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600908ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600909 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500910 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600911 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500912 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600913 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500914 uint32_t regionCount,
915 const VkImageBlit* pRegions,
916 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600917{
918 NULLDRV_LOG_FUNC;
919}
920
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600921ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600922 VkCmdBuffer cmdBuffer,
923 VkBuffer srcBuffer,
924 VkImage destImage,
925 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700926 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600927 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700928{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700929 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700930}
931
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600932ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600933 VkCmdBuffer cmdBuffer,
934 VkImage srcImage,
935 VkImageLayout srcImageLayout,
936 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700937 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600938 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700939{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700940 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700941}
942
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600943ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600944 VkCmdBuffer cmdBuffer,
945 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600946 VkDeviceSize destOffset,
947 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700948 const uint32_t* pData)
949{
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 vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600954 VkCmdBuffer cmdBuffer,
955 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600956 VkDeviceSize destOffset,
957 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700958 uint32_t data)
959{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700960 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700961}
962
Ian Elliotte924ab22015-07-08 13:24:30 -0600963ICD_EXPORT void VKAPI vkCmdClearDepthStencilImage(
964 VkCmdBuffer cmdBuffer,
965 VkImage image,
966 VkImageLayout imageLayout,
967 float depth,
968 uint32_t stencil,
969 uint32_t rangeCount,
970 const VkImageSubresourceRange* pRanges)
971{
972 NULLDRV_LOG_FUNC;
973}
974
975ICD_EXPORT void VKAPI vkCmdClearColorAttachment(
976 VkCmdBuffer cmdBuffer,
977 uint32_t colorAttachment,
978 VkImageLayout imageLayout,
979 const VkClearColorValue *pColor,
980 uint32_t rectCount,
981 const VkRect3D *pRects)
982{
983 NULLDRV_LOG_FUNC;
984}
985
986ICD_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(
987 VkCmdBuffer cmdBuffer,
988 VkImageAspectFlags imageAspectMask,
989 VkImageLayout imageLayout,
990 float depth,
991 uint32_t stencil,
992 uint32_t rectCount,
993 const VkRect3D *pRects)
994{
995 NULLDRV_LOG_FUNC;
996}
997
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600998ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -0600999 VkCmdBuffer cmdBuffer,
1000 VkImage image,
1001 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +12001002 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001003 uint32_t rangeCount,
1004 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001005{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001006 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001007}
1008
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001009ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001010 VkCmdBuffer cmdBuffer,
1011 VkImage image,
1012 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001013 float depth,
1014 uint32_t stencil,
1015 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001016 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001017{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001018 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001019}
1020
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001021ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001022 VkCmdBuffer cmdBuffer,
1023 VkImage srcImage,
1024 VkImageLayout srcImageLayout,
1025 VkImage destImage,
1026 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001027 uint32_t regionCount,
1028 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001029{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001030 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001031}
1032
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001033ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001034 VkCmdBuffer cmdBuffer,
1035 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001036 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001037 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001038{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001039 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001040}
1041
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001042ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001043 VkCmdBuffer cmdBuffer,
1044 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001045 uint32_t slot)
1046{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001047 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001048}
1049
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001050ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001051 VkCmdBuffer cmdBuffer,
1052 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001053 uint32_t startQuery,
1054 uint32_t queryCount)
1055{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001056 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001057}
1058
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001059ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001060 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001061 VkEvent event_,
1062 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001063{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001064 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001065}
1066
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001067ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001068 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001069 VkEvent event_,
1070 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001071{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001072 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001073}
1074
Ian Elliott63f1edb2015-04-16 18:10:19 -06001075ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1076 VkCmdBuffer cmdBuffer,
1077 VkQueryPool queryPool,
1078 uint32_t startQuery,
1079 uint32_t queryCount,
1080 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001081 VkDeviceSize destOffset,
1082 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001083 VkFlags flags)
1084{
1085 NULLDRV_LOG_FUNC;
1086}
1087
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001088ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001089 VkCmdBuffer cmdBuffer,
1090 VkTimestampType timestampType,
1091 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001092 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001093{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001094 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001095}
1096
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001097ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001098 VkCmdBuffer cmdBuffer,
1099 VkPipelineBindPoint pipelineBindPoint,
1100 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001101{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001102 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001103}
1104
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001105ICD_EXPORT void VKAPI vkCmdBindDynamicStateObject(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001106 VkCmdBuffer cmdBuffer,
1107 VkStateBindPoint stateBindPoint,
1108 VkDynamicStateObject state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001109{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001110 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001111}
1112
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001113ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001114 VkCmdBuffer cmdBuffer,
1115 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001116 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001117 uint32_t firstSet,
1118 uint32_t setCount,
1119 const VkDescriptorSet* pDescriptorSets,
1120 uint32_t dynamicOffsetCount,
1121 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001122{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001123 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001124}
1125
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001126ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1127 VkCmdBuffer cmdBuffer,
1128 uint32_t startBinding,
1129 uint32_t bindingCount,
1130 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001131 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001132{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001133 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001134}
1135
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001136ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001137 VkCmdBuffer cmdBuffer,
1138 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001139 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001140 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001141{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001142 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001143}
1144
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001145ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001146 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001147 uint32_t firstVertex,
1148 uint32_t vertexCount,
1149 uint32_t firstInstance,
1150 uint32_t instanceCount)
1151{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001152 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001153}
1154
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001155ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001156 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001157 uint32_t firstIndex,
1158 uint32_t indexCount,
1159 int32_t vertexOffset,
1160 uint32_t firstInstance,
1161 uint32_t instanceCount)
1162{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001163 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001164}
1165
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001166ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001167 VkCmdBuffer cmdBuffer,
1168 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001169 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001170 uint32_t count,
1171 uint32_t stride)
1172{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001173 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001174}
1175
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001176ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001177 VkCmdBuffer cmdBuffer,
1178 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001179 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001180 uint32_t count,
1181 uint32_t stride)
1182{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001183 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001184}
1185
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001186ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001187 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001188 uint32_t x,
1189 uint32_t y,
1190 uint32_t z)
1191{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001192 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001193}
1194
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001195ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001196 VkCmdBuffer cmdBuffer,
1197 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001198 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001199{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001200 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001201}
1202
Tony Barbour8205d902015-04-16 15:59:00 -06001203void VKAPI vkCmdWaitEvents(
1204 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001205 uint32_t eventCount,
1206 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001207 VkPipelineStageFlags sourceStageMask,
1208 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001209 uint32_t memBarrierCount,
1210 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001211{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001212 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001213}
1214
Tony Barbour8205d902015-04-16 15:59:00 -06001215void VKAPI vkCmdPipelineBarrier(
1216 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001217 VkPipelineStageFlags sourceStageMask,
1218 VkPipelineStageFlags destStageMask,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001219 VkBool32 byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001220 uint32_t memBarrierCount,
1221 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001222{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001223 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001224}
1225
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001226ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001227 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001228 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001229 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001230{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001231 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001232 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1233 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1234}
1235
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001236ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1237 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001238{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001239 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001240 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001241}
1242
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001243ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1244 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001245 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001246 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001247 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001248{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001249 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001250 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001251 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001252 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001253}
1254
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001255ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1256 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001257{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001258 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001259 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001260}
1261
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001262ICD_EXPORT VkResult VKAPI vkCreateEvent(
1263 VkDevice device,
1264 const VkEventCreateInfo* pCreateInfo,
1265 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001266{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001267 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001268 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001269}
1270
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001271ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001272 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001273 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001274{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001275 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001276 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001277}
1278
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001279ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001280 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001281 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001282{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001283 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001284 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001285}
1286
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001287ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001288 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001289 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001290{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001291 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001292 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001293}
1294
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001295ICD_EXPORT VkResult VKAPI vkCreateFence(
1296 VkDevice device,
1297 const VkFenceCreateInfo* pCreateInfo,
1298 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001299{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001300 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001301 struct nulldrv_dev *dev = nulldrv_dev(device);
1302
1303 return nulldrv_fence_create(dev, pCreateInfo,
1304 (struct nulldrv_fence **) pFence);
1305}
1306
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001307ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001308 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001309 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001310{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001311 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001312 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001313}
1314
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001315ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001316 VkDevice device,
1317 uint32_t fenceCount,
1318 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001319{
1320 NULLDRV_LOG_FUNC;
1321 return VK_SUCCESS;
1322}
1323
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001324ICD_EXPORT VkResult VKAPI vkWaitForFences(
1325 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001326 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001327 const VkFence* pFences,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001328 VkBool32 waitAll,
David Pinedo0257fbf2015-02-02 18:02:40 -07001329 uint64_t timeout)
1330{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001331 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001332 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001333}
1334
Tony Barbour426b9052015-06-24 16:06:58 -06001335ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1336 VkPhysicalDevice gpu_,
1337 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001338{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001339 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001340 VkResult ret = VK_SUCCESS;
1341
Tony Barbour426b9052015-06-24 16:06:58 -06001342 pProperties->apiVersion = VK_API_VERSION;
1343 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1344 pProperties->vendorId = 0;
1345 pProperties->deviceId = 0;
1346 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1347 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001348
1349 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001350}
1351
Chris Forbesd7576302015-06-21 22:55:02 +12001352ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1353 VkPhysicalDevice physicalDevice,
1354 VkPhysicalDeviceFeatures* pFeatures)
1355{
1356 NULLDRV_LOG_FUNC;
1357 VkResult ret = VK_SUCCESS;
1358
1359 /* TODO: fill out features */
1360 memset(pFeatures, 0, sizeof(*pFeatures));
1361
1362 return ret;
1363}
1364
1365ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatInfo(
1366 VkPhysicalDevice physicalDevice,
1367 VkFormat format,
1368 VkFormatProperties* pFormatInfo)
1369{
1370 NULLDRV_LOG_FUNC;
1371 VkResult ret = VK_SUCCESS;
1372
1373 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1374 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1375
1376 return ret;
1377}
1378
1379ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1380 VkPhysicalDevice physicalDevice,
1381 VkPhysicalDeviceLimits* pLimits)
1382{
1383 NULLDRV_LOG_FUNC;
1384 VkResult ret = VK_SUCCESS;
1385
1386 /* TODO: fill out limits */
1387 memset(pLimits, 0, sizeof(*pLimits));
1388
1389 return ret;
1390}
1391
Tony Barbour426b9052015-06-24 16:06:58 -06001392ICD_EXPORT VkResult VKAPI vkGetPhysicalDevicePerformance(
1393 VkPhysicalDevice gpu_,
1394 VkPhysicalDevicePerformance* pPerformance)
Jon Ashburneb2728b2015-04-10 14:33:07 -06001395{
Tony Barbour426b9052015-06-24 16:06:58 -06001396 pPerformance->maxDeviceClock = 1.0f;
1397 pPerformance->aluPerClock = 1.0f;
1398 pPerformance->texPerClock = 1.0f;
1399 pPerformance->primsPerClock = 1.0f;
1400 pPerformance->pixelsPerClock = 1.0f;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001401
1402 return VK_SUCCESS;
1403}
1404
Tony Barbour426b9052015-06-24 16:06:58 -06001405ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueCount(
1406 VkPhysicalDevice gpu_,
1407 uint32_t* pCount)
David Pinedo0257fbf2015-02-02 18:02:40 -07001408{
Tony Barbour426b9052015-06-24 16:06:58 -06001409 *pCount = 1;
1410 return VK_SUCCESS;
1411}
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001412
Tony Barbour426b9052015-06-24 16:06:58 -06001413ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueProperties(
1414 VkPhysicalDevice gpu_,
1415 uint32_t count,
1416 VkPhysicalDeviceQueueProperties* pProperties)
1417 {
1418 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1419 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001420 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001421
Tony Barbour426b9052015-06-24 16:06:58 -06001422 return VK_SUCCESS;
1423}
1424
Ian Elliotte924ab22015-07-08 13:24:30 -06001425ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(
1426 VkPhysicalDevice gpu_,
1427 VkPhysicalDeviceMemoryProperties* pProperties)
1428{
1429 // TODO: Fill in with real data
1430 return VK_SUCCESS;
1431}
1432
1433ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLayerProperties(
1434 VkPhysicalDevice physicalDevice,
1435 uint32_t* pCount,
1436 VkLayerProperties* pProperties)
1437{
1438 // TODO: Fill in with real data
1439 return VK_SUCCESS;
1440}
1441
Tony Barbour426b9052015-06-24 16:06:58 -06001442ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001443 const char* pLayerName,
1444 uint32_t* pCount,
1445 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001446{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001447 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001448
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001449 if (pCount == NULL) {
1450 return VK_ERROR_INVALID_POINTER;
1451 }
Tony Barbour426b9052015-06-24 16:06:58 -06001452
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001453 if (pProperties == NULL) {
1454 *pCount = NULLDRV_EXT_COUNT;
1455 return VK_SUCCESS;
1456 }
Tony Barbour426b9052015-06-24 16:06:58 -06001457
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001458 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1459 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1460 *pCount = copy_size;
1461 if (copy_size < NULLDRV_EXT_COUNT) {
1462 return VK_INCOMPLETE;
1463 }
Tony Barbour426b9052015-06-24 16:06:58 -06001464 return VK_SUCCESS;
1465}
Ian Elliotte924ab22015-07-08 13:24:30 -06001466ICD_EXPORT VkResult VKAPI vkGetGlobalLayerProperties(
1467 uint32_t* pCount,
1468 VkLayerProperties* pProperties)
1469{
1470 // TODO: Fill in with real data
1471 return VK_SUCCESS;
1472}
Tony Barbour426b9052015-06-24 16:06:58 -06001473
1474VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001475 VkPhysicalDevice physicalDevice,
1476 const char* pLayerName,
1477 uint32_t* pCount,
1478 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001479{
Tony Barbour426b9052015-06-24 16:06:58 -06001480
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001481 if (pCount == NULL) {
1482 return VK_ERROR_INVALID_POINTER;
1483 }
1484
Tony Barbour426b9052015-06-24 16:06:58 -06001485 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001486
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001487 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001488}
1489
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001490ICD_EXPORT VkResult VKAPI vkCreateImage(
1491 VkDevice device,
1492 const VkImageCreateInfo* pCreateInfo,
1493 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001494{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001495 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001496 struct nulldrv_dev *dev = nulldrv_dev(device);
1497
1498 return nulldrv_img_create(dev, pCreateInfo, false,
1499 (struct nulldrv_img **) pImage);
1500}
1501
Tony Barbour426b9052015-06-24 16:06:58 -06001502ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001503 VkDevice device,
1504 VkImage image,
1505 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001506 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001507{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001508 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001509
Tony Barbour426b9052015-06-24 16:06:58 -06001510 pLayout->offset = 0;
1511 pLayout->size = 1;
1512 pLayout->rowPitch = 4;
1513 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001514
Tony Barbour426b9052015-06-24 16:06:58 -06001515 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001516}
1517
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001518ICD_EXPORT VkResult VKAPI vkAllocMemory(
1519 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001520 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001521 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001522{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001523 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001524 struct nulldrv_dev *dev = nulldrv_dev(device);
1525
1526 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1527}
1528
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001529ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001530 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001531 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001532{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001533 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001534 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001535}
1536
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001537ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001538 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001539 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001540 VkDeviceSize offset,
1541 VkDeviceSize size,
1542 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001543 void** ppData)
1544{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001545 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001546 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1547 void *ptr = nulldrv_mem_map(mem, flags);
1548
1549 *ppData = ptr;
1550
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001551 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001552}
1553
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001554ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001555 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001556 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001557{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001558 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001559 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001560}
1561
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001562ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001563 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001564 uint32_t memRangeCount,
1565 const VkMappedMemoryRange* pMemRanges)
1566{
1567 NULLDRV_LOG_FUNC;
1568 return VK_SUCCESS;
1569}
1570
1571ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1572 VkDevice device,
1573 uint32_t memRangeCount,
1574 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001575{
1576 NULLDRV_LOG_FUNC;
1577 return VK_SUCCESS;
1578}
1579
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001580ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001581 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001582 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001583{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001584 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001585 struct nulldrv_instance *inst;
1586
1587 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001588 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001589 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001590 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001591
Tony Barbour426b9052015-06-24 16:06:58 -06001592 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001593
Mike Stroyan230e6252015-04-17 12:36:38 -06001594 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001595
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001596 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001597}
1598
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001599ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1600 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001601{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001602 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001603 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001604}
1605
Tony Barbour8205d902015-04-16 15:59:00 -06001606ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001607 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001608 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001609 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001610{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001611 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001612 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001613 struct nulldrv_gpu *gpu;
1614 *pGpuCount = 1;
1615 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001616 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001617 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001618 return ret;
1619}
1620
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001621ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001622 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001623 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001624 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001625 char* const* pOutLayers,
1626 void* pReserved)
1627{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001628 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001629 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001630}
1631
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001632ICD_EXPORT VkResult VKAPI vkDestroyObject(
Mike Stroyan230e6252015-04-17 12:36:38 -06001633 VkDevice device,
1634 VkObjectType objType,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001635 VkObject object)
David Pinedo0257fbf2015-02-02 18:02:40 -07001636{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001637 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001638 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001639}
1640
Tony Barbour426b9052015-06-24 16:06:58 -06001641ICD_EXPORT VkResult VKAPI vkGetObjectMemoryRequirements(
Mike Stroyan230e6252015-04-17 12:36:38 -06001642 VkDevice device,
1643 VkObjectType objType,
1644 VkObject object,
Tony Barbour426b9052015-06-24 16:06:58 -06001645 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -07001646{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001647 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001648 struct nulldrv_base *base = nulldrv_base(object);
1649
Tony Barbour426b9052015-06-24 16:06:58 -06001650 return base->get_memory_requirements(base, pMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -07001651}
1652
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001653ICD_EXPORT VkResult VKAPI vkBindObjectMemory(
1654 VkDevice device,
Mike Stroyan230e6252015-04-17 12:36:38 -06001655 VkObjectType objType,
1656 VkObject object,
Tony Barbour8205d902015-04-16 15:59:00 -06001657 VkDeviceMemory mem_,
1658 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001659{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001660 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001661 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001662}
1663
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001664ICD_EXPORT VkResult VKAPI vkGetImageSparseMemoryRequirements(
1665 VkDevice device,
1666 VkImage image,
1667 uint32_t* pNumRequirements,
1668 VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
1669{
1670 NULLDRV_LOG_FUNC;
1671 return VK_SUCCESS;
1672}
1673
1674ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(
1675 VkPhysicalDevice physicalDevice,
1676 VkFormat format,
1677 VkImageType type,
1678 uint32_t samples,
1679 VkImageUsageFlags usage,
1680 VkImageTiling tiling,
1681 uint32_t* pNumProperties,
1682 VkSparseImageFormatProperties* pProperties)
1683{
1684 NULLDRV_LOG_FUNC;
1685 return VK_SUCCESS;
1686}
1687
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001688ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001689 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001690 VkBuffer buffer,
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001691 uint32_t numBindings,
1692 const VkSparseMemoryBindInfo* pBindInfo)
1693{
1694 NULLDRV_LOG_FUNC;
1695 return VK_SUCCESS;
1696}
1697
1698ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageOpaqueMemory(
1699 VkQueue queue,
1700 VkImage image,
1701 uint32_t numBindings,
1702 const VkSparseMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001703{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001704 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001705 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001706}
1707
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001708ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001709 VkQueue queue,
1710 VkImage image,
1711 uint32_t numBindings,
1712 const VkSparseImageMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001713{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001714 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001715 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001716}
Jon Ashburn0e249962015-07-10 09:41:15 -07001717ICD_EXPORT VkResult VKAPI vkCreatePipelineCache(
1718 VkDevice device,
1719 const VkPipelineCacheCreateInfo* pCreateInfo,
1720 VkPipelineCache* pPipelineCache)
1721{
David Pinedo0257fbf2015-02-02 18:02:40 -07001722
Jon Ashburn0e249962015-07-10 09:41:15 -07001723 NULLDRV_LOG_FUNC;
1724 return VK_SUCCESS;
1725}
1726
1727VkResult VKAPI vkDestroyPipelineCache(
1728 VkDevice device,
1729 VkPipelineCache pipelineCache)
1730{
1731 NULLDRV_LOG_FUNC;
1732 return VK_SUCCESS;
1733}
1734
1735ICD_EXPORT size_t VKAPI vkGetPipelineCacheSize(
1736 VkDevice device,
1737 VkPipelineCache pipelineCache)
1738{
1739 NULLDRV_LOG_FUNC;
1740 return VK_ERROR_UNAVAILABLE;
1741}
1742
1743ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
1744 VkDevice device,
1745 VkPipelineCache pipelineCache,
1746 void* pData)
1747{
1748 NULLDRV_LOG_FUNC;
1749 return VK_ERROR_UNAVAILABLE;
1750}
1751
1752ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
1753 VkDevice device,
1754 VkPipelineCache destCache,
1755 uint32_t srcCacheCount,
1756 const VkPipelineCache* pSrcCaches)
1757{
1758 NULLDRV_LOG_FUNC;
1759 return VK_ERROR_UNAVAILABLE;
1760}
1761ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001762 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001763 VkPipelineCache pipelineCache,
1764 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001765 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1766 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001767{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001768 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001769 struct nulldrv_dev *dev = nulldrv_dev(device);
1770
1771 return graphics_pipeline_create(dev, pCreateInfo,
1772 (struct nulldrv_pipeline **) pPipeline);
1773}
1774
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001775
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001776
Jon Ashburn0e249962015-07-10 09:41:15 -07001777ICD_EXPORT VkResult VKAPI vkCreateComputePipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001778 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001779 VkPipelineCache pipelineCache,
1780 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001781 const VkComputePipelineCreateInfo* pCreateInfo,
1782 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001783{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001784 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001785 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001786}
1787
David Pinedo0257fbf2015-02-02 18:02:40 -07001788
David Pinedo0257fbf2015-02-02 18:02:40 -07001789
Jon Ashburn0e249962015-07-10 09:41:15 -07001790
David Pinedo0257fbf2015-02-02 18:02:40 -07001791
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001792ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1793 VkDevice device,
1794 const VkQueryPoolCreateInfo* pCreateInfo,
1795 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001796{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001797 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001798 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001799}
1800
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001801ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001802 VkDevice device,
1803 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001804 uint32_t startQuery,
1805 uint32_t queryCount,
1806 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001807 void* pData,
1808 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001809{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001810 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001811 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001812}
1813
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001814ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1815 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001816{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001817 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001818 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001819}
1820
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001821ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1822 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001823 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001824 const VkCmdBuffer* pCmdBuffers,
1825 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001826{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001827 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001828 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001829}
1830
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001831ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1832 VkDevice device,
1833 const VkSemaphoreCreateInfo* pCreateInfo,
1834 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001835{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001836 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001837 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001838}
1839
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001840ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1841 VkQueue queue,
1842 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001843{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001844 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001845 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001846}
1847
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001848ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1849 VkQueue queue,
1850 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001851{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001852 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001853 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001854}
1855
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001856ICD_EXPORT VkResult VKAPI vkCreateSampler(
1857 VkDevice device,
1858 const VkSamplerCreateInfo* pCreateInfo,
1859 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07001860{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001861 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001862 struct nulldrv_dev *dev = nulldrv_dev(device);
1863
1864 return nulldrv_sampler_create(dev, pCreateInfo,
1865 (struct nulldrv_sampler **) pSampler);
1866}
1867
Ian Elliotte924ab22015-07-08 13:24:30 -06001868ICD_EXPORT VkResult VKAPI vkCreateShaderModule(
1869 VkDevice device,
1870 const VkShaderModuleCreateInfo* pCreateInfo,
1871 VkShaderModule* pShaderModule)
1872{
1873 // TODO: Fill in with real data
1874 return VK_SUCCESS;
1875}
1876
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001877ICD_EXPORT VkResult VKAPI vkCreateShader(
1878 VkDevice device,
1879 const VkShaderCreateInfo* pCreateInfo,
1880 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07001881{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001882 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001883 struct nulldrv_dev *dev = nulldrv_dev(device);
1884
1885 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
1886}
1887
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001888ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
1889 VkDevice device,
1890 const VkDynamicVpStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001891 VkDynamicVpState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001892{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001893 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001894 struct nulldrv_dev *dev = nulldrv_dev(device);
1895
1896 return nulldrv_viewport_state_create(dev, pCreateInfo,
1897 (struct nulldrv_dynamic_vp **) pState);
1898}
1899
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001900ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
1901 VkDevice device,
1902 const VkDynamicRsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001903 VkDynamicRsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001904{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001905 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001906 struct nulldrv_dev *dev = nulldrv_dev(device);
1907
1908 return nulldrv_raster_state_create(dev, pCreateInfo,
1909 (struct nulldrv_dynamic_rs **) pState);
1910}
1911
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001912ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
1913 VkDevice device,
1914 const VkDynamicCbStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001915 VkDynamicCbState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001916{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001917 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001918 struct nulldrv_dev *dev = nulldrv_dev(device);
1919
1920 return nulldrv_blend_state_create(dev, pCreateInfo,
1921 (struct nulldrv_dynamic_cb **) pState);
1922}
1923
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001924ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
1925 VkDevice device,
1926 const VkDynamicDsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001927 VkDynamicDsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001928{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001929 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001930 struct nulldrv_dev *dev = nulldrv_dev(device);
1931
1932 return nulldrv_ds_state_create(dev, pCreateInfo,
1933 (struct nulldrv_dynamic_ds **) pState);
1934}
1935
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001936ICD_EXPORT VkResult VKAPI vkCreateBufferView(
1937 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001938 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001939 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001940{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001941 NULLDRV_LOG_FUNC;
1942 struct nulldrv_dev *dev = nulldrv_dev(device);
1943
1944 return nulldrv_buf_view_create(dev, pCreateInfo,
1945 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07001946}
1947
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001948ICD_EXPORT VkResult VKAPI vkCreateImageView(
1949 VkDevice device,
1950 const VkImageViewCreateInfo* pCreateInfo,
1951 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001952{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001953 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001954 struct nulldrv_dev *dev = nulldrv_dev(device);
1955
1956 return nulldrv_img_view_create(dev, pCreateInfo,
1957 (struct nulldrv_img_view **) pView);
1958}
1959
Chia-I Wuc278df82015-07-07 11:50:03 +08001960ICD_EXPORT VkResult VKAPI vkCreateAttachmentView(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001961 VkDevice device,
Chia-I Wuc278df82015-07-07 11:50:03 +08001962 const VkAttachmentViewCreateInfo* pCreateInfo,
1963 VkAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001964{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001965 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001966 struct nulldrv_dev *dev = nulldrv_dev(device);
1967
1968 return nulldrv_rt_view_create(dev, pCreateInfo,
1969 (struct nulldrv_rt_view **) pView);
1970}
1971
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001972ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
1973 VkDevice device,
1974 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
1975 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001976{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001977 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001978 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07001979
Chia-I Wu7732cb22015-03-26 15:27:55 +08001980 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07001981 (struct nulldrv_desc_layout **) pSetLayout);
1982}
1983
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001984ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
1985 VkDevice device,
1986 const VkPipelineLayoutCreateInfo* pCreateInfo,
1987 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08001988{
1989 NULLDRV_LOG_FUNC;
1990 struct nulldrv_dev *dev = nulldrv_dev(device);
1991
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001992 return nulldrv_pipeline_layout_create(dev,
1993 pCreateInfo,
1994 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08001995}
1996
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001997ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
1998 VkDevice device,
1999 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002000 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002001 const VkDescriptorPoolCreateInfo* pCreateInfo,
2002 VkDescriptorPool* pDescriptorPool)
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
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002007 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2008 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002009}
2010
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002011ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002012 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002013 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002014{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002015 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002016 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002017}
2018
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002019ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002020 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002021 VkDescriptorPool descriptorPool,
2022 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002023 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002024 const VkDescriptorSetLayout* pSetLayouts,
2025 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07002026 uint32_t* pCount)
2027{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002028 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002029 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2030 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002031 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002032 uint32_t i;
2033
2034 for (i = 0; i < count; i++) {
2035 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002036 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002037
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002038 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002039 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002040 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002041 break;
2042 }
2043
2044 if (pCount)
2045 *pCount = i;
2046
2047 return ret;
2048}
2049
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002050ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2051 VkDevice device,
2052 uint32_t writeCount,
2053 const VkWriteDescriptorSet* pDescriptorWrites,
2054 uint32_t copyCount,
2055 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002056{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002057 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002058 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002059}
2060
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002061ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2062 VkDevice device,
2063 const VkFramebufferCreateInfo* info,
2064 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002065{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002066 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002067 struct nulldrv_dev *dev = nulldrv_dev(device);
2068
2069 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2070}
2071
2072
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002073ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2074 VkDevice device,
2075 const VkRenderPassCreateInfo* info,
2076 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002077{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002078 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002079 struct nulldrv_dev *dev = nulldrv_dev(device);
2080
2081 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2082}
2083
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002084ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Chia-I Wuc278df82015-07-07 11:50:03 +08002085 VkCmdBuffer cmdBuffer,
2086 const VkRenderPassBeginInfo* pRenderPassBegin,
2087 VkRenderPassContents contents)
2088{
2089 NULLDRV_LOG_FUNC;
2090}
2091
2092ICD_EXPORT void VKAPI vkCmdNextSubpass(
2093 VkCmdBuffer cmdBuffer,
2094 VkRenderPassContents contents)
David Pinedo0257fbf2015-02-02 18:02:40 -07002095{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002096 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002097}
2098
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002099ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002100 VkCmdBuffer cmdBuffer)
2101{
2102 NULLDRV_LOG_FUNC;
2103}
2104
2105ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2106 VkCmdBuffer cmdBuffer,
2107 uint32_t cmdBuffersCount,
2108 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002109{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002110 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002111}
Ian Elliottf93069f2015-02-19 14:26:19 -07002112
2113ICD_EXPORT void* xcbCreateWindow(
2114 uint16_t width,
2115 uint16_t height)
2116{
2117 static uint32_t window; // Kludge to the max
2118 NULLDRV_LOG_FUNC;
2119 return &window;
2120}
2121
2122// May not be needed, if we stub out stuf in tri.c
2123ICD_EXPORT void xcbDestroyWindow()
2124{
2125 NULLDRV_LOG_FUNC;
2126}
2127
2128ICD_EXPORT int xcbGetMessage(void *msg)
2129{
2130 NULLDRV_LOG_FUNC;
2131 return 0;
2132}
2133
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002134ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002135{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002136 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002137}