blob: eb35263f1f5d0d12c8c9f992d5eb47cb4bacce64 [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
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600714ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
715 VkDevice device,
716 const VkCmdBufferCreateInfo* pCreateInfo,
717 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700718{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700719 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700720 struct nulldrv_dev *dev = nulldrv_dev(device);
721
722 return nulldrv_cmd_create(dev, pCreateInfo,
723 (struct nulldrv_cmd **) pCmdBuffer);
724}
725
Tony Barbourde4124d2015-07-03 10:33:54 -0600726ICD_EXPORT VkResult VKAPI vkDestroyCommandBuffer(
727 VkDevice device,
728 VkCmdBuffer cmdBuffer)
729{
730 NULLDRV_LOG_FUNC;
731 return VK_SUCCESS;
732}
733
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600734ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
735 VkCmdBuffer cmdBuffer,
736 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700737{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700738 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600739 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700740}
741
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600742ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
743 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700744{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700745 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600746 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700747}
748
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600749ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
750 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700751{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700752 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600753 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700754}
755
Ian Elliott64a68e12015-04-16 11:57:46 -0600756static const VkFormat nulldrv_presentable_formats[] = {
757 VK_FORMAT_B8G8R8A8_UNORM,
758};
759
Jon Ashburnba4a1952015-06-16 12:44:51 -0600760#if 0
Ian Elliott64a68e12015-04-16 11:57:46 -0600761ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
762 VkDisplayWSI display,
763 VkDisplayInfoTypeWSI infoType,
764 size_t* pDataSize,
765 void* pData)
766{
767 VkResult ret = VK_SUCCESS;
768
769 NULLDRV_LOG_FUNC;
770
771 if (!pDataSize)
772 return VK_ERROR_INVALID_POINTER;
773
774 switch (infoType) {
775 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
776 {
777 VkDisplayFormatPropertiesWSI *dst = pData;
778 size_t size_ret;
779 uint32_t i;
780
781 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
782
783 if (dst && *pDataSize < size_ret)
784 return VK_ERROR_INVALID_VALUE;
785
786 *pDataSize = size_ret;
787 if (!dst)
788 return VK_SUCCESS;
789
790 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
791 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
792 }
793 break;
794 default:
795 ret = VK_ERROR_INVALID_VALUE;
796 break;
797 }
798
799 return ret;
800}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600801#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600802
803ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
804 VkDevice device,
805 const VkSwapChainCreateInfoWSI* pCreateInfo,
806 VkSwapChainWSI* pSwapChain)
807{
808 NULLDRV_LOG_FUNC;
809 struct nulldrv_dev *dev = nulldrv_dev(device);
810 struct nulldrv_swap_chain *sc;
811
812 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600813 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600814 if (!sc) {
815 return VK_ERROR_OUT_OF_HOST_MEMORY;
816 }
817 sc->dev = dev;
818
Tony Barbour11e76ac2015-04-20 16:28:46 -0600819 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600820
821 return VK_SUCCESS;
822}
823
824ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
825 VkSwapChainWSI swapChain)
826{
827 NULLDRV_LOG_FUNC;
828 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
829
830 free(sc);
831
832 return VK_SUCCESS;
833}
834
835ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
836 VkSwapChainWSI swapChain,
837 VkSwapChainInfoTypeWSI infoType,
838 size_t* pDataSize,
839 void* pData)
840{
841 NULLDRV_LOG_FUNC;
842 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
843 struct nulldrv_dev *dev = sc->dev;
844 VkResult ret = VK_SUCCESS;
845
846 if (!pDataSize)
847 return VK_ERROR_INVALID_POINTER;
848
849 switch (infoType) {
850 case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
851 {
852 VkSwapChainImageInfoWSI *images;
853 const size_t size = sizeof(*images) * 2;
854 uint32_t i;
855
856 if (pData && *pDataSize < size)
857 return VK_ERROR_INVALID_VALUE;
858
859 *pDataSize = size;
860 if (!pData)
861 return VK_SUCCESS;
862
863 images = (VkSwapChainImageInfoWSI *) pData;
864 for (i = 0; i < 2; i++) {
865 struct nulldrv_img *img;
866 struct nulldrv_mem *mem;
867
868 img = (struct nulldrv_img *) nulldrv_base_create(dev,
869 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600870 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600871 if (!img)
872 return VK_ERROR_OUT_OF_HOST_MEMORY;
873
874 mem = (struct nulldrv_mem *) nulldrv_base_create(dev,
875 sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600876 VK_OBJECT_TYPE_DEVICE_MEMORY);
Ian Elliott64a68e12015-04-16 11:57:46 -0600877 if (!mem)
878 return VK_ERROR_OUT_OF_HOST_MEMORY;
879
Tony Barbourde4124d2015-07-03 10:33:54 -0600880 images[i].image.handle = (uint64_t) img;
881 images[i].memory.handle = (uint64_t) mem;
Ian Elliott64a68e12015-04-16 11:57:46 -0600882 }
883 }
884 break;
885 default:
886 ret = VK_ERROR_INVALID_VALUE;
887 break;
888 }
889
890 return ret;
891}
892
893ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
894 VkQueue queue_,
895 const VkPresentInfoWSI* pPresentInfo)
896{
897 NULLDRV_LOG_FUNC;
898
899 return VK_SUCCESS;
900}
901
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600902ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600903 VkCmdBuffer cmdBuffer,
904 VkBuffer srcBuffer,
905 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700906 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600907 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700908{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700909 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700910}
911
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600912ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600913 VkCmdBuffer cmdBuffer,
914 VkImage srcImage,
915 VkImageLayout srcImageLayout,
916 VkImage destImage,
917 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700918 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600919 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700920{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700921 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700922}
923
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600924ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600925 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500926 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600927 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500928 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600929 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500930 uint32_t regionCount,
931 const VkImageBlit* pRegions,
932 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600933{
934 NULLDRV_LOG_FUNC;
935}
936
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600937ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600938 VkCmdBuffer cmdBuffer,
939 VkBuffer srcBuffer,
940 VkImage destImage,
941 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700942 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600943 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700944{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700945 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700946}
947
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600948ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600949 VkCmdBuffer cmdBuffer,
950 VkImage srcImage,
951 VkImageLayout srcImageLayout,
952 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700953 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600954 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700955{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700956 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700957}
958
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600959ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600960 VkCmdBuffer cmdBuffer,
961 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600962 VkDeviceSize destOffset,
963 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700964 const uint32_t* pData)
965{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700966 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700967}
968
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600969ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600970 VkCmdBuffer cmdBuffer,
971 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600972 VkDeviceSize destOffset,
973 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700974 uint32_t data)
975{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700976 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700977}
978
Ian Elliotte924ab22015-07-08 13:24:30 -0600979ICD_EXPORT void VKAPI vkCmdClearDepthStencilImage(
980 VkCmdBuffer cmdBuffer,
981 VkImage image,
982 VkImageLayout imageLayout,
983 float depth,
984 uint32_t stencil,
985 uint32_t rangeCount,
986 const VkImageSubresourceRange* pRanges)
987{
988 NULLDRV_LOG_FUNC;
989}
990
991ICD_EXPORT void VKAPI vkCmdClearColorAttachment(
992 VkCmdBuffer cmdBuffer,
993 uint32_t colorAttachment,
994 VkImageLayout imageLayout,
995 const VkClearColorValue *pColor,
996 uint32_t rectCount,
997 const VkRect3D *pRects)
998{
999 NULLDRV_LOG_FUNC;
1000}
1001
1002ICD_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(
1003 VkCmdBuffer cmdBuffer,
1004 VkImageAspectFlags imageAspectMask,
1005 VkImageLayout imageLayout,
1006 float depth,
1007 uint32_t stencil,
1008 uint32_t rectCount,
1009 const VkRect3D *pRects)
1010{
1011 NULLDRV_LOG_FUNC;
1012}
1013
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001014ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001015 VkCmdBuffer cmdBuffer,
1016 VkImage image,
1017 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +12001018 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001019 uint32_t rangeCount,
1020 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001021{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001022 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001023}
1024
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001025ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001026 VkCmdBuffer cmdBuffer,
1027 VkImage image,
1028 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001029 float depth,
1030 uint32_t stencil,
1031 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001032 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001033{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001034 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001035}
1036
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001037ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001038 VkCmdBuffer cmdBuffer,
1039 VkImage srcImage,
1040 VkImageLayout srcImageLayout,
1041 VkImage destImage,
1042 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001043 uint32_t regionCount,
1044 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001045{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001046 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001047}
1048
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001049ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001050 VkCmdBuffer cmdBuffer,
1051 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001052 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001053 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001054{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001055 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001056}
1057
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001058ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001059 VkCmdBuffer cmdBuffer,
1060 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001061 uint32_t slot)
1062{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001063 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001064}
1065
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001066ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001067 VkCmdBuffer cmdBuffer,
1068 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001069 uint32_t startQuery,
1070 uint32_t queryCount)
1071{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001072 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001073}
1074
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001075ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001076 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001077 VkEvent event_,
1078 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001079{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001080 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001081}
1082
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001083ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001084 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001085 VkEvent event_,
1086 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001087{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001088 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001089}
1090
Ian Elliott63f1edb2015-04-16 18:10:19 -06001091ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1092 VkCmdBuffer cmdBuffer,
1093 VkQueryPool queryPool,
1094 uint32_t startQuery,
1095 uint32_t queryCount,
1096 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001097 VkDeviceSize destOffset,
1098 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001099 VkFlags flags)
1100{
1101 NULLDRV_LOG_FUNC;
1102}
1103
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001104ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001105 VkCmdBuffer cmdBuffer,
1106 VkTimestampType timestampType,
1107 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001108 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001109{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001110 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001111}
1112
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001113ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001114 VkCmdBuffer cmdBuffer,
Tony Barbourde4124d2015-07-03 10:33:54 -06001115 VkPipelineBindPoint pipelineBindPoint,
1116 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001117{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001118 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001119}
1120
Tony Barbourde4124d2015-07-03 10:33:54 -06001121ICD_EXPORT void VKAPI vkCmdBindDynamicViewportState(
1122 VkCmdBuffer cmdBuffer,
1123 VkDynamicViewportState state)
1124{
1125 NULLDRV_LOG_FUNC;
1126}
1127
1128ICD_EXPORT void VKAPI vkCmdBindDynamicRasterState(
1129 VkCmdBuffer cmdBuffer,
1130 VkDynamicRasterState state)
1131{
1132 NULLDRV_LOG_FUNC;
1133}
1134
1135ICD_EXPORT void VKAPI vkCmdBindDynamicColorBlendState(
1136 VkCmdBuffer cmdBuffer,
1137 VkDynamicColorBlendState state)
1138{
1139 NULLDRV_LOG_FUNC;
1140}
1141
1142ICD_EXPORT void VKAPI vkCmdBindDynamicDepthStencilState(
1143 VkCmdBuffer cmdBuffer,
1144 VkDynamicDepthStencilState state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001145{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001146 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001147}
1148
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001149ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001150 VkCmdBuffer cmdBuffer,
1151 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001152 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001153 uint32_t firstSet,
1154 uint32_t setCount,
1155 const VkDescriptorSet* pDescriptorSets,
1156 uint32_t dynamicOffsetCount,
1157 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001158{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001159 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001160}
1161
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001162ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1163 VkCmdBuffer cmdBuffer,
1164 uint32_t startBinding,
1165 uint32_t bindingCount,
1166 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001167 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001168{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001169 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001170}
1171
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001172ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001173 VkCmdBuffer cmdBuffer,
1174 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001175 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001176 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001177{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001178 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001179}
1180
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001181ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001182 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001183 uint32_t firstVertex,
1184 uint32_t vertexCount,
1185 uint32_t firstInstance,
1186 uint32_t instanceCount)
1187{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001188 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001189}
1190
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001191ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001192 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001193 uint32_t firstIndex,
1194 uint32_t indexCount,
1195 int32_t vertexOffset,
1196 uint32_t firstInstance,
1197 uint32_t instanceCount)
1198{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001199 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001200}
1201
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001202ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001203 VkCmdBuffer cmdBuffer,
1204 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001205 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001206 uint32_t count,
1207 uint32_t stride)
1208{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001209 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001210}
1211
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001212ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001213 VkCmdBuffer cmdBuffer,
1214 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001215 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001216 uint32_t count,
1217 uint32_t stride)
1218{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001219 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001220}
1221
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001222ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001223 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001224 uint32_t x,
1225 uint32_t y,
1226 uint32_t z)
1227{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001228 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001229}
1230
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001231ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001232 VkCmdBuffer cmdBuffer,
1233 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001234 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001235{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001236 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001237}
1238
Tony Barbour8205d902015-04-16 15:59:00 -06001239void VKAPI vkCmdWaitEvents(
1240 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001241 uint32_t eventCount,
1242 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001243 VkPipelineStageFlags sourceStageMask,
1244 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001245 uint32_t memBarrierCount,
1246 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001247{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001248 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001249}
1250
Tony Barbour8205d902015-04-16 15:59:00 -06001251void VKAPI vkCmdPipelineBarrier(
1252 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001253 VkPipelineStageFlags sourceStageMask,
1254 VkPipelineStageFlags destStageMask,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001255 VkBool32 byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001256 uint32_t memBarrierCount,
1257 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001258{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001259 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001260}
1261
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001262ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001263 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001264 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001265 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001266{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001267 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001268 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1269 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1270}
1271
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001272ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1273 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001274{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001275 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001276 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001277}
1278
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001279ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1280 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001281 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001282 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001283 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001284{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001285 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001286 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001287 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001288 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001289}
1290
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001291ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1292 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001293{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001294 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001295 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001296}
1297
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001298ICD_EXPORT VkResult VKAPI vkCreateEvent(
1299 VkDevice device,
1300 const VkEventCreateInfo* pCreateInfo,
1301 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001302{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001303 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001304 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001305}
1306
Tony Barbourde4124d2015-07-03 10:33:54 -06001307ICD_EXPORT VkResult VKAPI vkDestroyEvent(
1308 VkDevice device,
1309 VkEvent event)
1310{
1311 NULLDRV_LOG_FUNC;
1312 return VK_SUCCESS;
1313}
1314
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001315ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001316 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001317 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001318{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001319 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001320 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001321}
1322
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001323ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001324 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001325 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001326{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001327 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001328 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001329}
1330
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001331ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001332 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001333 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001334{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001335 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001336 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001337}
1338
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001339ICD_EXPORT VkResult VKAPI vkCreateFence(
1340 VkDevice device,
1341 const VkFenceCreateInfo* pCreateInfo,
1342 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001343{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001344 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001345 struct nulldrv_dev *dev = nulldrv_dev(device);
1346
1347 return nulldrv_fence_create(dev, pCreateInfo,
1348 (struct nulldrv_fence **) pFence);
1349}
1350
Tony Barbourde4124d2015-07-03 10:33:54 -06001351ICD_EXPORT VkResult VKAPI vkDestroyFence(
1352 VkDevice device,
1353 VkFence fence)
1354{
1355 NULLDRV_LOG_FUNC;
1356 return VK_SUCCESS;
1357}
1358
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001359ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001360 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001361 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001362{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001363 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001364 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001365}
1366
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001367ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001368 VkDevice device,
1369 uint32_t fenceCount,
1370 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001371{
1372 NULLDRV_LOG_FUNC;
1373 return VK_SUCCESS;
1374}
1375
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001376ICD_EXPORT VkResult VKAPI vkWaitForFences(
1377 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001378 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001379 const VkFence* pFences,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001380 VkBool32 waitAll,
David Pinedo0257fbf2015-02-02 18:02:40 -07001381 uint64_t timeout)
1382{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001383 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001384 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001385}
1386
Tony Barbour426b9052015-06-24 16:06:58 -06001387ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1388 VkPhysicalDevice gpu_,
1389 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001390{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001391 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001392 VkResult ret = VK_SUCCESS;
1393
Tony Barbour426b9052015-06-24 16:06:58 -06001394 pProperties->apiVersion = VK_API_VERSION;
1395 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1396 pProperties->vendorId = 0;
1397 pProperties->deviceId = 0;
1398 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1399 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001400
1401 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001402}
1403
Chris Forbesd7576302015-06-21 22:55:02 +12001404ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1405 VkPhysicalDevice physicalDevice,
1406 VkPhysicalDeviceFeatures* pFeatures)
1407{
1408 NULLDRV_LOG_FUNC;
1409 VkResult ret = VK_SUCCESS;
1410
1411 /* TODO: fill out features */
1412 memset(pFeatures, 0, sizeof(*pFeatures));
1413
1414 return ret;
1415}
1416
1417ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatInfo(
1418 VkPhysicalDevice physicalDevice,
1419 VkFormat format,
1420 VkFormatProperties* pFormatInfo)
1421{
1422 NULLDRV_LOG_FUNC;
1423 VkResult ret = VK_SUCCESS;
1424
1425 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1426 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1427
1428 return ret;
1429}
1430
1431ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1432 VkPhysicalDevice physicalDevice,
1433 VkPhysicalDeviceLimits* pLimits)
1434{
1435 NULLDRV_LOG_FUNC;
1436 VkResult ret = VK_SUCCESS;
1437
1438 /* TODO: fill out limits */
1439 memset(pLimits, 0, sizeof(*pLimits));
1440
1441 return ret;
1442}
1443
Tony Barbour426b9052015-06-24 16:06:58 -06001444ICD_EXPORT VkResult VKAPI vkGetPhysicalDevicePerformance(
1445 VkPhysicalDevice gpu_,
1446 VkPhysicalDevicePerformance* pPerformance)
Jon Ashburneb2728b2015-04-10 14:33:07 -06001447{
Tony Barbour426b9052015-06-24 16:06:58 -06001448 pPerformance->maxDeviceClock = 1.0f;
1449 pPerformance->aluPerClock = 1.0f;
1450 pPerformance->texPerClock = 1.0f;
1451 pPerformance->primsPerClock = 1.0f;
1452 pPerformance->pixelsPerClock = 1.0f;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001453
1454 return VK_SUCCESS;
1455}
1456
Tony Barbour426b9052015-06-24 16:06:58 -06001457ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueCount(
1458 VkPhysicalDevice gpu_,
1459 uint32_t* pCount)
David Pinedo0257fbf2015-02-02 18:02:40 -07001460{
Tony Barbour426b9052015-06-24 16:06:58 -06001461 *pCount = 1;
1462 return VK_SUCCESS;
1463}
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001464
Tony Barbour426b9052015-06-24 16:06:58 -06001465ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueProperties(
1466 VkPhysicalDevice gpu_,
1467 uint32_t count,
1468 VkPhysicalDeviceQueueProperties* pProperties)
1469 {
1470 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1471 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001472 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001473
Tony Barbour426b9052015-06-24 16:06:58 -06001474 return VK_SUCCESS;
1475}
1476
Ian Elliotte924ab22015-07-08 13:24:30 -06001477ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(
1478 VkPhysicalDevice gpu_,
1479 VkPhysicalDeviceMemoryProperties* pProperties)
1480{
1481 // TODO: Fill in with real data
1482 return VK_SUCCESS;
1483}
1484
1485ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLayerProperties(
1486 VkPhysicalDevice physicalDevice,
1487 uint32_t* pCount,
1488 VkLayerProperties* pProperties)
1489{
1490 // TODO: Fill in with real data
1491 return VK_SUCCESS;
1492}
1493
Tony Barbour426b9052015-06-24 16:06:58 -06001494ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001495 const char* pLayerName,
1496 uint32_t* pCount,
1497 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001498{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001499 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001500
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001501 if (pCount == NULL) {
1502 return VK_ERROR_INVALID_POINTER;
1503 }
Tony Barbour426b9052015-06-24 16:06:58 -06001504
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001505 if (pProperties == NULL) {
1506 *pCount = NULLDRV_EXT_COUNT;
1507 return VK_SUCCESS;
1508 }
Tony Barbour426b9052015-06-24 16:06:58 -06001509
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001510 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1511 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1512 *pCount = copy_size;
1513 if (copy_size < NULLDRV_EXT_COUNT) {
1514 return VK_INCOMPLETE;
1515 }
Tony Barbour426b9052015-06-24 16:06:58 -06001516 return VK_SUCCESS;
1517}
Ian Elliotte924ab22015-07-08 13:24:30 -06001518ICD_EXPORT VkResult VKAPI vkGetGlobalLayerProperties(
1519 uint32_t* pCount,
1520 VkLayerProperties* pProperties)
1521{
1522 // TODO: Fill in with real data
1523 return VK_SUCCESS;
1524}
Tony Barbour426b9052015-06-24 16:06:58 -06001525
1526VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001527 VkPhysicalDevice physicalDevice,
1528 const char* pLayerName,
1529 uint32_t* pCount,
1530 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001531{
Tony Barbour426b9052015-06-24 16:06:58 -06001532
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001533 if (pCount == NULL) {
1534 return VK_ERROR_INVALID_POINTER;
1535 }
1536
Tony Barbour426b9052015-06-24 16:06:58 -06001537 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001538
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001539 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001540}
1541
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001542ICD_EXPORT VkResult VKAPI vkCreateImage(
1543 VkDevice device,
1544 const VkImageCreateInfo* pCreateInfo,
1545 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001546{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001547 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001548 struct nulldrv_dev *dev = nulldrv_dev(device);
1549
1550 return nulldrv_img_create(dev, pCreateInfo, false,
1551 (struct nulldrv_img **) pImage);
1552}
1553
Tony Barbourde4124d2015-07-03 10:33:54 -06001554ICD_EXPORT VkResult VKAPI vkDestroyImage(
1555 VkDevice device,
1556 VkImage image)
1557{
1558 NULLDRV_LOG_FUNC;
1559 return VK_SUCCESS;
1560}
1561
Tony Barbour426b9052015-06-24 16:06:58 -06001562ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001563 VkDevice device,
1564 VkImage image,
1565 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001566 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001567{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001568 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001569
Tony Barbour426b9052015-06-24 16:06:58 -06001570 pLayout->offset = 0;
1571 pLayout->size = 1;
1572 pLayout->rowPitch = 4;
1573 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001574
Tony Barbour426b9052015-06-24 16:06:58 -06001575 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001576}
1577
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001578ICD_EXPORT VkResult VKAPI vkAllocMemory(
1579 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001580 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001581 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001582{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001583 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001584 struct nulldrv_dev *dev = nulldrv_dev(device);
1585
1586 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1587}
1588
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001589ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001590 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001591 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001592{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001593 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001594 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001595}
1596
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001597ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001598 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001599 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001600 VkDeviceSize offset,
1601 VkDeviceSize size,
1602 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001603 void** ppData)
1604{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001605 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001606 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1607 void *ptr = nulldrv_mem_map(mem, flags);
1608
1609 *ppData = ptr;
1610
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001611 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001612}
1613
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001614ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001615 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001616 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001617{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001618 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001619 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001620}
1621
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001622ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001623 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001624 uint32_t memRangeCount,
1625 const VkMappedMemoryRange* pMemRanges)
1626{
1627 NULLDRV_LOG_FUNC;
1628 return VK_SUCCESS;
1629}
1630
1631ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1632 VkDevice device,
1633 uint32_t memRangeCount,
1634 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001635{
1636 NULLDRV_LOG_FUNC;
1637 return VK_SUCCESS;
1638}
1639
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001640ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001641 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001642 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001643{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001644 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001645 struct nulldrv_instance *inst;
1646
1647 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001648 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001649 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001650 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001651
Tony Barbour426b9052015-06-24 16:06:58 -06001652 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001653
Mike Stroyan230e6252015-04-17 12:36:38 -06001654 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001655
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001656 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001657}
1658
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001659ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1660 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001661{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001662 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001663 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001664}
1665
Tony Barbour8205d902015-04-16 15:59:00 -06001666ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001667 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001668 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001669 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001670{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001671 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001672 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001673 struct nulldrv_gpu *gpu;
1674 *pGpuCount = 1;
1675 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001676 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001677 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001678 return ret;
1679}
1680
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001681ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001682 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001683 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001684 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001685 char* const* pOutLayers,
1686 void* pReserved)
1687{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001688 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001689 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001690}
1691
Tony Barbourde4124d2015-07-03 10:33:54 -06001692ICD_EXPORT VkResult VKAPI vkGetBufferMemoryRequirements(
1693 VkDevice device,
1694 VkBuffer buffer,
1695 VkMemoryRequirements* pMemoryRequirements)
1696{
1697 NULLDRV_LOG_FUNC;
1698 struct nulldrv_base *base = nulldrv_base((void*)buffer.handle);
1699
1700 return base->get_memory_requirements(base, pMemoryRequirements);
1701}
1702
1703ICD_EXPORT VkResult VKAPI vkGetImageMemoryRequirements(
1704 VkDevice device,
1705 VkImage image,
1706 VkMemoryRequirements* pMemoryRequirements)
1707{
1708 NULLDRV_LOG_FUNC;
1709 struct nulldrv_base *base = nulldrv_base((void*)image.handle);
1710
1711 return base->get_memory_requirements(base, pMemoryRequirements);
1712}
1713
1714ICD_EXPORT VkResult VKAPI vkBindBufferMemory(
1715 VkDevice device,
1716 VkBuffer buffer,
1717 VkDeviceMemory mem_,
1718 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001719{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001720 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001721 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001722}
1723
Tony Barbourde4124d2015-07-03 10:33:54 -06001724ICD_EXPORT VkResult VKAPI vkBindImageMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001725 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06001726 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001727 VkDeviceMemory mem_,
1728 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001729{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001730 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001731 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001732}
1733
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001734ICD_EXPORT VkResult VKAPI vkGetImageSparseMemoryRequirements(
1735 VkDevice device,
1736 VkImage image,
1737 uint32_t* pNumRequirements,
1738 VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
1739{
1740 NULLDRV_LOG_FUNC;
1741 return VK_SUCCESS;
1742}
1743
1744ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(
1745 VkPhysicalDevice physicalDevice,
1746 VkFormat format,
1747 VkImageType type,
1748 uint32_t samples,
1749 VkImageUsageFlags usage,
1750 VkImageTiling tiling,
1751 uint32_t* pNumProperties,
1752 VkSparseImageFormatProperties* pProperties)
1753{
1754 NULLDRV_LOG_FUNC;
1755 return VK_SUCCESS;
1756}
1757
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001758ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001759 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001760 VkBuffer buffer,
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001761 uint32_t numBindings,
1762 const VkSparseMemoryBindInfo* pBindInfo)
1763{
1764 NULLDRV_LOG_FUNC;
1765 return VK_SUCCESS;
1766}
1767
1768ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageOpaqueMemory(
1769 VkQueue queue,
1770 VkImage image,
1771 uint32_t numBindings,
1772 const VkSparseMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001773{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001774 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001775 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001776}
1777
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001778ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001779 VkQueue queue,
1780 VkImage image,
1781 uint32_t numBindings,
1782 const VkSparseImageMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001783{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001784 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001785 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001786}
Jon Ashburn0e249962015-07-10 09:41:15 -07001787ICD_EXPORT VkResult VKAPI vkCreatePipelineCache(
1788 VkDevice device,
1789 const VkPipelineCacheCreateInfo* pCreateInfo,
1790 VkPipelineCache* pPipelineCache)
1791{
David Pinedo0257fbf2015-02-02 18:02:40 -07001792
Jon Ashburn0e249962015-07-10 09:41:15 -07001793 NULLDRV_LOG_FUNC;
1794 return VK_SUCCESS;
1795}
1796
Tony Barbourde4124d2015-07-03 10:33:54 -06001797<<<<<<< HEAD
Jon Ashburn0e249962015-07-10 09:41:15 -07001798VkResult VKAPI vkDestroyPipelineCache(
1799 VkDevice device,
1800 VkPipelineCache pipelineCache)
Tony Barbourde4124d2015-07-03 10:33:54 -06001801=======
1802ICD_EXPORT VkResult VKAPI vkDestroyPipeline(
1803 VkDevice device,
1804 VkPipeline pipeline)
1805{
1806 NULLDRV_LOG_FUNC;
1807 return VK_SUCCESS;
1808}
1809
1810ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(
1811 VkDevice device,
1812 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1813 VkPipeline basePipeline,
1814 VkPipeline* pPipeline)
1815>>>>>>> Bug 14084 - Improve type safety and remove polymorphism
Jon Ashburn0e249962015-07-10 09:41:15 -07001816{
1817 NULLDRV_LOG_FUNC;
1818 return VK_SUCCESS;
1819}
1820
1821ICD_EXPORT size_t VKAPI vkGetPipelineCacheSize(
1822 VkDevice device,
1823 VkPipelineCache pipelineCache)
1824{
1825 NULLDRV_LOG_FUNC;
1826 return VK_ERROR_UNAVAILABLE;
1827}
1828
1829ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
1830 VkDevice device,
1831 VkPipelineCache pipelineCache,
1832 void* pData)
1833{
1834 NULLDRV_LOG_FUNC;
1835 return VK_ERROR_UNAVAILABLE;
1836}
1837
1838ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
1839 VkDevice device,
1840 VkPipelineCache destCache,
1841 uint32_t srcCacheCount,
1842 const VkPipelineCache* pSrcCaches)
1843{
1844 NULLDRV_LOG_FUNC;
1845 return VK_ERROR_UNAVAILABLE;
1846}
1847ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001848 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001849 VkPipelineCache pipelineCache,
1850 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001851 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1852 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001853{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001854 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001855 struct nulldrv_dev *dev = nulldrv_dev(device);
1856
1857 return graphics_pipeline_create(dev, pCreateInfo,
1858 (struct nulldrv_pipeline **) pPipeline);
1859}
1860
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001861
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001862
Jon Ashburn0e249962015-07-10 09:41:15 -07001863ICD_EXPORT VkResult VKAPI vkCreateComputePipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001864 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001865 VkPipelineCache pipelineCache,
1866 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001867 const VkComputePipelineCreateInfo* pCreateInfo,
1868 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001869{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001870 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001871 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001872}
1873
David Pinedo0257fbf2015-02-02 18:02:40 -07001874
David Pinedo0257fbf2015-02-02 18:02:40 -07001875
Jon Ashburn0e249962015-07-10 09:41:15 -07001876
David Pinedo0257fbf2015-02-02 18:02:40 -07001877
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001878ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1879 VkDevice device,
1880 const VkQueryPoolCreateInfo* pCreateInfo,
1881 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001882{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001883 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001884 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001885}
1886
Tony Barbourde4124d2015-07-03 10:33:54 -06001887ICD_EXPORT VkResult VKAPI vkDestroyQueryPool(
1888 VkDevice device,
1889 VkQueryPool queryPoool)
1890{
1891 NULLDRV_LOG_FUNC;
1892 return VK_SUCCESS;
1893}
1894
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001895ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001896 VkDevice device,
1897 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001898 uint32_t startQuery,
1899 uint32_t queryCount,
1900 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001901 void* pData,
1902 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001903{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001904 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001905 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001906}
1907
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001908ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1909 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001910{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001911 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001912 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001913}
1914
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001915ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1916 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001917 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001918 const VkCmdBuffer* pCmdBuffers,
1919 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001920{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001921 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001922 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001923}
1924
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001925ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1926 VkDevice device,
1927 const VkSemaphoreCreateInfo* pCreateInfo,
1928 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001929{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001930 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001931 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001932}
1933
Tony Barbourde4124d2015-07-03 10:33:54 -06001934ICD_EXPORT VkResult VKAPI vkDestroySemaphore(
1935 VkDevice device,
1936 VkSemaphore semaphore)
1937{
1938 NULLDRV_LOG_FUNC;
1939 return VK_SUCCESS;
1940}
1941
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001942ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1943 VkQueue queue,
1944 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001945{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001946 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001947 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001948}
1949
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001950ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1951 VkQueue queue,
1952 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001953{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001954 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001955 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001956}
1957
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001958ICD_EXPORT VkResult VKAPI vkCreateSampler(
1959 VkDevice device,
1960 const VkSamplerCreateInfo* pCreateInfo,
1961 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07001962{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001963 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001964 struct nulldrv_dev *dev = nulldrv_dev(device);
1965
1966 return nulldrv_sampler_create(dev, pCreateInfo,
1967 (struct nulldrv_sampler **) pSampler);
1968}
1969
Tony Barbourde4124d2015-07-03 10:33:54 -06001970ICD_EXPORT VkResult VKAPI vkDestroySampler(
1971 VkDevice device,
1972 VkSampler sampler)
1973{
1974 NULLDRV_LOG_FUNC;
1975 return VK_SUCCESS;
1976}
1977
Ian Elliotte924ab22015-07-08 13:24:30 -06001978ICD_EXPORT VkResult VKAPI vkCreateShaderModule(
1979 VkDevice device,
1980 const VkShaderModuleCreateInfo* pCreateInfo,
1981 VkShaderModule* pShaderModule)
1982{
1983 // TODO: Fill in with real data
Tony Barbourde4124d2015-07-03 10:33:54 -06001984 NULLDRV_LOG_FUNC;
1985 return VK_SUCCESS;
1986}
1987
1988ICD_EXPORT VkResult VKAPI vkDestroyShaderModule(
1989 VkDevice device,
1990 VkShaderModule shaderModule)
1991{
1992 // TODO: Fill in with real data
1993 NULLDRV_LOG_FUNC;
Ian Elliotte924ab22015-07-08 13:24:30 -06001994 return VK_SUCCESS;
1995}
1996
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001997ICD_EXPORT VkResult VKAPI vkCreateShader(
1998 VkDevice device,
1999 const VkShaderCreateInfo* pCreateInfo,
2000 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002001{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002002 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002003 struct nulldrv_dev *dev = nulldrv_dev(device);
2004
2005 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2006}
2007
Tony Barbourde4124d2015-07-03 10:33:54 -06002008ICD_EXPORT VkResult VKAPI vkDestroyShader(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002009 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002010 VkShader shader)
2011{
2012 NULLDRV_LOG_FUNC;
2013 return VK_SUCCESS;
2014}
2015
2016ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2017 VkDevice device,
2018 const VkDynamicViewportStateCreateInfo* pCreateInfo,
2019 VkDynamicViewportState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002020{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002021 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002022 struct nulldrv_dev *dev = nulldrv_dev(device);
2023
2024 return nulldrv_viewport_state_create(dev, pCreateInfo,
2025 (struct nulldrv_dynamic_vp **) pState);
2026}
2027
Tony Barbourde4124d2015-07-03 10:33:54 -06002028ICD_EXPORT VkResult VKAPI vkDestroyDynamicViewportState(
2029 VkDevice device,
2030 VkDynamicViewportState dynamicViewportState)
2031{
2032 NULLDRV_LOG_FUNC;
2033 return VK_SUCCESS;
2034}
2035
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002036ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
2037 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002038 const VkDynamicRasterStateCreateInfo* pCreateInfo,
2039 VkDynamicRasterState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002040{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002041 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002042 struct nulldrv_dev *dev = nulldrv_dev(device);
2043
2044 return nulldrv_raster_state_create(dev, pCreateInfo,
2045 (struct nulldrv_dynamic_rs **) pState);
2046}
2047
Tony Barbourde4124d2015-07-03 10:33:54 -06002048ICD_EXPORT VkResult VKAPI vkDestroyDynamicRasterState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002049 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002050 VkDynamicRasterState dynamicRasterState)
2051{
2052 NULLDRV_LOG_FUNC;
2053 return VK_SUCCESS;
2054}
2055
2056ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
2057 VkDevice device,
2058 const VkDynamicColorBlendStateCreateInfo* pCreateInfo,
2059 VkDynamicColorBlendState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002060{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002061 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002062 struct nulldrv_dev *dev = nulldrv_dev(device);
2063
2064 return nulldrv_blend_state_create(dev, pCreateInfo,
2065 (struct nulldrv_dynamic_cb **) pState);
2066}
2067
Tony Barbourde4124d2015-07-03 10:33:54 -06002068ICD_EXPORT VkResult VKAPI vkDestroyDynamicColorBlendState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002069 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002070 VkDynamicColorBlendState dynamicColorBlendState)
2071{
2072 NULLDRV_LOG_FUNC;
2073 return VK_SUCCESS;
2074}
2075
2076ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
2077 VkDevice device,
2078 const VkDynamicDepthStencilStateCreateInfo* pCreateInfo,
2079 VkDynamicDepthStencilState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002080{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002081 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002082 struct nulldrv_dev *dev = nulldrv_dev(device);
2083
2084 return nulldrv_ds_state_create(dev, pCreateInfo,
2085 (struct nulldrv_dynamic_ds **) pState);
2086}
2087
Tony Barbourde4124d2015-07-03 10:33:54 -06002088ICD_EXPORT VkResult VKAPI vkDestroyDynamicDepthStencilState(
2089 VkDevice device,
2090 VkDynamicDepthStencilState dynamicDepthStencilState)
2091{
2092 NULLDRV_LOG_FUNC;
2093 return VK_SUCCESS;
2094}
2095
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002096ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2097 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002098 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002099 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002100{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002101 NULLDRV_LOG_FUNC;
2102 struct nulldrv_dev *dev = nulldrv_dev(device);
2103
2104 return nulldrv_buf_view_create(dev, pCreateInfo,
2105 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002106}
2107
Tony Barbourde4124d2015-07-03 10:33:54 -06002108ICD_EXPORT VkResult VKAPI vkDestroyBufferView(
2109 VkDevice device,
2110 VkBufferView bufferView)
2111{
2112 NULLDRV_LOG_FUNC;
2113 return VK_SUCCESS;
2114}
2115
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002116ICD_EXPORT VkResult VKAPI vkCreateImageView(
2117 VkDevice device,
2118 const VkImageViewCreateInfo* pCreateInfo,
2119 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002120{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002121 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002122 struct nulldrv_dev *dev = nulldrv_dev(device);
2123
2124 return nulldrv_img_view_create(dev, pCreateInfo,
2125 (struct nulldrv_img_view **) pView);
2126}
2127
Tony Barbourde4124d2015-07-03 10:33:54 -06002128<<<<<<< HEAD
Chia-I Wuc278df82015-07-07 11:50:03 +08002129ICD_EXPORT VkResult VKAPI vkCreateAttachmentView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002130=======
2131ICD_EXPORT VkResult VKAPI vkDestroyImageView(
2132 VkDevice device,
2133 VkImageView imageView)
2134{
2135 NULLDRV_LOG_FUNC;
2136 return VK_SUCCESS;
2137}
2138
2139ICD_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
2140>>>>>>> Bug 14084 - Improve type safety and remove polymorphism
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002141 VkDevice device,
Chia-I Wuc278df82015-07-07 11:50:03 +08002142 const VkAttachmentViewCreateInfo* pCreateInfo,
2143 VkAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002144{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002145 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002146 struct nulldrv_dev *dev = nulldrv_dev(device);
2147
2148 return nulldrv_rt_view_create(dev, pCreateInfo,
2149 (struct nulldrv_rt_view **) pView);
2150}
2151
Tony Barbourde4124d2015-07-03 10:33:54 -06002152<<<<<<< HEAD
2153=======
2154ICD_EXPORT VkResult VKAPI vkDestroyColorAttachmentView(
2155 VkDevice device,
2156 VkColorAttachmentView colorAttachmentView)
2157{
2158 NULLDRV_LOG_FUNC;
2159 return VK_SUCCESS;
2160}
2161
2162ICD_EXPORT VkResult VKAPI vkCreateDepthStencilView(
2163 VkDevice device,
2164 const VkDepthStencilViewCreateInfo* pCreateInfo,
2165 VkDepthStencilView* pView)
2166{
2167 NULLDRV_LOG_FUNC;
2168 struct nulldrv_dev *dev = nulldrv_dev(device);
2169
2170 return nulldrv_ds_view_create(dev, pCreateInfo,
2171 (struct nulldrv_ds_view **) pView);
2172
2173}
2174
2175ICD_EXPORT VkResult VKAPI vkDestroyDepthStencilView(
2176 VkDevice device,
2177 VkDepthStencilView depthStencilView)
2178{
2179 NULLDRV_LOG_FUNC;
2180 return VK_SUCCESS;
2181}
2182
2183>>>>>>> Bug 14084 - Improve type safety and remove polymorphism
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002184ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2185 VkDevice device,
2186 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2187 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002188{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002189 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002190 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002191
Chia-I Wu7732cb22015-03-26 15:27:55 +08002192 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002193 (struct nulldrv_desc_layout **) pSetLayout);
2194}
2195
Tony Barbourde4124d2015-07-03 10:33:54 -06002196ICD_EXPORT VkResult VKAPI vkDestroyDescriptorSetLayout(
2197 VkDevice device,
2198 VkDescriptorSetLayout descriptorSetLayout)
2199{
2200 NULLDRV_LOG_FUNC;
2201 return VK_SUCCESS;
2202}
2203
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002204ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2205 VkDevice device,
2206 const VkPipelineLayoutCreateInfo* pCreateInfo,
2207 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002208{
2209 NULLDRV_LOG_FUNC;
2210 struct nulldrv_dev *dev = nulldrv_dev(device);
2211
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002212 return nulldrv_pipeline_layout_create(dev,
2213 pCreateInfo,
2214 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002215}
2216
Tony Barbourde4124d2015-07-03 10:33:54 -06002217ICD_EXPORT VkResult VKAPI vkDestroyPipelineLayout(
2218 VkDevice device,
2219 VkPipelineLayout pipelineLayout)
2220{
2221 NULLDRV_LOG_FUNC;
2222 return VK_SUCCESS;
2223}
2224
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002225ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2226 VkDevice device,
2227 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002228 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002229 const VkDescriptorPoolCreateInfo* pCreateInfo,
2230 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002231{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002232 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002233 struct nulldrv_dev *dev = nulldrv_dev(device);
2234
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002235 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2236 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002237}
2238
Tony Barbourde4124d2015-07-03 10:33:54 -06002239ICD_EXPORT VkResult VKAPI vkDestroyDescriptorPool(
2240 VkDevice device,
2241 VkDescriptorPool descriptorPool)
2242{
2243 NULLDRV_LOG_FUNC;
2244 return VK_SUCCESS;
2245}
2246
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002247ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002248 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002249 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002250{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002251 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002252 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002253}
2254
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002255ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002256 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002257 VkDescriptorPool descriptorPool,
2258 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002259 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002260 const VkDescriptorSetLayout* pSetLayouts,
2261 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07002262 uint32_t* pCount)
2263{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002264 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002265 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2266 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002267 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002268 uint32_t i;
2269
2270 for (i = 0; i < count; i++) {
2271 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002272 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002273
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002274 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002275 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002276 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002277 break;
2278 }
2279
2280 if (pCount)
2281 *pCount = i;
2282
2283 return ret;
2284}
2285
Tony Barbourb857d312015-07-10 10:50:45 -06002286ICD_EXPORT VkResult VKAPI vkFreeDescriptorSets(
2287 VkDevice device,
2288 VkDescriptorPool descriptorPool,
2289 uint32_t count,
2290 const VkDescriptorSet* pDescriptorSets)
2291{
2292 NULLDRV_LOG_FUNC;
2293 return VK_SUCCESS;
2294}
2295
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002296ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2297 VkDevice device,
2298 uint32_t writeCount,
2299 const VkWriteDescriptorSet* pDescriptorWrites,
2300 uint32_t copyCount,
2301 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002302{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002303 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002304 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002305}
2306
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002307ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2308 VkDevice device,
2309 const VkFramebufferCreateInfo* info,
2310 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002311{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002312 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002313 struct nulldrv_dev *dev = nulldrv_dev(device);
2314
2315 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2316}
2317
Tony Barbourde4124d2015-07-03 10:33:54 -06002318ICD_EXPORT VkResult VKAPI vkDestroyFramebuffer(
2319 VkDevice device,
2320 VkFramebuffer framebuffer)
2321{
2322 NULLDRV_LOG_FUNC;
2323 return VK_SUCCESS;
2324}
David Pinedo0257fbf2015-02-02 18:02:40 -07002325
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002326ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2327 VkDevice device,
2328 const VkRenderPassCreateInfo* info,
2329 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002330{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002331 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002332 struct nulldrv_dev *dev = nulldrv_dev(device);
2333
2334 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2335}
2336
Tony Barbourde4124d2015-07-03 10:33:54 -06002337ICD_EXPORT VkResult VKAPI vkDestroyRenderPass(
2338 VkDevice device,
2339 VkRenderPass renderPass)
2340{
2341 NULLDRV_LOG_FUNC;
2342 return VK_SUCCESS;
2343}
2344
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002345ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Chia-I Wuc278df82015-07-07 11:50:03 +08002346 VkCmdBuffer cmdBuffer,
2347 const VkRenderPassBeginInfo* pRenderPassBegin,
2348 VkRenderPassContents contents)
2349{
2350 NULLDRV_LOG_FUNC;
2351}
2352
2353ICD_EXPORT void VKAPI vkCmdNextSubpass(
2354 VkCmdBuffer cmdBuffer,
2355 VkRenderPassContents contents)
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}
2359
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002360ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002361 VkCmdBuffer cmdBuffer)
2362{
2363 NULLDRV_LOG_FUNC;
2364}
2365
2366ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2367 VkCmdBuffer cmdBuffer,
2368 uint32_t cmdBuffersCount,
2369 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002370{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002371 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002372}
Ian Elliottf93069f2015-02-19 14:26:19 -07002373
2374ICD_EXPORT void* xcbCreateWindow(
2375 uint16_t width,
2376 uint16_t height)
2377{
2378 static uint32_t window; // Kludge to the max
2379 NULLDRV_LOG_FUNC;
2380 return &window;
2381}
2382
2383// May not be needed, if we stub out stuf in tri.c
2384ICD_EXPORT void xcbDestroyWindow()
2385{
2386 NULLDRV_LOG_FUNC;
2387}
2388
2389ICD_EXPORT int xcbGetMessage(void *msg)
2390{
2391 NULLDRV_LOG_FUNC;
2392 return 0;
2393}
2394
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002395ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002396{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002397 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002398}