blob: f497c52418213e78ba04e2ae246aadec35004192 [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
Tony Barbourde4124d2015-07-03 10:33:54 -060053static struct nulldrv_base *nulldrv_base(void* 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,
Tony Barbourde4124d2015-07-03 10:33:54 -060061 VkDbgObjectType 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 Barbourde4124d2015-07-03 10:33:54 -060077 set_loader_magic_value(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 Barbourde4124d2015-07-03 10:33:54 -0600104 set_loader_magic_value(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{
Tony Barbourde4124d2015-07-03 10:33:54 -0600321 return *(struct nulldrv_img **) &image;
David Pinedo0257fbf2015-02-02 18:02:40 -0700322}
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{
Tony Barbourde4124d2015-07-03 10:33:54 -0600391 return *(struct nulldrv_mem **) &mem;
David Pinedo0257fbf2015-02-02 18:02:40 -0700392}
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{
Tony Barbourde4124d2015-07-03 10:33:54 -0600470 return *(struct nulldrv_desc_layout **) &layout;
David Pinedo0257fbf2015-02-02 18:02:40 -0700471}
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,
Tony Barbourde4124d2015-07-03 10:33:54 -0600507 const VkDynamicViewportStateCreateInfo *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,
Tony Barbour2a199c12015-07-09 17:31:46 -0600513 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_VIEWPORT_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,
Tony Barbourde4124d2015-07-03 10:33:54 -0600523 const VkDynamicRasterStateCreateInfo *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,
Tony Barbour2a199c12015-07-09 17:31:46 -0600529 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RASTER_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,
Tony Barbourde4124d2015-07-03 10:33:54 -0600539 const VkDynamicColorBlendStateCreateInfo *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,
Tony Barbour2a199c12015-07-09 17:31:46 -0600545 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_COLOR_BLEND_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,
Tony Barbourde4124d2015-07-03 10:33:54 -0600555 const VkDynamicDepthStencilStateCreateInfo *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,
Tony Barbour2a199c12015-07-09 17:31:46 -0600561 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_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{
Tony Barbourde4124d2015-07-03 10:33:54 -0600631 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{
Tony Barbourde4124d2015-07-03 10:33:54 -0600668 return *(struct nulldrv_buf **) &buf;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700669}
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
Tony Barbourde4124d2015-07-03 10:33:54 -0600706ICD_EXPORT VkResult VKAPI vkDestroyBuffer(
707 VkDevice device,
708 VkBuffer buffer)
709{
710 NULLDRV_LOG_FUNC;
711 return VK_SUCCESS;
712}
713
Cody Northropf02f9f82015-07-09 18:08:05 -0600714ICD_EXPORT VkResult VKAPI vkCreateCommandPool(
715 VkDevice device,
716 const VkCmdPoolCreateInfo* pCreateInfo,
717 VkCmdPool* pCmdPool)
718{
719 NULLDRV_LOG_FUNC;
720 return VK_SUCCESS;
721}
722
723ICD_EXPORT VkResult VKAPI vkDestroyCommandPool(
724 VkDevice device,
725 VkCmdPool cmdPool)
726{
727 NULLDRV_LOG_FUNC;
728 return VK_SUCCESS;
729}
730
731ICD_EXPORT VkResult VKAPI vkResetCommandPool(
732 VkDevice device,
733 VkCmdPool cmdPool,
734 VkCmdPoolResetFlags flags)
735{
736 NULLDRV_LOG_FUNC;
737 return VK_SUCCESS;
738}
739
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600740ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
741 VkDevice device,
742 const VkCmdBufferCreateInfo* pCreateInfo,
743 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700744{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700745 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700746 struct nulldrv_dev *dev = nulldrv_dev(device);
747
748 return nulldrv_cmd_create(dev, pCreateInfo,
749 (struct nulldrv_cmd **) pCmdBuffer);
750}
751
Tony Barbourde4124d2015-07-03 10:33:54 -0600752ICD_EXPORT VkResult VKAPI vkDestroyCommandBuffer(
753 VkDevice device,
754 VkCmdBuffer cmdBuffer)
755{
756 NULLDRV_LOG_FUNC;
757 return VK_SUCCESS;
758}
759
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600760ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
761 VkCmdBuffer cmdBuffer,
762 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700763{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700764 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600765 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700766}
767
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600768ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
769 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700770{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700771 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600772 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700773}
774
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600775ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
Cody Northropf02f9f82015-07-09 18:08:05 -0600776 VkCmdBuffer cmdBuffer,
777 VkCmdBufferResetFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700778{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700779 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600780 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700781}
782
Ian Elliott64a68e12015-04-16 11:57:46 -0600783static const VkFormat nulldrv_presentable_formats[] = {
784 VK_FORMAT_B8G8R8A8_UNORM,
785};
786
Jon Ashburnba4a1952015-06-16 12:44:51 -0600787#if 0
Ian Elliott64a68e12015-04-16 11:57:46 -0600788ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
789 VkDisplayWSI display,
790 VkDisplayInfoTypeWSI infoType,
791 size_t* pDataSize,
792 void* pData)
793{
794 VkResult ret = VK_SUCCESS;
795
796 NULLDRV_LOG_FUNC;
797
798 if (!pDataSize)
799 return VK_ERROR_INVALID_POINTER;
800
801 switch (infoType) {
802 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
803 {
804 VkDisplayFormatPropertiesWSI *dst = pData;
805 size_t size_ret;
806 uint32_t i;
807
808 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
809
810 if (dst && *pDataSize < size_ret)
811 return VK_ERROR_INVALID_VALUE;
812
813 *pDataSize = size_ret;
814 if (!dst)
815 return VK_SUCCESS;
816
817 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
818 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
819 }
820 break;
821 default:
822 ret = VK_ERROR_INVALID_VALUE;
823 break;
824 }
825
826 return ret;
827}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600828#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600829
830ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
831 VkDevice device,
832 const VkSwapChainCreateInfoWSI* pCreateInfo,
833 VkSwapChainWSI* pSwapChain)
834{
835 NULLDRV_LOG_FUNC;
836 struct nulldrv_dev *dev = nulldrv_dev(device);
837 struct nulldrv_swap_chain *sc;
838
839 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600840 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600841 if (!sc) {
842 return VK_ERROR_OUT_OF_HOST_MEMORY;
843 }
844 sc->dev = dev;
845
Tony Barbour11e76ac2015-04-20 16:28:46 -0600846 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600847
848 return VK_SUCCESS;
849}
850
851ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
852 VkSwapChainWSI swapChain)
853{
854 NULLDRV_LOG_FUNC;
855 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
856
857 free(sc);
858
859 return VK_SUCCESS;
860}
861
862ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
863 VkSwapChainWSI swapChain,
864 VkSwapChainInfoTypeWSI infoType,
865 size_t* pDataSize,
866 void* pData)
867{
868 NULLDRV_LOG_FUNC;
869 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
870 struct nulldrv_dev *dev = sc->dev;
871 VkResult ret = VK_SUCCESS;
872
873 if (!pDataSize)
874 return VK_ERROR_INVALID_POINTER;
875
876 switch (infoType) {
877 case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
878 {
879 VkSwapChainImageInfoWSI *images;
880 const size_t size = sizeof(*images) * 2;
881 uint32_t i;
882
883 if (pData && *pDataSize < size)
884 return VK_ERROR_INVALID_VALUE;
885
886 *pDataSize = size;
887 if (!pData)
888 return VK_SUCCESS;
889
890 images = (VkSwapChainImageInfoWSI *) pData;
891 for (i = 0; i < 2; i++) {
892 struct nulldrv_img *img;
893 struct nulldrv_mem *mem;
894
895 img = (struct nulldrv_img *) nulldrv_base_create(dev,
896 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600897 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600898 if (!img)
899 return VK_ERROR_OUT_OF_HOST_MEMORY;
900
901 mem = (struct nulldrv_mem *) nulldrv_base_create(dev,
902 sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600903 VK_OBJECT_TYPE_DEVICE_MEMORY);
Ian Elliott64a68e12015-04-16 11:57:46 -0600904 if (!mem)
905 return VK_ERROR_OUT_OF_HOST_MEMORY;
906
Tony Barbourde4124d2015-07-03 10:33:54 -0600907 images[i].image.handle = (uint64_t) img;
908 images[i].memory.handle = (uint64_t) mem;
Ian Elliott64a68e12015-04-16 11:57:46 -0600909 }
910 }
911 break;
912 default:
913 ret = VK_ERROR_INVALID_VALUE;
914 break;
915 }
916
917 return ret;
918}
919
920ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
921 VkQueue queue_,
922 const VkPresentInfoWSI* pPresentInfo)
923{
924 NULLDRV_LOG_FUNC;
925
926 return VK_SUCCESS;
927}
928
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600929ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600930 VkCmdBuffer cmdBuffer,
931 VkBuffer srcBuffer,
932 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700933 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600934 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700935{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700936 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700937}
938
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600939ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600940 VkCmdBuffer cmdBuffer,
941 VkImage srcImage,
942 VkImageLayout srcImageLayout,
943 VkImage destImage,
944 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700945 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600946 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700947{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700948 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700949}
950
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600951ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600952 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500953 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600954 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500955 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600956 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500957 uint32_t regionCount,
958 const VkImageBlit* pRegions,
959 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600960{
961 NULLDRV_LOG_FUNC;
962}
963
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600964ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600965 VkCmdBuffer cmdBuffer,
966 VkBuffer srcBuffer,
967 VkImage destImage,
968 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700969 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600970 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700971{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700972 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700973}
974
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600975ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600976 VkCmdBuffer cmdBuffer,
977 VkImage srcImage,
978 VkImageLayout srcImageLayout,
979 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700980 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600981 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700982{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700983 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700984}
985
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600986ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600987 VkCmdBuffer cmdBuffer,
988 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600989 VkDeviceSize destOffset,
990 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700991 const uint32_t* pData)
992{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700993 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700994}
995
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600996ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600997 VkCmdBuffer cmdBuffer,
998 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600999 VkDeviceSize destOffset,
1000 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001001 uint32_t data)
1002{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001003 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001004}
1005
Ian Elliotte924ab22015-07-08 13:24:30 -06001006ICD_EXPORT void VKAPI vkCmdClearDepthStencilImage(
1007 VkCmdBuffer cmdBuffer,
1008 VkImage image,
1009 VkImageLayout imageLayout,
1010 float depth,
1011 uint32_t stencil,
1012 uint32_t rangeCount,
1013 const VkImageSubresourceRange* pRanges)
1014{
1015 NULLDRV_LOG_FUNC;
1016}
1017
1018ICD_EXPORT void VKAPI vkCmdClearColorAttachment(
1019 VkCmdBuffer cmdBuffer,
1020 uint32_t colorAttachment,
1021 VkImageLayout imageLayout,
1022 const VkClearColorValue *pColor,
1023 uint32_t rectCount,
1024 const VkRect3D *pRects)
1025{
1026 NULLDRV_LOG_FUNC;
1027}
1028
1029ICD_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(
1030 VkCmdBuffer cmdBuffer,
1031 VkImageAspectFlags imageAspectMask,
1032 VkImageLayout imageLayout,
1033 float depth,
1034 uint32_t stencil,
1035 uint32_t rectCount,
1036 const VkRect3D *pRects)
1037{
1038 NULLDRV_LOG_FUNC;
1039}
1040
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001041ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001042 VkCmdBuffer cmdBuffer,
1043 VkImage image,
1044 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +12001045 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001046 uint32_t rangeCount,
1047 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001048{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001049 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001050}
1051
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001052ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001053 VkCmdBuffer cmdBuffer,
1054 VkImage image,
1055 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001056 float depth,
1057 uint32_t stencil,
1058 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001059 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001060{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001061 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001062}
1063
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001064ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001065 VkCmdBuffer cmdBuffer,
1066 VkImage srcImage,
1067 VkImageLayout srcImageLayout,
1068 VkImage destImage,
1069 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001070 uint32_t regionCount,
1071 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001072{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001073 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001074}
1075
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001076ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001077 VkCmdBuffer cmdBuffer,
1078 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001079 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001080 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001081{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001082 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001083}
1084
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001085ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001086 VkCmdBuffer cmdBuffer,
1087 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001088 uint32_t slot)
1089{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001090 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001091}
1092
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001093ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001094 VkCmdBuffer cmdBuffer,
1095 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001096 uint32_t startQuery,
1097 uint32_t queryCount)
1098{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001099 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001100}
1101
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001102ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001103 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001104 VkEvent event_,
1105 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001106{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001107 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001108}
1109
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001110ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001111 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001112 VkEvent event_,
1113 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001114{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001115 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001116}
1117
Ian Elliott63f1edb2015-04-16 18:10:19 -06001118ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1119 VkCmdBuffer cmdBuffer,
1120 VkQueryPool queryPool,
1121 uint32_t startQuery,
1122 uint32_t queryCount,
1123 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001124 VkDeviceSize destOffset,
1125 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001126 VkFlags flags)
1127{
1128 NULLDRV_LOG_FUNC;
1129}
1130
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001131ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001132 VkCmdBuffer cmdBuffer,
1133 VkTimestampType timestampType,
1134 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001135 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001136{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001137 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001138}
1139
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001140ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001141 VkCmdBuffer cmdBuffer,
Tony Barbourde4124d2015-07-03 10:33:54 -06001142 VkPipelineBindPoint pipelineBindPoint,
1143 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001144{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001145 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001146}
1147
Tony Barbourde4124d2015-07-03 10:33:54 -06001148ICD_EXPORT void VKAPI vkCmdBindDynamicViewportState(
1149 VkCmdBuffer cmdBuffer,
1150 VkDynamicViewportState state)
1151{
1152 NULLDRV_LOG_FUNC;
1153}
1154
1155ICD_EXPORT void VKAPI vkCmdBindDynamicRasterState(
1156 VkCmdBuffer cmdBuffer,
1157 VkDynamicRasterState state)
1158{
1159 NULLDRV_LOG_FUNC;
1160}
1161
1162ICD_EXPORT void VKAPI vkCmdBindDynamicColorBlendState(
1163 VkCmdBuffer cmdBuffer,
1164 VkDynamicColorBlendState state)
1165{
1166 NULLDRV_LOG_FUNC;
1167}
1168
1169ICD_EXPORT void VKAPI vkCmdBindDynamicDepthStencilState(
1170 VkCmdBuffer cmdBuffer,
1171 VkDynamicDepthStencilState state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001172{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001173 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001174}
1175
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001176ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001177 VkCmdBuffer cmdBuffer,
1178 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001179 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001180 uint32_t firstSet,
1181 uint32_t setCount,
1182 const VkDescriptorSet* pDescriptorSets,
1183 uint32_t dynamicOffsetCount,
1184 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001185{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001186 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001187}
1188
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001189ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1190 VkCmdBuffer cmdBuffer,
1191 uint32_t startBinding,
1192 uint32_t bindingCount,
1193 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001194 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001195{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001196 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001197}
1198
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001199ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001200 VkCmdBuffer cmdBuffer,
1201 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001202 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001203 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001204{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001205 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001206}
1207
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001208ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001209 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001210 uint32_t firstVertex,
1211 uint32_t vertexCount,
1212 uint32_t firstInstance,
1213 uint32_t instanceCount)
1214{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001215 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001216}
1217
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001218ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001219 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001220 uint32_t firstIndex,
1221 uint32_t indexCount,
1222 int32_t vertexOffset,
1223 uint32_t firstInstance,
1224 uint32_t instanceCount)
1225{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001226 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001227}
1228
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001229ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001230 VkCmdBuffer cmdBuffer,
1231 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001232 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001233 uint32_t count,
1234 uint32_t stride)
1235{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001236 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001237}
1238
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001239ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001240 VkCmdBuffer cmdBuffer,
1241 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001242 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001243 uint32_t count,
1244 uint32_t stride)
1245{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001246 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001247}
1248
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001249ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001250 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001251 uint32_t x,
1252 uint32_t y,
1253 uint32_t z)
1254{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001255 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001256}
1257
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001258ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001259 VkCmdBuffer cmdBuffer,
1260 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001261 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001262{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001263 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001264}
1265
Tony Barbour8205d902015-04-16 15:59:00 -06001266void VKAPI vkCmdWaitEvents(
1267 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001268 uint32_t eventCount,
1269 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001270 VkPipelineStageFlags sourceStageMask,
1271 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001272 uint32_t memBarrierCount,
Courtney Goeltzenleuchterd9ba3422015-07-12 12:58:58 -06001273 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001274{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001275 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001276}
1277
Tony Barbour8205d902015-04-16 15:59:00 -06001278void VKAPI vkCmdPipelineBarrier(
1279 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001280 VkPipelineStageFlags sourceStageMask,
1281 VkPipelineStageFlags destStageMask,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001282 VkBool32 byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001283 uint32_t memBarrierCount,
1284 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001285{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001286 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001287}
1288
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001289ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001290 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001291 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001292 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001293{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001294 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001295 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1296 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1297}
1298
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001299ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1300 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001301{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001302 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001303 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001304}
1305
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001306ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1307 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001308 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001309 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001310 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001311{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001312 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001313 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001314 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001315 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001316}
1317
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001318ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1319 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001320{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001321 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001322 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001323}
1324
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001325ICD_EXPORT VkResult VKAPI vkCreateEvent(
1326 VkDevice device,
1327 const VkEventCreateInfo* pCreateInfo,
1328 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001329{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001330 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001331 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001332}
1333
Tony Barbourde4124d2015-07-03 10:33:54 -06001334ICD_EXPORT VkResult VKAPI vkDestroyEvent(
1335 VkDevice device,
1336 VkEvent event)
1337{
1338 NULLDRV_LOG_FUNC;
1339 return VK_SUCCESS;
1340}
1341
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001342ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001343 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001344 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001345{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001346 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001347 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001348}
1349
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001350ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001351 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001352 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001353{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001354 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001355 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001356}
1357
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001358ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001359 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001360 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001361{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001362 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001363 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001364}
1365
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001366ICD_EXPORT VkResult VKAPI vkCreateFence(
1367 VkDevice device,
1368 const VkFenceCreateInfo* pCreateInfo,
1369 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001370{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001371 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001372 struct nulldrv_dev *dev = nulldrv_dev(device);
1373
1374 return nulldrv_fence_create(dev, pCreateInfo,
1375 (struct nulldrv_fence **) pFence);
1376}
1377
Tony Barbourde4124d2015-07-03 10:33:54 -06001378ICD_EXPORT VkResult VKAPI vkDestroyFence(
1379 VkDevice device,
1380 VkFence fence)
1381{
1382 NULLDRV_LOG_FUNC;
1383 return VK_SUCCESS;
1384}
1385
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001386ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001387 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001388 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001389{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001390 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001391 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001392}
1393
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001394ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001395 VkDevice device,
1396 uint32_t fenceCount,
1397 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001398{
1399 NULLDRV_LOG_FUNC;
1400 return VK_SUCCESS;
1401}
1402
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001403ICD_EXPORT VkResult VKAPI vkWaitForFences(
1404 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001405 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001406 const VkFence* pFences,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001407 VkBool32 waitAll,
David Pinedo0257fbf2015-02-02 18:02:40 -07001408 uint64_t timeout)
1409{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001410 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001411 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001412}
1413
Tony Barbour426b9052015-06-24 16:06:58 -06001414ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1415 VkPhysicalDevice gpu_,
1416 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001417{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001418 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001419 VkResult ret = VK_SUCCESS;
1420
Tony Barbour426b9052015-06-24 16:06:58 -06001421 pProperties->apiVersion = VK_API_VERSION;
1422 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1423 pProperties->vendorId = 0;
1424 pProperties->deviceId = 0;
1425 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1426 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001427
1428 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001429}
1430
Chris Forbesd7576302015-06-21 22:55:02 +12001431ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1432 VkPhysicalDevice physicalDevice,
1433 VkPhysicalDeviceFeatures* pFeatures)
1434{
1435 NULLDRV_LOG_FUNC;
1436 VkResult ret = VK_SUCCESS;
1437
1438 /* TODO: fill out features */
1439 memset(pFeatures, 0, sizeof(*pFeatures));
1440
1441 return ret;
1442}
1443
Courtney Goeltzenleuchter4da96aa2015-07-12 12:52:09 -06001444ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatProperties(
Chris Forbesd7576302015-06-21 22:55:02 +12001445 VkPhysicalDevice physicalDevice,
1446 VkFormat format,
1447 VkFormatProperties* pFormatInfo)
1448{
1449 NULLDRV_LOG_FUNC;
1450 VkResult ret = VK_SUCCESS;
1451
1452 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1453 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1454
1455 return ret;
1456}
1457
1458ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1459 VkPhysicalDevice physicalDevice,
1460 VkPhysicalDeviceLimits* pLimits)
1461{
1462 NULLDRV_LOG_FUNC;
1463 VkResult ret = VK_SUCCESS;
1464
1465 /* TODO: fill out limits */
1466 memset(pLimits, 0, sizeof(*pLimits));
1467
1468 return ret;
1469}
1470
Tony Barbour426b9052015-06-24 16:06:58 -06001471ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueCount(
1472 VkPhysicalDevice gpu_,
1473 uint32_t* pCount)
David Pinedo0257fbf2015-02-02 18:02:40 -07001474{
Tony Barbour426b9052015-06-24 16:06:58 -06001475 *pCount = 1;
1476 return VK_SUCCESS;
1477}
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001478
Tony Barbour426b9052015-06-24 16:06:58 -06001479ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueProperties(
1480 VkPhysicalDevice gpu_,
1481 uint32_t count,
1482 VkPhysicalDeviceQueueProperties* pProperties)
1483 {
1484 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1485 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001486 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001487
Tony Barbour426b9052015-06-24 16:06:58 -06001488 return VK_SUCCESS;
1489}
1490
Ian Elliotte924ab22015-07-08 13:24:30 -06001491ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(
1492 VkPhysicalDevice gpu_,
1493 VkPhysicalDeviceMemoryProperties* pProperties)
1494{
1495 // TODO: Fill in with real data
1496 return VK_SUCCESS;
1497}
1498
1499ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLayerProperties(
1500 VkPhysicalDevice physicalDevice,
1501 uint32_t* pCount,
1502 VkLayerProperties* pProperties)
1503{
1504 // TODO: Fill in with real data
1505 return VK_SUCCESS;
1506}
1507
Tony Barbour426b9052015-06-24 16:06:58 -06001508ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001509 const char* pLayerName,
1510 uint32_t* pCount,
1511 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001512{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001513 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001514
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001515 if (pCount == NULL) {
1516 return VK_ERROR_INVALID_POINTER;
1517 }
Tony Barbour426b9052015-06-24 16:06:58 -06001518
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001519 if (pProperties == NULL) {
1520 *pCount = NULLDRV_EXT_COUNT;
1521 return VK_SUCCESS;
1522 }
Tony Barbour426b9052015-06-24 16:06:58 -06001523
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001524 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1525 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1526 *pCount = copy_size;
1527 if (copy_size < NULLDRV_EXT_COUNT) {
1528 return VK_INCOMPLETE;
1529 }
Tony Barbour426b9052015-06-24 16:06:58 -06001530 return VK_SUCCESS;
1531}
Ian Elliotte924ab22015-07-08 13:24:30 -06001532ICD_EXPORT VkResult VKAPI vkGetGlobalLayerProperties(
1533 uint32_t* pCount,
1534 VkLayerProperties* pProperties)
1535{
1536 // TODO: Fill in with real data
1537 return VK_SUCCESS;
1538}
Tony Barbour426b9052015-06-24 16:06:58 -06001539
1540VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001541 VkPhysicalDevice physicalDevice,
1542 const char* pLayerName,
1543 uint32_t* pCount,
1544 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001545{
Tony Barbour426b9052015-06-24 16:06:58 -06001546
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001547 if (pCount == NULL) {
1548 return VK_ERROR_INVALID_POINTER;
1549 }
1550
Tony Barbour426b9052015-06-24 16:06:58 -06001551 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001552
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001553 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001554}
1555
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001556ICD_EXPORT VkResult VKAPI vkCreateImage(
1557 VkDevice device,
1558 const VkImageCreateInfo* pCreateInfo,
1559 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001560{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001561 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001562 struct nulldrv_dev *dev = nulldrv_dev(device);
1563
1564 return nulldrv_img_create(dev, pCreateInfo, false,
1565 (struct nulldrv_img **) pImage);
1566}
1567
Tony Barbourde4124d2015-07-03 10:33:54 -06001568ICD_EXPORT VkResult VKAPI vkDestroyImage(
1569 VkDevice device,
1570 VkImage image)
1571{
1572 NULLDRV_LOG_FUNC;
1573 return VK_SUCCESS;
1574}
1575
Tony Barbour426b9052015-06-24 16:06:58 -06001576ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001577 VkDevice device,
1578 VkImage image,
1579 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001580 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001581{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001582 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001583
Tony Barbour426b9052015-06-24 16:06:58 -06001584 pLayout->offset = 0;
1585 pLayout->size = 1;
1586 pLayout->rowPitch = 4;
1587 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001588
Tony Barbour426b9052015-06-24 16:06:58 -06001589 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001590}
1591
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001592ICD_EXPORT VkResult VKAPI vkAllocMemory(
1593 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001594 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001595 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001596{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001597 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001598 struct nulldrv_dev *dev = nulldrv_dev(device);
1599
1600 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1601}
1602
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001603ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001604 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001605 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001606{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001607 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001608 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001609}
1610
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001611ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001612 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001613 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001614 VkDeviceSize offset,
1615 VkDeviceSize size,
1616 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001617 void** ppData)
1618{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001619 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001620 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1621 void *ptr = nulldrv_mem_map(mem, flags);
1622
1623 *ppData = ptr;
1624
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001625 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001626}
1627
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001628ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001629 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001630 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001631{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001632 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001633 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001634}
1635
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001636ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001637 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001638 uint32_t memRangeCount,
1639 const VkMappedMemoryRange* pMemRanges)
1640{
1641 NULLDRV_LOG_FUNC;
1642 return VK_SUCCESS;
1643}
1644
1645ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1646 VkDevice device,
1647 uint32_t memRangeCount,
1648 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001649{
1650 NULLDRV_LOG_FUNC;
1651 return VK_SUCCESS;
1652}
1653
Courtney Goeltzenleuchterd040c5c2015-07-09 21:57:28 -06001654ICD_EXPORT VkResult VKAPI vkGetDeviceMemoryCommitment(
1655 VkDevice device,
1656 VkDeviceMemory memory,
1657 VkDeviceSize* pCommittedMemoryInBytes)
1658{
1659 return VK_SUCCESS;
1660}
1661
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001662ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001663 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001664 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001665{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001666 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001667 struct nulldrv_instance *inst;
1668
1669 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001670 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001671 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001672 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001673
Tony Barbour426b9052015-06-24 16:06:58 -06001674 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001675
Mike Stroyan230e6252015-04-17 12:36:38 -06001676 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001677
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001678 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001679}
1680
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001681ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1682 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001683{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001684 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001685 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001686}
1687
Tony Barbour8205d902015-04-16 15:59:00 -06001688ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001689 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001690 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001691 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001692{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001693 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001694 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001695 struct nulldrv_gpu *gpu;
1696 *pGpuCount = 1;
1697 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001698 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001699 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001700 return ret;
1701}
1702
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001703ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001704 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001705 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001706 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001707 char* const* pOutLayers,
1708 void* pReserved)
1709{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001710 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001711 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001712}
1713
Tony Barbourde4124d2015-07-03 10:33:54 -06001714ICD_EXPORT VkResult VKAPI vkGetBufferMemoryRequirements(
1715 VkDevice device,
1716 VkBuffer buffer,
1717 VkMemoryRequirements* pMemoryRequirements)
1718{
1719 NULLDRV_LOG_FUNC;
1720 struct nulldrv_base *base = nulldrv_base((void*)buffer.handle);
1721
1722 return base->get_memory_requirements(base, pMemoryRequirements);
1723}
1724
1725ICD_EXPORT VkResult VKAPI vkGetImageMemoryRequirements(
1726 VkDevice device,
1727 VkImage image,
1728 VkMemoryRequirements* pMemoryRequirements)
1729{
1730 NULLDRV_LOG_FUNC;
1731 struct nulldrv_base *base = nulldrv_base((void*)image.handle);
1732
1733 return base->get_memory_requirements(base, pMemoryRequirements);
1734}
1735
1736ICD_EXPORT VkResult VKAPI vkBindBufferMemory(
1737 VkDevice device,
1738 VkBuffer buffer,
1739 VkDeviceMemory mem_,
1740 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001741{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001742 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001743 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001744}
1745
Tony Barbourde4124d2015-07-03 10:33:54 -06001746ICD_EXPORT VkResult VKAPI vkBindImageMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001747 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06001748 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001749 VkDeviceMemory mem_,
1750 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001751{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001752 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001753 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001754}
1755
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001756ICD_EXPORT VkResult VKAPI vkGetImageSparseMemoryRequirements(
1757 VkDevice device,
1758 VkImage image,
1759 uint32_t* pNumRequirements,
1760 VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
1761{
1762 NULLDRV_LOG_FUNC;
1763 return VK_SUCCESS;
1764}
1765
1766ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(
1767 VkPhysicalDevice physicalDevice,
1768 VkFormat format,
1769 VkImageType type,
1770 uint32_t samples,
1771 VkImageUsageFlags usage,
1772 VkImageTiling tiling,
1773 uint32_t* pNumProperties,
1774 VkSparseImageFormatProperties* pProperties)
1775{
1776 NULLDRV_LOG_FUNC;
1777 return VK_SUCCESS;
1778}
1779
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001780ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001781 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001782 VkBuffer buffer,
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001783 uint32_t numBindings,
1784 const VkSparseMemoryBindInfo* pBindInfo)
1785{
1786 NULLDRV_LOG_FUNC;
1787 return VK_SUCCESS;
1788}
1789
1790ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageOpaqueMemory(
1791 VkQueue queue,
1792 VkImage image,
1793 uint32_t numBindings,
1794 const VkSparseMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001795{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001796 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001797 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001798}
1799
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001800ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001801 VkQueue queue,
1802 VkImage image,
1803 uint32_t numBindings,
1804 const VkSparseImageMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001805{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001806 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001807 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001808}
Jon Ashburn0e249962015-07-10 09:41:15 -07001809ICD_EXPORT VkResult VKAPI vkCreatePipelineCache(
1810 VkDevice device,
1811 const VkPipelineCacheCreateInfo* pCreateInfo,
1812 VkPipelineCache* pPipelineCache)
1813{
David Pinedo0257fbf2015-02-02 18:02:40 -07001814
Jon Ashburn0e249962015-07-10 09:41:15 -07001815 NULLDRV_LOG_FUNC;
1816 return VK_SUCCESS;
1817}
1818
Tony Barbourde4124d2015-07-03 10:33:54 -06001819ICD_EXPORT VkResult VKAPI vkDestroyPipeline(
1820 VkDevice device,
1821 VkPipeline pipeline)
1822{
1823 NULLDRV_LOG_FUNC;
1824 return VK_SUCCESS;
1825}
1826
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06001827VkResult VKAPI vkDestroyPipelineCache(
1828 VkDevice device,
1829 VkPipelineCache pipelineCache)
Jon Ashburn0e249962015-07-10 09:41:15 -07001830{
1831 NULLDRV_LOG_FUNC;
1832 return VK_SUCCESS;
1833}
1834
1835ICD_EXPORT size_t VKAPI vkGetPipelineCacheSize(
1836 VkDevice device,
1837 VkPipelineCache pipelineCache)
1838{
1839 NULLDRV_LOG_FUNC;
1840 return VK_ERROR_UNAVAILABLE;
1841}
1842
1843ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
1844 VkDevice device,
1845 VkPipelineCache pipelineCache,
1846 void* pData)
1847{
1848 NULLDRV_LOG_FUNC;
1849 return VK_ERROR_UNAVAILABLE;
1850}
1851
1852ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
1853 VkDevice device,
1854 VkPipelineCache destCache,
1855 uint32_t srcCacheCount,
1856 const VkPipelineCache* pSrcCaches)
1857{
1858 NULLDRV_LOG_FUNC;
1859 return VK_ERROR_UNAVAILABLE;
1860}
1861ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001862 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001863 VkPipelineCache pipelineCache,
1864 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001865 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1866 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001867{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001868 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001869 struct nulldrv_dev *dev = nulldrv_dev(device);
1870
1871 return graphics_pipeline_create(dev, pCreateInfo,
1872 (struct nulldrv_pipeline **) pPipeline);
1873}
1874
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001875
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001876
Jon Ashburn0e249962015-07-10 09:41:15 -07001877ICD_EXPORT VkResult VKAPI vkCreateComputePipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001878 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001879 VkPipelineCache pipelineCache,
1880 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001881 const VkComputePipelineCreateInfo* pCreateInfo,
1882 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001883{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001884 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001885 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001886}
1887
David Pinedo0257fbf2015-02-02 18:02:40 -07001888
David Pinedo0257fbf2015-02-02 18:02:40 -07001889
Jon Ashburn0e249962015-07-10 09:41:15 -07001890
David Pinedo0257fbf2015-02-02 18:02:40 -07001891
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001892ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1893 VkDevice device,
1894 const VkQueryPoolCreateInfo* pCreateInfo,
1895 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001896{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001897 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001898 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001899}
1900
Tony Barbourde4124d2015-07-03 10:33:54 -06001901ICD_EXPORT VkResult VKAPI vkDestroyQueryPool(
1902 VkDevice device,
1903 VkQueryPool queryPoool)
1904{
1905 NULLDRV_LOG_FUNC;
1906 return VK_SUCCESS;
1907}
1908
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001909ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001910 VkDevice device,
1911 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001912 uint32_t startQuery,
1913 uint32_t queryCount,
1914 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001915 void* pData,
1916 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001917{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001918 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001919 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001920}
1921
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001922ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1923 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001924{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001925 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001926 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001927}
1928
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001929ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1930 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001931 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001932 const VkCmdBuffer* pCmdBuffers,
1933 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001934{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001935 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001936 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001937}
1938
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001939ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1940 VkDevice device,
1941 const VkSemaphoreCreateInfo* pCreateInfo,
1942 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001943{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001944 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001945 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001946}
1947
Tony Barbourde4124d2015-07-03 10:33:54 -06001948ICD_EXPORT VkResult VKAPI vkDestroySemaphore(
1949 VkDevice device,
1950 VkSemaphore semaphore)
1951{
1952 NULLDRV_LOG_FUNC;
1953 return VK_SUCCESS;
1954}
1955
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001956ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1957 VkQueue queue,
1958 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001959{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001960 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001961 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001962}
1963
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001964ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1965 VkQueue queue,
1966 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001967{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001968 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001969 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001970}
1971
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001972ICD_EXPORT VkResult VKAPI vkCreateSampler(
1973 VkDevice device,
1974 const VkSamplerCreateInfo* pCreateInfo,
1975 VkSampler* pSampler)
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);
1979
1980 return nulldrv_sampler_create(dev, pCreateInfo,
1981 (struct nulldrv_sampler **) pSampler);
1982}
1983
Tony Barbourde4124d2015-07-03 10:33:54 -06001984ICD_EXPORT VkResult VKAPI vkDestroySampler(
1985 VkDevice device,
1986 VkSampler sampler)
1987{
1988 NULLDRV_LOG_FUNC;
1989 return VK_SUCCESS;
1990}
1991
Ian Elliotte924ab22015-07-08 13:24:30 -06001992ICD_EXPORT VkResult VKAPI vkCreateShaderModule(
1993 VkDevice device,
1994 const VkShaderModuleCreateInfo* pCreateInfo,
1995 VkShaderModule* pShaderModule)
1996{
1997 // TODO: Fill in with real data
Tony Barbourde4124d2015-07-03 10:33:54 -06001998 NULLDRV_LOG_FUNC;
1999 return VK_SUCCESS;
2000}
2001
2002ICD_EXPORT VkResult VKAPI vkDestroyShaderModule(
2003 VkDevice device,
2004 VkShaderModule shaderModule)
2005{
2006 // TODO: Fill in with real data
2007 NULLDRV_LOG_FUNC;
Ian Elliotte924ab22015-07-08 13:24:30 -06002008 return VK_SUCCESS;
2009}
2010
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002011ICD_EXPORT VkResult VKAPI vkCreateShader(
2012 VkDevice device,
2013 const VkShaderCreateInfo* pCreateInfo,
2014 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002015{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002016 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002017 struct nulldrv_dev *dev = nulldrv_dev(device);
2018
2019 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2020}
2021
Tony Barbourde4124d2015-07-03 10:33:54 -06002022ICD_EXPORT VkResult VKAPI vkDestroyShader(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002023 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002024 VkShader shader)
2025{
2026 NULLDRV_LOG_FUNC;
2027 return VK_SUCCESS;
2028}
2029
2030ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2031 VkDevice device,
2032 const VkDynamicViewportStateCreateInfo* pCreateInfo,
2033 VkDynamicViewportState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002034{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002035 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002036 struct nulldrv_dev *dev = nulldrv_dev(device);
2037
2038 return nulldrv_viewport_state_create(dev, pCreateInfo,
2039 (struct nulldrv_dynamic_vp **) pState);
2040}
2041
Tony Barbourde4124d2015-07-03 10:33:54 -06002042ICD_EXPORT VkResult VKAPI vkDestroyDynamicViewportState(
2043 VkDevice device,
2044 VkDynamicViewportState dynamicViewportState)
2045{
2046 NULLDRV_LOG_FUNC;
2047 return VK_SUCCESS;
2048}
2049
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002050ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
2051 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002052 const VkDynamicRasterStateCreateInfo* pCreateInfo,
2053 VkDynamicRasterState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002054{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002055 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002056 struct nulldrv_dev *dev = nulldrv_dev(device);
2057
2058 return nulldrv_raster_state_create(dev, pCreateInfo,
2059 (struct nulldrv_dynamic_rs **) pState);
2060}
2061
Tony Barbourde4124d2015-07-03 10:33:54 -06002062ICD_EXPORT VkResult VKAPI vkDestroyDynamicRasterState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002063 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002064 VkDynamicRasterState dynamicRasterState)
2065{
2066 NULLDRV_LOG_FUNC;
2067 return VK_SUCCESS;
2068}
2069
2070ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
2071 VkDevice device,
2072 const VkDynamicColorBlendStateCreateInfo* pCreateInfo,
2073 VkDynamicColorBlendState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002074{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002075 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002076 struct nulldrv_dev *dev = nulldrv_dev(device);
2077
2078 return nulldrv_blend_state_create(dev, pCreateInfo,
2079 (struct nulldrv_dynamic_cb **) pState);
2080}
2081
Tony Barbourde4124d2015-07-03 10:33:54 -06002082ICD_EXPORT VkResult VKAPI vkDestroyDynamicColorBlendState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002083 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002084 VkDynamicColorBlendState dynamicColorBlendState)
2085{
2086 NULLDRV_LOG_FUNC;
2087 return VK_SUCCESS;
2088}
2089
2090ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
2091 VkDevice device,
2092 const VkDynamicDepthStencilStateCreateInfo* pCreateInfo,
2093 VkDynamicDepthStencilState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002094{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002095 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002096 struct nulldrv_dev *dev = nulldrv_dev(device);
2097
2098 return nulldrv_ds_state_create(dev, pCreateInfo,
2099 (struct nulldrv_dynamic_ds **) pState);
2100}
2101
Tony Barbourde4124d2015-07-03 10:33:54 -06002102ICD_EXPORT VkResult VKAPI vkDestroyDynamicDepthStencilState(
2103 VkDevice device,
2104 VkDynamicDepthStencilState dynamicDepthStencilState)
2105{
2106 NULLDRV_LOG_FUNC;
2107 return VK_SUCCESS;
2108}
2109
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002110ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2111 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002112 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002113 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002114{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002115 NULLDRV_LOG_FUNC;
2116 struct nulldrv_dev *dev = nulldrv_dev(device);
2117
2118 return nulldrv_buf_view_create(dev, pCreateInfo,
2119 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002120}
2121
Tony Barbourde4124d2015-07-03 10:33:54 -06002122ICD_EXPORT VkResult VKAPI vkDestroyBufferView(
2123 VkDevice device,
2124 VkBufferView bufferView)
2125{
2126 NULLDRV_LOG_FUNC;
2127 return VK_SUCCESS;
2128}
2129
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002130ICD_EXPORT VkResult VKAPI vkCreateImageView(
2131 VkDevice device,
2132 const VkImageViewCreateInfo* pCreateInfo,
2133 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002134{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002135 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002136 struct nulldrv_dev *dev = nulldrv_dev(device);
2137
2138 return nulldrv_img_view_create(dev, pCreateInfo,
2139 (struct nulldrv_img_view **) pView);
2140}
2141
Tony Barbourde4124d2015-07-03 10:33:54 -06002142ICD_EXPORT VkResult VKAPI vkDestroyImageView(
2143 VkDevice device,
2144 VkImageView imageView)
2145{
2146 NULLDRV_LOG_FUNC;
2147 return VK_SUCCESS;
2148}
2149
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002150ICD_EXPORT VkResult VKAPI vkCreateAttachmentView(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002151 VkDevice device,
Chia-I Wuc278df82015-07-07 11:50:03 +08002152 const VkAttachmentViewCreateInfo* pCreateInfo,
2153 VkAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002154{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002155 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002156 struct nulldrv_dev *dev = nulldrv_dev(device);
2157
2158 return nulldrv_rt_view_create(dev, pCreateInfo,
2159 (struct nulldrv_rt_view **) pView);
2160}
2161
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002162ICD_EXPORT VkResult VKAPI vkDestroyAttachmentView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002163 VkDevice device,
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002164 VkAttachmentView attachmentView)
Tony Barbourde4124d2015-07-03 10:33:54 -06002165{
2166 NULLDRV_LOG_FUNC;
2167 return VK_SUCCESS;
2168}
2169
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002170ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2171 VkDevice device,
2172 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2173 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002174{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002175 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002176 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002177
Chia-I Wu7732cb22015-03-26 15:27:55 +08002178 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002179 (struct nulldrv_desc_layout **) pSetLayout);
2180}
2181
Tony Barbourde4124d2015-07-03 10:33:54 -06002182ICD_EXPORT VkResult VKAPI vkDestroyDescriptorSetLayout(
2183 VkDevice device,
2184 VkDescriptorSetLayout descriptorSetLayout)
2185{
2186 NULLDRV_LOG_FUNC;
2187 return VK_SUCCESS;
2188}
2189
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002190ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2191 VkDevice device,
2192 const VkPipelineLayoutCreateInfo* pCreateInfo,
2193 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002194{
2195 NULLDRV_LOG_FUNC;
2196 struct nulldrv_dev *dev = nulldrv_dev(device);
2197
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002198 return nulldrv_pipeline_layout_create(dev,
2199 pCreateInfo,
2200 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002201}
2202
Tony Barbourde4124d2015-07-03 10:33:54 -06002203ICD_EXPORT VkResult VKAPI vkDestroyPipelineLayout(
2204 VkDevice device,
2205 VkPipelineLayout pipelineLayout)
2206{
2207 NULLDRV_LOG_FUNC;
2208 return VK_SUCCESS;
2209}
2210
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002211ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2212 VkDevice device,
2213 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002214 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002215 const VkDescriptorPoolCreateInfo* pCreateInfo,
2216 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002217{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002218 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002219 struct nulldrv_dev *dev = nulldrv_dev(device);
2220
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002221 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2222 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002223}
2224
Tony Barbourde4124d2015-07-03 10:33:54 -06002225ICD_EXPORT VkResult VKAPI vkDestroyDescriptorPool(
2226 VkDevice device,
2227 VkDescriptorPool descriptorPool)
2228{
2229 NULLDRV_LOG_FUNC;
2230 return VK_SUCCESS;
2231}
2232
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002233ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002234 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002235 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002236{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002237 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002238 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002239}
2240
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002241ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002242 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002243 VkDescriptorPool descriptorPool,
2244 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002245 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002246 const VkDescriptorSetLayout* pSetLayouts,
2247 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07002248 uint32_t* pCount)
2249{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002250 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002251 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2252 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002253 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002254 uint32_t i;
2255
2256 for (i = 0; i < count; i++) {
2257 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002258 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002259
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002260 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002261 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002262 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002263 break;
2264 }
2265
2266 if (pCount)
2267 *pCount = i;
2268
2269 return ret;
2270}
2271
Tony Barbourb857d312015-07-10 10:50:45 -06002272ICD_EXPORT VkResult VKAPI vkFreeDescriptorSets(
2273 VkDevice device,
2274 VkDescriptorPool descriptorPool,
2275 uint32_t count,
2276 const VkDescriptorSet* pDescriptorSets)
2277{
2278 NULLDRV_LOG_FUNC;
2279 return VK_SUCCESS;
2280}
2281
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002282ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2283 VkDevice device,
2284 uint32_t writeCount,
2285 const VkWriteDescriptorSet* pDescriptorWrites,
2286 uint32_t copyCount,
2287 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002288{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002289 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002290 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002291}
2292
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002293ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2294 VkDevice device,
2295 const VkFramebufferCreateInfo* info,
2296 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002297{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002298 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002299 struct nulldrv_dev *dev = nulldrv_dev(device);
2300
2301 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2302}
2303
Tony Barbourde4124d2015-07-03 10:33:54 -06002304ICD_EXPORT VkResult VKAPI vkDestroyFramebuffer(
2305 VkDevice device,
2306 VkFramebuffer framebuffer)
2307{
2308 NULLDRV_LOG_FUNC;
2309 return VK_SUCCESS;
2310}
David Pinedo0257fbf2015-02-02 18:02:40 -07002311
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002312ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2313 VkDevice device,
2314 const VkRenderPassCreateInfo* info,
2315 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002316{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002317 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002318 struct nulldrv_dev *dev = nulldrv_dev(device);
2319
2320 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2321}
2322
Tony Barbourde4124d2015-07-03 10:33:54 -06002323ICD_EXPORT VkResult VKAPI vkDestroyRenderPass(
2324 VkDevice device,
2325 VkRenderPass renderPass)
2326{
2327 NULLDRV_LOG_FUNC;
2328 return VK_SUCCESS;
2329}
2330
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002331ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Chia-I Wuc278df82015-07-07 11:50:03 +08002332 VkCmdBuffer cmdBuffer,
2333 const VkRenderPassBeginInfo* pRenderPassBegin,
2334 VkRenderPassContents contents)
2335{
2336 NULLDRV_LOG_FUNC;
2337}
2338
2339ICD_EXPORT void VKAPI vkCmdNextSubpass(
2340 VkCmdBuffer cmdBuffer,
2341 VkRenderPassContents contents)
David Pinedo0257fbf2015-02-02 18:02:40 -07002342{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002343 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002344}
2345
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002346ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002347 VkCmdBuffer cmdBuffer)
2348{
2349 NULLDRV_LOG_FUNC;
2350}
2351
2352ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2353 VkCmdBuffer cmdBuffer,
2354 uint32_t cmdBuffersCount,
2355 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002356{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002357 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002358}
Ian Elliottf93069f2015-02-19 14:26:19 -07002359
2360ICD_EXPORT void* xcbCreateWindow(
2361 uint16_t width,
2362 uint16_t height)
2363{
2364 static uint32_t window; // Kludge to the max
2365 NULLDRV_LOG_FUNC;
2366 return &window;
2367}
2368
2369// May not be needed, if we stub out stuf in tri.c
2370ICD_EXPORT void xcbDestroyWindow()
2371{
2372 NULLDRV_LOG_FUNC;
2373}
2374
2375ICD_EXPORT int xcbGetMessage(void *msg)
2376{
2377 NULLDRV_LOG_FUNC;
2378 return 0;
2379}
2380
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002381ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002382{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002383 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002384}