blob: 599e84c4701d542377060e03564476b23a970e36 [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;
398 view->min_lod = info->minLod;
399
David Pinedo0257fbf2015-02-02 18:02:40 -0700400 view->cmd_len = 8;
401
402 *view_ret = view;
403
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600404 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700405}
406
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600407static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700408{
409 return mem->bo;
410}
411
Tony Barbour8205d902015-04-16 15:59:00 -0600412static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700413{
414 return (struct nulldrv_mem *) mem;
415}
416
417static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
418{
419 return (struct nulldrv_buf *) base;
420}
421
Tony Barbour426b9052015-06-24 16:06:58 -0600422static VkResult buf_get_memory_requirements(struct nulldrv_base *base,
423 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700424{
425 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
David Pinedo0257fbf2015-02-02 18:02:40 -0700426
Tony Barbour426b9052015-06-24 16:06:58 -0600427 if (pMemoryRequirements == NULL)
428 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700429
Tony Barbour426b9052015-06-24 16:06:58 -0600430 pMemoryRequirements->size = buf->size;
431 pMemoryRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700432
Tony Barbour426b9052015-06-24 16:06:58 -0600433 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700434}
435
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600436static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600437 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700438 struct nulldrv_buf **buf_ret)
439{
440 struct nulldrv_buf *buf;
441
442 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600443 VK_OBJECT_TYPE_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700444 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600445 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700446
447 buf->size = info->size;
448 buf->usage = info->usage;
449
Tony Barbour426b9052015-06-24 16:06:58 -0600450 buf->obj.base.get_memory_requirements = buf_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700451
452 *buf_ret = buf;
453
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600454 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700455}
456
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600457static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
458 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700459 struct nulldrv_desc_layout **layout_ret)
460{
461 struct nulldrv_desc_layout *layout;
462
463 layout = (struct nulldrv_desc_layout *)
464 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600465 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700466 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600467 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700468
469 *layout_ret = layout;
470
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600471 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700472}
473
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500474static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
475 const VkPipelineLayoutCreateInfo* pCreateInfo,
476 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800477{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500478 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800479
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500480 pipeline_layout = (struct nulldrv_pipeline_layout *)
481 nulldrv_base_create(dev, sizeof(*pipeline_layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600482 VK_OBJECT_TYPE_PIPELINE_LAYOUT);
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500483 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600484 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800485
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500486 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800487
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600488 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800489}
490
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600491static struct nulldrv_desc_layout *nulldrv_desc_layout(VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700492{
493 return (struct nulldrv_desc_layout *) layout;
494}
495
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600496static VkResult shader_create(struct nulldrv_dev *dev,
497 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700498 struct nulldrv_shader **sh_ret)
499{
David Pinedo0257fbf2015-02-02 18:02:40 -0700500 struct nulldrv_shader *sh;
501
502 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600503 VK_OBJECT_TYPE_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700504 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600505 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700506
507 *sh_ret = sh;
508
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600509 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700510}
511
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600512static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
513 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700514 struct nulldrv_pipeline **pipeline_ret)
515{
516 struct nulldrv_pipeline *pipeline;
517
518 pipeline = (struct nulldrv_pipeline *)
519 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600520 VK_OBJECT_TYPE_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700521 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600522 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700523
524 *pipeline_ret = pipeline;
525
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600526 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700527}
528
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600529static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
530 const VkDynamicVpStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700531 struct nulldrv_dynamic_vp **state_ret)
532{
533 struct nulldrv_dynamic_vp *state;
534
535 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600536 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_VP_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700537 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600538 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700539
540 *state_ret = state;
541
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600542 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700543}
544
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600545static VkResult nulldrv_raster_state_create(struct nulldrv_dev *dev,
546 const VkDynamicRsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700547 struct nulldrv_dynamic_rs **state_ret)
548{
549 struct nulldrv_dynamic_rs *state;
550
551 state = (struct nulldrv_dynamic_rs *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600552 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700553 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600554 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700555
556 *state_ret = state;
557
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600558 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700559}
560
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600561static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
562 const VkDynamicCbStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700563 struct nulldrv_dynamic_cb **state_ret)
564{
565 struct nulldrv_dynamic_cb *state;
566
567 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600568 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_CB_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700569 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600570 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700571
572 *state_ret = state;
573
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600574 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700575}
576
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600577static VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
578 const VkDynamicDsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700579 struct nulldrv_dynamic_ds **state_ret)
580{
581 struct nulldrv_dynamic_ds *state;
582
583 state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600584 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700585 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600586 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700587
588 *state_ret = state;
589
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600590 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700591}
592
593
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600594static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
595 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700596 struct nulldrv_cmd **cmd_ret)
597{
David Pinedo0257fbf2015-02-02 18:02:40 -0700598 struct nulldrv_cmd *cmd;
599
David Pinedo0257fbf2015-02-02 18:02:40 -0700600 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600601 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700602 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600603 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700604
605 *cmd_ret = cmd;
606
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600607 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700608}
609
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600610static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
611 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700612 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600613 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800614 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700615{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800616 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700617
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800618 pool = (struct nulldrv_desc_pool *)
619 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600620 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800621 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600622 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700623
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800624 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700625
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800626 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700627
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600628 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700629}
630
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600631static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800632 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600633 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700634 const struct nulldrv_desc_layout *layout,
635 struct nulldrv_desc_set **set_ret)
636{
637 struct nulldrv_desc_set *set;
638
639 set = (struct nulldrv_desc_set *)
640 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600641 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700642 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600643 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700644
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800645 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700646 set->layout = layout;
647 *set_ret = set;
648
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600649 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700650}
651
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600652static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700653{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800654 return (struct nulldrv_desc_pool *) pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700655}
656
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600657static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
658 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700659 struct nulldrv_framebuffer ** fb_ret)
660{
661
662 struct nulldrv_framebuffer *fb;
663 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600664 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700665 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600666 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700667
668 *fb_ret = fb;
669
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600670 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700671
672}
673
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600674static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
675 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700676 struct nulldrv_render_pass** rp_ret)
677{
678 struct nulldrv_render_pass *rp;
679 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600680 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700681 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600682 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700683
684 *rp_ret = rp;
685
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600686 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700687}
688
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600689static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700690{
691 return (struct nulldrv_buf *) buf;
692}
693
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600694static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600695 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700696 struct nulldrv_buf_view **view_ret)
697{
698 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
699 struct nulldrv_buf_view *view;
700
701 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600702 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700703 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600704 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700705
706 view->buf = buf;
707
708 *view_ret = view;
709
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600710 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700711}
712
David Pinedo0257fbf2015-02-02 18:02:40 -0700713
714//*********************************************
715// Driver entry points
716//*********************************************
717
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600718ICD_EXPORT VkResult VKAPI vkCreateBuffer(
719 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600720 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600721 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700722{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700723 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700724 struct nulldrv_dev *dev = nulldrv_dev(device);
725
726 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
727}
728
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600729ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
730 VkDevice device,
731 const VkCmdBufferCreateInfo* pCreateInfo,
732 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700733{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700734 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700735 struct nulldrv_dev *dev = nulldrv_dev(device);
736
737 return nulldrv_cmd_create(dev, pCreateInfo,
738 (struct nulldrv_cmd **) pCmdBuffer);
739}
740
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600741ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
742 VkCmdBuffer cmdBuffer,
743 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700744{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700745 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600746 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700747}
748
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600749ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
750 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700751{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700752 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600753 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700754}
755
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600756ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
757 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700758{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700759 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600760 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700761}
762
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600763ICD_EXPORT void VKAPI vkCmdInitAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600764 VkCmdBuffer cmdBuffer,
765 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700766 uint32_t startCounter,
767 uint32_t counterCount,
768 const uint32_t* pData)
769{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700770 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700771}
772
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600773ICD_EXPORT void VKAPI vkCmdLoadAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600774 VkCmdBuffer cmdBuffer,
775 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700776 uint32_t startCounter,
777 uint32_t counterCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600778 VkBuffer srcBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600779 VkDeviceSize srcOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700780{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700781 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700782}
783
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600784ICD_EXPORT void VKAPI vkCmdSaveAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600785 VkCmdBuffer cmdBuffer,
786 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700787 uint32_t startCounter,
788 uint32_t counterCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600789 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600790 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700791{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700792 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700793}
794
David Pinedo0257fbf2015-02-02 18:02:40 -0700795
Ian Elliott64a68e12015-04-16 11:57:46 -0600796static const VkFormat nulldrv_presentable_formats[] = {
797 VK_FORMAT_B8G8R8A8_UNORM,
798};
799
Jon Ashburnba4a1952015-06-16 12:44:51 -0600800#if 0
Ian Elliott64a68e12015-04-16 11:57:46 -0600801ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
802 VkDisplayWSI display,
803 VkDisplayInfoTypeWSI infoType,
804 size_t* pDataSize,
805 void* pData)
806{
807 VkResult ret = VK_SUCCESS;
808
809 NULLDRV_LOG_FUNC;
810
811 if (!pDataSize)
812 return VK_ERROR_INVALID_POINTER;
813
814 switch (infoType) {
815 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
816 {
817 VkDisplayFormatPropertiesWSI *dst = pData;
818 size_t size_ret;
819 uint32_t i;
820
821 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
822
823 if (dst && *pDataSize < size_ret)
824 return VK_ERROR_INVALID_VALUE;
825
826 *pDataSize = size_ret;
827 if (!dst)
828 return VK_SUCCESS;
829
830 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
831 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
832 }
833 break;
834 default:
835 ret = VK_ERROR_INVALID_VALUE;
836 break;
837 }
838
839 return ret;
840}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600841#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600842
843ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
844 VkDevice device,
845 const VkSwapChainCreateInfoWSI* pCreateInfo,
846 VkSwapChainWSI* pSwapChain)
847{
848 NULLDRV_LOG_FUNC;
849 struct nulldrv_dev *dev = nulldrv_dev(device);
850 struct nulldrv_swap_chain *sc;
851
852 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600853 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600854 if (!sc) {
855 return VK_ERROR_OUT_OF_HOST_MEMORY;
856 }
857 sc->dev = dev;
858
Tony Barbour11e76ac2015-04-20 16:28:46 -0600859 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600860
861 return VK_SUCCESS;
862}
863
864ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
865 VkSwapChainWSI swapChain)
866{
867 NULLDRV_LOG_FUNC;
868 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
869
870 free(sc);
871
872 return VK_SUCCESS;
873}
874
875ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
876 VkSwapChainWSI swapChain,
877 VkSwapChainInfoTypeWSI infoType,
878 size_t* pDataSize,
879 void* pData)
880{
881 NULLDRV_LOG_FUNC;
882 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
883 struct nulldrv_dev *dev = sc->dev;
884 VkResult ret = VK_SUCCESS;
885
886 if (!pDataSize)
887 return VK_ERROR_INVALID_POINTER;
888
889 switch (infoType) {
890 case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
891 {
892 VkSwapChainImageInfoWSI *images;
893 const size_t size = sizeof(*images) * 2;
894 uint32_t i;
895
896 if (pData && *pDataSize < size)
897 return VK_ERROR_INVALID_VALUE;
898
899 *pDataSize = size;
900 if (!pData)
901 return VK_SUCCESS;
902
903 images = (VkSwapChainImageInfoWSI *) pData;
904 for (i = 0; i < 2; i++) {
905 struct nulldrv_img *img;
906 struct nulldrv_mem *mem;
907
908 img = (struct nulldrv_img *) nulldrv_base_create(dev,
909 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600910 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600911 if (!img)
912 return VK_ERROR_OUT_OF_HOST_MEMORY;
913
914 mem = (struct nulldrv_mem *) nulldrv_base_create(dev,
915 sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600916 VK_OBJECT_TYPE_DEVICE_MEMORY);
Ian Elliott64a68e12015-04-16 11:57:46 -0600917 if (!mem)
918 return VK_ERROR_OUT_OF_HOST_MEMORY;
919
920 images[i].image = (VkImage) img;
921 images[i].memory = (VkDeviceMemory) mem;
922 }
923 }
924 break;
925 default:
926 ret = VK_ERROR_INVALID_VALUE;
927 break;
928 }
929
930 return ret;
931}
932
933ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
934 VkQueue queue_,
935 const VkPresentInfoWSI* pPresentInfo)
936{
937 NULLDRV_LOG_FUNC;
938
939 return VK_SUCCESS;
940}
941
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600942ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600943 VkCmdBuffer cmdBuffer,
944 VkBuffer srcBuffer,
945 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700946 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600947 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700948{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700949 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700950}
951
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600952ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600953 VkCmdBuffer cmdBuffer,
954 VkImage srcImage,
955 VkImageLayout srcImageLayout,
956 VkImage destImage,
957 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700958 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600959 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700960{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700961 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700962}
963
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600964ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600965 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500966 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600967 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500968 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600969 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500970 uint32_t regionCount,
971 const VkImageBlit* pRegions,
972 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600973{
974 NULLDRV_LOG_FUNC;
975}
976
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600977ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600978 VkCmdBuffer cmdBuffer,
979 VkBuffer srcBuffer,
980 VkImage destImage,
981 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700982 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600983 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700984{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700985 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700986}
987
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600988ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600989 VkCmdBuffer cmdBuffer,
990 VkImage srcImage,
991 VkImageLayout srcImageLayout,
992 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700993 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600994 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700995{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700996 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700997}
998
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600999ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001000 VkCmdBuffer cmdBuffer,
1001 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001002 VkDeviceSize destOffset,
1003 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001004 const uint32_t* pData)
1005{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001006 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001007}
1008
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001009ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001010 VkCmdBuffer cmdBuffer,
1011 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001012 VkDeviceSize destOffset,
1013 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001014 uint32_t data)
1015{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001016 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001017}
1018
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001019ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001020 VkCmdBuffer cmdBuffer,
1021 VkImage image,
1022 VkImageLayout imageLayout,
1023 const VkClearColor *pColor,
1024 uint32_t rangeCount,
1025 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001026{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001027 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001028}
1029
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001030ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001031 VkCmdBuffer cmdBuffer,
1032 VkImage image,
1033 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001034 float depth,
1035 uint32_t stencil,
1036 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001037 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001038{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001039 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001040}
1041
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001042ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001043 VkCmdBuffer cmdBuffer,
1044 VkImage srcImage,
1045 VkImageLayout srcImageLayout,
1046 VkImage destImage,
1047 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001048 uint32_t regionCount,
1049 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001050{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001051 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001052}
1053
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001054ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001055 VkCmdBuffer cmdBuffer,
1056 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001057 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001058 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001059{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001060 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001061}
1062
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001063ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001064 VkCmdBuffer cmdBuffer,
1065 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001066 uint32_t slot)
1067{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001068 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001069}
1070
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001071ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001072 VkCmdBuffer cmdBuffer,
1073 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001074 uint32_t startQuery,
1075 uint32_t queryCount)
1076{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001077 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001078}
1079
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001080ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001081 VkCmdBuffer cmdBuffer,
1082 VkEvent event_,
1083 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001084{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001085 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001086}
1087
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001088ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001089 VkCmdBuffer cmdBuffer,
1090 VkEvent event_,
1091 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001092{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001093 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001094}
1095
Ian Elliott63f1edb2015-04-16 18:10:19 -06001096ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1097 VkCmdBuffer cmdBuffer,
1098 VkQueryPool queryPool,
1099 uint32_t startQuery,
1100 uint32_t queryCount,
1101 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001102 VkDeviceSize destOffset,
1103 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001104 VkFlags flags)
1105{
1106 NULLDRV_LOG_FUNC;
1107}
1108
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001109ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001110 VkCmdBuffer cmdBuffer,
1111 VkTimestampType timestampType,
1112 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001113 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001114{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001115 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001116}
1117
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001118ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001119 VkCmdBuffer cmdBuffer,
1120 VkPipelineBindPoint pipelineBindPoint,
1121 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001122{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001123 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001124}
1125
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001126ICD_EXPORT void VKAPI vkCmdBindDynamicStateObject(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001127 VkCmdBuffer cmdBuffer,
1128 VkStateBindPoint stateBindPoint,
1129 VkDynamicStateObject state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001130{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001131 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001132}
1133
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001134ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001135 VkCmdBuffer cmdBuffer,
1136 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001137 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001138 uint32_t firstSet,
1139 uint32_t setCount,
1140 const VkDescriptorSet* pDescriptorSets,
1141 uint32_t dynamicOffsetCount,
1142 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001143{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001144 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001145}
1146
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001147ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1148 VkCmdBuffer cmdBuffer,
1149 uint32_t startBinding,
1150 uint32_t bindingCount,
1151 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001152 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001153{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001154 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001155}
1156
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001157ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001158 VkCmdBuffer cmdBuffer,
1159 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001160 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001161 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001162{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001163 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001164}
1165
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001166ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001167 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001168 uint32_t firstVertex,
1169 uint32_t vertexCount,
1170 uint32_t firstInstance,
1171 uint32_t instanceCount)
1172{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001173 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001174}
1175
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001176ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001177 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001178 uint32_t firstIndex,
1179 uint32_t indexCount,
1180 int32_t vertexOffset,
1181 uint32_t firstInstance,
1182 uint32_t instanceCount)
1183{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001184 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001185}
1186
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001187ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001188 VkCmdBuffer cmdBuffer,
1189 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001190 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001191 uint32_t count,
1192 uint32_t stride)
1193{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001194 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001195}
1196
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001197ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001198 VkCmdBuffer cmdBuffer,
1199 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001200 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001201 uint32_t count,
1202 uint32_t stride)
1203{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001204 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001205}
1206
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001207ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001208 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001209 uint32_t x,
1210 uint32_t y,
1211 uint32_t z)
1212{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001213 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001214}
1215
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001216ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001217 VkCmdBuffer cmdBuffer,
1218 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001219 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001220{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001221 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001222}
1223
Tony Barbour8205d902015-04-16 15:59:00 -06001224void VKAPI vkCmdWaitEvents(
1225 VkCmdBuffer cmdBuffer,
1226 VkWaitEvent waitEvent,
1227 uint32_t eventCount,
1228 const VkEvent* pEvents,
1229 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,
1237 VkWaitEvent waitEvent,
1238 uint32_t pipeEventCount,
1239 const VkPipeEvent* pPipeEvents,
1240 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"));
1368 pProperties->maxInlineMemoryUpdateSize = 0;
1369 pProperties->maxBoundDescriptorSets = 0;
1370 pProperties->maxThreadGroupSize = 0;
1371 pProperties->timestampFrequency = 0;
1372 pProperties->multiColorAttachmentClears = false;
Ian Elliott64a68e12015-04-16 11:57:46 -06001373
1374 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001375}
1376
Chris Forbesd7576302015-06-21 22:55:02 +12001377ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1378 VkPhysicalDevice physicalDevice,
1379 VkPhysicalDeviceFeatures* pFeatures)
1380{
1381 NULLDRV_LOG_FUNC;
1382 VkResult ret = VK_SUCCESS;
1383
1384 /* TODO: fill out features */
1385 memset(pFeatures, 0, sizeof(*pFeatures));
1386
1387 return ret;
1388}
1389
1390ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatInfo(
1391 VkPhysicalDevice physicalDevice,
1392 VkFormat format,
1393 VkFormatProperties* pFormatInfo)
1394{
1395 NULLDRV_LOG_FUNC;
1396 VkResult ret = VK_SUCCESS;
1397
1398 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1399 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1400
1401 return ret;
1402}
1403
1404ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1405 VkPhysicalDevice physicalDevice,
1406 VkPhysicalDeviceLimits* pLimits)
1407{
1408 NULLDRV_LOG_FUNC;
1409 VkResult ret = VK_SUCCESS;
1410
1411 /* TODO: fill out limits */
1412 memset(pLimits, 0, sizeof(*pLimits));
1413
1414 return ret;
1415}
1416
Tony Barbour426b9052015-06-24 16:06:58 -06001417ICD_EXPORT VkResult VKAPI vkGetPhysicalDevicePerformance(
1418 VkPhysicalDevice gpu_,
1419 VkPhysicalDevicePerformance* pPerformance)
Jon Ashburneb2728b2015-04-10 14:33:07 -06001420{
Tony Barbour426b9052015-06-24 16:06:58 -06001421 pPerformance->maxDeviceClock = 1.0f;
1422 pPerformance->aluPerClock = 1.0f;
1423 pPerformance->texPerClock = 1.0f;
1424 pPerformance->primsPerClock = 1.0f;
1425 pPerformance->pixelsPerClock = 1.0f;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001426
1427 return VK_SUCCESS;
1428}
1429
Tony Barbour426b9052015-06-24 16:06:58 -06001430ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueCount(
1431 VkPhysicalDevice gpu_,
1432 uint32_t* pCount)
David Pinedo0257fbf2015-02-02 18:02:40 -07001433{
Tony Barbour426b9052015-06-24 16:06:58 -06001434 *pCount = 1;
1435 return VK_SUCCESS;
1436}
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001437
Tony Barbour426b9052015-06-24 16:06:58 -06001438ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueProperties(
1439 VkPhysicalDevice gpu_,
1440 uint32_t count,
1441 VkPhysicalDeviceQueueProperties* pProperties)
1442 {
1443 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1444 pProperties->queueCount = 1;
1445 pProperties->maxAtomicCounters = 1;
1446 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001447
Tony Barbour426b9052015-06-24 16:06:58 -06001448 return VK_SUCCESS;
1449}
1450
1451ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
1452 uint32_t extensionIndex,
1453 VkExtensionProperties* pProperties)
1454{
1455 if (extensionIndex >= NULLDRV_EXT_COUNT)
1456 return VK_ERROR_INVALID_VALUE;
1457
1458 memcpy(pProperties, &intel_gpu_exts[extensionIndex], sizeof(VkExtensionProperties));
1459 return VK_SUCCESS;
1460}
1461
1462ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionCount(uint32_t *pCount)
1463{
1464 *pCount = NULLDRV_EXT_COUNT;
1465
1466 return VK_SUCCESS;
1467}
1468
1469VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
1470 VkPhysicalDevice gpu,
1471 uint32_t extesnionIndex,
1472 VkExtensionProperties* pProperties)
1473{
1474 return VK_ERROR_INVALID_EXTENSION;
1475}
1476
1477VkResult VKAPI vkGetPhysicalDeviceExtensionCount(
1478 VkPhysicalDevice gpu,
1479 uint32_t* pCount)
1480{
1481 *pCount = 0;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001482 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001483}
1484
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001485ICD_EXPORT VkResult VKAPI vkCreateImage(
1486 VkDevice device,
1487 const VkImageCreateInfo* pCreateInfo,
1488 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001489{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001490 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001491 struct nulldrv_dev *dev = nulldrv_dev(device);
1492
1493 return nulldrv_img_create(dev, pCreateInfo, false,
1494 (struct nulldrv_img **) pImage);
1495}
1496
Tony Barbour426b9052015-06-24 16:06:58 -06001497ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001498 VkDevice device,
1499 VkImage image,
1500 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001501 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001502{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001503 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001504
Tony Barbour426b9052015-06-24 16:06:58 -06001505 pLayout->offset = 0;
1506 pLayout->size = 1;
1507 pLayout->rowPitch = 4;
1508 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001509
Tony Barbour426b9052015-06-24 16:06:58 -06001510 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001511}
1512
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001513ICD_EXPORT VkResult VKAPI vkAllocMemory(
1514 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001515 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001516 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001517{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001518 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001519 struct nulldrv_dev *dev = nulldrv_dev(device);
1520
1521 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1522}
1523
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001524ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001525 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001526 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001527{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001528 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001529 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001530}
1531
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001532ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001533 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001534 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001535 VkDeviceSize offset,
1536 VkDeviceSize size,
1537 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001538 void** ppData)
1539{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001540 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001541 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1542 void *ptr = nulldrv_mem_map(mem, flags);
1543
1544 *ppData = ptr;
1545
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001546 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001547}
1548
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001549ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001550 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001551 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001552{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001553 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001554 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001555}
1556
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001557ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001558 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001559 uint32_t memRangeCount,
1560 const VkMappedMemoryRange* pMemRanges)
1561{
1562 NULLDRV_LOG_FUNC;
1563 return VK_SUCCESS;
1564}
1565
1566ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1567 VkDevice device,
1568 uint32_t memRangeCount,
1569 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001570{
1571 NULLDRV_LOG_FUNC;
1572 return VK_SUCCESS;
1573}
1574
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001575ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001576 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001577 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001578{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001579 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001580 struct nulldrv_instance *inst;
1581
1582 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001583 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001584 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001585 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001586
Tony Barbour426b9052015-06-24 16:06:58 -06001587 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001588
Mike Stroyan230e6252015-04-17 12:36:38 -06001589 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001590
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001591 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001592}
1593
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001594ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1595 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001596{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001597 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001598 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001599}
1600
Tony Barbour8205d902015-04-16 15:59:00 -06001601ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001602 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001603 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001604 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001605{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001606 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001607 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001608 struct nulldrv_gpu *gpu;
1609 *pGpuCount = 1;
1610 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001611 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001612 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001613 return ret;
1614}
1615
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001616ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001617 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001618 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001619 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001620 char* const* pOutLayers,
1621 void* pReserved)
1622{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001623 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001624 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001625}
1626
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001627ICD_EXPORT VkResult VKAPI vkDestroyObject(
Mike Stroyan230e6252015-04-17 12:36:38 -06001628 VkDevice device,
1629 VkObjectType objType,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001630 VkObject object)
David Pinedo0257fbf2015-02-02 18:02:40 -07001631{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001632 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001633 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001634}
1635
Tony Barbour426b9052015-06-24 16:06:58 -06001636ICD_EXPORT VkResult VKAPI vkGetObjectMemoryRequirements(
Mike Stroyan230e6252015-04-17 12:36:38 -06001637 VkDevice device,
1638 VkObjectType objType,
1639 VkObject object,
Tony Barbour426b9052015-06-24 16:06:58 -06001640 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -07001641{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001642 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001643 struct nulldrv_base *base = nulldrv_base(object);
1644
Tony Barbour426b9052015-06-24 16:06:58 -06001645 return base->get_memory_requirements(base, pMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -07001646}
1647
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001648ICD_EXPORT VkResult VKAPI vkBindObjectMemory(
1649 VkDevice device,
Mike Stroyan230e6252015-04-17 12:36:38 -06001650 VkObjectType objType,
1651 VkObject object,
Tony Barbour8205d902015-04-16 15:59:00 -06001652 VkDeviceMemory mem_,
1653 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001654{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001655 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001656 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001657}
1658
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001659ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001660 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001661 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001662 VkDeviceSize rangeOffset,
1663 VkDeviceSize rangeSize,
1664 VkDeviceMemory mem,
1665 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001666{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001667 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001668 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001669}
1670
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001671ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001672 VkQueue queue,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001673 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001674 const VkImageMemoryBindInfo* pBindInfo,
1675 VkDeviceMemory mem,
1676 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001677{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001678 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001679 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001680}
1681
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001682ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(
1683 VkDevice device,
1684 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1685 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001686{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001687 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001688 struct nulldrv_dev *dev = nulldrv_dev(device);
1689
1690 return graphics_pipeline_create(dev, pCreateInfo,
1691 (struct nulldrv_pipeline **) pPipeline);
1692}
1693
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001694ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(
1695 VkDevice device,
1696 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1697 VkPipeline basePipeline,
1698 VkPipeline* pPipeline)
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001699{
1700 NULLDRV_LOG_FUNC;
1701 struct nulldrv_dev *dev = nulldrv_dev(device);
1702
1703 return graphics_pipeline_create(dev, pCreateInfo,
1704 (struct nulldrv_pipeline **) pPipeline);
1705}
1706
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001707ICD_EXPORT VkResult VKAPI vkCreateComputePipeline(
1708 VkDevice device,
1709 const VkComputePipelineCreateInfo* pCreateInfo,
1710 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001711{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001712 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001713 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001714}
1715
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001716ICD_EXPORT VkResult VKAPI vkStorePipeline(
Mike Stroyan230e6252015-04-17 12:36:38 -06001717 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001718 VkPipeline pipeline,
David Pinedo0257fbf2015-02-02 18:02:40 -07001719 size_t* pDataSize,
1720 void* pData)
1721{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001722 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001723 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001724}
1725
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001726ICD_EXPORT VkResult VKAPI vkLoadPipeline(
1727 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001728 size_t dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001729 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001730 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001731{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001732 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001733 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001734}
1735
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001736ICD_EXPORT VkResult VKAPI vkLoadPipelineDerivative(
1737 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001738 size_t dataSize,
1739 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001740 VkPipeline basePipeline,
1741 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001742{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001743 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001744 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001745}
1746
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001747ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1748 VkDevice device,
1749 const VkQueryPoolCreateInfo* pCreateInfo,
1750 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001751{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001752 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001753 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001754}
1755
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001756ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001757 VkDevice device,
1758 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001759 uint32_t startQuery,
1760 uint32_t queryCount,
1761 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001762 void* pData,
1763 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001764{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001765 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001766 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001767}
1768
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001769ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1770 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001771{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001772 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001773 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001774}
1775
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001776ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1777 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001778 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001779 const VkCmdBuffer* pCmdBuffers,
1780 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001781{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001782 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001783 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001784}
1785
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001786ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1787 VkDevice device,
1788 const VkSemaphoreCreateInfo* pCreateInfo,
1789 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001790{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001791 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001792 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001793}
1794
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001795ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1796 VkQueue queue,
1797 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001798{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001799 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001800 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001801}
1802
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001803ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1804 VkQueue queue,
1805 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001806{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001807 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001808 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001809}
1810
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001811ICD_EXPORT VkResult VKAPI vkCreateSampler(
1812 VkDevice device,
1813 const VkSamplerCreateInfo* pCreateInfo,
1814 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07001815{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001816 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001817 struct nulldrv_dev *dev = nulldrv_dev(device);
1818
1819 return nulldrv_sampler_create(dev, pCreateInfo,
1820 (struct nulldrv_sampler **) pSampler);
1821}
1822
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001823ICD_EXPORT VkResult VKAPI vkCreateShader(
1824 VkDevice device,
1825 const VkShaderCreateInfo* pCreateInfo,
1826 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07001827{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001828 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001829 struct nulldrv_dev *dev = nulldrv_dev(device);
1830
1831 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
1832}
1833
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001834ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
1835 VkDevice device,
1836 const VkDynamicVpStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001837 VkDynamicVpState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001838{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001839 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001840 struct nulldrv_dev *dev = nulldrv_dev(device);
1841
1842 return nulldrv_viewport_state_create(dev, pCreateInfo,
1843 (struct nulldrv_dynamic_vp **) pState);
1844}
1845
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001846ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
1847 VkDevice device,
1848 const VkDynamicRsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001849 VkDynamicRsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001850{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001851 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001852 struct nulldrv_dev *dev = nulldrv_dev(device);
1853
1854 return nulldrv_raster_state_create(dev, pCreateInfo,
1855 (struct nulldrv_dynamic_rs **) pState);
1856}
1857
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001858ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
1859 VkDevice device,
1860 const VkDynamicCbStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001861 VkDynamicCbState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001862{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001863 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001864 struct nulldrv_dev *dev = nulldrv_dev(device);
1865
1866 return nulldrv_blend_state_create(dev, pCreateInfo,
1867 (struct nulldrv_dynamic_cb **) pState);
1868}
1869
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001870ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
1871 VkDevice device,
1872 const VkDynamicDsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001873 VkDynamicDsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001874{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001875 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001876 struct nulldrv_dev *dev = nulldrv_dev(device);
1877
1878 return nulldrv_ds_state_create(dev, pCreateInfo,
1879 (struct nulldrv_dynamic_ds **) pState);
1880}
1881
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001882ICD_EXPORT VkResult VKAPI vkCreateBufferView(
1883 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001884 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001885 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001886{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001887 NULLDRV_LOG_FUNC;
1888 struct nulldrv_dev *dev = nulldrv_dev(device);
1889
1890 return nulldrv_buf_view_create(dev, pCreateInfo,
1891 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07001892}
1893
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001894ICD_EXPORT VkResult VKAPI vkCreateImageView(
1895 VkDevice device,
1896 const VkImageViewCreateInfo* pCreateInfo,
1897 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001898{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001899 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001900 struct nulldrv_dev *dev = nulldrv_dev(device);
1901
1902 return nulldrv_img_view_create(dev, pCreateInfo,
1903 (struct nulldrv_img_view **) pView);
1904}
1905
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001906ICD_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
1907 VkDevice device,
1908 const VkColorAttachmentViewCreateInfo* pCreateInfo,
1909 VkColorAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001910{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001911 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001912 struct nulldrv_dev *dev = nulldrv_dev(device);
1913
1914 return nulldrv_rt_view_create(dev, pCreateInfo,
1915 (struct nulldrv_rt_view **) pView);
1916}
1917
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001918ICD_EXPORT VkResult VKAPI vkCreateDepthStencilView(
1919 VkDevice device,
1920 const VkDepthStencilViewCreateInfo* pCreateInfo,
1921 VkDepthStencilView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001922{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001923 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001924 struct nulldrv_dev *dev = nulldrv_dev(device);
1925
1926 return nulldrv_ds_view_create(dev, pCreateInfo,
1927 (struct nulldrv_ds_view **) pView);
1928
1929}
1930
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001931ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
1932 VkDevice device,
1933 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
1934 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001935{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001936 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001937 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07001938
Chia-I Wu7732cb22015-03-26 15:27:55 +08001939 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07001940 (struct nulldrv_desc_layout **) pSetLayout);
1941}
1942
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001943ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
1944 VkDevice device,
1945 const VkPipelineLayoutCreateInfo* pCreateInfo,
1946 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08001947{
1948 NULLDRV_LOG_FUNC;
1949 struct nulldrv_dev *dev = nulldrv_dev(device);
1950
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001951 return nulldrv_pipeline_layout_create(dev,
1952 pCreateInfo,
1953 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08001954}
1955
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001956ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
1957 VkDevice device,
1958 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07001959 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001960 const VkDescriptorPoolCreateInfo* pCreateInfo,
1961 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001962{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001963 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001964 struct nulldrv_dev *dev = nulldrv_dev(device);
1965
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001966 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
1967 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07001968}
1969
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001970ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06001971 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001972 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001973{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001974 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001975 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001976}
1977
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001978ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06001979 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001980 VkDescriptorPool descriptorPool,
1981 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07001982 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001983 const VkDescriptorSetLayout* pSetLayouts,
1984 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07001985 uint32_t* pCount)
1986{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001987 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001988 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
1989 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001990 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001991 uint32_t i;
1992
1993 for (i = 0; i < count; i++) {
1994 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001995 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07001996
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001997 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001998 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001999 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002000 break;
2001 }
2002
2003 if (pCount)
2004 *pCount = i;
2005
2006 return ret;
2007}
2008
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002009ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2010 VkDevice device,
2011 uint32_t writeCount,
2012 const VkWriteDescriptorSet* pDescriptorWrites,
2013 uint32_t copyCount,
2014 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002015{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002016 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002017 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002018}
2019
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002020ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2021 VkDevice device,
2022 const VkFramebufferCreateInfo* info,
2023 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002024{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002025 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002026 struct nulldrv_dev *dev = nulldrv_dev(device);
2027
2028 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2029}
2030
2031
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002032ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2033 VkDevice device,
2034 const VkRenderPassCreateInfo* info,
2035 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002036{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002037 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002038 struct nulldrv_dev *dev = nulldrv_dev(device);
2039
2040 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2041}
2042
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002043ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002044 VkCmdBuffer cmdBuffer,
2045 const VkRenderPassBegin* pRenderPassBegin)
David Pinedo0257fbf2015-02-02 18:02:40 -07002046{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002047 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002048}
2049
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002050ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002051 VkCmdBuffer cmdBuffer,
2052 VkRenderPass renderPass)
David Pinedo0257fbf2015-02-02 18:02:40 -07002053{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002054 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002055}
Ian Elliottf93069f2015-02-19 14:26:19 -07002056
2057ICD_EXPORT void* xcbCreateWindow(
2058 uint16_t width,
2059 uint16_t height)
2060{
2061 static uint32_t window; // Kludge to the max
2062 NULLDRV_LOG_FUNC;
2063 return &window;
2064}
2065
2066// May not be needed, if we stub out stuf in tri.c
2067ICD_EXPORT void xcbDestroyWindow()
2068{
2069 NULLDRV_LOG_FUNC;
2070}
2071
2072ICD_EXPORT int xcbGetMessage(void *msg)
2073{
2074 NULLDRV_LOG_FUNC;
2075 return 0;
2076}
2077
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002078ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002079{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002080 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002081}