blob: c8382a00faadc31b096462fd251e81b00a6c8130 [file] [log] [blame]
David Pinedo0257fbf2015-02-02 18:02:40 -07001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan null driver
David Pinedo0257fbf2015-02-02 18:02:40 -07003 *
4 * Copyright (C) 2015 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 */
25
26#include "nulldrv.h"
David Pinedo8e9cb3b2015-02-10 15:02:08 -070027#include <stdio.h>
David Pinedo0257fbf2015-02-02 18:02:40 -070028
David Pinedo8e9cb3b2015-02-10 15:02:08 -070029#if 0
30#define NULLDRV_LOG_FUNC \
31 do { \
32 fflush(stdout); \
33 fflush(stderr); \
34 printf("null driver: %s\n", __FUNCTION__); \
35 fflush(stdout); \
36 } while (0)
37#else
38 #define NULLDRV_LOG_FUNC do { } while (0)
39#endif
40
41// The null driver supports all WSI extenstions ... for now ...
David Pinedo0257fbf2015-02-02 18:02:40 -070042static const char * const nulldrv_gpu_exts[NULLDRV_EXT_COUNT] = {
Jon Ashburncedc15f2015-05-21 18:13:33 -060043 [NULLDRV_EXT_WSI_LUNARG] = VK_WSI_LUNARG_EXTENSION_NAME,
David Pinedo0257fbf2015-02-02 18:02:40 -070044};
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060045static const VkExtensionProperties intel_gpu_exts[NULLDRV_EXT_COUNT] = {
46 {
47 .sType = VK_STRUCTURE_TYPE_EXTENSION_PROPERTIES,
48 .name = VK_WSI_LUNARG_EXTENSION_NAME,
49 .version = VK_WSI_LUNARG_REVISION,
50 .description = "Null driver",
51 }
52};
David Pinedo0257fbf2015-02-02 18:02:40 -070053
Mike Stroyan230e6252015-04-17 12:36:38 -060054static struct nulldrv_base *nulldrv_base(VkObject base)
David Pinedo0257fbf2015-02-02 18:02:40 -070055{
56 return (struct nulldrv_base *) base;
57}
58
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060059static struct nulldrv_base *nulldrv_base_create(
60 struct nulldrv_dev *dev,
61 size_t obj_size,
62 VkObjectType type)
David Pinedo0257fbf2015-02-02 18:02:40 -070063{
64 struct nulldrv_base *base;
65
66 if (!obj_size)
67 obj_size = sizeof(*base);
68
69 assert(obj_size >= sizeof(*base));
70
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060071 base = (struct nulldrv_base*)malloc(obj_size);
David Pinedo0257fbf2015-02-02 18:02:40 -070072 if (!base)
73 return NULL;
74
75 memset(base, 0, obj_size);
76
77 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbour11e76ac2015-04-20 16:28:46 -060078 set_loader_magic_value((VkObject) base);
David Pinedo0257fbf2015-02-02 18:02:40 -070079
80 if (dev == NULL) {
81 /*
82 * dev is NULL when we are creating the base device object
83 * Set dev now so that debug setup happens correctly
84 */
85 dev = (struct nulldrv_dev *) base;
86 }
87
88
Tony Barbour426b9052015-06-24 16:06:58 -060089 base->get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -070090
91 return base;
92}
93
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060094static VkResult nulldrv_gpu_add(int devid, const char *primary_node,
David Pinedo0257fbf2015-02-02 18:02:40 -070095 const char *render_node, struct nulldrv_gpu **gpu_ret)
96{
97 struct nulldrv_gpu *gpu;
98
Chia-I Wu493a1752015-02-22 14:40:25 +080099 gpu = malloc(sizeof(*gpu));
David Pinedo0257fbf2015-02-02 18:02:40 -0700100 if (!gpu)
Tony Barbour8205d902015-04-16 15:59:00 -0600101 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700102 memset(gpu, 0, sizeof(*gpu));
Mark Lobodzinski97dcd042015-04-16 08:52:00 -0500103
David Pinedo0257fbf2015-02-02 18:02:40 -0700104 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbour11e76ac2015-04-20 16:28:46 -0600105 set_loader_magic_value((VkObject) gpu);
David Pinedo0257fbf2015-02-02 18:02:40 -0700106
107 *gpu_ret = gpu;
108
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600109 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700110}
111
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600112static VkResult nulldrv_queue_create(struct nulldrv_dev *dev,
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700113 uint32_t node_index,
David Pinedo0257fbf2015-02-02 18:02:40 -0700114 struct nulldrv_queue **queue_ret)
115{
116 struct nulldrv_queue *queue;
117
118 queue = (struct nulldrv_queue *) nulldrv_base_create(dev, sizeof(*queue),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600119 VK_OBJECT_TYPE_QUEUE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700120 if (!queue)
Tony Barbour8205d902015-04-16 15:59:00 -0600121 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700122
123 queue->dev = dev;
124
125 *queue_ret = queue;
126
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600127 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700128}
129
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600130static VkResult dev_create_queues(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600131 const VkDeviceQueueCreateInfo *queues,
David Pinedo0257fbf2015-02-02 18:02:40 -0700132 uint32_t count)
133{
134 uint32_t i;
135
136 if (!count)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600137 return VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700138
139 for (i = 0; i < count; i++) {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600140 const VkDeviceQueueCreateInfo *q = &queues[i];
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600141 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700142
143 if (q->queueCount == 1 && !dev->queues[q->queueNodeIndex]) {
144 ret = nulldrv_queue_create(dev, q->queueNodeIndex,
145 &dev->queues[q->queueNodeIndex]);
146 }
147 else {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600148 ret = VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700149 }
150
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600151 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700152 return ret;
153 }
154 }
155
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600156 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700157}
158
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600159static enum nulldrv_ext_type nulldrv_gpu_lookup_extension(
160 const struct nulldrv_gpu *gpu,
161 const VkExtensionProperties *ext)
David Pinedo0257fbf2015-02-02 18:02:40 -0700162{
163 enum nulldrv_ext_type type;
164
165 for (type = 0; type < ARRAY_SIZE(nulldrv_gpu_exts); type++) {
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600166 if (memcmp(&nulldrv_gpu_exts[type], ext, sizeof(VkExtensionProperties)) == 0)
David Pinedo0257fbf2015-02-02 18:02:40 -0700167 break;
168 }
169
170 assert(type < NULLDRV_EXT_COUNT || type == NULLDRV_EXT_INVALID);
171
172 return type;
173}
174
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600175static VkResult nulldrv_desc_ooxx_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800176 struct nulldrv_desc_ooxx **ooxx_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700177{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800178 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700179
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800180 ooxx = malloc(sizeof(*ooxx));
181 if (!ooxx)
Tony Barbour8205d902015-04-16 15:59:00 -0600182 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700183
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800184 memset(ooxx, 0, sizeof(*ooxx));
David Pinedo0257fbf2015-02-02 18:02:40 -0700185
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800186 ooxx->surface_desc_size = 0;
187 ooxx->sampler_desc_size = 0;
David Pinedo0257fbf2015-02-02 18:02:40 -0700188
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800189 *ooxx_ret = ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700190
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600191 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700192}
193
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600194static VkResult nulldrv_dev_create(struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600195 const VkDeviceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700196 struct nulldrv_dev **dev_ret)
197{
198 struct nulldrv_dev *dev;
199 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600200 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -0700201
202 dev = (struct nulldrv_dev *) nulldrv_base_create(NULL, sizeof(*dev),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600203 VK_OBJECT_TYPE_DEVICE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700204 if (!dev)
Tony Barbour8205d902015-04-16 15:59:00 -0600205 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700206
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600207 for (i = 0; i < info->extensionCount; i++) {
208 const enum nulldrv_ext_type ext = nulldrv_gpu_lookup_extension(
209 gpu,
210 &info->pEnabledExtensions[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700211
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600212 if (ext == NULLDRV_EXT_INVALID)
213 return VK_ERROR_INVALID_EXTENSION;
David Pinedo0257fbf2015-02-02 18:02:40 -0700214
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600215 dev->exts[ext] = true;
216 }
David Pinedo0257fbf2015-02-02 18:02:40 -0700217
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800218 ret = nulldrv_desc_ooxx_create(dev, &dev->desc_ooxx);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600219 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700220 return ret;
221 }
222
223 ret = dev_create_queues(dev, info->pRequestedQueues,
224 info->queueRecordCount);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600225 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700226 return ret;
227 }
228
229 *dev_ret = dev;
230
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600231 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700232}
233
Tony Barbour8205d902015-04-16 15:59:00 -0600234static struct nulldrv_gpu *nulldrv_gpu(VkPhysicalDevice gpu)
David Pinedo0257fbf2015-02-02 18:02:40 -0700235{
236 return (struct nulldrv_gpu *) gpu;
237}
238
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600239static VkResult nulldrv_rt_view_create(struct nulldrv_dev *dev,
240 const VkColorAttachmentViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700241 struct nulldrv_rt_view **view_ret)
242{
243 struct nulldrv_rt_view *view;
244
245 view = (struct nulldrv_rt_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600246 VK_OBJECT_TYPE_COLOR_ATTACHMENT_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700247 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600248 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700249
250 *view_ret = view;
251
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600252 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700253}
254
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600255static VkResult nulldrv_fence_create(struct nulldrv_dev *dev,
256 const VkFenceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700257 struct nulldrv_fence **fence_ret)
258{
259 struct nulldrv_fence *fence;
260
261 fence = (struct nulldrv_fence *) nulldrv_base_create(dev, sizeof(*fence),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600262 VK_OBJECT_TYPE_FENCE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700263 if (!fence)
Tony Barbour8205d902015-04-16 15:59:00 -0600264 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700265
266 *fence_ret = fence;
267
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600268 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700269}
270
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600271static struct nulldrv_dev *nulldrv_dev(VkDevice dev)
David Pinedo0257fbf2015-02-02 18:02:40 -0700272{
273 return (struct nulldrv_dev *) dev;
274}
275
276static struct nulldrv_img *nulldrv_img_from_base(struct nulldrv_base *base)
277{
278 return (struct nulldrv_img *) base;
279}
280
281
Tony Barbour426b9052015-06-24 16:06:58 -0600282static VkResult img_get_memory_requirements(struct nulldrv_base *base,
283 VkMemoryRequirements *pRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700284{
285 struct nulldrv_img *img = nulldrv_img_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600286 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700287
Tony Barbour426b9052015-06-24 16:06:58 -0600288 pRequirements->size = img->total_size;
289 pRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700290
291 return ret;
292}
293
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600294static VkResult nulldrv_img_create(struct nulldrv_dev *dev,
295 const VkImageCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700296 bool scanout,
297 struct nulldrv_img **img_ret)
298{
299 struct nulldrv_img *img;
300
301 img = (struct nulldrv_img *) nulldrv_base_create(dev, sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600302 VK_OBJECT_TYPE_IMAGE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700303 if (!img)
Tony Barbour8205d902015-04-16 15:59:00 -0600304 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700305
306 img->type = info->imageType;
307 img->depth = info->extent.depth;
308 img->mip_levels = info->mipLevels;
309 img->array_size = info->arraySize;
310 img->usage = info->usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700311 img->samples = info->samples;
312
Tony Barbour426b9052015-06-24 16:06:58 -0600313 img->obj.base.get_memory_requirements = img_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700314
315 *img_ret = img;
316
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600317 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700318}
319
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600320static struct nulldrv_img *nulldrv_img(VkImage image)
David Pinedo0257fbf2015-02-02 18:02:40 -0700321{
322 return (struct nulldrv_img *) image;
323}
324
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600325static VkResult nulldrv_mem_alloc(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600326 const VkMemoryAllocInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700327 struct nulldrv_mem **mem_ret)
328{
329 struct nulldrv_mem *mem;
330
331 mem = (struct nulldrv_mem *) nulldrv_base_create(dev, sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600332 VK_OBJECT_TYPE_DEVICE_MEMORY);
David Pinedo0257fbf2015-02-02 18:02:40 -0700333 if (!mem)
Tony Barbour8205d902015-04-16 15:59:00 -0600334 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700335
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700336 mem->bo = malloc(info->allocationSize);
David Pinedo0257fbf2015-02-02 18:02:40 -0700337 if (!mem->bo) {
Tony Barbour8205d902015-04-16 15:59:00 -0600338 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700339 }
340
341 mem->size = info->allocationSize;
342
343 *mem_ret = mem;
344
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600345 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700346}
347
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600348static VkResult nulldrv_ds_view_create(struct nulldrv_dev *dev,
349 const VkDepthStencilViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700350 struct nulldrv_ds_view **view_ret)
351{
352 struct nulldrv_img *img = nulldrv_img(info->image);
353 struct nulldrv_ds_view *view;
354
355 view = (struct nulldrv_ds_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600356 VK_OBJECT_TYPE_DEPTH_STENCIL_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700357 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600358 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700359
360 view->img = img;
361
362 view->array_size = info->arraySize;
363
364 *view_ret = view;
365
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600366 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700367}
368
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600369static VkResult nulldrv_sampler_create(struct nulldrv_dev *dev,
370 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700371 struct nulldrv_sampler **sampler_ret)
372{
373 struct nulldrv_sampler *sampler;
374
375 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600376 sizeof(*sampler), VK_OBJECT_TYPE_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700377 if (!sampler)
Tony Barbour8205d902015-04-16 15:59:00 -0600378 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700379
380 *sampler_ret = sampler;
381
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600382 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700383}
384
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600385static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
386 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700387 struct nulldrv_img_view **view_ret)
388{
389 struct nulldrv_img *img = nulldrv_img(info->image);
390 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700391
392 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600393 VK_OBJECT_TYPE_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700394 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600395 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700396
397 view->img = img;
David Pinedo0257fbf2015-02-02 18:02:40 -0700398
David Pinedo0257fbf2015-02-02 18:02:40 -0700399 view->cmd_len = 8;
400
401 *view_ret = view;
402
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600403 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700404}
405
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600406static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700407{
408 return mem->bo;
409}
410
Tony Barbour8205d902015-04-16 15:59:00 -0600411static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700412{
413 return (struct nulldrv_mem *) mem;
414}
415
416static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
417{
418 return (struct nulldrv_buf *) base;
419}
420
Tony Barbour426b9052015-06-24 16:06:58 -0600421static VkResult buf_get_memory_requirements(struct nulldrv_base *base,
422 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700423{
424 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
David Pinedo0257fbf2015-02-02 18:02:40 -0700425
Tony Barbour426b9052015-06-24 16:06:58 -0600426 if (pMemoryRequirements == NULL)
427 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700428
Tony Barbour426b9052015-06-24 16:06:58 -0600429 pMemoryRequirements->size = buf->size;
430 pMemoryRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700431
Tony Barbour426b9052015-06-24 16:06:58 -0600432 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700433}
434
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600435static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600436 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700437 struct nulldrv_buf **buf_ret)
438{
439 struct nulldrv_buf *buf;
440
441 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600442 VK_OBJECT_TYPE_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700443 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600444 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700445
446 buf->size = info->size;
447 buf->usage = info->usage;
448
Tony Barbour426b9052015-06-24 16:06:58 -0600449 buf->obj.base.get_memory_requirements = buf_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700450
451 *buf_ret = buf;
452
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600453 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700454}
455
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600456static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
457 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700458 struct nulldrv_desc_layout **layout_ret)
459{
460 struct nulldrv_desc_layout *layout;
461
462 layout = (struct nulldrv_desc_layout *)
463 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600464 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700465 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600466 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700467
468 *layout_ret = layout;
469
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600470 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700471}
472
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500473static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
474 const VkPipelineLayoutCreateInfo* pCreateInfo,
475 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800476{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500477 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800478
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500479 pipeline_layout = (struct nulldrv_pipeline_layout *)
480 nulldrv_base_create(dev, sizeof(*pipeline_layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600481 VK_OBJECT_TYPE_PIPELINE_LAYOUT);
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500482 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600483 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800484
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500485 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800486
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600487 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800488}
489
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600490static struct nulldrv_desc_layout *nulldrv_desc_layout(VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700491{
492 return (struct nulldrv_desc_layout *) layout;
493}
494
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600495static VkResult shader_create(struct nulldrv_dev *dev,
496 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700497 struct nulldrv_shader **sh_ret)
498{
David Pinedo0257fbf2015-02-02 18:02:40 -0700499 struct nulldrv_shader *sh;
500
501 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600502 VK_OBJECT_TYPE_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700503 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600504 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700505
506 *sh_ret = sh;
507
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600508 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700509}
510
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600511static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
512 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700513 struct nulldrv_pipeline **pipeline_ret)
514{
515 struct nulldrv_pipeline *pipeline;
516
517 pipeline = (struct nulldrv_pipeline *)
518 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600519 VK_OBJECT_TYPE_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700520 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600521 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700522
523 *pipeline_ret = pipeline;
524
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600525 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700526}
527
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600528static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
529 const VkDynamicVpStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700530 struct nulldrv_dynamic_vp **state_ret)
531{
532 struct nulldrv_dynamic_vp *state;
533
534 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600535 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_VP_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700536 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600537 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700538
539 *state_ret = state;
540
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600541 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700542}
543
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600544static VkResult nulldrv_raster_state_create(struct nulldrv_dev *dev,
545 const VkDynamicRsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700546 struct nulldrv_dynamic_rs **state_ret)
547{
548 struct nulldrv_dynamic_rs *state;
549
550 state = (struct nulldrv_dynamic_rs *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600551 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700552 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600553 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700554
555 *state_ret = state;
556
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600557 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700558}
559
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600560static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
561 const VkDynamicCbStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700562 struct nulldrv_dynamic_cb **state_ret)
563{
564 struct nulldrv_dynamic_cb *state;
565
566 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600567 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_CB_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700568 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600569 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700570
571 *state_ret = state;
572
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600573 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700574}
575
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600576static VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
577 const VkDynamicDsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700578 struct nulldrv_dynamic_ds **state_ret)
579{
580 struct nulldrv_dynamic_ds *state;
581
582 state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600583 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700584 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600585 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700586
587 *state_ret = state;
588
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600589 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700590}
591
592
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600593static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
594 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700595 struct nulldrv_cmd **cmd_ret)
596{
David Pinedo0257fbf2015-02-02 18:02:40 -0700597 struct nulldrv_cmd *cmd;
598
David Pinedo0257fbf2015-02-02 18:02:40 -0700599 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600600 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700601 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600602 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700603
604 *cmd_ret = cmd;
605
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600606 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700607}
608
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600609static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
610 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700611 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600612 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800613 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700614{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800615 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700616
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800617 pool = (struct nulldrv_desc_pool *)
618 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600619 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800620 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600621 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700622
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800623 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700624
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800625 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700626
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600627 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700628}
629
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600630static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800631 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600632 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700633 const struct nulldrv_desc_layout *layout,
634 struct nulldrv_desc_set **set_ret)
635{
636 struct nulldrv_desc_set *set;
637
638 set = (struct nulldrv_desc_set *)
639 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600640 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700641 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600642 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700643
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800644 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700645 set->layout = layout;
646 *set_ret = set;
647
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600648 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700649}
650
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600651static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700652{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800653 return (struct nulldrv_desc_pool *) pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700654}
655
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600656static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
657 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700658 struct nulldrv_framebuffer ** fb_ret)
659{
660
661 struct nulldrv_framebuffer *fb;
662 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600663 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700664 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600665 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700666
667 *fb_ret = fb;
668
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600669 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700670
671}
672
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600673static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
674 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700675 struct nulldrv_render_pass** rp_ret)
676{
677 struct nulldrv_render_pass *rp;
678 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600679 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700680 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600681 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700682
683 *rp_ret = rp;
684
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600685 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700686}
687
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600688static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700689{
690 return (struct nulldrv_buf *) buf;
691}
692
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600693static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600694 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700695 struct nulldrv_buf_view **view_ret)
696{
697 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
698 struct nulldrv_buf_view *view;
699
700 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600701 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700702 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600703 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700704
705 view->buf = buf;
706
707 *view_ret = view;
708
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600709 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700710}
711
David Pinedo0257fbf2015-02-02 18:02:40 -0700712
713//*********************************************
714// Driver entry points
715//*********************************************
716
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600717ICD_EXPORT VkResult VKAPI vkCreateBuffer(
718 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600719 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600720 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700721{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700722 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700723 struct nulldrv_dev *dev = nulldrv_dev(device);
724
725 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
726}
727
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600728ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
729 VkDevice device,
730 const VkCmdBufferCreateInfo* pCreateInfo,
731 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700732{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700733 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700734 struct nulldrv_dev *dev = nulldrv_dev(device);
735
736 return nulldrv_cmd_create(dev, pCreateInfo,
737 (struct nulldrv_cmd **) pCmdBuffer);
738}
739
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600740ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
741 VkCmdBuffer cmdBuffer,
742 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700743{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700744 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600745 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700746}
747
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600748ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
749 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700750{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700751 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600752 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700753}
754
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600755ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
756 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700757{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700758 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600759 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700760}
761
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600762ICD_EXPORT void VKAPI vkCmdInitAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600763 VkCmdBuffer cmdBuffer,
764 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700765 uint32_t startCounter,
766 uint32_t counterCount,
767 const uint32_t* pData)
768{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700769 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700770}
771
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600772ICD_EXPORT void VKAPI vkCmdLoadAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600773 VkCmdBuffer cmdBuffer,
774 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700775 uint32_t startCounter,
776 uint32_t counterCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600777 VkBuffer srcBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600778 VkDeviceSize srcOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700779{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700780 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700781}
782
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600783ICD_EXPORT void VKAPI vkCmdSaveAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600784 VkCmdBuffer cmdBuffer,
785 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700786 uint32_t startCounter,
787 uint32_t counterCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600788 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600789 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700790{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700791 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700792}
793
David Pinedo0257fbf2015-02-02 18:02:40 -0700794
Ian Elliott64a68e12015-04-16 11:57:46 -0600795static const VkFormat nulldrv_presentable_formats[] = {
796 VK_FORMAT_B8G8R8A8_UNORM,
797};
798
Jon Ashburnba4a1952015-06-16 12:44:51 -0600799#if 0
Ian Elliott64a68e12015-04-16 11:57:46 -0600800ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
801 VkDisplayWSI display,
802 VkDisplayInfoTypeWSI infoType,
803 size_t* pDataSize,
804 void* pData)
805{
806 VkResult ret = VK_SUCCESS;
807
808 NULLDRV_LOG_FUNC;
809
810 if (!pDataSize)
811 return VK_ERROR_INVALID_POINTER;
812
813 switch (infoType) {
814 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
815 {
816 VkDisplayFormatPropertiesWSI *dst = pData;
817 size_t size_ret;
818 uint32_t i;
819
820 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
821
822 if (dst && *pDataSize < size_ret)
823 return VK_ERROR_INVALID_VALUE;
824
825 *pDataSize = size_ret;
826 if (!dst)
827 return VK_SUCCESS;
828
829 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
830 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
831 }
832 break;
833 default:
834 ret = VK_ERROR_INVALID_VALUE;
835 break;
836 }
837
838 return ret;
839}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600840#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600841
842ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
843 VkDevice device,
844 const VkSwapChainCreateInfoWSI* pCreateInfo,
845 VkSwapChainWSI* pSwapChain)
846{
847 NULLDRV_LOG_FUNC;
848 struct nulldrv_dev *dev = nulldrv_dev(device);
849 struct nulldrv_swap_chain *sc;
850
851 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600852 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600853 if (!sc) {
854 return VK_ERROR_OUT_OF_HOST_MEMORY;
855 }
856 sc->dev = dev;
857
Tony Barbour11e76ac2015-04-20 16:28:46 -0600858 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600859
860 return VK_SUCCESS;
861}
862
863ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
864 VkSwapChainWSI swapChain)
865{
866 NULLDRV_LOG_FUNC;
867 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
868
869 free(sc);
870
871 return VK_SUCCESS;
872}
873
874ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
875 VkSwapChainWSI swapChain,
876 VkSwapChainInfoTypeWSI infoType,
877 size_t* pDataSize,
878 void* pData)
879{
880 NULLDRV_LOG_FUNC;
881 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
882 struct nulldrv_dev *dev = sc->dev;
883 VkResult ret = VK_SUCCESS;
884
885 if (!pDataSize)
886 return VK_ERROR_INVALID_POINTER;
887
888 switch (infoType) {
889 case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
890 {
891 VkSwapChainImageInfoWSI *images;
892 const size_t size = sizeof(*images) * 2;
893 uint32_t i;
894
895 if (pData && *pDataSize < size)
896 return VK_ERROR_INVALID_VALUE;
897
898 *pDataSize = size;
899 if (!pData)
900 return VK_SUCCESS;
901
902 images = (VkSwapChainImageInfoWSI *) pData;
903 for (i = 0; i < 2; i++) {
904 struct nulldrv_img *img;
905 struct nulldrv_mem *mem;
906
907 img = (struct nulldrv_img *) nulldrv_base_create(dev,
908 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600909 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600910 if (!img)
911 return VK_ERROR_OUT_OF_HOST_MEMORY;
912
913 mem = (struct nulldrv_mem *) nulldrv_base_create(dev,
914 sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600915 VK_OBJECT_TYPE_DEVICE_MEMORY);
Ian Elliott64a68e12015-04-16 11:57:46 -0600916 if (!mem)
917 return VK_ERROR_OUT_OF_HOST_MEMORY;
918
919 images[i].image = (VkImage) img;
920 images[i].memory = (VkDeviceMemory) mem;
921 }
922 }
923 break;
924 default:
925 ret = VK_ERROR_INVALID_VALUE;
926 break;
927 }
928
929 return ret;
930}
931
932ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
933 VkQueue queue_,
934 const VkPresentInfoWSI* pPresentInfo)
935{
936 NULLDRV_LOG_FUNC;
937
938 return VK_SUCCESS;
939}
940
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600941ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600942 VkCmdBuffer cmdBuffer,
943 VkBuffer srcBuffer,
944 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700945 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600946 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700947{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700948 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700949}
950
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600951ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600952 VkCmdBuffer cmdBuffer,
953 VkImage srcImage,
954 VkImageLayout srcImageLayout,
955 VkImage destImage,
956 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700957 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600958 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700959{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700960 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700961}
962
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600963ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600964 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500965 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600966 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500967 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600968 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500969 uint32_t regionCount,
970 const VkImageBlit* pRegions,
971 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600972{
973 NULLDRV_LOG_FUNC;
974}
975
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600976ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600977 VkCmdBuffer cmdBuffer,
978 VkBuffer srcBuffer,
979 VkImage destImage,
980 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700981 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600982 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700983{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700984 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700985}
986
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600987ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600988 VkCmdBuffer cmdBuffer,
989 VkImage srcImage,
990 VkImageLayout srcImageLayout,
991 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700992 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600993 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700994{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700995 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700996}
997
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600998ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600999 VkCmdBuffer cmdBuffer,
1000 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001001 VkDeviceSize destOffset,
1002 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001003 const uint32_t* pData)
1004{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001005 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001006}
1007
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001008ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001009 VkCmdBuffer cmdBuffer,
1010 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001011 VkDeviceSize destOffset,
1012 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001013 uint32_t data)
1014{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001015 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001016}
1017
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001018ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001019 VkCmdBuffer cmdBuffer,
1020 VkImage image,
1021 VkImageLayout imageLayout,
1022 const VkClearColor *pColor,
1023 uint32_t rangeCount,
1024 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001025{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001026 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001027}
1028
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001029ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001030 VkCmdBuffer cmdBuffer,
1031 VkImage image,
1032 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001033 float depth,
1034 uint32_t stencil,
1035 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001036 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001037{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001038 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001039}
1040
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001041ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001042 VkCmdBuffer cmdBuffer,
1043 VkImage srcImage,
1044 VkImageLayout srcImageLayout,
1045 VkImage destImage,
1046 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001047 uint32_t regionCount,
1048 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001049{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001050 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001051}
1052
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001053ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001054 VkCmdBuffer cmdBuffer,
1055 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001056 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001057 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001058{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001059 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001060}
1061
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001062ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001063 VkCmdBuffer cmdBuffer,
1064 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001065 uint32_t slot)
1066{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001067 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001068}
1069
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001070ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001071 VkCmdBuffer cmdBuffer,
1072 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001073 uint32_t startQuery,
1074 uint32_t queryCount)
1075{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001076 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001077}
1078
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001079ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001080 VkCmdBuffer cmdBuffer,
1081 VkEvent event_,
1082 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001083{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001084 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001085}
1086
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001087ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001088 VkCmdBuffer cmdBuffer,
1089 VkEvent event_,
1090 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001091{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001092 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001093}
1094
Ian Elliott63f1edb2015-04-16 18:10:19 -06001095ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1096 VkCmdBuffer cmdBuffer,
1097 VkQueryPool queryPool,
1098 uint32_t startQuery,
1099 uint32_t queryCount,
1100 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001101 VkDeviceSize destOffset,
1102 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001103 VkFlags flags)
1104{
1105 NULLDRV_LOG_FUNC;
1106}
1107
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001108ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001109 VkCmdBuffer cmdBuffer,
1110 VkTimestampType timestampType,
1111 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001112 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001113{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001114 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001115}
1116
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001117ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001118 VkCmdBuffer cmdBuffer,
1119 VkPipelineBindPoint pipelineBindPoint,
1120 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001121{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001122 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001123}
1124
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001125ICD_EXPORT void VKAPI vkCmdBindDynamicStateObject(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001126 VkCmdBuffer cmdBuffer,
1127 VkStateBindPoint stateBindPoint,
1128 VkDynamicStateObject state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001129{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001130 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001131}
1132
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001133ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001134 VkCmdBuffer cmdBuffer,
1135 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001136 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001137 uint32_t firstSet,
1138 uint32_t setCount,
1139 const VkDescriptorSet* pDescriptorSets,
1140 uint32_t dynamicOffsetCount,
1141 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001142{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001143 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001144}
1145
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001146ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1147 VkCmdBuffer cmdBuffer,
1148 uint32_t startBinding,
1149 uint32_t bindingCount,
1150 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001151 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001152{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001153 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001154}
1155
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001156ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001157 VkCmdBuffer cmdBuffer,
1158 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001159 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001160 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001161{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001162 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001163}
1164
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001165ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001166 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001167 uint32_t firstVertex,
1168 uint32_t vertexCount,
1169 uint32_t firstInstance,
1170 uint32_t instanceCount)
1171{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001172 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001173}
1174
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001175ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001176 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001177 uint32_t firstIndex,
1178 uint32_t indexCount,
1179 int32_t vertexOffset,
1180 uint32_t firstInstance,
1181 uint32_t instanceCount)
1182{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001183 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001184}
1185
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001186ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001187 VkCmdBuffer cmdBuffer,
1188 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001189 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001190 uint32_t count,
1191 uint32_t stride)
1192{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001193 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001194}
1195
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001196ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001197 VkCmdBuffer cmdBuffer,
1198 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001199 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001200 uint32_t count,
1201 uint32_t stride)
1202{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001203 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001204}
1205
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001206ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001207 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001208 uint32_t x,
1209 uint32_t y,
1210 uint32_t z)
1211{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001212 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001213}
1214
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001215ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001216 VkCmdBuffer cmdBuffer,
1217 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001218 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001219{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001220 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001221}
1222
Tony Barbour8205d902015-04-16 15:59:00 -06001223void VKAPI vkCmdWaitEvents(
1224 VkCmdBuffer cmdBuffer,
1225 VkWaitEvent waitEvent,
1226 uint32_t eventCount,
1227 const VkEvent* pEvents,
1228 uint32_t memBarrierCount,
1229 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001230{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001231 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001232}
1233
Tony Barbour8205d902015-04-16 15:59:00 -06001234void VKAPI vkCmdPipelineBarrier(
1235 VkCmdBuffer cmdBuffer,
1236 VkWaitEvent waitEvent,
1237 uint32_t pipeEventCount,
1238 const VkPipeEvent* pPipeEvents,
1239 uint32_t memBarrierCount,
1240 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001241{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001242 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001243}
1244
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001245ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001246 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001247 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001248 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001249{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001250 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001251 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1252 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1253}
1254
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001255ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1256 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001257{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001258 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001259 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001260}
1261
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001262ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1263 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001264 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001265 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001266 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001267{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001268 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001269 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001270 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001271 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001272}
1273
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001274ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1275 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001276{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001277 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001278 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001279}
1280
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001281ICD_EXPORT VkResult VKAPI vkCreateEvent(
1282 VkDevice device,
1283 const VkEventCreateInfo* pCreateInfo,
1284 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001285{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001286 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001287 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001288}
1289
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001290ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001291 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001292 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001293{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001294 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001295 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001296}
1297
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001298ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001299 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001300 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001301{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001302 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001303 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001304}
1305
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001306ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001307 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001308 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001309{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001310 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001311 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001312}
1313
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001314ICD_EXPORT VkResult VKAPI vkCreateFence(
1315 VkDevice device,
1316 const VkFenceCreateInfo* pCreateInfo,
1317 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001318{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001319 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001320 struct nulldrv_dev *dev = nulldrv_dev(device);
1321
1322 return nulldrv_fence_create(dev, pCreateInfo,
1323 (struct nulldrv_fence **) pFence);
1324}
1325
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001326ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001327 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001328 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001329{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001330 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001331 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001332}
1333
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001334ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001335 VkDevice device,
1336 uint32_t fenceCount,
1337 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001338{
1339 NULLDRV_LOG_FUNC;
1340 return VK_SUCCESS;
1341}
1342
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001343ICD_EXPORT VkResult VKAPI vkWaitForFences(
1344 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001345 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001346 const VkFence* pFences,
David Pinedo0257fbf2015-02-02 18:02:40 -07001347 bool32_t waitAll,
1348 uint64_t timeout)
1349{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001350 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001351 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001352}
1353
Tony Barbour426b9052015-06-24 16:06:58 -06001354ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1355 VkPhysicalDevice gpu_,
1356 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001357{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001358 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001359 VkResult ret = VK_SUCCESS;
1360
Tony Barbour426b9052015-06-24 16:06:58 -06001361 pProperties->apiVersion = VK_API_VERSION;
1362 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1363 pProperties->vendorId = 0;
1364 pProperties->deviceId = 0;
1365 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1366 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Tony Barbour426b9052015-06-24 16:06:58 -06001367 pProperties->maxBoundDescriptorSets = 0;
1368 pProperties->maxThreadGroupSize = 0;
1369 pProperties->timestampFrequency = 0;
1370 pProperties->multiColorAttachmentClears = false;
Ian Elliott64a68e12015-04-16 11:57:46 -06001371
1372 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001373}
1374
Chris Forbesd7576302015-06-21 22:55:02 +12001375ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1376 VkPhysicalDevice physicalDevice,
1377 VkPhysicalDeviceFeatures* pFeatures)
1378{
1379 NULLDRV_LOG_FUNC;
1380 VkResult ret = VK_SUCCESS;
1381
1382 /* TODO: fill out features */
1383 memset(pFeatures, 0, sizeof(*pFeatures));
1384
1385 return ret;
1386}
1387
1388ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatInfo(
1389 VkPhysicalDevice physicalDevice,
1390 VkFormat format,
1391 VkFormatProperties* pFormatInfo)
1392{
1393 NULLDRV_LOG_FUNC;
1394 VkResult ret = VK_SUCCESS;
1395
1396 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1397 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1398
1399 return ret;
1400}
1401
1402ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1403 VkPhysicalDevice physicalDevice,
1404 VkPhysicalDeviceLimits* pLimits)
1405{
1406 NULLDRV_LOG_FUNC;
1407 VkResult ret = VK_SUCCESS;
1408
1409 /* TODO: fill out limits */
1410 memset(pLimits, 0, sizeof(*pLimits));
1411
1412 return ret;
1413}
1414
Tony Barbour426b9052015-06-24 16:06:58 -06001415ICD_EXPORT VkResult VKAPI vkGetPhysicalDevicePerformance(
1416 VkPhysicalDevice gpu_,
1417 VkPhysicalDevicePerformance* pPerformance)
Jon Ashburneb2728b2015-04-10 14:33:07 -06001418{
Tony Barbour426b9052015-06-24 16:06:58 -06001419 pPerformance->maxDeviceClock = 1.0f;
1420 pPerformance->aluPerClock = 1.0f;
1421 pPerformance->texPerClock = 1.0f;
1422 pPerformance->primsPerClock = 1.0f;
1423 pPerformance->pixelsPerClock = 1.0f;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001424
1425 return VK_SUCCESS;
1426}
1427
Tony Barbour426b9052015-06-24 16:06:58 -06001428ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueCount(
1429 VkPhysicalDevice gpu_,
1430 uint32_t* pCount)
David Pinedo0257fbf2015-02-02 18:02:40 -07001431{
Tony Barbour426b9052015-06-24 16:06:58 -06001432 *pCount = 1;
1433 return VK_SUCCESS;
1434}
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001435
Tony Barbour426b9052015-06-24 16:06:58 -06001436ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueProperties(
1437 VkPhysicalDevice gpu_,
1438 uint32_t count,
1439 VkPhysicalDeviceQueueProperties* pProperties)
1440 {
1441 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1442 pProperties->queueCount = 1;
1443 pProperties->maxAtomicCounters = 1;
1444 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001445
Tony Barbour426b9052015-06-24 16:06:58 -06001446 return VK_SUCCESS;
1447}
1448
1449ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
1450 uint32_t extensionIndex,
1451 VkExtensionProperties* pProperties)
1452{
1453 if (extensionIndex >= NULLDRV_EXT_COUNT)
1454 return VK_ERROR_INVALID_VALUE;
1455
1456 memcpy(pProperties, &intel_gpu_exts[extensionIndex], sizeof(VkExtensionProperties));
1457 return VK_SUCCESS;
1458}
1459
1460ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionCount(uint32_t *pCount)
1461{
1462 *pCount = NULLDRV_EXT_COUNT;
1463
1464 return VK_SUCCESS;
1465}
1466
1467VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
1468 VkPhysicalDevice gpu,
1469 uint32_t extesnionIndex,
1470 VkExtensionProperties* pProperties)
1471{
1472 return VK_ERROR_INVALID_EXTENSION;
1473}
1474
1475VkResult VKAPI vkGetPhysicalDeviceExtensionCount(
1476 VkPhysicalDevice gpu,
1477 uint32_t* pCount)
1478{
1479 *pCount = 0;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001480 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001481}
1482
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001483ICD_EXPORT VkResult VKAPI vkCreateImage(
1484 VkDevice device,
1485 const VkImageCreateInfo* pCreateInfo,
1486 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001487{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001488 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001489 struct nulldrv_dev *dev = nulldrv_dev(device);
1490
1491 return nulldrv_img_create(dev, pCreateInfo, false,
1492 (struct nulldrv_img **) pImage);
1493}
1494
Tony Barbour426b9052015-06-24 16:06:58 -06001495ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001496 VkDevice device,
1497 VkImage image,
1498 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001499 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001500{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001501 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001502
Tony Barbour426b9052015-06-24 16:06:58 -06001503 pLayout->offset = 0;
1504 pLayout->size = 1;
1505 pLayout->rowPitch = 4;
1506 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001507
Tony Barbour426b9052015-06-24 16:06:58 -06001508 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001509}
1510
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001511ICD_EXPORT VkResult VKAPI vkAllocMemory(
1512 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001513 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001514 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001515{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001516 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001517 struct nulldrv_dev *dev = nulldrv_dev(device);
1518
1519 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1520}
1521
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001522ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001523 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001524 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001525{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001526 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001527 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001528}
1529
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001530ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001531 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001532 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001533 VkDeviceSize offset,
1534 VkDeviceSize size,
1535 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001536 void** ppData)
1537{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001538 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001539 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1540 void *ptr = nulldrv_mem_map(mem, flags);
1541
1542 *ppData = ptr;
1543
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001544 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001545}
1546
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001547ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001548 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001549 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001550{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001551 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001552 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001553}
1554
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001555ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001556 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001557 uint32_t memRangeCount,
1558 const VkMappedMemoryRange* pMemRanges)
1559{
1560 NULLDRV_LOG_FUNC;
1561 return VK_SUCCESS;
1562}
1563
1564ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1565 VkDevice device,
1566 uint32_t memRangeCount,
1567 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001568{
1569 NULLDRV_LOG_FUNC;
1570 return VK_SUCCESS;
1571}
1572
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001573ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001574 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001575 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001576{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001577 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001578 struct nulldrv_instance *inst;
1579
1580 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001581 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001582 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001583 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001584
Tony Barbour426b9052015-06-24 16:06:58 -06001585 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001586
Mike Stroyan230e6252015-04-17 12:36:38 -06001587 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001588
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001589 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001590}
1591
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001592ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1593 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001594{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001595 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001596 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001597}
1598
Tony Barbour8205d902015-04-16 15:59:00 -06001599ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001600 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001601 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001602 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001603{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001604 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001605 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001606 struct nulldrv_gpu *gpu;
1607 *pGpuCount = 1;
1608 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001609 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001610 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001611 return ret;
1612}
1613
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001614ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001615 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001616 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001617 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001618 char* const* pOutLayers,
1619 void* pReserved)
1620{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001621 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001622 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001623}
1624
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001625ICD_EXPORT VkResult VKAPI vkDestroyObject(
Mike Stroyan230e6252015-04-17 12:36:38 -06001626 VkDevice device,
1627 VkObjectType objType,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001628 VkObject object)
David Pinedo0257fbf2015-02-02 18:02:40 -07001629{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001630 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001631 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001632}
1633
Tony Barbour426b9052015-06-24 16:06:58 -06001634ICD_EXPORT VkResult VKAPI vkGetObjectMemoryRequirements(
Mike Stroyan230e6252015-04-17 12:36:38 -06001635 VkDevice device,
1636 VkObjectType objType,
1637 VkObject object,
Tony Barbour426b9052015-06-24 16:06:58 -06001638 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -07001639{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001640 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001641 struct nulldrv_base *base = nulldrv_base(object);
1642
Tony Barbour426b9052015-06-24 16:06:58 -06001643 return base->get_memory_requirements(base, pMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -07001644}
1645
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001646ICD_EXPORT VkResult VKAPI vkBindObjectMemory(
1647 VkDevice device,
Mike Stroyan230e6252015-04-17 12:36:38 -06001648 VkObjectType objType,
1649 VkObject object,
Tony Barbour8205d902015-04-16 15:59:00 -06001650 VkDeviceMemory mem_,
1651 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001652{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001653 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001654 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001655}
1656
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001657ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001658 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001659 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001660 VkDeviceSize rangeOffset,
1661 VkDeviceSize rangeSize,
1662 VkDeviceMemory mem,
1663 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001664{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001665 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001666 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001667}
1668
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001669ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001670 VkQueue queue,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001671 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001672 const VkImageMemoryBindInfo* pBindInfo,
1673 VkDeviceMemory mem,
1674 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001675{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001676 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001677 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001678}
1679
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001680ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(
1681 VkDevice device,
1682 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1683 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001684{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001685 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001686 struct nulldrv_dev *dev = nulldrv_dev(device);
1687
1688 return graphics_pipeline_create(dev, pCreateInfo,
1689 (struct nulldrv_pipeline **) pPipeline);
1690}
1691
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001692ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(
1693 VkDevice device,
1694 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1695 VkPipeline basePipeline,
1696 VkPipeline* pPipeline)
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001697{
1698 NULLDRV_LOG_FUNC;
1699 struct nulldrv_dev *dev = nulldrv_dev(device);
1700
1701 return graphics_pipeline_create(dev, pCreateInfo,
1702 (struct nulldrv_pipeline **) pPipeline);
1703}
1704
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001705ICD_EXPORT VkResult VKAPI vkCreateComputePipeline(
1706 VkDevice device,
1707 const VkComputePipelineCreateInfo* pCreateInfo,
1708 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001709{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001710 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001711 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001712}
1713
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001714ICD_EXPORT VkResult VKAPI vkStorePipeline(
Mike Stroyan230e6252015-04-17 12:36:38 -06001715 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001716 VkPipeline pipeline,
David Pinedo0257fbf2015-02-02 18:02:40 -07001717 size_t* pDataSize,
1718 void* pData)
1719{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001720 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001721 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001722}
1723
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001724ICD_EXPORT VkResult VKAPI vkLoadPipeline(
1725 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001726 size_t dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001727 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001728 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001729{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001730 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001731 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001732}
1733
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001734ICD_EXPORT VkResult VKAPI vkLoadPipelineDerivative(
1735 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001736 size_t dataSize,
1737 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001738 VkPipeline basePipeline,
1739 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001740{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001741 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001742 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001743}
1744
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001745ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1746 VkDevice device,
1747 const VkQueryPoolCreateInfo* pCreateInfo,
1748 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001749{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001750 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001751 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001752}
1753
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001754ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001755 VkDevice device,
1756 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001757 uint32_t startQuery,
1758 uint32_t queryCount,
1759 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001760 void* pData,
1761 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001762{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001763 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001764 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001765}
1766
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001767ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1768 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001769{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001770 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001771 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001772}
1773
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001774ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1775 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001776 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001777 const VkCmdBuffer* pCmdBuffers,
1778 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001779{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001780 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001781 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001782}
1783
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001784ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1785 VkDevice device,
1786 const VkSemaphoreCreateInfo* pCreateInfo,
1787 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001788{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001789 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001790 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001791}
1792
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001793ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1794 VkQueue queue,
1795 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001796{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001797 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001798 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001799}
1800
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001801ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1802 VkQueue queue,
1803 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001804{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001805 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001806 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001807}
1808
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001809ICD_EXPORT VkResult VKAPI vkCreateSampler(
1810 VkDevice device,
1811 const VkSamplerCreateInfo* pCreateInfo,
1812 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07001813{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001814 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001815 struct nulldrv_dev *dev = nulldrv_dev(device);
1816
1817 return nulldrv_sampler_create(dev, pCreateInfo,
1818 (struct nulldrv_sampler **) pSampler);
1819}
1820
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001821ICD_EXPORT VkResult VKAPI vkCreateShader(
1822 VkDevice device,
1823 const VkShaderCreateInfo* pCreateInfo,
1824 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07001825{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001826 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001827 struct nulldrv_dev *dev = nulldrv_dev(device);
1828
1829 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
1830}
1831
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001832ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
1833 VkDevice device,
1834 const VkDynamicVpStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001835 VkDynamicVpState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001836{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001837 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001838 struct nulldrv_dev *dev = nulldrv_dev(device);
1839
1840 return nulldrv_viewport_state_create(dev, pCreateInfo,
1841 (struct nulldrv_dynamic_vp **) pState);
1842}
1843
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001844ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
1845 VkDevice device,
1846 const VkDynamicRsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001847 VkDynamicRsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001848{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001849 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001850 struct nulldrv_dev *dev = nulldrv_dev(device);
1851
1852 return nulldrv_raster_state_create(dev, pCreateInfo,
1853 (struct nulldrv_dynamic_rs **) pState);
1854}
1855
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001856ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
1857 VkDevice device,
1858 const VkDynamicCbStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001859 VkDynamicCbState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001860{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001861 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001862 struct nulldrv_dev *dev = nulldrv_dev(device);
1863
1864 return nulldrv_blend_state_create(dev, pCreateInfo,
1865 (struct nulldrv_dynamic_cb **) pState);
1866}
1867
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001868ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
1869 VkDevice device,
1870 const VkDynamicDsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001871 VkDynamicDsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001872{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001873 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001874 struct nulldrv_dev *dev = nulldrv_dev(device);
1875
1876 return nulldrv_ds_state_create(dev, pCreateInfo,
1877 (struct nulldrv_dynamic_ds **) pState);
1878}
1879
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001880ICD_EXPORT VkResult VKAPI vkCreateBufferView(
1881 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001882 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001883 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001884{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001885 NULLDRV_LOG_FUNC;
1886 struct nulldrv_dev *dev = nulldrv_dev(device);
1887
1888 return nulldrv_buf_view_create(dev, pCreateInfo,
1889 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07001890}
1891
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001892ICD_EXPORT VkResult VKAPI vkCreateImageView(
1893 VkDevice device,
1894 const VkImageViewCreateInfo* pCreateInfo,
1895 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001896{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001897 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001898 struct nulldrv_dev *dev = nulldrv_dev(device);
1899
1900 return nulldrv_img_view_create(dev, pCreateInfo,
1901 (struct nulldrv_img_view **) pView);
1902}
1903
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001904ICD_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
1905 VkDevice device,
1906 const VkColorAttachmentViewCreateInfo* pCreateInfo,
1907 VkColorAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001908{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001909 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001910 struct nulldrv_dev *dev = nulldrv_dev(device);
1911
1912 return nulldrv_rt_view_create(dev, pCreateInfo,
1913 (struct nulldrv_rt_view **) pView);
1914}
1915
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001916ICD_EXPORT VkResult VKAPI vkCreateDepthStencilView(
1917 VkDevice device,
1918 const VkDepthStencilViewCreateInfo* pCreateInfo,
1919 VkDepthStencilView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001920{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001921 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001922 struct nulldrv_dev *dev = nulldrv_dev(device);
1923
1924 return nulldrv_ds_view_create(dev, pCreateInfo,
1925 (struct nulldrv_ds_view **) pView);
1926
1927}
1928
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001929ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
1930 VkDevice device,
1931 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
1932 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001933{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001934 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001935 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07001936
Chia-I Wu7732cb22015-03-26 15:27:55 +08001937 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07001938 (struct nulldrv_desc_layout **) pSetLayout);
1939}
1940
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001941ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
1942 VkDevice device,
1943 const VkPipelineLayoutCreateInfo* pCreateInfo,
1944 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08001945{
1946 NULLDRV_LOG_FUNC;
1947 struct nulldrv_dev *dev = nulldrv_dev(device);
1948
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001949 return nulldrv_pipeline_layout_create(dev,
1950 pCreateInfo,
1951 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08001952}
1953
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001954ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
1955 VkDevice device,
1956 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07001957 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001958 const VkDescriptorPoolCreateInfo* pCreateInfo,
1959 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001960{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001961 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001962 struct nulldrv_dev *dev = nulldrv_dev(device);
1963
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001964 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
1965 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07001966}
1967
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001968ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06001969 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001970 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001971{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001972 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001973 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001974}
1975
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001976ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06001977 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001978 VkDescriptorPool descriptorPool,
1979 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07001980 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001981 const VkDescriptorSetLayout* pSetLayouts,
1982 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07001983 uint32_t* pCount)
1984{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001985 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001986 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
1987 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001988 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001989 uint32_t i;
1990
1991 for (i = 0; i < count; i++) {
1992 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001993 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07001994
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001995 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001996 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001997 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07001998 break;
1999 }
2000
2001 if (pCount)
2002 *pCount = i;
2003
2004 return ret;
2005}
2006
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002007ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2008 VkDevice device,
2009 uint32_t writeCount,
2010 const VkWriteDescriptorSet* pDescriptorWrites,
2011 uint32_t copyCount,
2012 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002013{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002014 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002015 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002016}
2017
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002018ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2019 VkDevice device,
2020 const VkFramebufferCreateInfo* info,
2021 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002022{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002023 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002024 struct nulldrv_dev *dev = nulldrv_dev(device);
2025
2026 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2027}
2028
2029
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002030ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2031 VkDevice device,
2032 const VkRenderPassCreateInfo* info,
2033 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002034{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002035 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002036 struct nulldrv_dev *dev = nulldrv_dev(device);
2037
2038 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2039}
2040
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002041ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002042 VkCmdBuffer cmdBuffer,
2043 const VkRenderPassBegin* pRenderPassBegin)
David Pinedo0257fbf2015-02-02 18:02:40 -07002044{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002045 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002046}
2047
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002048ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002049 VkCmdBuffer cmdBuffer,
2050 VkRenderPass renderPass)
David Pinedo0257fbf2015-02-02 18:02:40 -07002051{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002052 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002053}
Ian Elliottf93069f2015-02-19 14:26:19 -07002054
2055ICD_EXPORT void* xcbCreateWindow(
2056 uint16_t width,
2057 uint16_t height)
2058{
2059 static uint32_t window; // Kludge to the max
2060 NULLDRV_LOG_FUNC;
2061 return &window;
2062}
2063
2064// May not be needed, if we stub out stuf in tri.c
2065ICD_EXPORT void xcbDestroyWindow()
2066{
2067 NULLDRV_LOG_FUNC;
2068}
2069
2070ICD_EXPORT int xcbGetMessage(void *msg)
2071{
2072 NULLDRV_LOG_FUNC;
2073 return 0;
2074}
2075
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002076ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002077{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002078 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002079}