blob: 7bb40203efd7fc6a47b518b69fc76b3ae7eff56a [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 {
47 .sType = VK_STRUCTURE_TYPE_EXTENSION_PROPERTIES,
48 .name = VK_WSI_LUNARG_EXTENSION_NAME,
49 .version = VK_WSI_LUNARG_REVISION,
50 .description = "Null driver",
51 }
52};
David Pinedo0257fbf2015-02-02 18:02:40 -070053
Mike Stroyan230e6252015-04-17 12:36:38 -060054static struct nulldrv_base *nulldrv_base(VkObject base)
David Pinedo0257fbf2015-02-02 18:02:40 -070055{
56 return (struct nulldrv_base *) base;
57}
58
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060059static struct nulldrv_base *nulldrv_base_create(
60 struct nulldrv_dev *dev,
61 size_t obj_size,
62 VkObjectType type)
David Pinedo0257fbf2015-02-02 18:02:40 -070063{
64 struct nulldrv_base *base;
65
66 if (!obj_size)
67 obj_size = sizeof(*base);
68
69 assert(obj_size >= sizeof(*base));
70
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060071 base = (struct nulldrv_base*)malloc(obj_size);
David Pinedo0257fbf2015-02-02 18:02:40 -070072 if (!base)
73 return NULL;
74
75 memset(base, 0, obj_size);
76
77 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbour11e76ac2015-04-20 16:28:46 -060078 set_loader_magic_value((VkObject) base);
David Pinedo0257fbf2015-02-02 18:02:40 -070079
80 if (dev == NULL) {
81 /*
82 * dev is NULL when we are creating the base device object
83 * Set dev now so that debug setup happens correctly
84 */
85 dev = (struct nulldrv_dev *) base;
86 }
87
88
Tony Barbour426b9052015-06-24 16:06:58 -060089 base->get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -070090
91 return base;
92}
93
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060094static VkResult nulldrv_gpu_add(int devid, const char *primary_node,
David Pinedo0257fbf2015-02-02 18:02:40 -070095 const char *render_node, struct nulldrv_gpu **gpu_ret)
96{
97 struct nulldrv_gpu *gpu;
98
Chia-I Wu493a1752015-02-22 14:40:25 +080099 gpu = malloc(sizeof(*gpu));
David Pinedo0257fbf2015-02-02 18:02:40 -0700100 if (!gpu)
Tony Barbour8205d902015-04-16 15:59:00 -0600101 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700102 memset(gpu, 0, sizeof(*gpu));
Mark Lobodzinski97dcd042015-04-16 08:52:00 -0500103
David Pinedo0257fbf2015-02-02 18:02:40 -0700104 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbour11e76ac2015-04-20 16:28:46 -0600105 set_loader_magic_value((VkObject) gpu);
David Pinedo0257fbf2015-02-02 18:02:40 -0700106
107 *gpu_ret = gpu;
108
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600109 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700110}
111
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600112static VkResult nulldrv_queue_create(struct nulldrv_dev *dev,
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700113 uint32_t node_index,
David Pinedo0257fbf2015-02-02 18:02:40 -0700114 struct nulldrv_queue **queue_ret)
115{
116 struct nulldrv_queue *queue;
117
118 queue = (struct nulldrv_queue *) nulldrv_base_create(dev, sizeof(*queue),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600119 VK_OBJECT_TYPE_QUEUE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700120 if (!queue)
Tony Barbour8205d902015-04-16 15:59:00 -0600121 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700122
123 queue->dev = dev;
124
125 *queue_ret = queue;
126
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600127 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700128}
129
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600130static VkResult dev_create_queues(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600131 const VkDeviceQueueCreateInfo *queues,
David Pinedo0257fbf2015-02-02 18:02:40 -0700132 uint32_t count)
133{
134 uint32_t i;
135
136 if (!count)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600137 return VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700138
139 for (i = 0; i < count; i++) {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600140 const VkDeviceQueueCreateInfo *q = &queues[i];
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600141 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700142
143 if (q->queueCount == 1 && !dev->queues[q->queueNodeIndex]) {
144 ret = nulldrv_queue_create(dev, q->queueNodeIndex,
145 &dev->queues[q->queueNodeIndex]);
146 }
147 else {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600148 ret = VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700149 }
150
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600151 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700152 return ret;
153 }
154 }
155
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600156 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700157}
158
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600159static enum nulldrv_ext_type nulldrv_gpu_lookup_extension(
160 const struct nulldrv_gpu *gpu,
161 const VkExtensionProperties *ext)
David Pinedo0257fbf2015-02-02 18:02:40 -0700162{
163 enum nulldrv_ext_type type;
164
165 for (type = 0; type < ARRAY_SIZE(nulldrv_gpu_exts); type++) {
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600166 if (memcmp(&nulldrv_gpu_exts[type], ext, sizeof(VkExtensionProperties)) == 0)
David Pinedo0257fbf2015-02-02 18:02:40 -0700167 break;
168 }
169
170 assert(type < NULLDRV_EXT_COUNT || type == NULLDRV_EXT_INVALID);
171
172 return type;
173}
174
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600175static VkResult nulldrv_desc_ooxx_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800176 struct nulldrv_desc_ooxx **ooxx_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700177{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800178 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700179
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800180 ooxx = malloc(sizeof(*ooxx));
181 if (!ooxx)
Tony Barbour8205d902015-04-16 15:59:00 -0600182 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700183
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800184 memset(ooxx, 0, sizeof(*ooxx));
David Pinedo0257fbf2015-02-02 18:02:40 -0700185
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800186 ooxx->surface_desc_size = 0;
187 ooxx->sampler_desc_size = 0;
David Pinedo0257fbf2015-02-02 18:02:40 -0700188
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800189 *ooxx_ret = ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700190
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600191 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700192}
193
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600194static VkResult nulldrv_dev_create(struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600195 const VkDeviceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700196 struct nulldrv_dev **dev_ret)
197{
198 struct nulldrv_dev *dev;
199 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600200 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -0700201
202 dev = (struct nulldrv_dev *) nulldrv_base_create(NULL, sizeof(*dev),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600203 VK_OBJECT_TYPE_DEVICE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700204 if (!dev)
Tony Barbour8205d902015-04-16 15:59:00 -0600205 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700206
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600207 for (i = 0; i < info->extensionCount; i++) {
208 const enum nulldrv_ext_type ext = nulldrv_gpu_lookup_extension(
209 gpu,
210 &info->pEnabledExtensions[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700211
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600212 if (ext == NULLDRV_EXT_INVALID)
213 return VK_ERROR_INVALID_EXTENSION;
David Pinedo0257fbf2015-02-02 18:02:40 -0700214
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600215 dev->exts[ext] = true;
216 }
David Pinedo0257fbf2015-02-02 18:02:40 -0700217
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800218 ret = nulldrv_desc_ooxx_create(dev, &dev->desc_ooxx);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600219 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700220 return ret;
221 }
222
223 ret = dev_create_queues(dev, info->pRequestedQueues,
224 info->queueRecordCount);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600225 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700226 return ret;
227 }
228
229 *dev_ret = dev;
230
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600231 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700232}
233
Tony Barbour8205d902015-04-16 15:59:00 -0600234static struct nulldrv_gpu *nulldrv_gpu(VkPhysicalDevice gpu)
David Pinedo0257fbf2015-02-02 18:02:40 -0700235{
236 return (struct nulldrv_gpu *) gpu;
237}
238
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600239static VkResult nulldrv_rt_view_create(struct nulldrv_dev *dev,
240 const VkColorAttachmentViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700241 struct nulldrv_rt_view **view_ret)
242{
243 struct nulldrv_rt_view *view;
244
245 view = (struct nulldrv_rt_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600246 VK_OBJECT_TYPE_COLOR_ATTACHMENT_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700247 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600248 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700249
250 *view_ret = view;
251
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600252 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700253}
254
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600255static VkResult nulldrv_fence_create(struct nulldrv_dev *dev,
256 const VkFenceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700257 struct nulldrv_fence **fence_ret)
258{
259 struct nulldrv_fence *fence;
260
261 fence = (struct nulldrv_fence *) nulldrv_base_create(dev, sizeof(*fence),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600262 VK_OBJECT_TYPE_FENCE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700263 if (!fence)
Tony Barbour8205d902015-04-16 15:59:00 -0600264 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700265
266 *fence_ret = fence;
267
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600268 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700269}
270
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600271static struct nulldrv_dev *nulldrv_dev(VkDevice dev)
David Pinedo0257fbf2015-02-02 18:02:40 -0700272{
273 return (struct nulldrv_dev *) dev;
274}
275
276static struct nulldrv_img *nulldrv_img_from_base(struct nulldrv_base *base)
277{
278 return (struct nulldrv_img *) base;
279}
280
281
Tony Barbour426b9052015-06-24 16:06:58 -0600282static VkResult img_get_memory_requirements(struct nulldrv_base *base,
283 VkMemoryRequirements *pRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700284{
285 struct nulldrv_img *img = nulldrv_img_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600286 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700287
Tony Barbour426b9052015-06-24 16:06:58 -0600288 pRequirements->size = img->total_size;
289 pRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700290
291 return ret;
292}
293
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600294static VkResult nulldrv_img_create(struct nulldrv_dev *dev,
295 const VkImageCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700296 bool scanout,
297 struct nulldrv_img **img_ret)
298{
299 struct nulldrv_img *img;
300
301 img = (struct nulldrv_img *) nulldrv_base_create(dev, sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600302 VK_OBJECT_TYPE_IMAGE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700303 if (!img)
Tony Barbour8205d902015-04-16 15:59:00 -0600304 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700305
306 img->type = info->imageType;
307 img->depth = info->extent.depth;
308 img->mip_levels = info->mipLevels;
309 img->array_size = info->arraySize;
310 img->usage = info->usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700311 img->samples = info->samples;
312
Tony Barbour426b9052015-06-24 16:06:58 -0600313 img->obj.base.get_memory_requirements = img_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700314
315 *img_ret = img;
316
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600317 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700318}
319
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600320static struct nulldrv_img *nulldrv_img(VkImage image)
David Pinedo0257fbf2015-02-02 18:02:40 -0700321{
322 return (struct nulldrv_img *) image;
323}
324
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600325static VkResult nulldrv_mem_alloc(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600326 const VkMemoryAllocInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700327 struct nulldrv_mem **mem_ret)
328{
329 struct nulldrv_mem *mem;
330
331 mem = (struct nulldrv_mem *) nulldrv_base_create(dev, sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600332 VK_OBJECT_TYPE_DEVICE_MEMORY);
David Pinedo0257fbf2015-02-02 18:02:40 -0700333 if (!mem)
Tony Barbour8205d902015-04-16 15:59:00 -0600334 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700335
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700336 mem->bo = malloc(info->allocationSize);
David Pinedo0257fbf2015-02-02 18:02:40 -0700337 if (!mem->bo) {
Tony Barbour8205d902015-04-16 15:59:00 -0600338 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700339 }
340
341 mem->size = info->allocationSize;
342
343 *mem_ret = mem;
344
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600345 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700346}
347
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600348static VkResult nulldrv_ds_view_create(struct nulldrv_dev *dev,
349 const VkDepthStencilViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700350 struct nulldrv_ds_view **view_ret)
351{
352 struct nulldrv_img *img = nulldrv_img(info->image);
353 struct nulldrv_ds_view *view;
354
355 view = (struct nulldrv_ds_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600356 VK_OBJECT_TYPE_DEPTH_STENCIL_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700357 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600358 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700359
360 view->img = img;
361
362 view->array_size = info->arraySize;
363
364 *view_ret = view;
365
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600366 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700367}
368
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600369static VkResult nulldrv_sampler_create(struct nulldrv_dev *dev,
370 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700371 struct nulldrv_sampler **sampler_ret)
372{
373 struct nulldrv_sampler *sampler;
374
375 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600376 sizeof(*sampler), VK_OBJECT_TYPE_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700377 if (!sampler)
Tony Barbour8205d902015-04-16 15:59:00 -0600378 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700379
380 *sampler_ret = sampler;
381
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600382 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700383}
384
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600385static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
386 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700387 struct nulldrv_img_view **view_ret)
388{
389 struct nulldrv_img *img = nulldrv_img(info->image);
390 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700391
392 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600393 VK_OBJECT_TYPE_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700394 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600395 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700396
397 view->img = img;
David Pinedo0257fbf2015-02-02 18:02:40 -0700398
David Pinedo0257fbf2015-02-02 18:02:40 -0700399 view->cmd_len = 8;
400
401 *view_ret = view;
402
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600403 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700404}
405
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600406static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700407{
408 return mem->bo;
409}
410
Tony Barbour8205d902015-04-16 15:59:00 -0600411static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700412{
413 return (struct nulldrv_mem *) mem;
414}
415
416static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
417{
418 return (struct nulldrv_buf *) base;
419}
420
Tony Barbour426b9052015-06-24 16:06:58 -0600421static VkResult buf_get_memory_requirements(struct nulldrv_base *base,
422 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700423{
424 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
David Pinedo0257fbf2015-02-02 18:02:40 -0700425
Tony Barbour426b9052015-06-24 16:06:58 -0600426 if (pMemoryRequirements == NULL)
427 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700428
Tony Barbour426b9052015-06-24 16:06:58 -0600429 pMemoryRequirements->size = buf->size;
430 pMemoryRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700431
Tony Barbour426b9052015-06-24 16:06:58 -0600432 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700433}
434
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600435static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600436 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700437 struct nulldrv_buf **buf_ret)
438{
439 struct nulldrv_buf *buf;
440
441 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600442 VK_OBJECT_TYPE_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700443 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600444 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700445
446 buf->size = info->size;
447 buf->usage = info->usage;
448
Tony Barbour426b9052015-06-24 16:06:58 -0600449 buf->obj.base.get_memory_requirements = buf_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700450
451 *buf_ret = buf;
452
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600453 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700454}
455
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600456static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
457 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700458 struct nulldrv_desc_layout **layout_ret)
459{
460 struct nulldrv_desc_layout *layout;
461
462 layout = (struct nulldrv_desc_layout *)
463 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600464 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700465 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600466 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700467
468 *layout_ret = layout;
469
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600470 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700471}
472
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500473static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
474 const VkPipelineLayoutCreateInfo* pCreateInfo,
475 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800476{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500477 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800478
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500479 pipeline_layout = (struct nulldrv_pipeline_layout *)
480 nulldrv_base_create(dev, sizeof(*pipeline_layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600481 VK_OBJECT_TYPE_PIPELINE_LAYOUT);
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500482 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600483 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800484
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500485 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800486
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600487 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800488}
489
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600490static struct nulldrv_desc_layout *nulldrv_desc_layout(VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700491{
492 return (struct nulldrv_desc_layout *) layout;
493}
494
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600495static VkResult shader_create(struct nulldrv_dev *dev,
496 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700497 struct nulldrv_shader **sh_ret)
498{
David Pinedo0257fbf2015-02-02 18:02:40 -0700499 struct nulldrv_shader *sh;
500
501 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600502 VK_OBJECT_TYPE_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700503 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600504 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700505
506 *sh_ret = sh;
507
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600508 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700509}
510
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600511static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
512 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700513 struct nulldrv_pipeline **pipeline_ret)
514{
515 struct nulldrv_pipeline *pipeline;
516
517 pipeline = (struct nulldrv_pipeline *)
518 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600519 VK_OBJECT_TYPE_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700520 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600521 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700522
523 *pipeline_ret = pipeline;
524
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600525 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700526}
527
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600528static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
529 const VkDynamicVpStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700530 struct nulldrv_dynamic_vp **state_ret)
531{
532 struct nulldrv_dynamic_vp *state;
533
534 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600535 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_VP_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700536 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600537 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700538
539 *state_ret = state;
540
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600541 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700542}
543
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600544static VkResult nulldrv_raster_state_create(struct nulldrv_dev *dev,
545 const VkDynamicRsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700546 struct nulldrv_dynamic_rs **state_ret)
547{
548 struct nulldrv_dynamic_rs *state;
549
550 state = (struct nulldrv_dynamic_rs *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600551 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700552 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600553 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700554
555 *state_ret = state;
556
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600557 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700558}
559
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600560static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
561 const VkDynamicCbStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700562 struct nulldrv_dynamic_cb **state_ret)
563{
564 struct nulldrv_dynamic_cb *state;
565
566 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600567 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_CB_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700568 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600569 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700570
571 *state_ret = state;
572
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600573 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700574}
575
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600576static VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
577 const VkDynamicDsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700578 struct nulldrv_dynamic_ds **state_ret)
579{
580 struct nulldrv_dynamic_ds *state;
581
582 state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600583 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700584 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600585 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700586
587 *state_ret = state;
588
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600589 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700590}
591
592
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600593static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
594 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700595 struct nulldrv_cmd **cmd_ret)
596{
David Pinedo0257fbf2015-02-02 18:02:40 -0700597 struct nulldrv_cmd *cmd;
598
David Pinedo0257fbf2015-02-02 18:02:40 -0700599 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600600 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700601 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600602 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700603
604 *cmd_ret = cmd;
605
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600606 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700607}
608
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600609static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
610 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700611 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600612 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800613 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700614{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800615 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700616
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800617 pool = (struct nulldrv_desc_pool *)
618 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600619 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800620 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600621 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700622
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800623 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700624
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800625 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700626
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600627 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700628}
629
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600630static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800631 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600632 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700633 const struct nulldrv_desc_layout *layout,
634 struct nulldrv_desc_set **set_ret)
635{
636 struct nulldrv_desc_set *set;
637
638 set = (struct nulldrv_desc_set *)
639 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600640 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700641 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600642 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700643
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800644 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700645 set->layout = layout;
646 *set_ret = set;
647
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600648 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700649}
650
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600651static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700652{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800653 return (struct nulldrv_desc_pool *) pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700654}
655
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600656static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
657 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700658 struct nulldrv_framebuffer ** fb_ret)
659{
660
661 struct nulldrv_framebuffer *fb;
662 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600663 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700664 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600665 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700666
667 *fb_ret = fb;
668
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600669 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700670
671}
672
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600673static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
674 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700675 struct nulldrv_render_pass** rp_ret)
676{
677 struct nulldrv_render_pass *rp;
678 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600679 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700680 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600681 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700682
683 *rp_ret = rp;
684
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600685 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700686}
687
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600688static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700689{
690 return (struct nulldrv_buf *) buf;
691}
692
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600693static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600694 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700695 struct nulldrv_buf_view **view_ret)
696{
697 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
698 struct nulldrv_buf_view *view;
699
700 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600701 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700702 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600703 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700704
705 view->buf = buf;
706
707 *view_ret = view;
708
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600709 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700710}
711
David Pinedo0257fbf2015-02-02 18:02:40 -0700712
713//*********************************************
714// Driver entry points
715//*********************************************
716
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600717ICD_EXPORT VkResult VKAPI vkCreateBuffer(
718 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600719 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600720 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700721{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700722 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700723 struct nulldrv_dev *dev = nulldrv_dev(device);
724
725 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
726}
727
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600728ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
729 VkDevice device,
730 const VkCmdBufferCreateInfo* pCreateInfo,
731 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700732{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700733 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700734 struct nulldrv_dev *dev = nulldrv_dev(device);
735
736 return nulldrv_cmd_create(dev, pCreateInfo,
737 (struct nulldrv_cmd **) pCmdBuffer);
738}
739
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600740ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
741 VkCmdBuffer cmdBuffer,
742 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700743{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700744 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600745 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700746}
747
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600748ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
749 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700750{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700751 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600752 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700753}
754
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600755ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
756 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700757{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700758 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600759 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700760}
761
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600762ICD_EXPORT void VKAPI vkCmdInitAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600763 VkCmdBuffer cmdBuffer,
764 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700765 uint32_t startCounter,
766 uint32_t counterCount,
767 const uint32_t* pData)
768{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700769 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700770}
771
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600772ICD_EXPORT void VKAPI vkCmdLoadAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600773 VkCmdBuffer cmdBuffer,
774 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700775 uint32_t startCounter,
776 uint32_t counterCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600777 VkBuffer srcBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600778 VkDeviceSize srcOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700779{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700780 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700781}
782
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600783ICD_EXPORT void VKAPI vkCmdSaveAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600784 VkCmdBuffer cmdBuffer,
785 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700786 uint32_t startCounter,
787 uint32_t counterCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600788 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600789 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700790{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700791 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700792}
793
David Pinedo0257fbf2015-02-02 18:02:40 -0700794
Ian Elliott64a68e12015-04-16 11:57:46 -0600795static const VkFormat nulldrv_presentable_formats[] = {
796 VK_FORMAT_B8G8R8A8_UNORM,
797};
798
Jon Ashburnba4a1952015-06-16 12:44:51 -0600799#if 0
Ian Elliott64a68e12015-04-16 11:57:46 -0600800ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
801 VkDisplayWSI display,
802 VkDisplayInfoTypeWSI infoType,
803 size_t* pDataSize,
804 void* pData)
805{
806 VkResult ret = VK_SUCCESS;
807
808 NULLDRV_LOG_FUNC;
809
810 if (!pDataSize)
811 return VK_ERROR_INVALID_POINTER;
812
813 switch (infoType) {
814 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
815 {
816 VkDisplayFormatPropertiesWSI *dst = pData;
817 size_t size_ret;
818 uint32_t i;
819
820 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
821
822 if (dst && *pDataSize < size_ret)
823 return VK_ERROR_INVALID_VALUE;
824
825 *pDataSize = size_ret;
826 if (!dst)
827 return VK_SUCCESS;
828
829 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
830 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
831 }
832 break;
833 default:
834 ret = VK_ERROR_INVALID_VALUE;
835 break;
836 }
837
838 return ret;
839}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600840#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600841
842ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
843 VkDevice device,
844 const VkSwapChainCreateInfoWSI* pCreateInfo,
845 VkSwapChainWSI* pSwapChain)
846{
847 NULLDRV_LOG_FUNC;
848 struct nulldrv_dev *dev = nulldrv_dev(device);
849 struct nulldrv_swap_chain *sc;
850
851 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600852 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600853 if (!sc) {
854 return VK_ERROR_OUT_OF_HOST_MEMORY;
855 }
856 sc->dev = dev;
857
Tony Barbour11e76ac2015-04-20 16:28:46 -0600858 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600859
860 return VK_SUCCESS;
861}
862
863ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
864 VkSwapChainWSI swapChain)
865{
866 NULLDRV_LOG_FUNC;
867 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
868
869 free(sc);
870
871 return VK_SUCCESS;
872}
873
874ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
875 VkSwapChainWSI swapChain,
876 VkSwapChainInfoTypeWSI infoType,
877 size_t* pDataSize,
878 void* pData)
879{
880 NULLDRV_LOG_FUNC;
881 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
882 struct nulldrv_dev *dev = sc->dev;
883 VkResult ret = VK_SUCCESS;
884
885 if (!pDataSize)
886 return VK_ERROR_INVALID_POINTER;
887
888 switch (infoType) {
889 case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
890 {
891 VkSwapChainImageInfoWSI *images;
892 const size_t size = sizeof(*images) * 2;
893 uint32_t i;
894
895 if (pData && *pDataSize < size)
896 return VK_ERROR_INVALID_VALUE;
897
898 *pDataSize = size;
899 if (!pData)
900 return VK_SUCCESS;
901
902 images = (VkSwapChainImageInfoWSI *) pData;
903 for (i = 0; i < 2; i++) {
904 struct nulldrv_img *img;
905 struct nulldrv_mem *mem;
906
907 img = (struct nulldrv_img *) nulldrv_base_create(dev,
908 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600909 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600910 if (!img)
911 return VK_ERROR_OUT_OF_HOST_MEMORY;
912
913 mem = (struct nulldrv_mem *) nulldrv_base_create(dev,
914 sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600915 VK_OBJECT_TYPE_DEVICE_MEMORY);
Ian Elliott64a68e12015-04-16 11:57:46 -0600916 if (!mem)
917 return VK_ERROR_OUT_OF_HOST_MEMORY;
918
919 images[i].image = (VkImage) img;
920 images[i].memory = (VkDeviceMemory) mem;
921 }
922 }
923 break;
924 default:
925 ret = VK_ERROR_INVALID_VALUE;
926 break;
927 }
928
929 return ret;
930}
931
932ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
933 VkQueue queue_,
934 const VkPresentInfoWSI* pPresentInfo)
935{
936 NULLDRV_LOG_FUNC;
937
938 return VK_SUCCESS;
939}
940
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600941ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600942 VkCmdBuffer cmdBuffer,
943 VkBuffer srcBuffer,
944 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700945 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600946 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700947{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700948 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700949}
950
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600951ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600952 VkCmdBuffer cmdBuffer,
953 VkImage srcImage,
954 VkImageLayout srcImageLayout,
955 VkImage destImage,
956 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700957 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600958 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700959{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700960 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700961}
962
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600963ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600964 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500965 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600966 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500967 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600968 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500969 uint32_t regionCount,
970 const VkImageBlit* pRegions,
971 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600972{
973 NULLDRV_LOG_FUNC;
974}
975
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600976ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600977 VkCmdBuffer cmdBuffer,
978 VkBuffer srcBuffer,
979 VkImage destImage,
980 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700981 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600982 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700983{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700984 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700985}
986
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600987ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600988 VkCmdBuffer cmdBuffer,
989 VkImage srcImage,
990 VkImageLayout srcImageLayout,
991 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700992 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600993 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700994{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700995 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700996}
997
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600998ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600999 VkCmdBuffer cmdBuffer,
1000 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001001 VkDeviceSize destOffset,
1002 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001003 const uint32_t* pData)
1004{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001005 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001006}
1007
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001008ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001009 VkCmdBuffer cmdBuffer,
1010 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001011 VkDeviceSize destOffset,
1012 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001013 uint32_t data)
1014{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001015 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001016}
1017
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001018ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001019 VkCmdBuffer cmdBuffer,
1020 VkImage image,
1021 VkImageLayout imageLayout,
1022 const VkClearColor *pColor,
1023 uint32_t rangeCount,
1024 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001025{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001026 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001027}
1028
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001029ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001030 VkCmdBuffer cmdBuffer,
1031 VkImage image,
1032 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001033 float depth,
1034 uint32_t stencil,
1035 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001036 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001037{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001038 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001039}
1040
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001041ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001042 VkCmdBuffer cmdBuffer,
1043 VkImage srcImage,
1044 VkImageLayout srcImageLayout,
1045 VkImage destImage,
1046 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001047 uint32_t regionCount,
1048 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001049{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001050 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001051}
1052
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001053ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001054 VkCmdBuffer cmdBuffer,
1055 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001056 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001057 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001058{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001059 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001060}
1061
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001062ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001063 VkCmdBuffer cmdBuffer,
1064 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001065 uint32_t slot)
1066{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001067 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001068}
1069
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001070ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001071 VkCmdBuffer cmdBuffer,
1072 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001073 uint32_t startQuery,
1074 uint32_t queryCount)
1075{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001076 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001077}
1078
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001079ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001080 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001081 VkEvent event_,
1082 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001083{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001084 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001085}
1086
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001087ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001088 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001089 VkEvent event_,
1090 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001091{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001092 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001093}
1094
Ian Elliott63f1edb2015-04-16 18:10:19 -06001095ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1096 VkCmdBuffer cmdBuffer,
1097 VkQueryPool queryPool,
1098 uint32_t startQuery,
1099 uint32_t queryCount,
1100 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001101 VkDeviceSize destOffset,
1102 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001103 VkFlags flags)
1104{
1105 NULLDRV_LOG_FUNC;
1106}
1107
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001108ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001109 VkCmdBuffer cmdBuffer,
1110 VkTimestampType timestampType,
1111 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001112 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001113{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001114 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001115}
1116
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001117ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001118 VkCmdBuffer cmdBuffer,
1119 VkPipelineBindPoint pipelineBindPoint,
1120 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001121{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001122 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001123}
1124
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001125ICD_EXPORT void VKAPI vkCmdBindDynamicStateObject(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001126 VkCmdBuffer cmdBuffer,
1127 VkStateBindPoint stateBindPoint,
1128 VkDynamicStateObject state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001129{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001130 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001131}
1132
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001133ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001134 VkCmdBuffer cmdBuffer,
1135 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001136 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001137 uint32_t firstSet,
1138 uint32_t setCount,
1139 const VkDescriptorSet* pDescriptorSets,
1140 uint32_t dynamicOffsetCount,
1141 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001142{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001143 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001144}
1145
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001146ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1147 VkCmdBuffer cmdBuffer,
1148 uint32_t startBinding,
1149 uint32_t bindingCount,
1150 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001151 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001152{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001153 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001154}
1155
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001156ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001157 VkCmdBuffer cmdBuffer,
1158 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001159 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001160 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001161{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001162 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001163}
1164
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001165ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001166 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001167 uint32_t firstVertex,
1168 uint32_t vertexCount,
1169 uint32_t firstInstance,
1170 uint32_t instanceCount)
1171{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001172 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001173}
1174
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001175ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001176 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001177 uint32_t firstIndex,
1178 uint32_t indexCount,
1179 int32_t vertexOffset,
1180 uint32_t firstInstance,
1181 uint32_t instanceCount)
1182{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001183 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001184}
1185
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001186ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001187 VkCmdBuffer cmdBuffer,
1188 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001189 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001190 uint32_t count,
1191 uint32_t stride)
1192{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001193 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001194}
1195
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001196ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001197 VkCmdBuffer cmdBuffer,
1198 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001199 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001200 uint32_t count,
1201 uint32_t stride)
1202{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001203 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001204}
1205
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001206ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001207 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001208 uint32_t x,
1209 uint32_t y,
1210 uint32_t z)
1211{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001212 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001213}
1214
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001215ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001216 VkCmdBuffer cmdBuffer,
1217 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001218 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001219{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001220 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001221}
1222
Tony Barbour8205d902015-04-16 15:59:00 -06001223void VKAPI vkCmdWaitEvents(
1224 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001225 uint32_t eventCount,
1226 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001227 VkPipelineStageFlags sourceStageMask,
1228 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001229 uint32_t memBarrierCount,
1230 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001231{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001232 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001233}
1234
Tony Barbour8205d902015-04-16 15:59:00 -06001235void VKAPI vkCmdPipelineBarrier(
1236 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001237 VkPipelineStageFlags sourceStageMask,
1238 VkPipelineStageFlags destStageMask,
1239 bool32_t byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001240 uint32_t memBarrierCount,
1241 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001242{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001243 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001244}
1245
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001246ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001247 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001248 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001249 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001250{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001251 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001252 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1253 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1254}
1255
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001256ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1257 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001258{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001259 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001260 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001261}
1262
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001263ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1264 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001265 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001266 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001267 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001268{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001269 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001270 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001271 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001272 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001273}
1274
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001275ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1276 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001277{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001278 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001279 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001280}
1281
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001282ICD_EXPORT VkResult VKAPI vkCreateEvent(
1283 VkDevice device,
1284 const VkEventCreateInfo* pCreateInfo,
1285 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001286{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001287 NULLDRV_LOG_FUNC;
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 vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001292 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001293 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001294{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001295 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001296 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001297}
1298
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001299ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001300 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001301 VkEvent event_)
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
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001307ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001308 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001309 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001310{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001311 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001312 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001313}
1314
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001315ICD_EXPORT VkResult VKAPI vkCreateFence(
1316 VkDevice device,
1317 const VkFenceCreateInfo* pCreateInfo,
1318 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001319{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001320 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001321 struct nulldrv_dev *dev = nulldrv_dev(device);
1322
1323 return nulldrv_fence_create(dev, pCreateInfo,
1324 (struct nulldrv_fence **) pFence);
1325}
1326
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001327ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001328 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001329 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001330{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001331 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001332 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001333}
1334
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001335ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001336 VkDevice device,
1337 uint32_t fenceCount,
1338 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001339{
1340 NULLDRV_LOG_FUNC;
1341 return VK_SUCCESS;
1342}
1343
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001344ICD_EXPORT VkResult VKAPI vkWaitForFences(
1345 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001346 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001347 const VkFence* pFences,
David Pinedo0257fbf2015-02-02 18:02:40 -07001348 bool32_t waitAll,
1349 uint64_t timeout)
1350{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001351 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001352 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001353}
1354
Tony Barbour426b9052015-06-24 16:06:58 -06001355ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1356 VkPhysicalDevice gpu_,
1357 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001358{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001359 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001360 VkResult ret = VK_SUCCESS;
1361
Tony Barbour426b9052015-06-24 16:06:58 -06001362 pProperties->apiVersion = VK_API_VERSION;
1363 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1364 pProperties->vendorId = 0;
1365 pProperties->deviceId = 0;
1366 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1367 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Tony Barbour426b9052015-06-24 16:06:58 -06001368 pProperties->maxBoundDescriptorSets = 0;
1369 pProperties->maxThreadGroupSize = 0;
1370 pProperties->timestampFrequency = 0;
1371 pProperties->multiColorAttachmentClears = false;
Ian Elliott64a68e12015-04-16 11:57:46 -06001372
1373 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001374}
1375
Chris Forbesd7576302015-06-21 22:55:02 +12001376ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1377 VkPhysicalDevice physicalDevice,
1378 VkPhysicalDeviceFeatures* pFeatures)
1379{
1380 NULLDRV_LOG_FUNC;
1381 VkResult ret = VK_SUCCESS;
1382
1383 /* TODO: fill out features */
1384 memset(pFeatures, 0, sizeof(*pFeatures));
1385
1386 return ret;
1387}
1388
1389ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatInfo(
1390 VkPhysicalDevice physicalDevice,
1391 VkFormat format,
1392 VkFormatProperties* pFormatInfo)
1393{
1394 NULLDRV_LOG_FUNC;
1395 VkResult ret = VK_SUCCESS;
1396
1397 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1398 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1399
1400 return ret;
1401}
1402
1403ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1404 VkPhysicalDevice physicalDevice,
1405 VkPhysicalDeviceLimits* pLimits)
1406{
1407 NULLDRV_LOG_FUNC;
1408 VkResult ret = VK_SUCCESS;
1409
1410 /* TODO: fill out limits */
1411 memset(pLimits, 0, sizeof(*pLimits));
1412
1413 return ret;
1414}
1415
Tony Barbour426b9052015-06-24 16:06:58 -06001416ICD_EXPORT VkResult VKAPI vkGetPhysicalDevicePerformance(
1417 VkPhysicalDevice gpu_,
1418 VkPhysicalDevicePerformance* pPerformance)
Jon Ashburneb2728b2015-04-10 14:33:07 -06001419{
Tony Barbour426b9052015-06-24 16:06:58 -06001420 pPerformance->maxDeviceClock = 1.0f;
1421 pPerformance->aluPerClock = 1.0f;
1422 pPerformance->texPerClock = 1.0f;
1423 pPerformance->primsPerClock = 1.0f;
1424 pPerformance->pixelsPerClock = 1.0f;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001425
1426 return VK_SUCCESS;
1427}
1428
Tony Barbour426b9052015-06-24 16:06:58 -06001429ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueCount(
1430 VkPhysicalDevice gpu_,
1431 uint32_t* pCount)
David Pinedo0257fbf2015-02-02 18:02:40 -07001432{
Tony Barbour426b9052015-06-24 16:06:58 -06001433 *pCount = 1;
1434 return VK_SUCCESS;
1435}
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001436
Tony Barbour426b9052015-06-24 16:06:58 -06001437ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueProperties(
1438 VkPhysicalDevice gpu_,
1439 uint32_t count,
1440 VkPhysicalDeviceQueueProperties* pProperties)
1441 {
1442 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1443 pProperties->queueCount = 1;
1444 pProperties->maxAtomicCounters = 1;
1445 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001446
Tony Barbour426b9052015-06-24 16:06:58 -06001447 return VK_SUCCESS;
1448}
1449
1450ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
1451 uint32_t extensionIndex,
1452 VkExtensionProperties* pProperties)
1453{
1454 if (extensionIndex >= NULLDRV_EXT_COUNT)
1455 return VK_ERROR_INVALID_VALUE;
1456
1457 memcpy(pProperties, &intel_gpu_exts[extensionIndex], sizeof(VkExtensionProperties));
1458 return VK_SUCCESS;
1459}
1460
1461ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionCount(uint32_t *pCount)
1462{
1463 *pCount = NULLDRV_EXT_COUNT;
1464
1465 return VK_SUCCESS;
1466}
1467
1468VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
1469 VkPhysicalDevice gpu,
1470 uint32_t extesnionIndex,
1471 VkExtensionProperties* pProperties)
1472{
1473 return VK_ERROR_INVALID_EXTENSION;
1474}
1475
1476VkResult VKAPI vkGetPhysicalDeviceExtensionCount(
1477 VkPhysicalDevice gpu,
1478 uint32_t* pCount)
1479{
1480 *pCount = 0;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001481 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001482}
1483
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001484ICD_EXPORT VkResult VKAPI vkCreateImage(
1485 VkDevice device,
1486 const VkImageCreateInfo* pCreateInfo,
1487 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001488{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001489 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001490 struct nulldrv_dev *dev = nulldrv_dev(device);
1491
1492 return nulldrv_img_create(dev, pCreateInfo, false,
1493 (struct nulldrv_img **) pImage);
1494}
1495
Tony Barbour426b9052015-06-24 16:06:58 -06001496ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001497 VkDevice device,
1498 VkImage image,
1499 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001500 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001501{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001502 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001503
Tony Barbour426b9052015-06-24 16:06:58 -06001504 pLayout->offset = 0;
1505 pLayout->size = 1;
1506 pLayout->rowPitch = 4;
1507 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001508
Tony Barbour426b9052015-06-24 16:06:58 -06001509 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001510}
1511
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001512ICD_EXPORT VkResult VKAPI vkAllocMemory(
1513 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001514 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001515 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001516{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001517 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001518 struct nulldrv_dev *dev = nulldrv_dev(device);
1519
1520 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1521}
1522
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001523ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001524 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001525 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001526{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001527 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001528 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001529}
1530
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001531ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001532 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001533 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001534 VkDeviceSize offset,
1535 VkDeviceSize size,
1536 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001537 void** ppData)
1538{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001539 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001540 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1541 void *ptr = nulldrv_mem_map(mem, flags);
1542
1543 *ppData = ptr;
1544
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001545 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001546}
1547
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001548ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001549 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001550 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001551{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001552 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001553 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001554}
1555
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001556ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001557 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001558 uint32_t memRangeCount,
1559 const VkMappedMemoryRange* pMemRanges)
1560{
1561 NULLDRV_LOG_FUNC;
1562 return VK_SUCCESS;
1563}
1564
1565ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1566 VkDevice device,
1567 uint32_t memRangeCount,
1568 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001569{
1570 NULLDRV_LOG_FUNC;
1571 return VK_SUCCESS;
1572}
1573
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001574ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001575 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001576 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001577{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001578 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001579 struct nulldrv_instance *inst;
1580
1581 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001582 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001583 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001584 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001585
Tony Barbour426b9052015-06-24 16:06:58 -06001586 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001587
Mike Stroyan230e6252015-04-17 12:36:38 -06001588 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001589
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001590 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001591}
1592
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001593ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1594 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001595{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001596 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001597 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001598}
1599
Tony Barbour8205d902015-04-16 15:59:00 -06001600ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001601 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001602 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001603 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001604{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001605 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001606 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001607 struct nulldrv_gpu *gpu;
1608 *pGpuCount = 1;
1609 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001610 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001611 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001612 return ret;
1613}
1614
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001615ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001616 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001617 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001618 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001619 char* const* pOutLayers,
1620 void* pReserved)
1621{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001622 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001623 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001624}
1625
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001626ICD_EXPORT VkResult VKAPI vkDestroyObject(
Mike Stroyan230e6252015-04-17 12:36:38 -06001627 VkDevice device,
1628 VkObjectType objType,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001629 VkObject object)
David Pinedo0257fbf2015-02-02 18:02:40 -07001630{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001631 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001632 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001633}
1634
Tony Barbour426b9052015-06-24 16:06:58 -06001635ICD_EXPORT VkResult VKAPI vkGetObjectMemoryRequirements(
Mike Stroyan230e6252015-04-17 12:36:38 -06001636 VkDevice device,
1637 VkObjectType objType,
1638 VkObject object,
Tony Barbour426b9052015-06-24 16:06:58 -06001639 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -07001640{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001641 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001642 struct nulldrv_base *base = nulldrv_base(object);
1643
Tony Barbour426b9052015-06-24 16:06:58 -06001644 return base->get_memory_requirements(base, pMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -07001645}
1646
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001647ICD_EXPORT VkResult VKAPI vkBindObjectMemory(
1648 VkDevice device,
Mike Stroyan230e6252015-04-17 12:36:38 -06001649 VkObjectType objType,
1650 VkObject object,
Tony Barbour8205d902015-04-16 15:59:00 -06001651 VkDeviceMemory mem_,
1652 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001653{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001654 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001655 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001656}
1657
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001658ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001659 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001660 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001661 VkDeviceSize rangeOffset,
1662 VkDeviceSize rangeSize,
1663 VkDeviceMemory mem,
1664 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001665{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001666 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001667 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001668}
1669
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001670ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001671 VkQueue queue,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001672 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001673 const VkImageMemoryBindInfo* pBindInfo,
1674 VkDeviceMemory mem,
1675 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001676{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001677 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001678 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001679}
1680
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001681ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(
1682 VkDevice device,
1683 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1684 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001685{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001686 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001687 struct nulldrv_dev *dev = nulldrv_dev(device);
1688
1689 return graphics_pipeline_create(dev, pCreateInfo,
1690 (struct nulldrv_pipeline **) pPipeline);
1691}
1692
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001693ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(
1694 VkDevice device,
1695 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1696 VkPipeline basePipeline,
1697 VkPipeline* pPipeline)
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001698{
1699 NULLDRV_LOG_FUNC;
1700 struct nulldrv_dev *dev = nulldrv_dev(device);
1701
1702 return graphics_pipeline_create(dev, pCreateInfo,
1703 (struct nulldrv_pipeline **) pPipeline);
1704}
1705
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001706ICD_EXPORT VkResult VKAPI vkCreateComputePipeline(
1707 VkDevice device,
1708 const VkComputePipelineCreateInfo* pCreateInfo,
1709 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001710{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001711 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001712 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001713}
1714
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001715ICD_EXPORT VkResult VKAPI vkStorePipeline(
Mike Stroyan230e6252015-04-17 12:36:38 -06001716 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001717 VkPipeline pipeline,
David Pinedo0257fbf2015-02-02 18:02:40 -07001718 size_t* pDataSize,
1719 void* pData)
1720{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001721 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001722 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001723}
1724
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001725ICD_EXPORT VkResult VKAPI vkLoadPipeline(
1726 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001727 size_t dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001728 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001729 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001730{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001731 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001732 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001733}
1734
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001735ICD_EXPORT VkResult VKAPI vkLoadPipelineDerivative(
1736 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001737 size_t dataSize,
1738 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001739 VkPipeline basePipeline,
1740 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001741{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001742 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001743 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001744}
1745
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001746ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1747 VkDevice device,
1748 const VkQueryPoolCreateInfo* pCreateInfo,
1749 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001750{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001751 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001752 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001753}
1754
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001755ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001756 VkDevice device,
1757 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001758 uint32_t startQuery,
1759 uint32_t queryCount,
1760 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001761 void* pData,
1762 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001763{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001764 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001765 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001766}
1767
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001768ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1769 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001770{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001771 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001772 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001773}
1774
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001775ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1776 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001777 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001778 const VkCmdBuffer* pCmdBuffers,
1779 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001780{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001781 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001782 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001783}
1784
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001785ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1786 VkDevice device,
1787 const VkSemaphoreCreateInfo* pCreateInfo,
1788 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001789{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001790 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001791 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001792}
1793
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001794ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1795 VkQueue queue,
1796 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001797{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001798 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001799 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001800}
1801
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001802ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1803 VkQueue queue,
1804 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001805{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001806 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001807 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001808}
1809
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001810ICD_EXPORT VkResult VKAPI vkCreateSampler(
1811 VkDevice device,
1812 const VkSamplerCreateInfo* pCreateInfo,
1813 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07001814{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001815 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001816 struct nulldrv_dev *dev = nulldrv_dev(device);
1817
1818 return nulldrv_sampler_create(dev, pCreateInfo,
1819 (struct nulldrv_sampler **) pSampler);
1820}
1821
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001822ICD_EXPORT VkResult VKAPI vkCreateShader(
1823 VkDevice device,
1824 const VkShaderCreateInfo* pCreateInfo,
1825 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07001826{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001827 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001828 struct nulldrv_dev *dev = nulldrv_dev(device);
1829
1830 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
1831}
1832
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001833ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
1834 VkDevice device,
1835 const VkDynamicVpStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001836 VkDynamicVpState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001837{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001838 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001839 struct nulldrv_dev *dev = nulldrv_dev(device);
1840
1841 return nulldrv_viewport_state_create(dev, pCreateInfo,
1842 (struct nulldrv_dynamic_vp **) pState);
1843}
1844
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001845ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
1846 VkDevice device,
1847 const VkDynamicRsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001848 VkDynamicRsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001849{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001850 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001851 struct nulldrv_dev *dev = nulldrv_dev(device);
1852
1853 return nulldrv_raster_state_create(dev, pCreateInfo,
1854 (struct nulldrv_dynamic_rs **) pState);
1855}
1856
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001857ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
1858 VkDevice device,
1859 const VkDynamicCbStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001860 VkDynamicCbState* pState)
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 nulldrv_blend_state_create(dev, pCreateInfo,
1866 (struct nulldrv_dynamic_cb **) pState);
1867}
1868
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001869ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
1870 VkDevice device,
1871 const VkDynamicDsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001872 VkDynamicDsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001873{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001874 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001875 struct nulldrv_dev *dev = nulldrv_dev(device);
1876
1877 return nulldrv_ds_state_create(dev, pCreateInfo,
1878 (struct nulldrv_dynamic_ds **) pState);
1879}
1880
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001881ICD_EXPORT VkResult VKAPI vkCreateBufferView(
1882 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001883 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001884 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001885{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001886 NULLDRV_LOG_FUNC;
1887 struct nulldrv_dev *dev = nulldrv_dev(device);
1888
1889 return nulldrv_buf_view_create(dev, pCreateInfo,
1890 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07001891}
1892
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001893ICD_EXPORT VkResult VKAPI vkCreateImageView(
1894 VkDevice device,
1895 const VkImageViewCreateInfo* pCreateInfo,
1896 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001897{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001898 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001899 struct nulldrv_dev *dev = nulldrv_dev(device);
1900
1901 return nulldrv_img_view_create(dev, pCreateInfo,
1902 (struct nulldrv_img_view **) pView);
1903}
1904
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001905ICD_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
1906 VkDevice device,
1907 const VkColorAttachmentViewCreateInfo* pCreateInfo,
1908 VkColorAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001909{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001910 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001911 struct nulldrv_dev *dev = nulldrv_dev(device);
1912
1913 return nulldrv_rt_view_create(dev, pCreateInfo,
1914 (struct nulldrv_rt_view **) pView);
1915}
1916
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001917ICD_EXPORT VkResult VKAPI vkCreateDepthStencilView(
1918 VkDevice device,
1919 const VkDepthStencilViewCreateInfo* pCreateInfo,
1920 VkDepthStencilView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001921{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001922 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001923 struct nulldrv_dev *dev = nulldrv_dev(device);
1924
1925 return nulldrv_ds_view_create(dev, pCreateInfo,
1926 (struct nulldrv_ds_view **) pView);
1927
1928}
1929
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001930ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
1931 VkDevice device,
1932 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
1933 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001934{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001935 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001936 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07001937
Chia-I Wu7732cb22015-03-26 15:27:55 +08001938 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07001939 (struct nulldrv_desc_layout **) pSetLayout);
1940}
1941
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001942ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
1943 VkDevice device,
1944 const VkPipelineLayoutCreateInfo* pCreateInfo,
1945 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08001946{
1947 NULLDRV_LOG_FUNC;
1948 struct nulldrv_dev *dev = nulldrv_dev(device);
1949
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001950 return nulldrv_pipeline_layout_create(dev,
1951 pCreateInfo,
1952 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08001953}
1954
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001955ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
1956 VkDevice device,
1957 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07001958 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001959 const VkDescriptorPoolCreateInfo* pCreateInfo,
1960 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001961{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001962 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001963 struct nulldrv_dev *dev = nulldrv_dev(device);
1964
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001965 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
1966 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07001967}
1968
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001969ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06001970 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001971 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001972{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001973 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001974 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001975}
1976
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001977ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06001978 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001979 VkDescriptorPool descriptorPool,
1980 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07001981 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001982 const VkDescriptorSetLayout* pSetLayouts,
1983 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07001984 uint32_t* pCount)
1985{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001986 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001987 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
1988 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001989 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001990 uint32_t i;
1991
1992 for (i = 0; i < count; i++) {
1993 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001994 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07001995
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001996 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001997 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001998 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07001999 break;
2000 }
2001
2002 if (pCount)
2003 *pCount = i;
2004
2005 return ret;
2006}
2007
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002008ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2009 VkDevice device,
2010 uint32_t writeCount,
2011 const VkWriteDescriptorSet* pDescriptorWrites,
2012 uint32_t copyCount,
2013 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002014{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002015 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002016 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002017}
2018
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002019ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2020 VkDevice device,
2021 const VkFramebufferCreateInfo* info,
2022 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002023{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002024 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002025 struct nulldrv_dev *dev = nulldrv_dev(device);
2026
2027 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2028}
2029
2030
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002031ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2032 VkDevice device,
2033 const VkRenderPassCreateInfo* info,
2034 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002035{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002036 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002037 struct nulldrv_dev *dev = nulldrv_dev(device);
2038
2039 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2040}
2041
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002042ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002043 VkCmdBuffer cmdBuffer,
2044 const VkRenderPassBegin* pRenderPassBegin)
David Pinedo0257fbf2015-02-02 18:02:40 -07002045{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002046 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002047}
2048
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002049ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002050 VkCmdBuffer cmdBuffer,
2051 VkRenderPass renderPass)
David Pinedo0257fbf2015-02-02 18:02:40 -07002052{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002053 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002054}
Ian Elliottf93069f2015-02-19 14:26:19 -07002055
2056ICD_EXPORT void* xcbCreateWindow(
2057 uint16_t width,
2058 uint16_t height)
2059{
2060 static uint32_t window; // Kludge to the max
2061 NULLDRV_LOG_FUNC;
2062 return &window;
2063}
2064
2065// May not be needed, if we stub out stuf in tri.c
2066ICD_EXPORT void xcbDestroyWindow()
2067{
2068 NULLDRV_LOG_FUNC;
2069}
2070
2071ICD_EXPORT int xcbGetMessage(void *msg)
2072{
2073 NULLDRV_LOG_FUNC;
2074 return 0;
2075}
2076
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002077ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002078{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002079 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002080}