blob: 4b6b2230c9ca77b3273d426fa673e97023533408 [file] [log] [blame]
David Pinedo0257fbf2015-02-02 18:02:40 -07001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan null driver
David Pinedo0257fbf2015-02-02 18:02:40 -07003 *
4 * Copyright (C) 2015 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 */
25
26#include "nulldrv.h"
David Pinedo8e9cb3b2015-02-10 15:02:08 -070027#include <stdio.h>
David Pinedo0257fbf2015-02-02 18:02:40 -070028
David Pinedo8e9cb3b2015-02-10 15:02:08 -070029#if 0
30#define NULLDRV_LOG_FUNC \
31 do { \
32 fflush(stdout); \
33 fflush(stderr); \
34 printf("null driver: %s\n", __FUNCTION__); \
35 fflush(stdout); \
36 } while (0)
37#else
38 #define NULLDRV_LOG_FUNC do { } while (0)
39#endif
40
41// The null driver supports all WSI extenstions ... for now ...
David Pinedo0257fbf2015-02-02 18:02:40 -070042static const char * const nulldrv_gpu_exts[NULLDRV_EXT_COUNT] = {
Jon Ashburncedc15f2015-05-21 18:13:33 -060043 [NULLDRV_EXT_WSI_LUNARG] = VK_WSI_LUNARG_EXTENSION_NAME,
David Pinedo0257fbf2015-02-02 18:02:40 -070044};
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060045static const VkExtensionProperties intel_gpu_exts[NULLDRV_EXT_COUNT] = {
46 {
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -060047 .extName = VK_WSI_LUNARG_EXTENSION_NAME,
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060048 .version = VK_WSI_LUNARG_REVISION,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -060049 .specVersion = VK_API_VERSION,
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060050 }
51};
David Pinedo0257fbf2015-02-02 18:02:40 -070052
Tony Barbourde4124d2015-07-03 10:33:54 -060053static struct nulldrv_base *nulldrv_base(void* base)
David Pinedo0257fbf2015-02-02 18:02:40 -070054{
55 return (struct nulldrv_base *) base;
56}
57
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060058static struct nulldrv_base *nulldrv_base_create(
59 struct nulldrv_dev *dev,
60 size_t obj_size,
Tony Barbourde4124d2015-07-03 10:33:54 -060061 VkDbgObjectType type)
David Pinedo0257fbf2015-02-02 18:02:40 -070062{
63 struct nulldrv_base *base;
64
65 if (!obj_size)
66 obj_size = sizeof(*base);
67
68 assert(obj_size >= sizeof(*base));
69
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060070 base = (struct nulldrv_base*)malloc(obj_size);
David Pinedo0257fbf2015-02-02 18:02:40 -070071 if (!base)
72 return NULL;
73
74 memset(base, 0, obj_size);
75
76 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbourde4124d2015-07-03 10:33:54 -060077 set_loader_magic_value(base);
David Pinedo0257fbf2015-02-02 18:02:40 -070078
79 if (dev == NULL) {
80 /*
81 * dev is NULL when we are creating the base device object
82 * Set dev now so that debug setup happens correctly
83 */
84 dev = (struct nulldrv_dev *) base;
85 }
86
87
Tony Barbour426b9052015-06-24 16:06:58 -060088 base->get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -070089
90 return base;
91}
92
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060093static VkResult nulldrv_gpu_add(int devid, const char *primary_node,
David Pinedo0257fbf2015-02-02 18:02:40 -070094 const char *render_node, struct nulldrv_gpu **gpu_ret)
95{
96 struct nulldrv_gpu *gpu;
97
Chia-I Wu493a1752015-02-22 14:40:25 +080098 gpu = malloc(sizeof(*gpu));
David Pinedo0257fbf2015-02-02 18:02:40 -070099 if (!gpu)
Tony Barbour8205d902015-04-16 15:59:00 -0600100 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700101 memset(gpu, 0, sizeof(*gpu));
Mark Lobodzinski97dcd042015-04-16 08:52:00 -0500102
David Pinedo0257fbf2015-02-02 18:02:40 -0700103 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbourde4124d2015-07-03 10:33:54 -0600104 set_loader_magic_value(gpu);
David Pinedo0257fbf2015-02-02 18:02:40 -0700105
106 *gpu_ret = gpu;
107
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600108 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700109}
110
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600111static VkResult nulldrv_queue_create(struct nulldrv_dev *dev,
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700112 uint32_t node_index,
David Pinedo0257fbf2015-02-02 18:02:40 -0700113 struct nulldrv_queue **queue_ret)
114{
115 struct nulldrv_queue *queue;
116
117 queue = (struct nulldrv_queue *) nulldrv_base_create(dev, sizeof(*queue),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600118 VK_OBJECT_TYPE_QUEUE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700119 if (!queue)
Tony Barbour8205d902015-04-16 15:59:00 -0600120 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700121
122 queue->dev = dev;
123
124 *queue_ret = queue;
125
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600126 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700127}
128
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600129static VkResult dev_create_queues(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600130 const VkDeviceQueueCreateInfo *queues,
David Pinedo0257fbf2015-02-02 18:02:40 -0700131 uint32_t count)
132{
133 uint32_t i;
134
135 if (!count)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600136 return VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700137
138 for (i = 0; i < count; i++) {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600139 const VkDeviceQueueCreateInfo *q = &queues[i];
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600140 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700141
142 if (q->queueCount == 1 && !dev->queues[q->queueNodeIndex]) {
143 ret = nulldrv_queue_create(dev, q->queueNodeIndex,
144 &dev->queues[q->queueNodeIndex]);
145 }
146 else {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600147 ret = VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700148 }
149
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600150 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700151 return ret;
152 }
153 }
154
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600155 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700156}
157
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600158static enum nulldrv_ext_type nulldrv_gpu_lookup_extension(
159 const struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600160 const char* extName)
David Pinedo0257fbf2015-02-02 18:02:40 -0700161{
162 enum nulldrv_ext_type type;
163
164 for (type = 0; type < ARRAY_SIZE(nulldrv_gpu_exts); type++) {
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600165 if (strcmp(nulldrv_gpu_exts[type], extName) == 0)
David Pinedo0257fbf2015-02-02 18:02:40 -0700166 break;
167 }
168
169 assert(type < NULLDRV_EXT_COUNT || type == NULLDRV_EXT_INVALID);
170
171 return type;
172}
173
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600174static VkResult nulldrv_desc_ooxx_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800175 struct nulldrv_desc_ooxx **ooxx_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700176{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800177 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700178
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800179 ooxx = malloc(sizeof(*ooxx));
180 if (!ooxx)
Tony Barbour8205d902015-04-16 15:59:00 -0600181 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700182
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800183 memset(ooxx, 0, sizeof(*ooxx));
David Pinedo0257fbf2015-02-02 18:02:40 -0700184
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800185 ooxx->surface_desc_size = 0;
186 ooxx->sampler_desc_size = 0;
David Pinedo0257fbf2015-02-02 18:02:40 -0700187
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800188 *ooxx_ret = ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700189
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600190 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700191}
192
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600193static VkResult nulldrv_dev_create(struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600194 const VkDeviceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700195 struct nulldrv_dev **dev_ret)
196{
197 struct nulldrv_dev *dev;
198 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600199 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -0700200
201 dev = (struct nulldrv_dev *) nulldrv_base_create(NULL, sizeof(*dev),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600202 VK_OBJECT_TYPE_DEVICE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700203 if (!dev)
Tony Barbour8205d902015-04-16 15:59:00 -0600204 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700205
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600206 for (i = 0; i < info->extensionCount; i++) {
207 const enum nulldrv_ext_type ext = nulldrv_gpu_lookup_extension(
208 gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600209 info->ppEnabledExtensionNames[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700210
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600211 if (ext == NULLDRV_EXT_INVALID)
212 return VK_ERROR_INVALID_EXTENSION;
David Pinedo0257fbf2015-02-02 18:02:40 -0700213
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600214 dev->exts[ext] = true;
215 }
David Pinedo0257fbf2015-02-02 18:02:40 -0700216
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800217 ret = nulldrv_desc_ooxx_create(dev, &dev->desc_ooxx);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600218 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700219 return ret;
220 }
221
222 ret = dev_create_queues(dev, info->pRequestedQueues,
223 info->queueRecordCount);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600224 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700225 return ret;
226 }
227
228 *dev_ret = dev;
229
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600230 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700231}
232
Tony Barbour8205d902015-04-16 15:59:00 -0600233static struct nulldrv_gpu *nulldrv_gpu(VkPhysicalDevice gpu)
David Pinedo0257fbf2015-02-02 18:02:40 -0700234{
235 return (struct nulldrv_gpu *) gpu;
236}
237
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600238static VkResult nulldrv_rt_view_create(struct nulldrv_dev *dev,
Chia-I Wuc278df82015-07-07 11:50:03 +0800239 const VkAttachmentViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700240 struct nulldrv_rt_view **view_ret)
241{
242 struct nulldrv_rt_view *view;
243
244 view = (struct nulldrv_rt_view *) nulldrv_base_create(dev, sizeof(*view),
Chia-I Wuc278df82015-07-07 11:50:03 +0800245 VK_OBJECT_TYPE_ATTACHMENT_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700246 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600247 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700248
249 *view_ret = view;
250
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600251 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700252}
253
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600254static VkResult nulldrv_fence_create(struct nulldrv_dev *dev,
255 const VkFenceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700256 struct nulldrv_fence **fence_ret)
257{
258 struct nulldrv_fence *fence;
259
260 fence = (struct nulldrv_fence *) nulldrv_base_create(dev, sizeof(*fence),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600261 VK_OBJECT_TYPE_FENCE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700262 if (!fence)
Tony Barbour8205d902015-04-16 15:59:00 -0600263 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700264
265 *fence_ret = fence;
266
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600267 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700268}
269
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600270static struct nulldrv_dev *nulldrv_dev(VkDevice dev)
David Pinedo0257fbf2015-02-02 18:02:40 -0700271{
272 return (struct nulldrv_dev *) dev;
273}
274
275static struct nulldrv_img *nulldrv_img_from_base(struct nulldrv_base *base)
276{
277 return (struct nulldrv_img *) base;
278}
279
280
Tony Barbour426b9052015-06-24 16:06:58 -0600281static VkResult img_get_memory_requirements(struct nulldrv_base *base,
282 VkMemoryRequirements *pRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700283{
284 struct nulldrv_img *img = nulldrv_img_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600285 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700286
Tony Barbour426b9052015-06-24 16:06:58 -0600287 pRequirements->size = img->total_size;
288 pRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700289
290 return ret;
291}
292
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600293static VkResult nulldrv_img_create(struct nulldrv_dev *dev,
294 const VkImageCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700295 bool scanout,
296 struct nulldrv_img **img_ret)
297{
298 struct nulldrv_img *img;
299
300 img = (struct nulldrv_img *) nulldrv_base_create(dev, sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600301 VK_OBJECT_TYPE_IMAGE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700302 if (!img)
Tony Barbour8205d902015-04-16 15:59:00 -0600303 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700304
305 img->type = info->imageType;
306 img->depth = info->extent.depth;
307 img->mip_levels = info->mipLevels;
308 img->array_size = info->arraySize;
309 img->usage = info->usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700310 img->samples = info->samples;
311
Tony Barbour426b9052015-06-24 16:06:58 -0600312 img->obj.base.get_memory_requirements = img_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700313
314 *img_ret = img;
315
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600316 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700317}
318
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600319static struct nulldrv_img *nulldrv_img(VkImage image)
David Pinedo0257fbf2015-02-02 18:02:40 -0700320{
Tony Barbourde4124d2015-07-03 10:33:54 -0600321 return *(struct nulldrv_img **) &image;
David Pinedo0257fbf2015-02-02 18:02:40 -0700322}
323
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600324static VkResult nulldrv_mem_alloc(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600325 const VkMemoryAllocInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700326 struct nulldrv_mem **mem_ret)
327{
328 struct nulldrv_mem *mem;
329
330 mem = (struct nulldrv_mem *) nulldrv_base_create(dev, sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600331 VK_OBJECT_TYPE_DEVICE_MEMORY);
David Pinedo0257fbf2015-02-02 18:02:40 -0700332 if (!mem)
Tony Barbour8205d902015-04-16 15:59:00 -0600333 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700334
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700335 mem->bo = malloc(info->allocationSize);
David Pinedo0257fbf2015-02-02 18:02:40 -0700336 if (!mem->bo) {
Tony Barbour8205d902015-04-16 15:59:00 -0600337 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700338 }
339
340 mem->size = info->allocationSize;
341
342 *mem_ret = mem;
343
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600344 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700345}
346
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600347static VkResult nulldrv_sampler_create(struct nulldrv_dev *dev,
348 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700349 struct nulldrv_sampler **sampler_ret)
350{
351 struct nulldrv_sampler *sampler;
352
353 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600354 sizeof(*sampler), VK_OBJECT_TYPE_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700355 if (!sampler)
Tony Barbour8205d902015-04-16 15:59:00 -0600356 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700357
358 *sampler_ret = sampler;
359
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600360 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700361}
362
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600363static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
364 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700365 struct nulldrv_img_view **view_ret)
366{
367 struct nulldrv_img *img = nulldrv_img(info->image);
368 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700369
370 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600371 VK_OBJECT_TYPE_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700372 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600373 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700374
375 view->img = img;
David Pinedo0257fbf2015-02-02 18:02:40 -0700376
David Pinedo0257fbf2015-02-02 18:02:40 -0700377 view->cmd_len = 8;
378
379 *view_ret = view;
380
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600381 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700382}
383
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600384static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700385{
386 return mem->bo;
387}
388
Tony Barbour8205d902015-04-16 15:59:00 -0600389static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700390{
Tony Barbourde4124d2015-07-03 10:33:54 -0600391 return *(struct nulldrv_mem **) &mem;
David Pinedo0257fbf2015-02-02 18:02:40 -0700392}
393
394static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
395{
396 return (struct nulldrv_buf *) base;
397}
398
Tony Barbour426b9052015-06-24 16:06:58 -0600399static VkResult buf_get_memory_requirements(struct nulldrv_base *base,
400 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700401{
402 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
David Pinedo0257fbf2015-02-02 18:02:40 -0700403
Tony Barbour426b9052015-06-24 16:06:58 -0600404 if (pMemoryRequirements == NULL)
405 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700406
Tony Barbour426b9052015-06-24 16:06:58 -0600407 pMemoryRequirements->size = buf->size;
408 pMemoryRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700409
Tony Barbour426b9052015-06-24 16:06:58 -0600410 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700411}
412
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600413static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600414 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700415 struct nulldrv_buf **buf_ret)
416{
417 struct nulldrv_buf *buf;
418
419 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600420 VK_OBJECT_TYPE_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700421 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600422 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700423
424 buf->size = info->size;
425 buf->usage = info->usage;
426
Tony Barbour426b9052015-06-24 16:06:58 -0600427 buf->obj.base.get_memory_requirements = buf_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700428
429 *buf_ret = buf;
430
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600431 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700432}
433
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600434static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
435 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700436 struct nulldrv_desc_layout **layout_ret)
437{
438 struct nulldrv_desc_layout *layout;
439
440 layout = (struct nulldrv_desc_layout *)
441 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600442 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700443 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600444 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700445
446 *layout_ret = layout;
447
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600448 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700449}
450
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500451static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
452 const VkPipelineLayoutCreateInfo* pCreateInfo,
453 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800454{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500455 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800456
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500457 pipeline_layout = (struct nulldrv_pipeline_layout *)
458 nulldrv_base_create(dev, sizeof(*pipeline_layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600459 VK_OBJECT_TYPE_PIPELINE_LAYOUT);
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500460 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600461 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800462
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500463 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800464
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600465 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800466}
467
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600468static struct nulldrv_desc_layout *nulldrv_desc_layout(VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700469{
Tony Barbourde4124d2015-07-03 10:33:54 -0600470 return *(struct nulldrv_desc_layout **) &layout;
David Pinedo0257fbf2015-02-02 18:02:40 -0700471}
472
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600473static VkResult shader_create(struct nulldrv_dev *dev,
474 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700475 struct nulldrv_shader **sh_ret)
476{
David Pinedo0257fbf2015-02-02 18:02:40 -0700477 struct nulldrv_shader *sh;
478
479 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600480 VK_OBJECT_TYPE_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700481 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600482 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700483
484 *sh_ret = sh;
485
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600486 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700487}
488
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600489static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
490 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700491 struct nulldrv_pipeline **pipeline_ret)
492{
493 struct nulldrv_pipeline *pipeline;
494
495 pipeline = (struct nulldrv_pipeline *)
496 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600497 VK_OBJECT_TYPE_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700498 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600499 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700500
501 *pipeline_ret = pipeline;
502
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600503 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700504}
505
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600506static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600507 const VkDynamicViewportStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700508 struct nulldrv_dynamic_vp **state_ret)
509{
510 struct nulldrv_dynamic_vp *state;
511
512 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600513 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_VIEWPORT_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700514 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600515 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700516
517 *state_ret = state;
518
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600519 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700520}
521
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600522static VkResult nulldrv_raster_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600523 const VkDynamicRasterStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700524 struct nulldrv_dynamic_rs **state_ret)
525{
526 struct nulldrv_dynamic_rs *state;
527
528 state = (struct nulldrv_dynamic_rs *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600529 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RASTER_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700530 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600531 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700532
533 *state_ret = state;
534
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600535 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700536}
537
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600538static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600539 const VkDynamicColorBlendStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700540 struct nulldrv_dynamic_cb **state_ret)
541{
542 struct nulldrv_dynamic_cb *state;
543
544 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600545 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_COLOR_BLEND_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700546 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600547 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700548
549 *state_ret = state;
550
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600551 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700552}
553
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600554static VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600555 const VkDynamicDepthStencilStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700556 struct nulldrv_dynamic_ds **state_ret)
557{
558 struct nulldrv_dynamic_ds *state;
559
560 state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600561 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700562 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600563 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700564
565 *state_ret = state;
566
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600567 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700568}
569
570
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600571static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
572 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700573 struct nulldrv_cmd **cmd_ret)
574{
David Pinedo0257fbf2015-02-02 18:02:40 -0700575 struct nulldrv_cmd *cmd;
576
David Pinedo0257fbf2015-02-02 18:02:40 -0700577 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600578 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700579 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600580 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700581
582 *cmd_ret = cmd;
583
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600584 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700585}
586
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600587static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
588 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700589 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600590 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800591 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700592{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800593 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700594
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800595 pool = (struct nulldrv_desc_pool *)
596 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600597 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800598 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600599 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700600
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800601 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700602
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800603 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700604
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600605 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700606}
607
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600608static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800609 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600610 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700611 const struct nulldrv_desc_layout *layout,
612 struct nulldrv_desc_set **set_ret)
613{
614 struct nulldrv_desc_set *set;
615
616 set = (struct nulldrv_desc_set *)
617 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600618 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700619 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600620 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700621
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800622 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700623 set->layout = layout;
624 *set_ret = set;
625
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600626 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700627}
628
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600629static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700630{
Tony Barbourde4124d2015-07-03 10:33:54 -0600631 return *(struct nulldrv_desc_pool **) &pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700632}
633
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600634static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
635 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700636 struct nulldrv_framebuffer ** fb_ret)
637{
638
639 struct nulldrv_framebuffer *fb;
640 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600641 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700642 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600643 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700644
645 *fb_ret = fb;
646
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600647 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700648
649}
650
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600651static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
652 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700653 struct nulldrv_render_pass** rp_ret)
654{
655 struct nulldrv_render_pass *rp;
656 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600657 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700658 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600659 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700660
661 *rp_ret = rp;
662
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600663 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700664}
665
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600666static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700667{
Tony Barbourde4124d2015-07-03 10:33:54 -0600668 return *(struct nulldrv_buf **) &buf;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700669}
670
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600671static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600672 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700673 struct nulldrv_buf_view **view_ret)
674{
675 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
676 struct nulldrv_buf_view *view;
677
678 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600679 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700680 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600681 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700682
683 view->buf = buf;
684
685 *view_ret = view;
686
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600687 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700688}
689
David Pinedo0257fbf2015-02-02 18:02:40 -0700690
691//*********************************************
692// Driver entry points
693//*********************************************
694
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600695ICD_EXPORT VkResult VKAPI vkCreateBuffer(
696 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600697 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600698 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700699{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700700 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700701 struct nulldrv_dev *dev = nulldrv_dev(device);
702
703 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
704}
705
Tony Barbourde4124d2015-07-03 10:33:54 -0600706ICD_EXPORT VkResult VKAPI vkDestroyBuffer(
707 VkDevice device,
708 VkBuffer buffer)
709{
710 NULLDRV_LOG_FUNC;
711 return VK_SUCCESS;
712}
713
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600714ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
715 VkDevice device,
716 const VkCmdBufferCreateInfo* pCreateInfo,
717 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700718{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700719 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700720 struct nulldrv_dev *dev = nulldrv_dev(device);
721
722 return nulldrv_cmd_create(dev, pCreateInfo,
723 (struct nulldrv_cmd **) pCmdBuffer);
724}
725
Tony Barbourde4124d2015-07-03 10:33:54 -0600726ICD_EXPORT VkResult VKAPI vkDestroyCommandBuffer(
727 VkDevice device,
728 VkCmdBuffer cmdBuffer)
729{
730 NULLDRV_LOG_FUNC;
731 return VK_SUCCESS;
732}
733
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600734ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
735 VkCmdBuffer cmdBuffer,
736 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700737{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700738 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600739 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700740}
741
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600742ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
743 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700744{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700745 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600746 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700747}
748
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600749ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
750 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700751{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700752 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600753 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700754}
755
Ian Elliott64a68e12015-04-16 11:57:46 -0600756static const VkFormat nulldrv_presentable_formats[] = {
757 VK_FORMAT_B8G8R8A8_UNORM,
758};
759
Jon Ashburnba4a1952015-06-16 12:44:51 -0600760#if 0
Ian Elliott64a68e12015-04-16 11:57:46 -0600761ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
762 VkDisplayWSI display,
763 VkDisplayInfoTypeWSI infoType,
764 size_t* pDataSize,
765 void* pData)
766{
767 VkResult ret = VK_SUCCESS;
768
769 NULLDRV_LOG_FUNC;
770
771 if (!pDataSize)
772 return VK_ERROR_INVALID_POINTER;
773
774 switch (infoType) {
775 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
776 {
777 VkDisplayFormatPropertiesWSI *dst = pData;
778 size_t size_ret;
779 uint32_t i;
780
781 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
782
783 if (dst && *pDataSize < size_ret)
784 return VK_ERROR_INVALID_VALUE;
785
786 *pDataSize = size_ret;
787 if (!dst)
788 return VK_SUCCESS;
789
790 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
791 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
792 }
793 break;
794 default:
795 ret = VK_ERROR_INVALID_VALUE;
796 break;
797 }
798
799 return ret;
800}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600801#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600802
803ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
804 VkDevice device,
805 const VkSwapChainCreateInfoWSI* pCreateInfo,
806 VkSwapChainWSI* pSwapChain)
807{
808 NULLDRV_LOG_FUNC;
809 struct nulldrv_dev *dev = nulldrv_dev(device);
810 struct nulldrv_swap_chain *sc;
811
812 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600813 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600814 if (!sc) {
815 return VK_ERROR_OUT_OF_HOST_MEMORY;
816 }
817 sc->dev = dev;
818
Tony Barbour11e76ac2015-04-20 16:28:46 -0600819 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600820
821 return VK_SUCCESS;
822}
823
824ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
825 VkSwapChainWSI swapChain)
826{
827 NULLDRV_LOG_FUNC;
828 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
829
830 free(sc);
831
832 return VK_SUCCESS;
833}
834
835ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
836 VkSwapChainWSI swapChain,
837 VkSwapChainInfoTypeWSI infoType,
838 size_t* pDataSize,
839 void* pData)
840{
841 NULLDRV_LOG_FUNC;
842 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
843 struct nulldrv_dev *dev = sc->dev;
844 VkResult ret = VK_SUCCESS;
845
846 if (!pDataSize)
847 return VK_ERROR_INVALID_POINTER;
848
849 switch (infoType) {
850 case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
851 {
852 VkSwapChainImageInfoWSI *images;
853 const size_t size = sizeof(*images) * 2;
854 uint32_t i;
855
856 if (pData && *pDataSize < size)
857 return VK_ERROR_INVALID_VALUE;
858
859 *pDataSize = size;
860 if (!pData)
861 return VK_SUCCESS;
862
863 images = (VkSwapChainImageInfoWSI *) pData;
864 for (i = 0; i < 2; i++) {
865 struct nulldrv_img *img;
866 struct nulldrv_mem *mem;
867
868 img = (struct nulldrv_img *) nulldrv_base_create(dev,
869 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600870 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600871 if (!img)
872 return VK_ERROR_OUT_OF_HOST_MEMORY;
873
874 mem = (struct nulldrv_mem *) nulldrv_base_create(dev,
875 sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600876 VK_OBJECT_TYPE_DEVICE_MEMORY);
Ian Elliott64a68e12015-04-16 11:57:46 -0600877 if (!mem)
878 return VK_ERROR_OUT_OF_HOST_MEMORY;
879
Tony Barbourde4124d2015-07-03 10:33:54 -0600880 images[i].image.handle = (uint64_t) img;
881 images[i].memory.handle = (uint64_t) mem;
Ian Elliott64a68e12015-04-16 11:57:46 -0600882 }
883 }
884 break;
885 default:
886 ret = VK_ERROR_INVALID_VALUE;
887 break;
888 }
889
890 return ret;
891}
892
893ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
894 VkQueue queue_,
895 const VkPresentInfoWSI* pPresentInfo)
896{
897 NULLDRV_LOG_FUNC;
898
899 return VK_SUCCESS;
900}
901
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600902ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600903 VkCmdBuffer cmdBuffer,
904 VkBuffer srcBuffer,
905 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700906 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600907 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700908{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700909 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700910}
911
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600912ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600913 VkCmdBuffer cmdBuffer,
914 VkImage srcImage,
915 VkImageLayout srcImageLayout,
916 VkImage destImage,
917 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700918 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600919 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700920{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700921 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700922}
923
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600924ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600925 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500926 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600927 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500928 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600929 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500930 uint32_t regionCount,
931 const VkImageBlit* pRegions,
932 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600933{
934 NULLDRV_LOG_FUNC;
935}
936
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600937ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600938 VkCmdBuffer cmdBuffer,
939 VkBuffer srcBuffer,
940 VkImage destImage,
941 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700942 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600943 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700944{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700945 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700946}
947
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600948ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600949 VkCmdBuffer cmdBuffer,
950 VkImage srcImage,
951 VkImageLayout srcImageLayout,
952 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700953 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600954 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700955{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700956 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700957}
958
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600959ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600960 VkCmdBuffer cmdBuffer,
961 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600962 VkDeviceSize destOffset,
963 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700964 const uint32_t* pData)
965{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700966 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700967}
968
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600969ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600970 VkCmdBuffer cmdBuffer,
971 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600972 VkDeviceSize destOffset,
973 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700974 uint32_t data)
975{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700976 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700977}
978
Ian Elliotte924ab22015-07-08 13:24:30 -0600979ICD_EXPORT void VKAPI vkCmdClearDepthStencilImage(
980 VkCmdBuffer cmdBuffer,
981 VkImage image,
982 VkImageLayout imageLayout,
983 float depth,
984 uint32_t stencil,
985 uint32_t rangeCount,
986 const VkImageSubresourceRange* pRanges)
987{
988 NULLDRV_LOG_FUNC;
989}
990
991ICD_EXPORT void VKAPI vkCmdClearColorAttachment(
992 VkCmdBuffer cmdBuffer,
993 uint32_t colorAttachment,
994 VkImageLayout imageLayout,
995 const VkClearColorValue *pColor,
996 uint32_t rectCount,
997 const VkRect3D *pRects)
998{
999 NULLDRV_LOG_FUNC;
1000}
1001
1002ICD_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(
1003 VkCmdBuffer cmdBuffer,
1004 VkImageAspectFlags imageAspectMask,
1005 VkImageLayout imageLayout,
1006 float depth,
1007 uint32_t stencil,
1008 uint32_t rectCount,
1009 const VkRect3D *pRects)
1010{
1011 NULLDRV_LOG_FUNC;
1012}
1013
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001014ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001015 VkCmdBuffer cmdBuffer,
1016 VkImage image,
1017 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +12001018 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001019 uint32_t rangeCount,
1020 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001021{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001022 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001023}
1024
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001025ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001026 VkCmdBuffer cmdBuffer,
1027 VkImage image,
1028 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001029 float depth,
1030 uint32_t stencil,
1031 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001032 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001033{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001034 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001035}
1036
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001037ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001038 VkCmdBuffer cmdBuffer,
1039 VkImage srcImage,
1040 VkImageLayout srcImageLayout,
1041 VkImage destImage,
1042 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001043 uint32_t regionCount,
1044 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001045{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001046 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001047}
1048
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001049ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001050 VkCmdBuffer cmdBuffer,
1051 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001052 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001053 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001054{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001055 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001056}
1057
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001058ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001059 VkCmdBuffer cmdBuffer,
1060 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001061 uint32_t slot)
1062{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001063 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001064}
1065
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001066ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001067 VkCmdBuffer cmdBuffer,
1068 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001069 uint32_t startQuery,
1070 uint32_t queryCount)
1071{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001072 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001073}
1074
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001075ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001076 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001077 VkEvent event_,
1078 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001079{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001080 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001081}
1082
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001083ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001084 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001085 VkEvent event_,
1086 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001087{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001088 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001089}
1090
Ian Elliott63f1edb2015-04-16 18:10:19 -06001091ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1092 VkCmdBuffer cmdBuffer,
1093 VkQueryPool queryPool,
1094 uint32_t startQuery,
1095 uint32_t queryCount,
1096 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001097 VkDeviceSize destOffset,
1098 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001099 VkFlags flags)
1100{
1101 NULLDRV_LOG_FUNC;
1102}
1103
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001104ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001105 VkCmdBuffer cmdBuffer,
1106 VkTimestampType timestampType,
1107 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001108 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001109{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001110 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001111}
1112
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001113ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001114 VkCmdBuffer cmdBuffer,
Tony Barbourde4124d2015-07-03 10:33:54 -06001115 VkPipelineBindPoint pipelineBindPoint,
1116 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001117{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001118 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001119}
1120
Tony Barbourde4124d2015-07-03 10:33:54 -06001121ICD_EXPORT void VKAPI vkCmdBindDynamicViewportState(
1122 VkCmdBuffer cmdBuffer,
1123 VkDynamicViewportState state)
1124{
1125 NULLDRV_LOG_FUNC;
1126}
1127
1128ICD_EXPORT void VKAPI vkCmdBindDynamicRasterState(
1129 VkCmdBuffer cmdBuffer,
1130 VkDynamicRasterState state)
1131{
1132 NULLDRV_LOG_FUNC;
1133}
1134
1135ICD_EXPORT void VKAPI vkCmdBindDynamicColorBlendState(
1136 VkCmdBuffer cmdBuffer,
1137 VkDynamicColorBlendState state)
1138{
1139 NULLDRV_LOG_FUNC;
1140}
1141
1142ICD_EXPORT void VKAPI vkCmdBindDynamicDepthStencilState(
1143 VkCmdBuffer cmdBuffer,
1144 VkDynamicDepthStencilState state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001145{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001146 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001147}
1148
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001149ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001150 VkCmdBuffer cmdBuffer,
1151 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001152 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001153 uint32_t firstSet,
1154 uint32_t setCount,
1155 const VkDescriptorSet* pDescriptorSets,
1156 uint32_t dynamicOffsetCount,
1157 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001158{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001159 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001160}
1161
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001162ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1163 VkCmdBuffer cmdBuffer,
1164 uint32_t startBinding,
1165 uint32_t bindingCount,
1166 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001167 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001168{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001169 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001170}
1171
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001172ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001173 VkCmdBuffer cmdBuffer,
1174 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001175 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001176 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001177{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001178 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001179}
1180
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001181ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001182 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001183 uint32_t firstVertex,
1184 uint32_t vertexCount,
1185 uint32_t firstInstance,
1186 uint32_t instanceCount)
1187{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001188 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001189}
1190
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001191ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001192 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001193 uint32_t firstIndex,
1194 uint32_t indexCount,
1195 int32_t vertexOffset,
1196 uint32_t firstInstance,
1197 uint32_t instanceCount)
1198{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001199 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001200}
1201
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001202ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001203 VkCmdBuffer cmdBuffer,
1204 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001205 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001206 uint32_t count,
1207 uint32_t stride)
1208{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001209 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001210}
1211
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001212ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001213 VkCmdBuffer cmdBuffer,
1214 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001215 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001216 uint32_t count,
1217 uint32_t stride)
1218{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001219 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001220}
1221
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001222ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001223 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001224 uint32_t x,
1225 uint32_t y,
1226 uint32_t z)
1227{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001228 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001229}
1230
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001231ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001232 VkCmdBuffer cmdBuffer,
1233 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001234 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001235{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001236 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001237}
1238
Tony Barbour8205d902015-04-16 15:59:00 -06001239void VKAPI vkCmdWaitEvents(
1240 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001241 uint32_t eventCount,
1242 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001243 VkPipelineStageFlags sourceStageMask,
1244 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001245 uint32_t memBarrierCount,
1246 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001247{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001248 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001249}
1250
Tony Barbour8205d902015-04-16 15:59:00 -06001251void VKAPI vkCmdPipelineBarrier(
1252 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001253 VkPipelineStageFlags sourceStageMask,
1254 VkPipelineStageFlags destStageMask,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001255 VkBool32 byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001256 uint32_t memBarrierCount,
1257 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001258{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001259 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001260}
1261
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001262ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001263 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001264 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001265 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001266{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001267 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001268 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1269 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1270}
1271
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001272ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1273 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001274{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001275 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001276 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001277}
1278
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001279ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1280 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001281 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001282 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001283 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001284{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001285 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001286 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001287 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001288 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001289}
1290
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001291ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1292 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001293{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001294 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001295 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001296}
1297
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001298ICD_EXPORT VkResult VKAPI vkCreateEvent(
1299 VkDevice device,
1300 const VkEventCreateInfo* pCreateInfo,
1301 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001302{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001303 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001304 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001305}
1306
Tony Barbourde4124d2015-07-03 10:33:54 -06001307ICD_EXPORT VkResult VKAPI vkDestroyEvent(
1308 VkDevice device,
1309 VkEvent event)
1310{
1311 NULLDRV_LOG_FUNC;
1312 return VK_SUCCESS;
1313}
1314
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001315ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001316 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001317 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001318{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001319 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001320 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001321}
1322
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001323ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001324 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001325 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001326{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001327 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001328 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001329}
1330
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001331ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001332 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001333 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001334{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001335 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001336 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001337}
1338
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001339ICD_EXPORT VkResult VKAPI vkCreateFence(
1340 VkDevice device,
1341 const VkFenceCreateInfo* pCreateInfo,
1342 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001343{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001344 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001345 struct nulldrv_dev *dev = nulldrv_dev(device);
1346
1347 return nulldrv_fence_create(dev, pCreateInfo,
1348 (struct nulldrv_fence **) pFence);
1349}
1350
Tony Barbourde4124d2015-07-03 10:33:54 -06001351ICD_EXPORT VkResult VKAPI vkDestroyFence(
1352 VkDevice device,
1353 VkFence fence)
1354{
1355 NULLDRV_LOG_FUNC;
1356 return VK_SUCCESS;
1357}
1358
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001359ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001360 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001361 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001362{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001363 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001364 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001365}
1366
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001367ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001368 VkDevice device,
1369 uint32_t fenceCount,
1370 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001371{
1372 NULLDRV_LOG_FUNC;
1373 return VK_SUCCESS;
1374}
1375
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001376ICD_EXPORT VkResult VKAPI vkWaitForFences(
1377 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001378 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001379 const VkFence* pFences,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001380 VkBool32 waitAll,
David Pinedo0257fbf2015-02-02 18:02:40 -07001381 uint64_t timeout)
1382{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001383 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001384 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001385}
1386
Tony Barbour426b9052015-06-24 16:06:58 -06001387ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1388 VkPhysicalDevice gpu_,
1389 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001390{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001391 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001392 VkResult ret = VK_SUCCESS;
1393
Tony Barbour426b9052015-06-24 16:06:58 -06001394 pProperties->apiVersion = VK_API_VERSION;
1395 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1396 pProperties->vendorId = 0;
1397 pProperties->deviceId = 0;
1398 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1399 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001400
1401 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001402}
1403
Chris Forbesd7576302015-06-21 22:55:02 +12001404ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1405 VkPhysicalDevice physicalDevice,
1406 VkPhysicalDeviceFeatures* pFeatures)
1407{
1408 NULLDRV_LOG_FUNC;
1409 VkResult ret = VK_SUCCESS;
1410
1411 /* TODO: fill out features */
1412 memset(pFeatures, 0, sizeof(*pFeatures));
1413
1414 return ret;
1415}
1416
1417ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatInfo(
1418 VkPhysicalDevice physicalDevice,
1419 VkFormat format,
1420 VkFormatProperties* pFormatInfo)
1421{
1422 NULLDRV_LOG_FUNC;
1423 VkResult ret = VK_SUCCESS;
1424
1425 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1426 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1427
1428 return ret;
1429}
1430
1431ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1432 VkPhysicalDevice physicalDevice,
1433 VkPhysicalDeviceLimits* pLimits)
1434{
1435 NULLDRV_LOG_FUNC;
1436 VkResult ret = VK_SUCCESS;
1437
1438 /* TODO: fill out limits */
1439 memset(pLimits, 0, sizeof(*pLimits));
1440
1441 return ret;
1442}
1443
Tony Barbour426b9052015-06-24 16:06:58 -06001444ICD_EXPORT VkResult VKAPI vkGetPhysicalDevicePerformance(
1445 VkPhysicalDevice gpu_,
1446 VkPhysicalDevicePerformance* pPerformance)
Jon Ashburneb2728b2015-04-10 14:33:07 -06001447{
Tony Barbour426b9052015-06-24 16:06:58 -06001448 pPerformance->maxDeviceClock = 1.0f;
1449 pPerformance->aluPerClock = 1.0f;
1450 pPerformance->texPerClock = 1.0f;
1451 pPerformance->primsPerClock = 1.0f;
1452 pPerformance->pixelsPerClock = 1.0f;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001453
1454 return VK_SUCCESS;
1455}
1456
Tony Barbour426b9052015-06-24 16:06:58 -06001457ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueCount(
1458 VkPhysicalDevice gpu_,
1459 uint32_t* pCount)
David Pinedo0257fbf2015-02-02 18:02:40 -07001460{
Tony Barbour426b9052015-06-24 16:06:58 -06001461 *pCount = 1;
1462 return VK_SUCCESS;
1463}
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001464
Tony Barbour426b9052015-06-24 16:06:58 -06001465ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueProperties(
1466 VkPhysicalDevice gpu_,
1467 uint32_t count,
1468 VkPhysicalDeviceQueueProperties* pProperties)
1469 {
1470 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1471 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001472 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001473
Tony Barbour426b9052015-06-24 16:06:58 -06001474 return VK_SUCCESS;
1475}
1476
Ian Elliotte924ab22015-07-08 13:24:30 -06001477ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(
1478 VkPhysicalDevice gpu_,
1479 VkPhysicalDeviceMemoryProperties* pProperties)
1480{
1481 // TODO: Fill in with real data
1482 return VK_SUCCESS;
1483}
1484
1485ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLayerProperties(
1486 VkPhysicalDevice physicalDevice,
1487 uint32_t* pCount,
1488 VkLayerProperties* pProperties)
1489{
1490 // TODO: Fill in with real data
1491 return VK_SUCCESS;
1492}
1493
Tony Barbour426b9052015-06-24 16:06:58 -06001494ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001495 const char* pLayerName,
1496 uint32_t* pCount,
1497 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001498{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001499 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001500
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001501 if (pCount == NULL) {
1502 return VK_ERROR_INVALID_POINTER;
1503 }
Tony Barbour426b9052015-06-24 16:06:58 -06001504
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001505 if (pProperties == NULL) {
1506 *pCount = NULLDRV_EXT_COUNT;
1507 return VK_SUCCESS;
1508 }
Tony Barbour426b9052015-06-24 16:06:58 -06001509
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001510 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1511 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1512 *pCount = copy_size;
1513 if (copy_size < NULLDRV_EXT_COUNT) {
1514 return VK_INCOMPLETE;
1515 }
Tony Barbour426b9052015-06-24 16:06:58 -06001516 return VK_SUCCESS;
1517}
Ian Elliotte924ab22015-07-08 13:24:30 -06001518ICD_EXPORT VkResult VKAPI vkGetGlobalLayerProperties(
1519 uint32_t* pCount,
1520 VkLayerProperties* pProperties)
1521{
1522 // TODO: Fill in with real data
1523 return VK_SUCCESS;
1524}
Tony Barbour426b9052015-06-24 16:06:58 -06001525
1526VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001527 VkPhysicalDevice physicalDevice,
1528 const char* pLayerName,
1529 uint32_t* pCount,
1530 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001531{
Tony Barbour426b9052015-06-24 16:06:58 -06001532
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001533 if (pCount == NULL) {
1534 return VK_ERROR_INVALID_POINTER;
1535 }
1536
Tony Barbour426b9052015-06-24 16:06:58 -06001537 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001538
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001539 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001540}
1541
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001542ICD_EXPORT VkResult VKAPI vkCreateImage(
1543 VkDevice device,
1544 const VkImageCreateInfo* pCreateInfo,
1545 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001546{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001547 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001548 struct nulldrv_dev *dev = nulldrv_dev(device);
1549
1550 return nulldrv_img_create(dev, pCreateInfo, false,
1551 (struct nulldrv_img **) pImage);
1552}
1553
Tony Barbourde4124d2015-07-03 10:33:54 -06001554ICD_EXPORT VkResult VKAPI vkDestroyImage(
1555 VkDevice device,
1556 VkImage image)
1557{
1558 NULLDRV_LOG_FUNC;
1559 return VK_SUCCESS;
1560}
1561
Tony Barbour426b9052015-06-24 16:06:58 -06001562ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001563 VkDevice device,
1564 VkImage image,
1565 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001566 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001567{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001568 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001569
Tony Barbour426b9052015-06-24 16:06:58 -06001570 pLayout->offset = 0;
1571 pLayout->size = 1;
1572 pLayout->rowPitch = 4;
1573 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001574
Tony Barbour426b9052015-06-24 16:06:58 -06001575 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001576}
1577
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001578ICD_EXPORT VkResult VKAPI vkAllocMemory(
1579 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001580 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001581 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001582{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001583 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001584 struct nulldrv_dev *dev = nulldrv_dev(device);
1585
1586 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1587}
1588
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001589ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001590 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001591 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001592{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001593 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001594 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001595}
1596
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001597ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001598 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001599 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001600 VkDeviceSize offset,
1601 VkDeviceSize size,
1602 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001603 void** ppData)
1604{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001605 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001606 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1607 void *ptr = nulldrv_mem_map(mem, flags);
1608
1609 *ppData = ptr;
1610
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001611 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001612}
1613
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001614ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001615 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001616 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001617{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001618 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001619 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001620}
1621
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001622ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001623 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001624 uint32_t memRangeCount,
1625 const VkMappedMemoryRange* pMemRanges)
1626{
1627 NULLDRV_LOG_FUNC;
1628 return VK_SUCCESS;
1629}
1630
1631ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1632 VkDevice device,
1633 uint32_t memRangeCount,
1634 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001635{
1636 NULLDRV_LOG_FUNC;
1637 return VK_SUCCESS;
1638}
1639
Courtney Goeltzenleuchterd040c5c2015-07-09 21:57:28 -06001640ICD_EXPORT VkResult VKAPI vkGetDeviceMemoryCommitment(
1641 VkDevice device,
1642 VkDeviceMemory memory,
1643 VkDeviceSize* pCommittedMemoryInBytes)
1644{
1645 return VK_SUCCESS;
1646}
1647
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001648ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001649 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001650 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001651{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001652 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001653 struct nulldrv_instance *inst;
1654
1655 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001656 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001657 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001658 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001659
Tony Barbour426b9052015-06-24 16:06:58 -06001660 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001661
Mike Stroyan230e6252015-04-17 12:36:38 -06001662 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001663
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001664 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001665}
1666
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001667ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1668 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001669{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001670 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001671 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001672}
1673
Tony Barbour8205d902015-04-16 15:59:00 -06001674ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001675 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001676 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001677 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001678{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001679 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001680 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001681 struct nulldrv_gpu *gpu;
1682 *pGpuCount = 1;
1683 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001684 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001685 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001686 return ret;
1687}
1688
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001689ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001690 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001691 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001692 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001693 char* const* pOutLayers,
1694 void* pReserved)
1695{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001696 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001697 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001698}
1699
Tony Barbourde4124d2015-07-03 10:33:54 -06001700ICD_EXPORT VkResult VKAPI vkGetBufferMemoryRequirements(
1701 VkDevice device,
1702 VkBuffer buffer,
1703 VkMemoryRequirements* pMemoryRequirements)
1704{
1705 NULLDRV_LOG_FUNC;
1706 struct nulldrv_base *base = nulldrv_base((void*)buffer.handle);
1707
1708 return base->get_memory_requirements(base, pMemoryRequirements);
1709}
1710
1711ICD_EXPORT VkResult VKAPI vkGetImageMemoryRequirements(
1712 VkDevice device,
1713 VkImage image,
1714 VkMemoryRequirements* pMemoryRequirements)
1715{
1716 NULLDRV_LOG_FUNC;
1717 struct nulldrv_base *base = nulldrv_base((void*)image.handle);
1718
1719 return base->get_memory_requirements(base, pMemoryRequirements);
1720}
1721
1722ICD_EXPORT VkResult VKAPI vkBindBufferMemory(
1723 VkDevice device,
1724 VkBuffer buffer,
1725 VkDeviceMemory mem_,
1726 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001727{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001728 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001729 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001730}
1731
Tony Barbourde4124d2015-07-03 10:33:54 -06001732ICD_EXPORT VkResult VKAPI vkBindImageMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001733 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06001734 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001735 VkDeviceMemory mem_,
1736 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001737{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001738 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001739 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001740}
1741
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001742ICD_EXPORT VkResult VKAPI vkGetImageSparseMemoryRequirements(
1743 VkDevice device,
1744 VkImage image,
1745 uint32_t* pNumRequirements,
1746 VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
1747{
1748 NULLDRV_LOG_FUNC;
1749 return VK_SUCCESS;
1750}
1751
1752ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(
1753 VkPhysicalDevice physicalDevice,
1754 VkFormat format,
1755 VkImageType type,
1756 uint32_t samples,
1757 VkImageUsageFlags usage,
1758 VkImageTiling tiling,
1759 uint32_t* pNumProperties,
1760 VkSparseImageFormatProperties* pProperties)
1761{
1762 NULLDRV_LOG_FUNC;
1763 return VK_SUCCESS;
1764}
1765
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001766ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001767 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001768 VkBuffer buffer,
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001769 uint32_t numBindings,
1770 const VkSparseMemoryBindInfo* pBindInfo)
1771{
1772 NULLDRV_LOG_FUNC;
1773 return VK_SUCCESS;
1774}
1775
1776ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageOpaqueMemory(
1777 VkQueue queue,
1778 VkImage image,
1779 uint32_t numBindings,
1780 const VkSparseMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001781{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001782 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001783 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001784}
1785
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001786ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001787 VkQueue queue,
1788 VkImage image,
1789 uint32_t numBindings,
1790 const VkSparseImageMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001791{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001792 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001793 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001794}
Jon Ashburn0e249962015-07-10 09:41:15 -07001795ICD_EXPORT VkResult VKAPI vkCreatePipelineCache(
1796 VkDevice device,
1797 const VkPipelineCacheCreateInfo* pCreateInfo,
1798 VkPipelineCache* pPipelineCache)
1799{
David Pinedo0257fbf2015-02-02 18:02:40 -07001800
Jon Ashburn0e249962015-07-10 09:41:15 -07001801 NULLDRV_LOG_FUNC;
1802 return VK_SUCCESS;
1803}
1804
Tony Barbourde4124d2015-07-03 10:33:54 -06001805<<<<<<< HEAD
Jon Ashburn0e249962015-07-10 09:41:15 -07001806VkResult VKAPI vkDestroyPipelineCache(
1807 VkDevice device,
1808 VkPipelineCache pipelineCache)
Tony Barbourde4124d2015-07-03 10:33:54 -06001809=======
1810ICD_EXPORT VkResult VKAPI vkDestroyPipeline(
1811 VkDevice device,
1812 VkPipeline pipeline)
1813{
1814 NULLDRV_LOG_FUNC;
1815 return VK_SUCCESS;
1816}
1817
1818ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(
1819 VkDevice device,
1820 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1821 VkPipeline basePipeline,
1822 VkPipeline* pPipeline)
1823>>>>>>> Bug 14084 - Improve type safety and remove polymorphism
Jon Ashburn0e249962015-07-10 09:41:15 -07001824{
1825 NULLDRV_LOG_FUNC;
1826 return VK_SUCCESS;
1827}
1828
1829ICD_EXPORT size_t VKAPI vkGetPipelineCacheSize(
1830 VkDevice device,
1831 VkPipelineCache pipelineCache)
1832{
1833 NULLDRV_LOG_FUNC;
1834 return VK_ERROR_UNAVAILABLE;
1835}
1836
1837ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
1838 VkDevice device,
1839 VkPipelineCache pipelineCache,
1840 void* pData)
1841{
1842 NULLDRV_LOG_FUNC;
1843 return VK_ERROR_UNAVAILABLE;
1844}
1845
1846ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
1847 VkDevice device,
1848 VkPipelineCache destCache,
1849 uint32_t srcCacheCount,
1850 const VkPipelineCache* pSrcCaches)
1851{
1852 NULLDRV_LOG_FUNC;
1853 return VK_ERROR_UNAVAILABLE;
1854}
1855ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001856 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001857 VkPipelineCache pipelineCache,
1858 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001859 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1860 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001861{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001862 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001863 struct nulldrv_dev *dev = nulldrv_dev(device);
1864
1865 return graphics_pipeline_create(dev, pCreateInfo,
1866 (struct nulldrv_pipeline **) pPipeline);
1867}
1868
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001869
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001870
Jon Ashburn0e249962015-07-10 09:41:15 -07001871ICD_EXPORT VkResult VKAPI vkCreateComputePipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001872 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001873 VkPipelineCache pipelineCache,
1874 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001875 const VkComputePipelineCreateInfo* pCreateInfo,
1876 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001877{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001878 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001879 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001880}
1881
David Pinedo0257fbf2015-02-02 18:02:40 -07001882
David Pinedo0257fbf2015-02-02 18:02:40 -07001883
Jon Ashburn0e249962015-07-10 09:41:15 -07001884
David Pinedo0257fbf2015-02-02 18:02:40 -07001885
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001886ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1887 VkDevice device,
1888 const VkQueryPoolCreateInfo* pCreateInfo,
1889 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001890{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001891 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001892 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001893}
1894
Tony Barbourde4124d2015-07-03 10:33:54 -06001895ICD_EXPORT VkResult VKAPI vkDestroyQueryPool(
1896 VkDevice device,
1897 VkQueryPool queryPoool)
1898{
1899 NULLDRV_LOG_FUNC;
1900 return VK_SUCCESS;
1901}
1902
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001903ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001904 VkDevice device,
1905 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001906 uint32_t startQuery,
1907 uint32_t queryCount,
1908 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001909 void* pData,
1910 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001911{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001912 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001913 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001914}
1915
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001916ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1917 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001918{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001919 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001920 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001921}
1922
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001923ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1924 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001925 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001926 const VkCmdBuffer* pCmdBuffers,
1927 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001928{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001929 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001930 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001931}
1932
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001933ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1934 VkDevice device,
1935 const VkSemaphoreCreateInfo* pCreateInfo,
1936 VkSemaphore* pSemaphore)
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
Tony Barbourde4124d2015-07-03 10:33:54 -06001942ICD_EXPORT VkResult VKAPI vkDestroySemaphore(
1943 VkDevice device,
1944 VkSemaphore semaphore)
1945{
1946 NULLDRV_LOG_FUNC;
1947 return VK_SUCCESS;
1948}
1949
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001950ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1951 VkQueue queue,
1952 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001953{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001954 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001955 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001956}
1957
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001958ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1959 VkQueue queue,
1960 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001961{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001962 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001963 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001964}
1965
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001966ICD_EXPORT VkResult VKAPI vkCreateSampler(
1967 VkDevice device,
1968 const VkSamplerCreateInfo* pCreateInfo,
1969 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07001970{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001971 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001972 struct nulldrv_dev *dev = nulldrv_dev(device);
1973
1974 return nulldrv_sampler_create(dev, pCreateInfo,
1975 (struct nulldrv_sampler **) pSampler);
1976}
1977
Tony Barbourde4124d2015-07-03 10:33:54 -06001978ICD_EXPORT VkResult VKAPI vkDestroySampler(
1979 VkDevice device,
1980 VkSampler sampler)
1981{
1982 NULLDRV_LOG_FUNC;
1983 return VK_SUCCESS;
1984}
1985
Ian Elliotte924ab22015-07-08 13:24:30 -06001986ICD_EXPORT VkResult VKAPI vkCreateShaderModule(
1987 VkDevice device,
1988 const VkShaderModuleCreateInfo* pCreateInfo,
1989 VkShaderModule* pShaderModule)
1990{
1991 // TODO: Fill in with real data
Tony Barbourde4124d2015-07-03 10:33:54 -06001992 NULLDRV_LOG_FUNC;
1993 return VK_SUCCESS;
1994}
1995
1996ICD_EXPORT VkResult VKAPI vkDestroyShaderModule(
1997 VkDevice device,
1998 VkShaderModule shaderModule)
1999{
2000 // TODO: Fill in with real data
2001 NULLDRV_LOG_FUNC;
Ian Elliotte924ab22015-07-08 13:24:30 -06002002 return VK_SUCCESS;
2003}
2004
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002005ICD_EXPORT VkResult VKAPI vkCreateShader(
2006 VkDevice device,
2007 const VkShaderCreateInfo* pCreateInfo,
2008 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002009{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002010 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002011 struct nulldrv_dev *dev = nulldrv_dev(device);
2012
2013 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2014}
2015
Tony Barbourde4124d2015-07-03 10:33:54 -06002016ICD_EXPORT VkResult VKAPI vkDestroyShader(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002017 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002018 VkShader shader)
2019{
2020 NULLDRV_LOG_FUNC;
2021 return VK_SUCCESS;
2022}
2023
2024ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2025 VkDevice device,
2026 const VkDynamicViewportStateCreateInfo* pCreateInfo,
2027 VkDynamicViewportState* pState)
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 nulldrv_viewport_state_create(dev, pCreateInfo,
2033 (struct nulldrv_dynamic_vp **) pState);
2034}
2035
Tony Barbourde4124d2015-07-03 10:33:54 -06002036ICD_EXPORT VkResult VKAPI vkDestroyDynamicViewportState(
2037 VkDevice device,
2038 VkDynamicViewportState dynamicViewportState)
2039{
2040 NULLDRV_LOG_FUNC;
2041 return VK_SUCCESS;
2042}
2043
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002044ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
2045 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002046 const VkDynamicRasterStateCreateInfo* pCreateInfo,
2047 VkDynamicRasterState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002048{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002049 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002050 struct nulldrv_dev *dev = nulldrv_dev(device);
2051
2052 return nulldrv_raster_state_create(dev, pCreateInfo,
2053 (struct nulldrv_dynamic_rs **) pState);
2054}
2055
Tony Barbourde4124d2015-07-03 10:33:54 -06002056ICD_EXPORT VkResult VKAPI vkDestroyDynamicRasterState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002057 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002058 VkDynamicRasterState dynamicRasterState)
2059{
2060 NULLDRV_LOG_FUNC;
2061 return VK_SUCCESS;
2062}
2063
2064ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
2065 VkDevice device,
2066 const VkDynamicColorBlendStateCreateInfo* pCreateInfo,
2067 VkDynamicColorBlendState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002068{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002069 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002070 struct nulldrv_dev *dev = nulldrv_dev(device);
2071
2072 return nulldrv_blend_state_create(dev, pCreateInfo,
2073 (struct nulldrv_dynamic_cb **) pState);
2074}
2075
Tony Barbourde4124d2015-07-03 10:33:54 -06002076ICD_EXPORT VkResult VKAPI vkDestroyDynamicColorBlendState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002077 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002078 VkDynamicColorBlendState dynamicColorBlendState)
2079{
2080 NULLDRV_LOG_FUNC;
2081 return VK_SUCCESS;
2082}
2083
2084ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
2085 VkDevice device,
2086 const VkDynamicDepthStencilStateCreateInfo* pCreateInfo,
2087 VkDynamicDepthStencilState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002088{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002089 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002090 struct nulldrv_dev *dev = nulldrv_dev(device);
2091
2092 return nulldrv_ds_state_create(dev, pCreateInfo,
2093 (struct nulldrv_dynamic_ds **) pState);
2094}
2095
Tony Barbourde4124d2015-07-03 10:33:54 -06002096ICD_EXPORT VkResult VKAPI vkDestroyDynamicDepthStencilState(
2097 VkDevice device,
2098 VkDynamicDepthStencilState dynamicDepthStencilState)
2099{
2100 NULLDRV_LOG_FUNC;
2101 return VK_SUCCESS;
2102}
2103
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002104ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2105 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002106 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002107 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002108{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002109 NULLDRV_LOG_FUNC;
2110 struct nulldrv_dev *dev = nulldrv_dev(device);
2111
2112 return nulldrv_buf_view_create(dev, pCreateInfo,
2113 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002114}
2115
Tony Barbourde4124d2015-07-03 10:33:54 -06002116ICD_EXPORT VkResult VKAPI vkDestroyBufferView(
2117 VkDevice device,
2118 VkBufferView bufferView)
2119{
2120 NULLDRV_LOG_FUNC;
2121 return VK_SUCCESS;
2122}
2123
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002124ICD_EXPORT VkResult VKAPI vkCreateImageView(
2125 VkDevice device,
2126 const VkImageViewCreateInfo* pCreateInfo,
2127 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002128{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002129 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002130 struct nulldrv_dev *dev = nulldrv_dev(device);
2131
2132 return nulldrv_img_view_create(dev, pCreateInfo,
2133 (struct nulldrv_img_view **) pView);
2134}
2135
Tony Barbourde4124d2015-07-03 10:33:54 -06002136<<<<<<< HEAD
Chia-I Wuc278df82015-07-07 11:50:03 +08002137ICD_EXPORT VkResult VKAPI vkCreateAttachmentView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002138=======
2139ICD_EXPORT VkResult VKAPI vkDestroyImageView(
2140 VkDevice device,
2141 VkImageView imageView)
2142{
2143 NULLDRV_LOG_FUNC;
2144 return VK_SUCCESS;
2145}
2146
2147ICD_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
2148>>>>>>> Bug 14084 - Improve type safety and remove polymorphism
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002149 VkDevice device,
Chia-I Wuc278df82015-07-07 11:50:03 +08002150 const VkAttachmentViewCreateInfo* pCreateInfo,
2151 VkAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002152{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002153 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002154 struct nulldrv_dev *dev = nulldrv_dev(device);
2155
2156 return nulldrv_rt_view_create(dev, pCreateInfo,
2157 (struct nulldrv_rt_view **) pView);
2158}
2159
Tony Barbourde4124d2015-07-03 10:33:54 -06002160<<<<<<< HEAD
2161=======
2162ICD_EXPORT VkResult VKAPI vkDestroyColorAttachmentView(
2163 VkDevice device,
2164 VkColorAttachmentView colorAttachmentView)
2165{
2166 NULLDRV_LOG_FUNC;
2167 return VK_SUCCESS;
2168}
2169
2170ICD_EXPORT VkResult VKAPI vkCreateDepthStencilView(
2171 VkDevice device,
2172 const VkDepthStencilViewCreateInfo* pCreateInfo,
2173 VkDepthStencilView* pView)
2174{
2175 NULLDRV_LOG_FUNC;
2176 struct nulldrv_dev *dev = nulldrv_dev(device);
2177
2178 return nulldrv_ds_view_create(dev, pCreateInfo,
2179 (struct nulldrv_ds_view **) pView);
2180
2181}
2182
2183ICD_EXPORT VkResult VKAPI vkDestroyDepthStencilView(
2184 VkDevice device,
2185 VkDepthStencilView depthStencilView)
2186{
2187 NULLDRV_LOG_FUNC;
2188 return VK_SUCCESS;
2189}
2190
2191>>>>>>> Bug 14084 - Improve type safety and remove polymorphism
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002192ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2193 VkDevice device,
2194 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2195 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002196{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002197 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002198 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002199
Chia-I Wu7732cb22015-03-26 15:27:55 +08002200 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002201 (struct nulldrv_desc_layout **) pSetLayout);
2202}
2203
Tony Barbourde4124d2015-07-03 10:33:54 -06002204ICD_EXPORT VkResult VKAPI vkDestroyDescriptorSetLayout(
2205 VkDevice device,
2206 VkDescriptorSetLayout descriptorSetLayout)
2207{
2208 NULLDRV_LOG_FUNC;
2209 return VK_SUCCESS;
2210}
2211
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002212ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2213 VkDevice device,
2214 const VkPipelineLayoutCreateInfo* pCreateInfo,
2215 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002216{
2217 NULLDRV_LOG_FUNC;
2218 struct nulldrv_dev *dev = nulldrv_dev(device);
2219
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002220 return nulldrv_pipeline_layout_create(dev,
2221 pCreateInfo,
2222 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002223}
2224
Tony Barbourde4124d2015-07-03 10:33:54 -06002225ICD_EXPORT VkResult VKAPI vkDestroyPipelineLayout(
2226 VkDevice device,
2227 VkPipelineLayout pipelineLayout)
2228{
2229 NULLDRV_LOG_FUNC;
2230 return VK_SUCCESS;
2231}
2232
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002233ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2234 VkDevice device,
2235 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002236 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002237 const VkDescriptorPoolCreateInfo* pCreateInfo,
2238 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002239{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002240 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002241 struct nulldrv_dev *dev = nulldrv_dev(device);
2242
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002243 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2244 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002245}
2246
Tony Barbourde4124d2015-07-03 10:33:54 -06002247ICD_EXPORT VkResult VKAPI vkDestroyDescriptorPool(
2248 VkDevice device,
2249 VkDescriptorPool descriptorPool)
2250{
2251 NULLDRV_LOG_FUNC;
2252 return VK_SUCCESS;
2253}
2254
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002255ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002256 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002257 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002258{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002259 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002260 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002261}
2262
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002263ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002264 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002265 VkDescriptorPool descriptorPool,
2266 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002267 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002268 const VkDescriptorSetLayout* pSetLayouts,
2269 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07002270 uint32_t* pCount)
2271{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002272 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002273 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2274 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002275 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002276 uint32_t i;
2277
2278 for (i = 0; i < count; i++) {
2279 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002280 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002281
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002282 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002283 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002284 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002285 break;
2286 }
2287
2288 if (pCount)
2289 *pCount = i;
2290
2291 return ret;
2292}
2293
Tony Barbourb857d312015-07-10 10:50:45 -06002294ICD_EXPORT VkResult VKAPI vkFreeDescriptorSets(
2295 VkDevice device,
2296 VkDescriptorPool descriptorPool,
2297 uint32_t count,
2298 const VkDescriptorSet* pDescriptorSets)
2299{
2300 NULLDRV_LOG_FUNC;
2301 return VK_SUCCESS;
2302}
2303
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002304ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2305 VkDevice device,
2306 uint32_t writeCount,
2307 const VkWriteDescriptorSet* pDescriptorWrites,
2308 uint32_t copyCount,
2309 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002310{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002311 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002312 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002313}
2314
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002315ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2316 VkDevice device,
2317 const VkFramebufferCreateInfo* info,
2318 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002319{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002320 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002321 struct nulldrv_dev *dev = nulldrv_dev(device);
2322
2323 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2324}
2325
Tony Barbourde4124d2015-07-03 10:33:54 -06002326ICD_EXPORT VkResult VKAPI vkDestroyFramebuffer(
2327 VkDevice device,
2328 VkFramebuffer framebuffer)
2329{
2330 NULLDRV_LOG_FUNC;
2331 return VK_SUCCESS;
2332}
David Pinedo0257fbf2015-02-02 18:02:40 -07002333
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002334ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2335 VkDevice device,
2336 const VkRenderPassCreateInfo* info,
2337 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002338{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002339 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002340 struct nulldrv_dev *dev = nulldrv_dev(device);
2341
2342 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2343}
2344
Tony Barbourde4124d2015-07-03 10:33:54 -06002345ICD_EXPORT VkResult VKAPI vkDestroyRenderPass(
2346 VkDevice device,
2347 VkRenderPass renderPass)
2348{
2349 NULLDRV_LOG_FUNC;
2350 return VK_SUCCESS;
2351}
2352
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002353ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Chia-I Wuc278df82015-07-07 11:50:03 +08002354 VkCmdBuffer cmdBuffer,
2355 const VkRenderPassBeginInfo* pRenderPassBegin,
2356 VkRenderPassContents contents)
2357{
2358 NULLDRV_LOG_FUNC;
2359}
2360
2361ICD_EXPORT void VKAPI vkCmdNextSubpass(
2362 VkCmdBuffer cmdBuffer,
2363 VkRenderPassContents contents)
David Pinedo0257fbf2015-02-02 18:02:40 -07002364{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002365 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002366}
2367
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002368ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002369 VkCmdBuffer cmdBuffer)
2370{
2371 NULLDRV_LOG_FUNC;
2372}
2373
2374ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2375 VkCmdBuffer cmdBuffer,
2376 uint32_t cmdBuffersCount,
2377 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002378{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002379 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002380}
Ian Elliottf93069f2015-02-19 14:26:19 -07002381
2382ICD_EXPORT void* xcbCreateWindow(
2383 uint16_t width,
2384 uint16_t height)
2385{
2386 static uint32_t window; // Kludge to the max
2387 NULLDRV_LOG_FUNC;
2388 return &window;
2389}
2390
2391// May not be needed, if we stub out stuf in tri.c
2392ICD_EXPORT void xcbDestroyWindow()
2393{
2394 NULLDRV_LOG_FUNC;
2395}
2396
2397ICD_EXPORT int xcbGetMessage(void *msg)
2398{
2399 NULLDRV_LOG_FUNC;
2400 return 0;
2401}
2402
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002403ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002404{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002405 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002406}