blob: e2d36c08b6250f9bd15c06540103e983a4ab5c74 [file] [log] [blame]
David Pinedo0257fbf2015-02-02 18:02:40 -07001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan null driver
David Pinedo0257fbf2015-02-02 18:02:40 -07003 *
4 * Copyright (C) 2015 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 */
25
26#include "nulldrv.h"
David Pinedo8e9cb3b2015-02-10 15:02:08 -070027#include <stdio.h>
David Pinedo0257fbf2015-02-02 18:02:40 -070028
David Pinedo8e9cb3b2015-02-10 15:02:08 -070029#if 0
30#define NULLDRV_LOG_FUNC \
31 do { \
32 fflush(stdout); \
33 fflush(stderr); \
34 printf("null driver: %s\n", __FUNCTION__); \
35 fflush(stdout); \
36 } while (0)
37#else
38 #define NULLDRV_LOG_FUNC do { } while (0)
39#endif
40
41// The null driver supports all WSI extenstions ... for now ...
David Pinedo0257fbf2015-02-02 18:02:40 -070042static const char * const nulldrv_gpu_exts[NULLDRV_EXT_COUNT] = {
Jon Ashburncedc15f2015-05-21 18:13:33 -060043 [NULLDRV_EXT_WSI_LUNARG] = VK_WSI_LUNARG_EXTENSION_NAME,
David Pinedo0257fbf2015-02-02 18:02:40 -070044};
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060045static const VkExtensionProperties intel_gpu_exts[NULLDRV_EXT_COUNT] = {
46 {
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -060047 .extName = VK_WSI_LUNARG_EXTENSION_NAME,
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060048 .version = VK_WSI_LUNARG_REVISION,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -060049 .specVersion = VK_API_VERSION,
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060050 }
51};
David Pinedo0257fbf2015-02-02 18:02:40 -070052
Tony Barbourde4124d2015-07-03 10:33:54 -060053static struct nulldrv_base *nulldrv_base(void* base)
David Pinedo0257fbf2015-02-02 18:02:40 -070054{
55 return (struct nulldrv_base *) base;
56}
57
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060058static struct nulldrv_base *nulldrv_base_create(
59 struct nulldrv_dev *dev,
60 size_t obj_size,
Tony Barbourde4124d2015-07-03 10:33:54 -060061 VkDbgObjectType type)
David Pinedo0257fbf2015-02-02 18:02:40 -070062{
63 struct nulldrv_base *base;
64
65 if (!obj_size)
66 obj_size = sizeof(*base);
67
68 assert(obj_size >= sizeof(*base));
69
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060070 base = (struct nulldrv_base*)malloc(obj_size);
David Pinedo0257fbf2015-02-02 18:02:40 -070071 if (!base)
72 return NULL;
73
74 memset(base, 0, obj_size);
75
76 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbourde4124d2015-07-03 10:33:54 -060077 set_loader_magic_value(base);
David Pinedo0257fbf2015-02-02 18:02:40 -070078
79 if (dev == NULL) {
80 /*
81 * dev is NULL when we are creating the base device object
82 * Set dev now so that debug setup happens correctly
83 */
84 dev = (struct nulldrv_dev *) base;
85 }
86
87
Tony Barbour426b9052015-06-24 16:06:58 -060088 base->get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -070089
90 return base;
91}
92
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060093static VkResult nulldrv_gpu_add(int devid, const char *primary_node,
David Pinedo0257fbf2015-02-02 18:02:40 -070094 const char *render_node, struct nulldrv_gpu **gpu_ret)
95{
96 struct nulldrv_gpu *gpu;
97
Chia-I Wu493a1752015-02-22 14:40:25 +080098 gpu = malloc(sizeof(*gpu));
David Pinedo0257fbf2015-02-02 18:02:40 -070099 if (!gpu)
Tony Barbour8205d902015-04-16 15:59:00 -0600100 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700101 memset(gpu, 0, sizeof(*gpu));
Mark Lobodzinski97dcd042015-04-16 08:52:00 -0500102
David Pinedo0257fbf2015-02-02 18:02:40 -0700103 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbourde4124d2015-07-03 10:33:54 -0600104 set_loader_magic_value(gpu);
David Pinedo0257fbf2015-02-02 18:02:40 -0700105
106 *gpu_ret = gpu;
107
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600108 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700109}
110
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600111static VkResult nulldrv_queue_create(struct nulldrv_dev *dev,
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700112 uint32_t node_index,
David Pinedo0257fbf2015-02-02 18:02:40 -0700113 struct nulldrv_queue **queue_ret)
114{
115 struct nulldrv_queue *queue;
116
117 queue = (struct nulldrv_queue *) nulldrv_base_create(dev, sizeof(*queue),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600118 VK_OBJECT_TYPE_QUEUE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700119 if (!queue)
Tony Barbour8205d902015-04-16 15:59:00 -0600120 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700121
122 queue->dev = dev;
123
124 *queue_ret = queue;
125
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600126 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700127}
128
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600129static VkResult dev_create_queues(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600130 const VkDeviceQueueCreateInfo *queues,
David Pinedo0257fbf2015-02-02 18:02:40 -0700131 uint32_t count)
132{
133 uint32_t i;
134
135 if (!count)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600136 return VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700137
138 for (i = 0; i < count; i++) {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600139 const VkDeviceQueueCreateInfo *q = &queues[i];
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600140 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700141
142 if (q->queueCount == 1 && !dev->queues[q->queueNodeIndex]) {
143 ret = nulldrv_queue_create(dev, q->queueNodeIndex,
144 &dev->queues[q->queueNodeIndex]);
145 }
146 else {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600147 ret = VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700148 }
149
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600150 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700151 return ret;
152 }
153 }
154
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600155 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700156}
157
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600158static enum nulldrv_ext_type nulldrv_gpu_lookup_extension(
159 const struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600160 const char* extName)
David Pinedo0257fbf2015-02-02 18:02:40 -0700161{
162 enum nulldrv_ext_type type;
163
164 for (type = 0; type < ARRAY_SIZE(nulldrv_gpu_exts); type++) {
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600165 if (strcmp(nulldrv_gpu_exts[type], extName) == 0)
David Pinedo0257fbf2015-02-02 18:02:40 -0700166 break;
167 }
168
169 assert(type < NULLDRV_EXT_COUNT || type == NULLDRV_EXT_INVALID);
170
171 return type;
172}
173
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600174static VkResult nulldrv_desc_ooxx_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800175 struct nulldrv_desc_ooxx **ooxx_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700176{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800177 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700178
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800179 ooxx = malloc(sizeof(*ooxx));
180 if (!ooxx)
Tony Barbour8205d902015-04-16 15:59:00 -0600181 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700182
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800183 memset(ooxx, 0, sizeof(*ooxx));
David Pinedo0257fbf2015-02-02 18:02:40 -0700184
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800185 ooxx->surface_desc_size = 0;
186 ooxx->sampler_desc_size = 0;
David Pinedo0257fbf2015-02-02 18:02:40 -0700187
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800188 *ooxx_ret = ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700189
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600190 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700191}
192
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600193static VkResult nulldrv_dev_create(struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600194 const VkDeviceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700195 struct nulldrv_dev **dev_ret)
196{
197 struct nulldrv_dev *dev;
198 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600199 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -0700200
201 dev = (struct nulldrv_dev *) nulldrv_base_create(NULL, sizeof(*dev),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600202 VK_OBJECT_TYPE_DEVICE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700203 if (!dev)
Tony Barbour8205d902015-04-16 15:59:00 -0600204 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700205
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600206 for (i = 0; i < info->extensionCount; i++) {
207 const enum nulldrv_ext_type ext = nulldrv_gpu_lookup_extension(
208 gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600209 info->ppEnabledExtensionNames[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700210
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600211 if (ext == NULLDRV_EXT_INVALID)
212 return VK_ERROR_INVALID_EXTENSION;
David Pinedo0257fbf2015-02-02 18:02:40 -0700213
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600214 dev->exts[ext] = true;
215 }
David Pinedo0257fbf2015-02-02 18:02:40 -0700216
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800217 ret = nulldrv_desc_ooxx_create(dev, &dev->desc_ooxx);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600218 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700219 return ret;
220 }
221
222 ret = dev_create_queues(dev, info->pRequestedQueues,
223 info->queueRecordCount);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600224 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700225 return ret;
226 }
227
228 *dev_ret = dev;
229
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600230 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700231}
232
Tony Barbour8205d902015-04-16 15:59:00 -0600233static struct nulldrv_gpu *nulldrv_gpu(VkPhysicalDevice gpu)
David Pinedo0257fbf2015-02-02 18:02:40 -0700234{
235 return (struct nulldrv_gpu *) gpu;
236}
237
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600238static VkResult nulldrv_rt_view_create(struct nulldrv_dev *dev,
Chia-I Wuc278df82015-07-07 11:50:03 +0800239 const VkAttachmentViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700240 struct nulldrv_rt_view **view_ret)
241{
242 struct nulldrv_rt_view *view;
243
244 view = (struct nulldrv_rt_view *) nulldrv_base_create(dev, sizeof(*view),
Chia-I Wuc278df82015-07-07 11:50:03 +0800245 VK_OBJECT_TYPE_ATTACHMENT_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700246 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600247 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700248
249 *view_ret = view;
250
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600251 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700252}
253
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600254static VkResult nulldrv_fence_create(struct nulldrv_dev *dev,
255 const VkFenceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700256 struct nulldrv_fence **fence_ret)
257{
258 struct nulldrv_fence *fence;
259
260 fence = (struct nulldrv_fence *) nulldrv_base_create(dev, sizeof(*fence),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600261 VK_OBJECT_TYPE_FENCE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700262 if (!fence)
Tony Barbour8205d902015-04-16 15:59:00 -0600263 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700264
265 *fence_ret = fence;
266
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600267 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700268}
269
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600270static struct nulldrv_dev *nulldrv_dev(VkDevice dev)
David Pinedo0257fbf2015-02-02 18:02:40 -0700271{
272 return (struct nulldrv_dev *) dev;
273}
274
275static struct nulldrv_img *nulldrv_img_from_base(struct nulldrv_base *base)
276{
277 return (struct nulldrv_img *) base;
278}
279
280
Tony Barbour426b9052015-06-24 16:06:58 -0600281static VkResult img_get_memory_requirements(struct nulldrv_base *base,
282 VkMemoryRequirements *pRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700283{
284 struct nulldrv_img *img = nulldrv_img_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600285 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700286
Tony Barbour426b9052015-06-24 16:06:58 -0600287 pRequirements->size = img->total_size;
288 pRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700289
290 return ret;
291}
292
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600293static VkResult nulldrv_img_create(struct nulldrv_dev *dev,
294 const VkImageCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700295 bool scanout,
296 struct nulldrv_img **img_ret)
297{
298 struct nulldrv_img *img;
299
300 img = (struct nulldrv_img *) nulldrv_base_create(dev, sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600301 VK_OBJECT_TYPE_IMAGE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700302 if (!img)
Tony Barbour8205d902015-04-16 15:59:00 -0600303 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700304
305 img->type = info->imageType;
306 img->depth = info->extent.depth;
307 img->mip_levels = info->mipLevels;
308 img->array_size = info->arraySize;
309 img->usage = info->usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700310 img->samples = info->samples;
311
Tony Barbour426b9052015-06-24 16:06:58 -0600312 img->obj.base.get_memory_requirements = img_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700313
314 *img_ret = img;
315
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600316 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700317}
318
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600319static struct nulldrv_img *nulldrv_img(VkImage image)
David Pinedo0257fbf2015-02-02 18:02:40 -0700320{
Tony Barbourde4124d2015-07-03 10:33:54 -0600321 return *(struct nulldrv_img **) &image;
David Pinedo0257fbf2015-02-02 18:02:40 -0700322}
323
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600324static VkResult nulldrv_mem_alloc(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600325 const VkMemoryAllocInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700326 struct nulldrv_mem **mem_ret)
327{
328 struct nulldrv_mem *mem;
329
330 mem = (struct nulldrv_mem *) nulldrv_base_create(dev, sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600331 VK_OBJECT_TYPE_DEVICE_MEMORY);
David Pinedo0257fbf2015-02-02 18:02:40 -0700332 if (!mem)
Tony Barbour8205d902015-04-16 15:59:00 -0600333 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700334
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700335 mem->bo = malloc(info->allocationSize);
David Pinedo0257fbf2015-02-02 18:02:40 -0700336 if (!mem->bo) {
Tony Barbour8205d902015-04-16 15:59:00 -0600337 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700338 }
339
340 mem->size = info->allocationSize;
341
342 *mem_ret = mem;
343
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600344 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700345}
346
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600347static VkResult nulldrv_sampler_create(struct nulldrv_dev *dev,
348 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700349 struct nulldrv_sampler **sampler_ret)
350{
351 struct nulldrv_sampler *sampler;
352
353 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600354 sizeof(*sampler), VK_OBJECT_TYPE_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700355 if (!sampler)
Tony Barbour8205d902015-04-16 15:59:00 -0600356 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700357
358 *sampler_ret = sampler;
359
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600360 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700361}
362
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600363static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
364 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700365 struct nulldrv_img_view **view_ret)
366{
367 struct nulldrv_img *img = nulldrv_img(info->image);
368 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700369
370 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600371 VK_OBJECT_TYPE_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700372 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600373 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700374
375 view->img = img;
David Pinedo0257fbf2015-02-02 18:02:40 -0700376
David Pinedo0257fbf2015-02-02 18:02:40 -0700377 view->cmd_len = 8;
378
379 *view_ret = view;
380
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600381 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700382}
383
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600384static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700385{
386 return mem->bo;
387}
388
Tony Barbour8205d902015-04-16 15:59:00 -0600389static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700390{
Tony Barbourde4124d2015-07-03 10:33:54 -0600391 return *(struct nulldrv_mem **) &mem;
David Pinedo0257fbf2015-02-02 18:02:40 -0700392}
393
394static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
395{
396 return (struct nulldrv_buf *) base;
397}
398
Tony Barbour426b9052015-06-24 16:06:58 -0600399static VkResult buf_get_memory_requirements(struct nulldrv_base *base,
400 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700401{
402 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
David Pinedo0257fbf2015-02-02 18:02:40 -0700403
Tony Barbour426b9052015-06-24 16:06:58 -0600404 if (pMemoryRequirements == NULL)
405 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700406
Tony Barbour426b9052015-06-24 16:06:58 -0600407 pMemoryRequirements->size = buf->size;
408 pMemoryRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700409
Tony Barbour426b9052015-06-24 16:06:58 -0600410 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700411}
412
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600413static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600414 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700415 struct nulldrv_buf **buf_ret)
416{
417 struct nulldrv_buf *buf;
418
419 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600420 VK_OBJECT_TYPE_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700421 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600422 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700423
424 buf->size = info->size;
425 buf->usage = info->usage;
426
Tony Barbour426b9052015-06-24 16:06:58 -0600427 buf->obj.base.get_memory_requirements = buf_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700428
429 *buf_ret = buf;
430
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600431 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700432}
433
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600434static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
435 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700436 struct nulldrv_desc_layout **layout_ret)
437{
438 struct nulldrv_desc_layout *layout;
439
440 layout = (struct nulldrv_desc_layout *)
441 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600442 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700443 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600444 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700445
446 *layout_ret = layout;
447
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600448 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700449}
450
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500451static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
452 const VkPipelineLayoutCreateInfo* pCreateInfo,
453 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800454{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500455 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800456
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500457 pipeline_layout = (struct nulldrv_pipeline_layout *)
458 nulldrv_base_create(dev, sizeof(*pipeline_layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600459 VK_OBJECT_TYPE_PIPELINE_LAYOUT);
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500460 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600461 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800462
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500463 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800464
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600465 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800466}
467
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600468static struct nulldrv_desc_layout *nulldrv_desc_layout(VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700469{
Tony Barbourde4124d2015-07-03 10:33:54 -0600470 return *(struct nulldrv_desc_layout **) &layout;
David Pinedo0257fbf2015-02-02 18:02:40 -0700471}
472
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600473static VkResult shader_create(struct nulldrv_dev *dev,
474 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700475 struct nulldrv_shader **sh_ret)
476{
David Pinedo0257fbf2015-02-02 18:02:40 -0700477 struct nulldrv_shader *sh;
478
479 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600480 VK_OBJECT_TYPE_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700481 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600482 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700483
484 *sh_ret = sh;
485
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600486 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700487}
488
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600489static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
490 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700491 struct nulldrv_pipeline **pipeline_ret)
492{
493 struct nulldrv_pipeline *pipeline;
494
495 pipeline = (struct nulldrv_pipeline *)
496 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600497 VK_OBJECT_TYPE_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700498 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600499 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700500
501 *pipeline_ret = pipeline;
502
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600503 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700504}
505
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600506static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600507 const VkDynamicViewportStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700508 struct nulldrv_dynamic_vp **state_ret)
509{
510 struct nulldrv_dynamic_vp *state;
511
512 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600513 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_VIEWPORT_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700514 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600515 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700516
517 *state_ret = state;
518
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600519 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700520}
521
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600522static VkResult nulldrv_raster_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600523 const VkDynamicRasterStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700524 struct nulldrv_dynamic_rs **state_ret)
525{
526 struct nulldrv_dynamic_rs *state;
527
528 state = (struct nulldrv_dynamic_rs *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600529 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RASTER_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700530 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600531 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700532
533 *state_ret = state;
534
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600535 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700536}
537
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600538static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600539 const VkDynamicColorBlendStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700540 struct nulldrv_dynamic_cb **state_ret)
541{
542 struct nulldrv_dynamic_cb *state;
543
544 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600545 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_COLOR_BLEND_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700546 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600547 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700548
549 *state_ret = state;
550
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600551 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700552}
553
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600554static VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600555 const VkDynamicDepthStencilStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700556 struct nulldrv_dynamic_ds **state_ret)
557{
558 struct nulldrv_dynamic_ds *state;
559
560 state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600561 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700562 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600563 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700564
565 *state_ret = state;
566
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600567 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700568}
569
570
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600571static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
572 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700573 struct nulldrv_cmd **cmd_ret)
574{
David Pinedo0257fbf2015-02-02 18:02:40 -0700575 struct nulldrv_cmd *cmd;
576
David Pinedo0257fbf2015-02-02 18:02:40 -0700577 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600578 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700579 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600580 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700581
582 *cmd_ret = cmd;
583
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600584 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700585}
586
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600587static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
588 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700589 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600590 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800591 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700592{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800593 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700594
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800595 pool = (struct nulldrv_desc_pool *)
596 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600597 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800598 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600599 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700600
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800601 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700602
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800603 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700604
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600605 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700606}
607
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600608static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800609 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600610 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700611 const struct nulldrv_desc_layout *layout,
612 struct nulldrv_desc_set **set_ret)
613{
614 struct nulldrv_desc_set *set;
615
616 set = (struct nulldrv_desc_set *)
617 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600618 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700619 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600620 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700621
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800622 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700623 set->layout = layout;
624 *set_ret = set;
625
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600626 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700627}
628
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600629static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700630{
Tony Barbourde4124d2015-07-03 10:33:54 -0600631 return *(struct nulldrv_desc_pool **) &pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700632}
633
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600634static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
635 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700636 struct nulldrv_framebuffer ** fb_ret)
637{
638
639 struct nulldrv_framebuffer *fb;
640 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600641 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700642 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600643 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700644
645 *fb_ret = fb;
646
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600647 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700648
649}
650
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600651static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
652 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700653 struct nulldrv_render_pass** rp_ret)
654{
655 struct nulldrv_render_pass *rp;
656 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600657 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700658 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600659 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700660
661 *rp_ret = rp;
662
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600663 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700664}
665
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600666static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700667{
Tony Barbourde4124d2015-07-03 10:33:54 -0600668 return *(struct nulldrv_buf **) &buf;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700669}
670
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600671static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600672 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700673 struct nulldrv_buf_view **view_ret)
674{
675 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
676 struct nulldrv_buf_view *view;
677
678 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600679 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700680 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600681 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700682
683 view->buf = buf;
684
685 *view_ret = view;
686
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600687 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700688}
689
David Pinedo0257fbf2015-02-02 18:02:40 -0700690
691//*********************************************
692// Driver entry points
693//*********************************************
694
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600695ICD_EXPORT VkResult VKAPI vkCreateBuffer(
696 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600697 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600698 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700699{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700700 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700701 struct nulldrv_dev *dev = nulldrv_dev(device);
702
703 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
704}
705
Tony Barbourde4124d2015-07-03 10:33:54 -0600706ICD_EXPORT VkResult VKAPI vkDestroyBuffer(
707 VkDevice device,
708 VkBuffer buffer)
709{
710 NULLDRV_LOG_FUNC;
711 return VK_SUCCESS;
712}
713
Cody Northropf02f9f82015-07-09 18:08:05 -0600714ICD_EXPORT VkResult VKAPI vkCreateCommandPool(
715 VkDevice device,
716 const VkCmdPoolCreateInfo* pCreateInfo,
717 VkCmdPool* pCmdPool)
718{
719 NULLDRV_LOG_FUNC;
720 return VK_SUCCESS;
721}
722
723ICD_EXPORT VkResult VKAPI vkDestroyCommandPool(
724 VkDevice device,
725 VkCmdPool cmdPool)
726{
727 NULLDRV_LOG_FUNC;
728 return VK_SUCCESS;
729}
730
731ICD_EXPORT VkResult VKAPI vkResetCommandPool(
732 VkDevice device,
733 VkCmdPool cmdPool,
734 VkCmdPoolResetFlags flags)
735{
736 NULLDRV_LOG_FUNC;
737 return VK_SUCCESS;
738}
739
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600740ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
741 VkDevice device,
742 const VkCmdBufferCreateInfo* pCreateInfo,
743 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700744{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700745 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700746 struct nulldrv_dev *dev = nulldrv_dev(device);
747
748 return nulldrv_cmd_create(dev, pCreateInfo,
749 (struct nulldrv_cmd **) pCmdBuffer);
750}
751
Tony Barbourde4124d2015-07-03 10:33:54 -0600752ICD_EXPORT VkResult VKAPI vkDestroyCommandBuffer(
753 VkDevice device,
754 VkCmdBuffer cmdBuffer)
755{
756 NULLDRV_LOG_FUNC;
757 return VK_SUCCESS;
758}
759
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600760ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
761 VkCmdBuffer cmdBuffer,
762 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700763{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700764 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600765 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700766}
767
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600768ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
769 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700770{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700771 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600772 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700773}
774
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600775ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
Cody Northropf02f9f82015-07-09 18:08:05 -0600776 VkCmdBuffer cmdBuffer,
777 VkCmdBufferResetFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700778{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700779 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600780 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700781}
782
Ian Elliott64a68e12015-04-16 11:57:46 -0600783static const VkFormat nulldrv_presentable_formats[] = {
784 VK_FORMAT_B8G8R8A8_UNORM,
785};
786
Jon Ashburnba4a1952015-06-16 12:44:51 -0600787#if 0
Ian Elliott64a68e12015-04-16 11:57:46 -0600788ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
789 VkDisplayWSI display,
790 VkDisplayInfoTypeWSI infoType,
791 size_t* pDataSize,
792 void* pData)
793{
794 VkResult ret = VK_SUCCESS;
795
796 NULLDRV_LOG_FUNC;
797
798 if (!pDataSize)
799 return VK_ERROR_INVALID_POINTER;
800
801 switch (infoType) {
802 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
803 {
804 VkDisplayFormatPropertiesWSI *dst = pData;
805 size_t size_ret;
806 uint32_t i;
807
808 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
809
810 if (dst && *pDataSize < size_ret)
811 return VK_ERROR_INVALID_VALUE;
812
813 *pDataSize = size_ret;
814 if (!dst)
815 return VK_SUCCESS;
816
817 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
818 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
819 }
820 break;
821 default:
822 ret = VK_ERROR_INVALID_VALUE;
823 break;
824 }
825
826 return ret;
827}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600828#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600829
830ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
831 VkDevice device,
832 const VkSwapChainCreateInfoWSI* pCreateInfo,
833 VkSwapChainWSI* pSwapChain)
834{
835 NULLDRV_LOG_FUNC;
836 struct nulldrv_dev *dev = nulldrv_dev(device);
837 struct nulldrv_swap_chain *sc;
838
839 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600840 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600841 if (!sc) {
842 return VK_ERROR_OUT_OF_HOST_MEMORY;
843 }
844 sc->dev = dev;
845
Tony Barbour11e76ac2015-04-20 16:28:46 -0600846 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600847
848 return VK_SUCCESS;
849}
850
851ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
852 VkSwapChainWSI swapChain)
853{
854 NULLDRV_LOG_FUNC;
855 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
856
857 free(sc);
858
859 return VK_SUCCESS;
860}
861
862ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
863 VkSwapChainWSI swapChain,
864 VkSwapChainInfoTypeWSI infoType,
865 size_t* pDataSize,
866 void* pData)
867{
868 NULLDRV_LOG_FUNC;
869 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
870 struct nulldrv_dev *dev = sc->dev;
871 VkResult ret = VK_SUCCESS;
872
873 if (!pDataSize)
874 return VK_ERROR_INVALID_POINTER;
875
876 switch (infoType) {
877 case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
878 {
879 VkSwapChainImageInfoWSI *images;
880 const size_t size = sizeof(*images) * 2;
881 uint32_t i;
882
883 if (pData && *pDataSize < size)
884 return VK_ERROR_INVALID_VALUE;
885
886 *pDataSize = size;
887 if (!pData)
888 return VK_SUCCESS;
889
890 images = (VkSwapChainImageInfoWSI *) pData;
891 for (i = 0; i < 2; i++) {
892 struct nulldrv_img *img;
893 struct nulldrv_mem *mem;
894
895 img = (struct nulldrv_img *) nulldrv_base_create(dev,
896 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600897 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600898 if (!img)
899 return VK_ERROR_OUT_OF_HOST_MEMORY;
900
901 mem = (struct nulldrv_mem *) nulldrv_base_create(dev,
902 sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600903 VK_OBJECT_TYPE_DEVICE_MEMORY);
Ian Elliott64a68e12015-04-16 11:57:46 -0600904 if (!mem)
905 return VK_ERROR_OUT_OF_HOST_MEMORY;
906
Tony Barbourde4124d2015-07-03 10:33:54 -0600907 images[i].image.handle = (uint64_t) img;
908 images[i].memory.handle = (uint64_t) mem;
Ian Elliott64a68e12015-04-16 11:57:46 -0600909 }
910 }
911 break;
912 default:
913 ret = VK_ERROR_INVALID_VALUE;
914 break;
915 }
916
917 return ret;
918}
919
920ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
921 VkQueue queue_,
922 const VkPresentInfoWSI* pPresentInfo)
923{
924 NULLDRV_LOG_FUNC;
925
926 return VK_SUCCESS;
927}
928
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600929ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600930 VkCmdBuffer cmdBuffer,
931 VkBuffer srcBuffer,
932 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700933 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600934 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700935{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700936 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700937}
938
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600939ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600940 VkCmdBuffer cmdBuffer,
941 VkImage srcImage,
942 VkImageLayout srcImageLayout,
943 VkImage destImage,
944 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700945 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600946 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700947{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700948 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700949}
950
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600951ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600952 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500953 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600954 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500955 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600956 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500957 uint32_t regionCount,
958 const VkImageBlit* pRegions,
959 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600960{
961 NULLDRV_LOG_FUNC;
962}
963
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600964ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600965 VkCmdBuffer cmdBuffer,
966 VkBuffer srcBuffer,
967 VkImage destImage,
968 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700969 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600970 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700971{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700972 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700973}
974
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600975ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600976 VkCmdBuffer cmdBuffer,
977 VkImage srcImage,
978 VkImageLayout srcImageLayout,
979 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700980 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600981 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700982{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700983 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700984}
985
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600986ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600987 VkCmdBuffer cmdBuffer,
988 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600989 VkDeviceSize destOffset,
990 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700991 const uint32_t* pData)
992{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700993 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700994}
995
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600996ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600997 VkCmdBuffer cmdBuffer,
998 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600999 VkDeviceSize destOffset,
1000 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001001 uint32_t data)
1002{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001003 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001004}
1005
Ian Elliotte924ab22015-07-08 13:24:30 -06001006ICD_EXPORT void VKAPI vkCmdClearDepthStencilImage(
1007 VkCmdBuffer cmdBuffer,
1008 VkImage image,
1009 VkImageLayout imageLayout,
1010 float depth,
1011 uint32_t stencil,
1012 uint32_t rangeCount,
1013 const VkImageSubresourceRange* pRanges)
1014{
1015 NULLDRV_LOG_FUNC;
1016}
1017
1018ICD_EXPORT void VKAPI vkCmdClearColorAttachment(
1019 VkCmdBuffer cmdBuffer,
1020 uint32_t colorAttachment,
1021 VkImageLayout imageLayout,
1022 const VkClearColorValue *pColor,
1023 uint32_t rectCount,
1024 const VkRect3D *pRects)
1025{
1026 NULLDRV_LOG_FUNC;
1027}
1028
1029ICD_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(
1030 VkCmdBuffer cmdBuffer,
1031 VkImageAspectFlags imageAspectMask,
1032 VkImageLayout imageLayout,
1033 float depth,
1034 uint32_t stencil,
1035 uint32_t rectCount,
1036 const VkRect3D *pRects)
1037{
1038 NULLDRV_LOG_FUNC;
1039}
1040
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001041ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001042 VkCmdBuffer cmdBuffer,
1043 VkImage image,
1044 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +12001045 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001046 uint32_t rangeCount,
1047 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001048{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001049 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001050}
1051
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001052ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001053 VkCmdBuffer cmdBuffer,
1054 VkImage image,
1055 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001056 float depth,
1057 uint32_t stencil,
1058 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001059 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001060{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001061 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001062}
1063
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001064ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001065 VkCmdBuffer cmdBuffer,
1066 VkImage srcImage,
1067 VkImageLayout srcImageLayout,
1068 VkImage destImage,
1069 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001070 uint32_t regionCount,
1071 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001072{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001073 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001074}
1075
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001076ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001077 VkCmdBuffer cmdBuffer,
1078 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001079 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001080 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001081{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001082 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001083}
1084
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001085ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001086 VkCmdBuffer cmdBuffer,
1087 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001088 uint32_t slot)
1089{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001090 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001091}
1092
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001093ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001094 VkCmdBuffer cmdBuffer,
1095 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001096 uint32_t startQuery,
1097 uint32_t queryCount)
1098{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001099 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001100}
1101
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001102ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001103 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001104 VkEvent event_,
1105 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001106{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001107 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001108}
1109
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001110ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001111 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001112 VkEvent event_,
1113 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001114{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001115 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001116}
1117
Ian Elliott63f1edb2015-04-16 18:10:19 -06001118ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1119 VkCmdBuffer cmdBuffer,
1120 VkQueryPool queryPool,
1121 uint32_t startQuery,
1122 uint32_t queryCount,
1123 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001124 VkDeviceSize destOffset,
1125 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001126 VkFlags flags)
1127{
1128 NULLDRV_LOG_FUNC;
1129}
1130
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001131ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001132 VkCmdBuffer cmdBuffer,
1133 VkTimestampType timestampType,
1134 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001135 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001136{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001137 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001138}
1139
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001140ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001141 VkCmdBuffer cmdBuffer,
Tony Barbourde4124d2015-07-03 10:33:54 -06001142 VkPipelineBindPoint pipelineBindPoint,
1143 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001144{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001145 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001146}
1147
Tony Barbourde4124d2015-07-03 10:33:54 -06001148ICD_EXPORT void VKAPI vkCmdBindDynamicViewportState(
1149 VkCmdBuffer cmdBuffer,
1150 VkDynamicViewportState state)
1151{
1152 NULLDRV_LOG_FUNC;
1153}
1154
1155ICD_EXPORT void VKAPI vkCmdBindDynamicRasterState(
1156 VkCmdBuffer cmdBuffer,
1157 VkDynamicRasterState state)
1158{
1159 NULLDRV_LOG_FUNC;
1160}
1161
1162ICD_EXPORT void VKAPI vkCmdBindDynamicColorBlendState(
1163 VkCmdBuffer cmdBuffer,
1164 VkDynamicColorBlendState state)
1165{
1166 NULLDRV_LOG_FUNC;
1167}
1168
1169ICD_EXPORT void VKAPI vkCmdBindDynamicDepthStencilState(
1170 VkCmdBuffer cmdBuffer,
1171 VkDynamicDepthStencilState state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001172{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001173 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001174}
1175
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001176ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001177 VkCmdBuffer cmdBuffer,
1178 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001179 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001180 uint32_t firstSet,
1181 uint32_t setCount,
1182 const VkDescriptorSet* pDescriptorSets,
1183 uint32_t dynamicOffsetCount,
1184 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001185{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001186 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001187}
1188
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001189ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1190 VkCmdBuffer cmdBuffer,
1191 uint32_t startBinding,
1192 uint32_t bindingCount,
1193 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001194 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001195{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001196 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001197}
1198
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001199ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001200 VkCmdBuffer cmdBuffer,
1201 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001202 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001203 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001204{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001205 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001206}
1207
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001208ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001209 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001210 uint32_t firstVertex,
1211 uint32_t vertexCount,
1212 uint32_t firstInstance,
1213 uint32_t instanceCount)
1214{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001215 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001216}
1217
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001218ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001219 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001220 uint32_t firstIndex,
1221 uint32_t indexCount,
1222 int32_t vertexOffset,
1223 uint32_t firstInstance,
1224 uint32_t instanceCount)
1225{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001226 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001227}
1228
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001229ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001230 VkCmdBuffer cmdBuffer,
1231 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001232 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001233 uint32_t count,
1234 uint32_t stride)
1235{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001236 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001237}
1238
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001239ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001240 VkCmdBuffer cmdBuffer,
1241 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001242 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001243 uint32_t count,
1244 uint32_t stride)
1245{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001246 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001247}
1248
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001249ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001250 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001251 uint32_t x,
1252 uint32_t y,
1253 uint32_t z)
1254{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001255 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001256}
1257
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001258ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001259 VkCmdBuffer cmdBuffer,
1260 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001261 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001262{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001263 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001264}
1265
Tony Barbour8205d902015-04-16 15:59:00 -06001266void VKAPI vkCmdWaitEvents(
1267 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001268 uint32_t eventCount,
1269 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001270 VkPipelineStageFlags sourceStageMask,
1271 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001272 uint32_t memBarrierCount,
1273 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001274{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001275 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001276}
1277
Tony Barbour8205d902015-04-16 15:59:00 -06001278void VKAPI vkCmdPipelineBarrier(
1279 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001280 VkPipelineStageFlags sourceStageMask,
1281 VkPipelineStageFlags destStageMask,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001282 VkBool32 byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001283 uint32_t memBarrierCount,
1284 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001285{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001286 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001287}
1288
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001289ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001290 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001291 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001292 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001293{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001294 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001295 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1296 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1297}
1298
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001299ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1300 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001301{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001302 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001303 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001304}
1305
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001306ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1307 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001308 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001309 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001310 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001311{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001312 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001313 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001314 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001315 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001316}
1317
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001318ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1319 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001320{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001321 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001322 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001323}
1324
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001325ICD_EXPORT VkResult VKAPI vkCreateEvent(
1326 VkDevice device,
1327 const VkEventCreateInfo* pCreateInfo,
1328 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001329{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001330 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001331 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001332}
1333
Tony Barbourde4124d2015-07-03 10:33:54 -06001334ICD_EXPORT VkResult VKAPI vkDestroyEvent(
1335 VkDevice device,
1336 VkEvent event)
1337{
1338 NULLDRV_LOG_FUNC;
1339 return VK_SUCCESS;
1340}
1341
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001342ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001343 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001344 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001345{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001346 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001347 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001348}
1349
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001350ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001351 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001352 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001353{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001354 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001355 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001356}
1357
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001358ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001359 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001360 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001361{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001362 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001363 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001364}
1365
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001366ICD_EXPORT VkResult VKAPI vkCreateFence(
1367 VkDevice device,
1368 const VkFenceCreateInfo* pCreateInfo,
1369 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001370{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001371 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001372 struct nulldrv_dev *dev = nulldrv_dev(device);
1373
1374 return nulldrv_fence_create(dev, pCreateInfo,
1375 (struct nulldrv_fence **) pFence);
1376}
1377
Tony Barbourde4124d2015-07-03 10:33:54 -06001378ICD_EXPORT VkResult VKAPI vkDestroyFence(
1379 VkDevice device,
1380 VkFence fence)
1381{
1382 NULLDRV_LOG_FUNC;
1383 return VK_SUCCESS;
1384}
1385
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001386ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001387 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001388 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001389{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001390 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001391 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001392}
1393
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001394ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001395 VkDevice device,
1396 uint32_t fenceCount,
1397 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001398{
1399 NULLDRV_LOG_FUNC;
1400 return VK_SUCCESS;
1401}
1402
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001403ICD_EXPORT VkResult VKAPI vkWaitForFences(
1404 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001405 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001406 const VkFence* pFences,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001407 VkBool32 waitAll,
David Pinedo0257fbf2015-02-02 18:02:40 -07001408 uint64_t timeout)
1409{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001410 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001411 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001412}
1413
Tony Barbour426b9052015-06-24 16:06:58 -06001414ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1415 VkPhysicalDevice gpu_,
1416 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001417{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001418 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001419 VkResult ret = VK_SUCCESS;
1420
Tony Barbour426b9052015-06-24 16:06:58 -06001421 pProperties->apiVersion = VK_API_VERSION;
1422 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1423 pProperties->vendorId = 0;
1424 pProperties->deviceId = 0;
1425 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1426 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001427
1428 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001429}
1430
Chris Forbesd7576302015-06-21 22:55:02 +12001431ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1432 VkPhysicalDevice physicalDevice,
1433 VkPhysicalDeviceFeatures* pFeatures)
1434{
1435 NULLDRV_LOG_FUNC;
1436 VkResult ret = VK_SUCCESS;
1437
1438 /* TODO: fill out features */
1439 memset(pFeatures, 0, sizeof(*pFeatures));
1440
1441 return ret;
1442}
1443
1444ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatInfo(
1445 VkPhysicalDevice physicalDevice,
1446 VkFormat format,
1447 VkFormatProperties* pFormatInfo)
1448{
1449 NULLDRV_LOG_FUNC;
1450 VkResult ret = VK_SUCCESS;
1451
1452 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1453 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1454
1455 return ret;
1456}
1457
1458ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1459 VkPhysicalDevice physicalDevice,
1460 VkPhysicalDeviceLimits* pLimits)
1461{
1462 NULLDRV_LOG_FUNC;
1463 VkResult ret = VK_SUCCESS;
1464
1465 /* TODO: fill out limits */
1466 memset(pLimits, 0, sizeof(*pLimits));
1467
1468 return ret;
1469}
1470
Tony Barbour426b9052015-06-24 16:06:58 -06001471ICD_EXPORT VkResult VKAPI vkGetPhysicalDevicePerformance(
1472 VkPhysicalDevice gpu_,
1473 VkPhysicalDevicePerformance* pPerformance)
Jon Ashburneb2728b2015-04-10 14:33:07 -06001474{
Tony Barbour426b9052015-06-24 16:06:58 -06001475 pPerformance->maxDeviceClock = 1.0f;
1476 pPerformance->aluPerClock = 1.0f;
1477 pPerformance->texPerClock = 1.0f;
1478 pPerformance->primsPerClock = 1.0f;
1479 pPerformance->pixelsPerClock = 1.0f;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001480
1481 return VK_SUCCESS;
1482}
1483
Tony Barbour426b9052015-06-24 16:06:58 -06001484ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueCount(
1485 VkPhysicalDevice gpu_,
1486 uint32_t* pCount)
David Pinedo0257fbf2015-02-02 18:02:40 -07001487{
Tony Barbour426b9052015-06-24 16:06:58 -06001488 *pCount = 1;
1489 return VK_SUCCESS;
1490}
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001491
Tony Barbour426b9052015-06-24 16:06:58 -06001492ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueProperties(
1493 VkPhysicalDevice gpu_,
1494 uint32_t count,
1495 VkPhysicalDeviceQueueProperties* pProperties)
1496 {
1497 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1498 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001499 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001500
Tony Barbour426b9052015-06-24 16:06:58 -06001501 return VK_SUCCESS;
1502}
1503
Ian Elliotte924ab22015-07-08 13:24:30 -06001504ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(
1505 VkPhysicalDevice gpu_,
1506 VkPhysicalDeviceMemoryProperties* pProperties)
1507{
1508 // TODO: Fill in with real data
1509 return VK_SUCCESS;
1510}
1511
1512ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLayerProperties(
1513 VkPhysicalDevice physicalDevice,
1514 uint32_t* pCount,
1515 VkLayerProperties* pProperties)
1516{
1517 // TODO: Fill in with real data
1518 return VK_SUCCESS;
1519}
1520
Tony Barbour426b9052015-06-24 16:06:58 -06001521ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001522 const char* pLayerName,
1523 uint32_t* pCount,
1524 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001525{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001526 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001527
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001528 if (pCount == NULL) {
1529 return VK_ERROR_INVALID_POINTER;
1530 }
Tony Barbour426b9052015-06-24 16:06:58 -06001531
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001532 if (pProperties == NULL) {
1533 *pCount = NULLDRV_EXT_COUNT;
1534 return VK_SUCCESS;
1535 }
Tony Barbour426b9052015-06-24 16:06:58 -06001536
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001537 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1538 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1539 *pCount = copy_size;
1540 if (copy_size < NULLDRV_EXT_COUNT) {
1541 return VK_INCOMPLETE;
1542 }
Tony Barbour426b9052015-06-24 16:06:58 -06001543 return VK_SUCCESS;
1544}
Ian Elliotte924ab22015-07-08 13:24:30 -06001545ICD_EXPORT VkResult VKAPI vkGetGlobalLayerProperties(
1546 uint32_t* pCount,
1547 VkLayerProperties* pProperties)
1548{
1549 // TODO: Fill in with real data
1550 return VK_SUCCESS;
1551}
Tony Barbour426b9052015-06-24 16:06:58 -06001552
1553VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001554 VkPhysicalDevice physicalDevice,
1555 const char* pLayerName,
1556 uint32_t* pCount,
1557 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001558{
Tony Barbour426b9052015-06-24 16:06:58 -06001559
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001560 if (pCount == NULL) {
1561 return VK_ERROR_INVALID_POINTER;
1562 }
1563
Tony Barbour426b9052015-06-24 16:06:58 -06001564 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001565
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001566 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001567}
1568
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001569ICD_EXPORT VkResult VKAPI vkCreateImage(
1570 VkDevice device,
1571 const VkImageCreateInfo* pCreateInfo,
1572 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001573{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001574 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001575 struct nulldrv_dev *dev = nulldrv_dev(device);
1576
1577 return nulldrv_img_create(dev, pCreateInfo, false,
1578 (struct nulldrv_img **) pImage);
1579}
1580
Tony Barbourde4124d2015-07-03 10:33:54 -06001581ICD_EXPORT VkResult VKAPI vkDestroyImage(
1582 VkDevice device,
1583 VkImage image)
1584{
1585 NULLDRV_LOG_FUNC;
1586 return VK_SUCCESS;
1587}
1588
Tony Barbour426b9052015-06-24 16:06:58 -06001589ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001590 VkDevice device,
1591 VkImage image,
1592 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001593 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001594{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001595 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001596
Tony Barbour426b9052015-06-24 16:06:58 -06001597 pLayout->offset = 0;
1598 pLayout->size = 1;
1599 pLayout->rowPitch = 4;
1600 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001601
Tony Barbour426b9052015-06-24 16:06:58 -06001602 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001603}
1604
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001605ICD_EXPORT VkResult VKAPI vkAllocMemory(
1606 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001607 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001608 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001609{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001610 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001611 struct nulldrv_dev *dev = nulldrv_dev(device);
1612
1613 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1614}
1615
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001616ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001617 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001618 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001619{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001620 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001621 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001622}
1623
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001624ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001625 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001626 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001627 VkDeviceSize offset,
1628 VkDeviceSize size,
1629 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001630 void** ppData)
1631{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001632 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001633 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1634 void *ptr = nulldrv_mem_map(mem, flags);
1635
1636 *ppData = ptr;
1637
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001638 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001639}
1640
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001641ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001642 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001643 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001644{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001645 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001646 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001647}
1648
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001649ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001650 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001651 uint32_t memRangeCount,
1652 const VkMappedMemoryRange* pMemRanges)
1653{
1654 NULLDRV_LOG_FUNC;
1655 return VK_SUCCESS;
1656}
1657
1658ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1659 VkDevice device,
1660 uint32_t memRangeCount,
1661 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001662{
1663 NULLDRV_LOG_FUNC;
1664 return VK_SUCCESS;
1665}
1666
Courtney Goeltzenleuchterd040c5c2015-07-09 21:57:28 -06001667ICD_EXPORT VkResult VKAPI vkGetDeviceMemoryCommitment(
1668 VkDevice device,
1669 VkDeviceMemory memory,
1670 VkDeviceSize* pCommittedMemoryInBytes)
1671{
1672 return VK_SUCCESS;
1673}
1674
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001675ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001676 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001677 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001678{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001679 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001680 struct nulldrv_instance *inst;
1681
1682 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001683 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001684 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001685 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001686
Tony Barbour426b9052015-06-24 16:06:58 -06001687 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001688
Mike Stroyan230e6252015-04-17 12:36:38 -06001689 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001690
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001691 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001692}
1693
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001694ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1695 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001696{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001697 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001698 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001699}
1700
Tony Barbour8205d902015-04-16 15:59:00 -06001701ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001702 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001703 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001704 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001705{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001706 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001707 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001708 struct nulldrv_gpu *gpu;
1709 *pGpuCount = 1;
1710 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001711 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001712 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001713 return ret;
1714}
1715
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001716ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001717 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001718 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001719 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001720 char* const* pOutLayers,
1721 void* pReserved)
1722{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001723 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001724 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001725}
1726
Tony Barbourde4124d2015-07-03 10:33:54 -06001727ICD_EXPORT VkResult VKAPI vkGetBufferMemoryRequirements(
1728 VkDevice device,
1729 VkBuffer buffer,
1730 VkMemoryRequirements* pMemoryRequirements)
1731{
1732 NULLDRV_LOG_FUNC;
1733 struct nulldrv_base *base = nulldrv_base((void*)buffer.handle);
1734
1735 return base->get_memory_requirements(base, pMemoryRequirements);
1736}
1737
1738ICD_EXPORT VkResult VKAPI vkGetImageMemoryRequirements(
1739 VkDevice device,
1740 VkImage image,
1741 VkMemoryRequirements* pMemoryRequirements)
1742{
1743 NULLDRV_LOG_FUNC;
1744 struct nulldrv_base *base = nulldrv_base((void*)image.handle);
1745
1746 return base->get_memory_requirements(base, pMemoryRequirements);
1747}
1748
1749ICD_EXPORT VkResult VKAPI vkBindBufferMemory(
1750 VkDevice device,
1751 VkBuffer buffer,
1752 VkDeviceMemory mem_,
1753 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001754{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001755 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001756 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001757}
1758
Tony Barbourde4124d2015-07-03 10:33:54 -06001759ICD_EXPORT VkResult VKAPI vkBindImageMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001760 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06001761 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001762 VkDeviceMemory mem_,
1763 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001764{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001765 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001766 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001767}
1768
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001769ICD_EXPORT VkResult VKAPI vkGetImageSparseMemoryRequirements(
1770 VkDevice device,
1771 VkImage image,
1772 uint32_t* pNumRequirements,
1773 VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
1774{
1775 NULLDRV_LOG_FUNC;
1776 return VK_SUCCESS;
1777}
1778
1779ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(
1780 VkPhysicalDevice physicalDevice,
1781 VkFormat format,
1782 VkImageType type,
1783 uint32_t samples,
1784 VkImageUsageFlags usage,
1785 VkImageTiling tiling,
1786 uint32_t* pNumProperties,
1787 VkSparseImageFormatProperties* pProperties)
1788{
1789 NULLDRV_LOG_FUNC;
1790 return VK_SUCCESS;
1791}
1792
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001793ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001794 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001795 VkBuffer buffer,
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001796 uint32_t numBindings,
1797 const VkSparseMemoryBindInfo* pBindInfo)
1798{
1799 NULLDRV_LOG_FUNC;
1800 return VK_SUCCESS;
1801}
1802
1803ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageOpaqueMemory(
1804 VkQueue queue,
1805 VkImage image,
1806 uint32_t numBindings,
1807 const VkSparseMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001808{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001809 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001810 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001811}
1812
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001813ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001814 VkQueue queue,
1815 VkImage image,
1816 uint32_t numBindings,
1817 const VkSparseImageMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001818{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001819 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001820 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001821}
Jon Ashburn0e249962015-07-10 09:41:15 -07001822ICD_EXPORT VkResult VKAPI vkCreatePipelineCache(
1823 VkDevice device,
1824 const VkPipelineCacheCreateInfo* pCreateInfo,
1825 VkPipelineCache* pPipelineCache)
1826{
David Pinedo0257fbf2015-02-02 18:02:40 -07001827
Jon Ashburn0e249962015-07-10 09:41:15 -07001828 NULLDRV_LOG_FUNC;
1829 return VK_SUCCESS;
1830}
1831
Tony Barbourde4124d2015-07-03 10:33:54 -06001832ICD_EXPORT VkResult VKAPI vkDestroyPipeline(
1833 VkDevice device,
1834 VkPipeline pipeline)
1835{
1836 NULLDRV_LOG_FUNC;
1837 return VK_SUCCESS;
1838}
1839
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06001840VkResult VKAPI vkDestroyPipelineCache(
1841 VkDevice device,
1842 VkPipelineCache pipelineCache)
Jon Ashburn0e249962015-07-10 09:41:15 -07001843{
1844 NULLDRV_LOG_FUNC;
1845 return VK_SUCCESS;
1846}
1847
1848ICD_EXPORT size_t VKAPI vkGetPipelineCacheSize(
1849 VkDevice device,
1850 VkPipelineCache pipelineCache)
1851{
1852 NULLDRV_LOG_FUNC;
1853 return VK_ERROR_UNAVAILABLE;
1854}
1855
1856ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
1857 VkDevice device,
1858 VkPipelineCache pipelineCache,
1859 void* pData)
1860{
1861 NULLDRV_LOG_FUNC;
1862 return VK_ERROR_UNAVAILABLE;
1863}
1864
1865ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
1866 VkDevice device,
1867 VkPipelineCache destCache,
1868 uint32_t srcCacheCount,
1869 const VkPipelineCache* pSrcCaches)
1870{
1871 NULLDRV_LOG_FUNC;
1872 return VK_ERROR_UNAVAILABLE;
1873}
1874ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001875 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001876 VkPipelineCache pipelineCache,
1877 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001878 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1879 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001880{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001881 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001882 struct nulldrv_dev *dev = nulldrv_dev(device);
1883
1884 return graphics_pipeline_create(dev, pCreateInfo,
1885 (struct nulldrv_pipeline **) pPipeline);
1886}
1887
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001888
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001889
Jon Ashburn0e249962015-07-10 09:41:15 -07001890ICD_EXPORT VkResult VKAPI vkCreateComputePipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001891 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001892 VkPipelineCache pipelineCache,
1893 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001894 const VkComputePipelineCreateInfo* pCreateInfo,
1895 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001896{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001897 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001898 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001899}
1900
David Pinedo0257fbf2015-02-02 18:02:40 -07001901
David Pinedo0257fbf2015-02-02 18:02:40 -07001902
Jon Ashburn0e249962015-07-10 09:41:15 -07001903
David Pinedo0257fbf2015-02-02 18:02:40 -07001904
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001905ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1906 VkDevice device,
1907 const VkQueryPoolCreateInfo* pCreateInfo,
1908 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001909{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001910 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001911 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001912}
1913
Tony Barbourde4124d2015-07-03 10:33:54 -06001914ICD_EXPORT VkResult VKAPI vkDestroyQueryPool(
1915 VkDevice device,
1916 VkQueryPool queryPoool)
1917{
1918 NULLDRV_LOG_FUNC;
1919 return VK_SUCCESS;
1920}
1921
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001922ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001923 VkDevice device,
1924 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001925 uint32_t startQuery,
1926 uint32_t queryCount,
1927 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001928 void* pData,
1929 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001930{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001931 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001932 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001933}
1934
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001935ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1936 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001937{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001938 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001939 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001940}
1941
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001942ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1943 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001944 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001945 const VkCmdBuffer* pCmdBuffers,
1946 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001947{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001948 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001949 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001950}
1951
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001952ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1953 VkDevice device,
1954 const VkSemaphoreCreateInfo* pCreateInfo,
1955 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001956{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001957 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001958 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001959}
1960
Tony Barbourde4124d2015-07-03 10:33:54 -06001961ICD_EXPORT VkResult VKAPI vkDestroySemaphore(
1962 VkDevice device,
1963 VkSemaphore semaphore)
1964{
1965 NULLDRV_LOG_FUNC;
1966 return VK_SUCCESS;
1967}
1968
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001969ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1970 VkQueue queue,
1971 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001972{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001973 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001974 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001975}
1976
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001977ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1978 VkQueue queue,
1979 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001980{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001981 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001982 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001983}
1984
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001985ICD_EXPORT VkResult VKAPI vkCreateSampler(
1986 VkDevice device,
1987 const VkSamplerCreateInfo* pCreateInfo,
1988 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07001989{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001990 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001991 struct nulldrv_dev *dev = nulldrv_dev(device);
1992
1993 return nulldrv_sampler_create(dev, pCreateInfo,
1994 (struct nulldrv_sampler **) pSampler);
1995}
1996
Tony Barbourde4124d2015-07-03 10:33:54 -06001997ICD_EXPORT VkResult VKAPI vkDestroySampler(
1998 VkDevice device,
1999 VkSampler sampler)
2000{
2001 NULLDRV_LOG_FUNC;
2002 return VK_SUCCESS;
2003}
2004
Ian Elliotte924ab22015-07-08 13:24:30 -06002005ICD_EXPORT VkResult VKAPI vkCreateShaderModule(
2006 VkDevice device,
2007 const VkShaderModuleCreateInfo* pCreateInfo,
2008 VkShaderModule* pShaderModule)
2009{
2010 // TODO: Fill in with real data
Tony Barbourde4124d2015-07-03 10:33:54 -06002011 NULLDRV_LOG_FUNC;
2012 return VK_SUCCESS;
2013}
2014
2015ICD_EXPORT VkResult VKAPI vkDestroyShaderModule(
2016 VkDevice device,
2017 VkShaderModule shaderModule)
2018{
2019 // TODO: Fill in with real data
2020 NULLDRV_LOG_FUNC;
Ian Elliotte924ab22015-07-08 13:24:30 -06002021 return VK_SUCCESS;
2022}
2023
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002024ICD_EXPORT VkResult VKAPI vkCreateShader(
2025 VkDevice device,
2026 const VkShaderCreateInfo* pCreateInfo,
2027 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002028{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002029 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002030 struct nulldrv_dev *dev = nulldrv_dev(device);
2031
2032 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2033}
2034
Tony Barbourde4124d2015-07-03 10:33:54 -06002035ICD_EXPORT VkResult VKAPI vkDestroyShader(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002036 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002037 VkShader shader)
2038{
2039 NULLDRV_LOG_FUNC;
2040 return VK_SUCCESS;
2041}
2042
2043ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2044 VkDevice device,
2045 const VkDynamicViewportStateCreateInfo* pCreateInfo,
2046 VkDynamicViewportState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002047{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002048 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002049 struct nulldrv_dev *dev = nulldrv_dev(device);
2050
2051 return nulldrv_viewport_state_create(dev, pCreateInfo,
2052 (struct nulldrv_dynamic_vp **) pState);
2053}
2054
Tony Barbourde4124d2015-07-03 10:33:54 -06002055ICD_EXPORT VkResult VKAPI vkDestroyDynamicViewportState(
2056 VkDevice device,
2057 VkDynamicViewportState dynamicViewportState)
2058{
2059 NULLDRV_LOG_FUNC;
2060 return VK_SUCCESS;
2061}
2062
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002063ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
2064 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002065 const VkDynamicRasterStateCreateInfo* pCreateInfo,
2066 VkDynamicRasterState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002067{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002068 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002069 struct nulldrv_dev *dev = nulldrv_dev(device);
2070
2071 return nulldrv_raster_state_create(dev, pCreateInfo,
2072 (struct nulldrv_dynamic_rs **) pState);
2073}
2074
Tony Barbourde4124d2015-07-03 10:33:54 -06002075ICD_EXPORT VkResult VKAPI vkDestroyDynamicRasterState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002076 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002077 VkDynamicRasterState dynamicRasterState)
2078{
2079 NULLDRV_LOG_FUNC;
2080 return VK_SUCCESS;
2081}
2082
2083ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
2084 VkDevice device,
2085 const VkDynamicColorBlendStateCreateInfo* pCreateInfo,
2086 VkDynamicColorBlendState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002087{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002088 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002089 struct nulldrv_dev *dev = nulldrv_dev(device);
2090
2091 return nulldrv_blend_state_create(dev, pCreateInfo,
2092 (struct nulldrv_dynamic_cb **) pState);
2093}
2094
Tony Barbourde4124d2015-07-03 10:33:54 -06002095ICD_EXPORT VkResult VKAPI vkDestroyDynamicColorBlendState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002096 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002097 VkDynamicColorBlendState dynamicColorBlendState)
2098{
2099 NULLDRV_LOG_FUNC;
2100 return VK_SUCCESS;
2101}
2102
2103ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
2104 VkDevice device,
2105 const VkDynamicDepthStencilStateCreateInfo* pCreateInfo,
2106 VkDynamicDepthStencilState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002107{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002108 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002109 struct nulldrv_dev *dev = nulldrv_dev(device);
2110
2111 return nulldrv_ds_state_create(dev, pCreateInfo,
2112 (struct nulldrv_dynamic_ds **) pState);
2113}
2114
Tony Barbourde4124d2015-07-03 10:33:54 -06002115ICD_EXPORT VkResult VKAPI vkDestroyDynamicDepthStencilState(
2116 VkDevice device,
2117 VkDynamicDepthStencilState dynamicDepthStencilState)
2118{
2119 NULLDRV_LOG_FUNC;
2120 return VK_SUCCESS;
2121}
2122
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002123ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2124 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002125 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002126 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002127{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002128 NULLDRV_LOG_FUNC;
2129 struct nulldrv_dev *dev = nulldrv_dev(device);
2130
2131 return nulldrv_buf_view_create(dev, pCreateInfo,
2132 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002133}
2134
Tony Barbourde4124d2015-07-03 10:33:54 -06002135ICD_EXPORT VkResult VKAPI vkDestroyBufferView(
2136 VkDevice device,
2137 VkBufferView bufferView)
2138{
2139 NULLDRV_LOG_FUNC;
2140 return VK_SUCCESS;
2141}
2142
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002143ICD_EXPORT VkResult VKAPI vkCreateImageView(
2144 VkDevice device,
2145 const VkImageViewCreateInfo* pCreateInfo,
2146 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002147{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002148 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002149 struct nulldrv_dev *dev = nulldrv_dev(device);
2150
2151 return nulldrv_img_view_create(dev, pCreateInfo,
2152 (struct nulldrv_img_view **) pView);
2153}
2154
Tony Barbourde4124d2015-07-03 10:33:54 -06002155ICD_EXPORT VkResult VKAPI vkDestroyImageView(
2156 VkDevice device,
2157 VkImageView imageView)
2158{
2159 NULLDRV_LOG_FUNC;
2160 return VK_SUCCESS;
2161}
2162
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002163ICD_EXPORT VkResult VKAPI vkCreateAttachmentView(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002164 VkDevice device,
Chia-I Wuc278df82015-07-07 11:50:03 +08002165 const VkAttachmentViewCreateInfo* pCreateInfo,
2166 VkAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002167{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002168 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002169 struct nulldrv_dev *dev = nulldrv_dev(device);
2170
2171 return nulldrv_rt_view_create(dev, pCreateInfo,
2172 (struct nulldrv_rt_view **) pView);
2173}
2174
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002175ICD_EXPORT VkResult VKAPI vkDestroyAttachmentView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002176 VkDevice device,
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002177 VkAttachmentView attachmentView)
Tony Barbourde4124d2015-07-03 10:33:54 -06002178{
2179 NULLDRV_LOG_FUNC;
2180 return VK_SUCCESS;
2181}
2182
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002183ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2184 VkDevice device,
2185 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2186 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002187{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002188 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002189 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002190
Chia-I Wu7732cb22015-03-26 15:27:55 +08002191 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002192 (struct nulldrv_desc_layout **) pSetLayout);
2193}
2194
Tony Barbourde4124d2015-07-03 10:33:54 -06002195ICD_EXPORT VkResult VKAPI vkDestroyDescriptorSetLayout(
2196 VkDevice device,
2197 VkDescriptorSetLayout descriptorSetLayout)
2198{
2199 NULLDRV_LOG_FUNC;
2200 return VK_SUCCESS;
2201}
2202
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002203ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2204 VkDevice device,
2205 const VkPipelineLayoutCreateInfo* pCreateInfo,
2206 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002207{
2208 NULLDRV_LOG_FUNC;
2209 struct nulldrv_dev *dev = nulldrv_dev(device);
2210
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002211 return nulldrv_pipeline_layout_create(dev,
2212 pCreateInfo,
2213 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002214}
2215
Tony Barbourde4124d2015-07-03 10:33:54 -06002216ICD_EXPORT VkResult VKAPI vkDestroyPipelineLayout(
2217 VkDevice device,
2218 VkPipelineLayout pipelineLayout)
2219{
2220 NULLDRV_LOG_FUNC;
2221 return VK_SUCCESS;
2222}
2223
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002224ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2225 VkDevice device,
2226 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002227 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002228 const VkDescriptorPoolCreateInfo* pCreateInfo,
2229 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002230{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002231 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002232 struct nulldrv_dev *dev = nulldrv_dev(device);
2233
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002234 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2235 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002236}
2237
Tony Barbourde4124d2015-07-03 10:33:54 -06002238ICD_EXPORT VkResult VKAPI vkDestroyDescriptorPool(
2239 VkDevice device,
2240 VkDescriptorPool descriptorPool)
2241{
2242 NULLDRV_LOG_FUNC;
2243 return VK_SUCCESS;
2244}
2245
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002246ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002247 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002248 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002249{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002250 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002251 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002252}
2253
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002254ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002255 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002256 VkDescriptorPool descriptorPool,
2257 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002258 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002259 const VkDescriptorSetLayout* pSetLayouts,
2260 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07002261 uint32_t* pCount)
2262{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002263 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002264 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2265 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002266 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002267 uint32_t i;
2268
2269 for (i = 0; i < count; i++) {
2270 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002271 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002272
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002273 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002274 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002275 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002276 break;
2277 }
2278
2279 if (pCount)
2280 *pCount = i;
2281
2282 return ret;
2283}
2284
Tony Barbourb857d312015-07-10 10:50:45 -06002285ICD_EXPORT VkResult VKAPI vkFreeDescriptorSets(
2286 VkDevice device,
2287 VkDescriptorPool descriptorPool,
2288 uint32_t count,
2289 const VkDescriptorSet* pDescriptorSets)
2290{
2291 NULLDRV_LOG_FUNC;
2292 return VK_SUCCESS;
2293}
2294
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002295ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2296 VkDevice device,
2297 uint32_t writeCount,
2298 const VkWriteDescriptorSet* pDescriptorWrites,
2299 uint32_t copyCount,
2300 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002301{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002302 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002303 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002304}
2305
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002306ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2307 VkDevice device,
2308 const VkFramebufferCreateInfo* info,
2309 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002310{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002311 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002312 struct nulldrv_dev *dev = nulldrv_dev(device);
2313
2314 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2315}
2316
Tony Barbourde4124d2015-07-03 10:33:54 -06002317ICD_EXPORT VkResult VKAPI vkDestroyFramebuffer(
2318 VkDevice device,
2319 VkFramebuffer framebuffer)
2320{
2321 NULLDRV_LOG_FUNC;
2322 return VK_SUCCESS;
2323}
David Pinedo0257fbf2015-02-02 18:02:40 -07002324
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002325ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2326 VkDevice device,
2327 const VkRenderPassCreateInfo* info,
2328 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002329{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002330 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002331 struct nulldrv_dev *dev = nulldrv_dev(device);
2332
2333 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2334}
2335
Tony Barbourde4124d2015-07-03 10:33:54 -06002336ICD_EXPORT VkResult VKAPI vkDestroyRenderPass(
2337 VkDevice device,
2338 VkRenderPass renderPass)
2339{
2340 NULLDRV_LOG_FUNC;
2341 return VK_SUCCESS;
2342}
2343
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002344ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Chia-I Wuc278df82015-07-07 11:50:03 +08002345 VkCmdBuffer cmdBuffer,
2346 const VkRenderPassBeginInfo* pRenderPassBegin,
2347 VkRenderPassContents contents)
2348{
2349 NULLDRV_LOG_FUNC;
2350}
2351
2352ICD_EXPORT void VKAPI vkCmdNextSubpass(
2353 VkCmdBuffer cmdBuffer,
2354 VkRenderPassContents contents)
David Pinedo0257fbf2015-02-02 18:02:40 -07002355{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002356 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002357}
2358
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002359ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002360 VkCmdBuffer cmdBuffer)
2361{
2362 NULLDRV_LOG_FUNC;
2363}
2364
2365ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2366 VkCmdBuffer cmdBuffer,
2367 uint32_t cmdBuffersCount,
2368 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002369{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002370 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002371}
Ian Elliottf93069f2015-02-19 14:26:19 -07002372
2373ICD_EXPORT void* xcbCreateWindow(
2374 uint16_t width,
2375 uint16_t height)
2376{
2377 static uint32_t window; // Kludge to the max
2378 NULLDRV_LOG_FUNC;
2379 return &window;
2380}
2381
2382// May not be needed, if we stub out stuf in tri.c
2383ICD_EXPORT void xcbDestroyWindow()
2384{
2385 NULLDRV_LOG_FUNC;
2386}
2387
2388ICD_EXPORT int xcbGetMessage(void *msg)
2389{
2390 NULLDRV_LOG_FUNC;
2391 return 0;
2392}
2393
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002394ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002395{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002396 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002397}