blob: 749aee4e0275a57cdd7c796221583d0572de3790 [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
Ian Elliott64a68e12015-04-16 11:57:46 -0600762static const VkFormat nulldrv_presentable_formats[] = {
763 VK_FORMAT_B8G8R8A8_UNORM,
764};
765
Jon Ashburnba4a1952015-06-16 12:44:51 -0600766#if 0
Ian Elliott64a68e12015-04-16 11:57:46 -0600767ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
768 VkDisplayWSI display,
769 VkDisplayInfoTypeWSI infoType,
770 size_t* pDataSize,
771 void* pData)
772{
773 VkResult ret = VK_SUCCESS;
774
775 NULLDRV_LOG_FUNC;
776
777 if (!pDataSize)
778 return VK_ERROR_INVALID_POINTER;
779
780 switch (infoType) {
781 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
782 {
783 VkDisplayFormatPropertiesWSI *dst = pData;
784 size_t size_ret;
785 uint32_t i;
786
787 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
788
789 if (dst && *pDataSize < size_ret)
790 return VK_ERROR_INVALID_VALUE;
791
792 *pDataSize = size_ret;
793 if (!dst)
794 return VK_SUCCESS;
795
796 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
797 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
798 }
799 break;
800 default:
801 ret = VK_ERROR_INVALID_VALUE;
802 break;
803 }
804
805 return ret;
806}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600807#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600808
809ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
810 VkDevice device,
811 const VkSwapChainCreateInfoWSI* pCreateInfo,
812 VkSwapChainWSI* pSwapChain)
813{
814 NULLDRV_LOG_FUNC;
815 struct nulldrv_dev *dev = nulldrv_dev(device);
816 struct nulldrv_swap_chain *sc;
817
818 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600819 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600820 if (!sc) {
821 return VK_ERROR_OUT_OF_HOST_MEMORY;
822 }
823 sc->dev = dev;
824
Tony Barbour11e76ac2015-04-20 16:28:46 -0600825 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600826
827 return VK_SUCCESS;
828}
829
830ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
831 VkSwapChainWSI swapChain)
832{
833 NULLDRV_LOG_FUNC;
834 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
835
836 free(sc);
837
838 return VK_SUCCESS;
839}
840
841ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
842 VkSwapChainWSI swapChain,
843 VkSwapChainInfoTypeWSI infoType,
844 size_t* pDataSize,
845 void* pData)
846{
847 NULLDRV_LOG_FUNC;
848 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
849 struct nulldrv_dev *dev = sc->dev;
850 VkResult ret = VK_SUCCESS;
851
852 if (!pDataSize)
853 return VK_ERROR_INVALID_POINTER;
854
855 switch (infoType) {
856 case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
857 {
858 VkSwapChainImageInfoWSI *images;
859 const size_t size = sizeof(*images) * 2;
860 uint32_t i;
861
862 if (pData && *pDataSize < size)
863 return VK_ERROR_INVALID_VALUE;
864
865 *pDataSize = size;
866 if (!pData)
867 return VK_SUCCESS;
868
869 images = (VkSwapChainImageInfoWSI *) pData;
870 for (i = 0; i < 2; i++) {
871 struct nulldrv_img *img;
872 struct nulldrv_mem *mem;
873
874 img = (struct nulldrv_img *) nulldrv_base_create(dev,
875 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600876 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600877 if (!img)
878 return VK_ERROR_OUT_OF_HOST_MEMORY;
879
880 mem = (struct nulldrv_mem *) nulldrv_base_create(dev,
881 sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600882 VK_OBJECT_TYPE_DEVICE_MEMORY);
Ian Elliott64a68e12015-04-16 11:57:46 -0600883 if (!mem)
884 return VK_ERROR_OUT_OF_HOST_MEMORY;
885
886 images[i].image = (VkImage) img;
887 images[i].memory = (VkDeviceMemory) mem;
888 }
889 }
890 break;
891 default:
892 ret = VK_ERROR_INVALID_VALUE;
893 break;
894 }
895
896 return ret;
897}
898
899ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
900 VkQueue queue_,
901 const VkPresentInfoWSI* pPresentInfo)
902{
903 NULLDRV_LOG_FUNC;
904
905 return VK_SUCCESS;
906}
907
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600908ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600909 VkCmdBuffer cmdBuffer,
910 VkBuffer srcBuffer,
911 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700912 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600913 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700914{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700915 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700916}
917
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600918ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600919 VkCmdBuffer cmdBuffer,
920 VkImage srcImage,
921 VkImageLayout srcImageLayout,
922 VkImage destImage,
923 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700924 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600925 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700926{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700927 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700928}
929
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600930ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600931 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500932 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600933 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500934 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600935 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500936 uint32_t regionCount,
937 const VkImageBlit* pRegions,
938 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600939{
940 NULLDRV_LOG_FUNC;
941}
942
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600943ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600944 VkCmdBuffer cmdBuffer,
945 VkBuffer srcBuffer,
946 VkImage destImage,
947 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700948 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600949 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700950{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700951 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700952}
953
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600954ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600955 VkCmdBuffer cmdBuffer,
956 VkImage srcImage,
957 VkImageLayout srcImageLayout,
958 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700959 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600960 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700961{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700962 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700963}
964
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600965ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600966 VkCmdBuffer cmdBuffer,
967 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600968 VkDeviceSize destOffset,
969 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700970 const uint32_t* pData)
971{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700972 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700973}
974
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600975ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600976 VkCmdBuffer cmdBuffer,
977 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600978 VkDeviceSize destOffset,
979 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700980 uint32_t data)
981{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700982 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700983}
984
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600985ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -0600986 VkCmdBuffer cmdBuffer,
987 VkImage image,
988 VkImageLayout imageLayout,
989 const VkClearColor *pColor,
990 uint32_t rangeCount,
991 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -0700992{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700993 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700994}
995
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600996ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600997 VkCmdBuffer cmdBuffer,
998 VkImage image,
999 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001000 float depth,
1001 uint32_t stencil,
1002 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001003 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001004{
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 vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001009 VkCmdBuffer cmdBuffer,
1010 VkImage srcImage,
1011 VkImageLayout srcImageLayout,
1012 VkImage destImage,
1013 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001014 uint32_t regionCount,
1015 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001016{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001017 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001018}
1019
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001020ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001021 VkCmdBuffer cmdBuffer,
1022 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001023 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001024 VkFlags flags)
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 vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001030 VkCmdBuffer cmdBuffer,
1031 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001032 uint32_t slot)
1033{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001034 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001035}
1036
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001037ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001038 VkCmdBuffer cmdBuffer,
1039 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001040 uint32_t startQuery,
1041 uint32_t queryCount)
1042{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001043 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001044}
1045
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001046ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001047 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001048 VkEvent event_,
1049 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001050{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001051 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001052}
1053
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001054ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001055 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001056 VkEvent event_,
1057 VkPipelineStageFlags stageMask)
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
Ian Elliott63f1edb2015-04-16 18:10:19 -06001062ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1063 VkCmdBuffer cmdBuffer,
1064 VkQueryPool queryPool,
1065 uint32_t startQuery,
1066 uint32_t queryCount,
1067 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001068 VkDeviceSize destOffset,
1069 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001070 VkFlags flags)
1071{
1072 NULLDRV_LOG_FUNC;
1073}
1074
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001075ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001076 VkCmdBuffer cmdBuffer,
1077 VkTimestampType timestampType,
1078 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001079 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001080{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001081 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001082}
1083
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001084ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001085 VkCmdBuffer cmdBuffer,
1086 VkPipelineBindPoint pipelineBindPoint,
1087 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001088{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001089 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001090}
1091
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001092ICD_EXPORT void VKAPI vkCmdBindDynamicStateObject(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001093 VkCmdBuffer cmdBuffer,
1094 VkStateBindPoint stateBindPoint,
1095 VkDynamicStateObject state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001096{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001097 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001098}
1099
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001100ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001101 VkCmdBuffer cmdBuffer,
1102 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001103 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001104 uint32_t firstSet,
1105 uint32_t setCount,
1106 const VkDescriptorSet* pDescriptorSets,
1107 uint32_t dynamicOffsetCount,
1108 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001109{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001110 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001111}
1112
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001113ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1114 VkCmdBuffer cmdBuffer,
1115 uint32_t startBinding,
1116 uint32_t bindingCount,
1117 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001118 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001119{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001120 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001121}
1122
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001123ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001124 VkCmdBuffer cmdBuffer,
1125 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001126 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001127 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001128{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001129 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001130}
1131
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001132ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001133 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001134 uint32_t firstVertex,
1135 uint32_t vertexCount,
1136 uint32_t firstInstance,
1137 uint32_t instanceCount)
1138{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001139 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001140}
1141
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001142ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001143 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001144 uint32_t firstIndex,
1145 uint32_t indexCount,
1146 int32_t vertexOffset,
1147 uint32_t firstInstance,
1148 uint32_t instanceCount)
1149{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001150 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001151}
1152
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001153ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001154 VkCmdBuffer cmdBuffer,
1155 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001156 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001157 uint32_t count,
1158 uint32_t stride)
1159{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001160 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001161}
1162
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001163ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001164 VkCmdBuffer cmdBuffer,
1165 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001166 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001167 uint32_t count,
1168 uint32_t stride)
1169{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001170 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001171}
1172
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001173ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001174 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001175 uint32_t x,
1176 uint32_t y,
1177 uint32_t z)
1178{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001179 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001180}
1181
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001182ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001183 VkCmdBuffer cmdBuffer,
1184 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001185 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001186{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001187 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001188}
1189
Tony Barbour8205d902015-04-16 15:59:00 -06001190void VKAPI vkCmdWaitEvents(
1191 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001192 uint32_t eventCount,
1193 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001194 VkPipelineStageFlags sourceStageMask,
1195 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001196 uint32_t memBarrierCount,
1197 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001198{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001199 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001200}
1201
Tony Barbour8205d902015-04-16 15:59:00 -06001202void VKAPI vkCmdPipelineBarrier(
1203 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001204 VkPipelineStageFlags sourceStageMask,
1205 VkPipelineStageFlags destStageMask,
1206 bool32_t byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001207 uint32_t memBarrierCount,
1208 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001209{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001210 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001211}
1212
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001213ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001214 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001215 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001216 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001217{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001218 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001219 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1220 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1221}
1222
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001223ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1224 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001225{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001226 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001227 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001228}
1229
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001230ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1231 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001232 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001233 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001234 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001235{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001236 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001237 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001238 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001239 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001240}
1241
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001242ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1243 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001244{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001245 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001246 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001247}
1248
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001249ICD_EXPORT VkResult VKAPI vkCreateEvent(
1250 VkDevice device,
1251 const VkEventCreateInfo* pCreateInfo,
1252 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001253{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001254 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001255 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001256}
1257
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001258ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001259 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001260 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001261{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001262 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001263 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001264}
1265
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001266ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001267 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001268 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001269{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001270 NULLDRV_LOG_FUNC;
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 vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001275 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001276 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001277{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001278 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001279 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001280}
1281
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001282ICD_EXPORT VkResult VKAPI vkCreateFence(
1283 VkDevice device,
1284 const VkFenceCreateInfo* pCreateInfo,
1285 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001286{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001287 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001288 struct nulldrv_dev *dev = nulldrv_dev(device);
1289
1290 return nulldrv_fence_create(dev, pCreateInfo,
1291 (struct nulldrv_fence **) pFence);
1292}
1293
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001294ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001295 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001296 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001297{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001298 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001299 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001300}
1301
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001302ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001303 VkDevice device,
1304 uint32_t fenceCount,
1305 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001306{
1307 NULLDRV_LOG_FUNC;
1308 return VK_SUCCESS;
1309}
1310
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001311ICD_EXPORT VkResult VKAPI vkWaitForFences(
1312 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001313 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001314 const VkFence* pFences,
David Pinedo0257fbf2015-02-02 18:02:40 -07001315 bool32_t waitAll,
1316 uint64_t timeout)
1317{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001318 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001319 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001320}
1321
Tony Barbour426b9052015-06-24 16:06:58 -06001322ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1323 VkPhysicalDevice gpu_,
1324 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001325{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001326 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001327 VkResult ret = VK_SUCCESS;
1328
Tony Barbour426b9052015-06-24 16:06:58 -06001329 pProperties->apiVersion = VK_API_VERSION;
1330 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1331 pProperties->vendorId = 0;
1332 pProperties->deviceId = 0;
1333 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1334 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Tony Barbour426b9052015-06-24 16:06:58 -06001335 pProperties->maxBoundDescriptorSets = 0;
1336 pProperties->maxThreadGroupSize = 0;
1337 pProperties->timestampFrequency = 0;
1338 pProperties->multiColorAttachmentClears = false;
Ian Elliott64a68e12015-04-16 11:57:46 -06001339
1340 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001341}
1342
Chris Forbesd7576302015-06-21 22:55:02 +12001343ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1344 VkPhysicalDevice physicalDevice,
1345 VkPhysicalDeviceFeatures* pFeatures)
1346{
1347 NULLDRV_LOG_FUNC;
1348 VkResult ret = VK_SUCCESS;
1349
1350 /* TODO: fill out features */
1351 memset(pFeatures, 0, sizeof(*pFeatures));
1352
1353 return ret;
1354}
1355
1356ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatInfo(
1357 VkPhysicalDevice physicalDevice,
1358 VkFormat format,
1359 VkFormatProperties* pFormatInfo)
1360{
1361 NULLDRV_LOG_FUNC;
1362 VkResult ret = VK_SUCCESS;
1363
1364 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1365 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1366
1367 return ret;
1368}
1369
1370ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1371 VkPhysicalDevice physicalDevice,
1372 VkPhysicalDeviceLimits* pLimits)
1373{
1374 NULLDRV_LOG_FUNC;
1375 VkResult ret = VK_SUCCESS;
1376
1377 /* TODO: fill out limits */
1378 memset(pLimits, 0, sizeof(*pLimits));
1379
1380 return ret;
1381}
1382
Tony Barbour426b9052015-06-24 16:06:58 -06001383ICD_EXPORT VkResult VKAPI vkGetPhysicalDevicePerformance(
1384 VkPhysicalDevice gpu_,
1385 VkPhysicalDevicePerformance* pPerformance)
Jon Ashburneb2728b2015-04-10 14:33:07 -06001386{
Tony Barbour426b9052015-06-24 16:06:58 -06001387 pPerformance->maxDeviceClock = 1.0f;
1388 pPerformance->aluPerClock = 1.0f;
1389 pPerformance->texPerClock = 1.0f;
1390 pPerformance->primsPerClock = 1.0f;
1391 pPerformance->pixelsPerClock = 1.0f;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001392
1393 return VK_SUCCESS;
1394}
1395
Tony Barbour426b9052015-06-24 16:06:58 -06001396ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueCount(
1397 VkPhysicalDevice gpu_,
1398 uint32_t* pCount)
David Pinedo0257fbf2015-02-02 18:02:40 -07001399{
Tony Barbour426b9052015-06-24 16:06:58 -06001400 *pCount = 1;
1401 return VK_SUCCESS;
1402}
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001403
Tony Barbour426b9052015-06-24 16:06:58 -06001404ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueProperties(
1405 VkPhysicalDevice gpu_,
1406 uint32_t count,
1407 VkPhysicalDeviceQueueProperties* pProperties)
1408 {
1409 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1410 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001411 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001412
Tony Barbour426b9052015-06-24 16:06:58 -06001413 return VK_SUCCESS;
1414}
1415
1416ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
1417 uint32_t extensionIndex,
1418 VkExtensionProperties* pProperties)
1419{
1420 if (extensionIndex >= NULLDRV_EXT_COUNT)
1421 return VK_ERROR_INVALID_VALUE;
1422
1423 memcpy(pProperties, &intel_gpu_exts[extensionIndex], sizeof(VkExtensionProperties));
1424 return VK_SUCCESS;
1425}
1426
1427ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionCount(uint32_t *pCount)
1428{
1429 *pCount = NULLDRV_EXT_COUNT;
1430
1431 return VK_SUCCESS;
1432}
1433
1434VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
1435 VkPhysicalDevice gpu,
1436 uint32_t extesnionIndex,
1437 VkExtensionProperties* pProperties)
1438{
1439 return VK_ERROR_INVALID_EXTENSION;
1440}
1441
1442VkResult VKAPI vkGetPhysicalDeviceExtensionCount(
1443 VkPhysicalDevice gpu,
1444 uint32_t* pCount)
1445{
1446 *pCount = 0;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001447 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001448}
1449
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001450ICD_EXPORT VkResult VKAPI vkCreateImage(
1451 VkDevice device,
1452 const VkImageCreateInfo* pCreateInfo,
1453 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001454{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001455 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001456 struct nulldrv_dev *dev = nulldrv_dev(device);
1457
1458 return nulldrv_img_create(dev, pCreateInfo, false,
1459 (struct nulldrv_img **) pImage);
1460}
1461
Tony Barbour426b9052015-06-24 16:06:58 -06001462ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001463 VkDevice device,
1464 VkImage image,
1465 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001466 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001467{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001468 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001469
Tony Barbour426b9052015-06-24 16:06:58 -06001470 pLayout->offset = 0;
1471 pLayout->size = 1;
1472 pLayout->rowPitch = 4;
1473 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001474
Tony Barbour426b9052015-06-24 16:06:58 -06001475 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001476}
1477
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001478ICD_EXPORT VkResult VKAPI vkAllocMemory(
1479 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001480 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001481 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001482{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001483 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001484 struct nulldrv_dev *dev = nulldrv_dev(device);
1485
1486 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1487}
1488
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001489ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001490 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001491 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001492{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001493 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001494 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001495}
1496
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001497ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001498 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001499 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001500 VkDeviceSize offset,
1501 VkDeviceSize size,
1502 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001503 void** ppData)
1504{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001505 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001506 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1507 void *ptr = nulldrv_mem_map(mem, flags);
1508
1509 *ppData = ptr;
1510
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001511 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001512}
1513
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001514ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001515 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001516 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001517{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001518 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001519 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001520}
1521
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001522ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001523 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001524 uint32_t memRangeCount,
1525 const VkMappedMemoryRange* pMemRanges)
1526{
1527 NULLDRV_LOG_FUNC;
1528 return VK_SUCCESS;
1529}
1530
1531ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1532 VkDevice device,
1533 uint32_t memRangeCount,
1534 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001535{
1536 NULLDRV_LOG_FUNC;
1537 return VK_SUCCESS;
1538}
1539
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001540ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001541 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001542 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001543{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001544 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001545 struct nulldrv_instance *inst;
1546
1547 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001548 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001549 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001550 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001551
Tony Barbour426b9052015-06-24 16:06:58 -06001552 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001553
Mike Stroyan230e6252015-04-17 12:36:38 -06001554 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001555
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001556 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001557}
1558
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001559ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1560 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001561{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001562 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001563 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001564}
1565
Tony Barbour8205d902015-04-16 15:59:00 -06001566ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001567 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001568 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001569 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001570{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001571 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001572 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001573 struct nulldrv_gpu *gpu;
1574 *pGpuCount = 1;
1575 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001576 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001577 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001578 return ret;
1579}
1580
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001581ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001582 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001583 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001584 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001585 char* const* pOutLayers,
1586 void* pReserved)
1587{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001588 NULLDRV_LOG_FUNC;
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 vkDestroyObject(
Mike Stroyan230e6252015-04-17 12:36:38 -06001593 VkDevice device,
1594 VkObjectType objType,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001595 VkObject object)
David Pinedo0257fbf2015-02-02 18:02:40 -07001596{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001597 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001598 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001599}
1600
Tony Barbour426b9052015-06-24 16:06:58 -06001601ICD_EXPORT VkResult VKAPI vkGetObjectMemoryRequirements(
Mike Stroyan230e6252015-04-17 12:36:38 -06001602 VkDevice device,
1603 VkObjectType objType,
1604 VkObject object,
Tony Barbour426b9052015-06-24 16:06:58 -06001605 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -07001606{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001607 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001608 struct nulldrv_base *base = nulldrv_base(object);
1609
Tony Barbour426b9052015-06-24 16:06:58 -06001610 return base->get_memory_requirements(base, pMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -07001611}
1612
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001613ICD_EXPORT VkResult VKAPI vkBindObjectMemory(
1614 VkDevice device,
Mike Stroyan230e6252015-04-17 12:36:38 -06001615 VkObjectType objType,
1616 VkObject object,
Tony Barbour8205d902015-04-16 15:59:00 -06001617 VkDeviceMemory mem_,
1618 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001619{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001620 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001621 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001622}
1623
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001624ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001625 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001626 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001627 VkDeviceSize rangeOffset,
1628 VkDeviceSize rangeSize,
1629 VkDeviceMemory mem,
1630 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001631{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001632 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001633 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001634}
1635
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001636ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001637 VkQueue queue,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001638 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001639 const VkImageMemoryBindInfo* pBindInfo,
1640 VkDeviceMemory mem,
1641 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001642{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001643 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001644 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001645}
1646
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001647ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(
1648 VkDevice device,
1649 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1650 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001651{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001652 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001653 struct nulldrv_dev *dev = nulldrv_dev(device);
1654
1655 return graphics_pipeline_create(dev, pCreateInfo,
1656 (struct nulldrv_pipeline **) pPipeline);
1657}
1658
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001659ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(
1660 VkDevice device,
1661 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1662 VkPipeline basePipeline,
1663 VkPipeline* pPipeline)
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001664{
1665 NULLDRV_LOG_FUNC;
1666 struct nulldrv_dev *dev = nulldrv_dev(device);
1667
1668 return graphics_pipeline_create(dev, pCreateInfo,
1669 (struct nulldrv_pipeline **) pPipeline);
1670}
1671
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001672ICD_EXPORT VkResult VKAPI vkCreateComputePipeline(
1673 VkDevice device,
1674 const VkComputePipelineCreateInfo* pCreateInfo,
1675 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001676{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001677 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001678 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001679}
1680
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001681ICD_EXPORT VkResult VKAPI vkStorePipeline(
Mike Stroyan230e6252015-04-17 12:36:38 -06001682 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001683 VkPipeline pipeline,
David Pinedo0257fbf2015-02-02 18:02:40 -07001684 size_t* pDataSize,
1685 void* pData)
1686{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001687 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001688 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001689}
1690
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001691ICD_EXPORT VkResult VKAPI vkLoadPipeline(
1692 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001693 size_t dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001694 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001695 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001696{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001697 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001698 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001699}
1700
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001701ICD_EXPORT VkResult VKAPI vkLoadPipelineDerivative(
1702 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001703 size_t dataSize,
1704 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001705 VkPipeline basePipeline,
1706 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001707{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001708 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001709 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001710}
1711
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001712ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1713 VkDevice device,
1714 const VkQueryPoolCreateInfo* pCreateInfo,
1715 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001716{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001717 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001718 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001719}
1720
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001721ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001722 VkDevice device,
1723 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001724 uint32_t startQuery,
1725 uint32_t queryCount,
1726 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001727 void* pData,
1728 VkQueryResultFlags flags)
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 vkQueueWaitIdle(
1735 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001736{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001737 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001738 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001739}
1740
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001741ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1742 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001743 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001744 const VkCmdBuffer* pCmdBuffers,
1745 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001746{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001747 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001748 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001749}
1750
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001751ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1752 VkDevice device,
1753 const VkSemaphoreCreateInfo* pCreateInfo,
1754 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001755{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001756 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001757 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001758}
1759
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001760ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1761 VkQueue queue,
1762 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001763{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001764 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001765 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001766}
1767
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001768ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1769 VkQueue queue,
1770 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001771{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001772 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001773 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001774}
1775
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001776ICD_EXPORT VkResult VKAPI vkCreateSampler(
1777 VkDevice device,
1778 const VkSamplerCreateInfo* pCreateInfo,
1779 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07001780{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001781 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001782 struct nulldrv_dev *dev = nulldrv_dev(device);
1783
1784 return nulldrv_sampler_create(dev, pCreateInfo,
1785 (struct nulldrv_sampler **) pSampler);
1786}
1787
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001788ICD_EXPORT VkResult VKAPI vkCreateShader(
1789 VkDevice device,
1790 const VkShaderCreateInfo* pCreateInfo,
1791 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07001792{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001793 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001794 struct nulldrv_dev *dev = nulldrv_dev(device);
1795
1796 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
1797}
1798
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001799ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
1800 VkDevice device,
1801 const VkDynamicVpStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001802 VkDynamicVpState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001803{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001804 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001805 struct nulldrv_dev *dev = nulldrv_dev(device);
1806
1807 return nulldrv_viewport_state_create(dev, pCreateInfo,
1808 (struct nulldrv_dynamic_vp **) pState);
1809}
1810
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001811ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
1812 VkDevice device,
1813 const VkDynamicRsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001814 VkDynamicRsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001815{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001816 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001817 struct nulldrv_dev *dev = nulldrv_dev(device);
1818
1819 return nulldrv_raster_state_create(dev, pCreateInfo,
1820 (struct nulldrv_dynamic_rs **) pState);
1821}
1822
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001823ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
1824 VkDevice device,
1825 const VkDynamicCbStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001826 VkDynamicCbState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001827{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001828 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001829 struct nulldrv_dev *dev = nulldrv_dev(device);
1830
1831 return nulldrv_blend_state_create(dev, pCreateInfo,
1832 (struct nulldrv_dynamic_cb **) pState);
1833}
1834
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001835ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
1836 VkDevice device,
1837 const VkDynamicDsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001838 VkDynamicDsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001839{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001840 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001841 struct nulldrv_dev *dev = nulldrv_dev(device);
1842
1843 return nulldrv_ds_state_create(dev, pCreateInfo,
1844 (struct nulldrv_dynamic_ds **) pState);
1845}
1846
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001847ICD_EXPORT VkResult VKAPI vkCreateBufferView(
1848 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001849 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001850 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001851{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001852 NULLDRV_LOG_FUNC;
1853 struct nulldrv_dev *dev = nulldrv_dev(device);
1854
1855 return nulldrv_buf_view_create(dev, pCreateInfo,
1856 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07001857}
1858
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001859ICD_EXPORT VkResult VKAPI vkCreateImageView(
1860 VkDevice device,
1861 const VkImageViewCreateInfo* pCreateInfo,
1862 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001863{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001864 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001865 struct nulldrv_dev *dev = nulldrv_dev(device);
1866
1867 return nulldrv_img_view_create(dev, pCreateInfo,
1868 (struct nulldrv_img_view **) pView);
1869}
1870
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001871ICD_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
1872 VkDevice device,
1873 const VkColorAttachmentViewCreateInfo* pCreateInfo,
1874 VkColorAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001875{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001876 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001877 struct nulldrv_dev *dev = nulldrv_dev(device);
1878
1879 return nulldrv_rt_view_create(dev, pCreateInfo,
1880 (struct nulldrv_rt_view **) pView);
1881}
1882
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001883ICD_EXPORT VkResult VKAPI vkCreateDepthStencilView(
1884 VkDevice device,
1885 const VkDepthStencilViewCreateInfo* pCreateInfo,
1886 VkDepthStencilView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001887{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001888 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001889 struct nulldrv_dev *dev = nulldrv_dev(device);
1890
1891 return nulldrv_ds_view_create(dev, pCreateInfo,
1892 (struct nulldrv_ds_view **) pView);
1893
1894}
1895
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001896ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
1897 VkDevice device,
1898 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
1899 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001900{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001901 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001902 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07001903
Chia-I Wu7732cb22015-03-26 15:27:55 +08001904 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07001905 (struct nulldrv_desc_layout **) pSetLayout);
1906}
1907
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001908ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
1909 VkDevice device,
1910 const VkPipelineLayoutCreateInfo* pCreateInfo,
1911 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08001912{
1913 NULLDRV_LOG_FUNC;
1914 struct nulldrv_dev *dev = nulldrv_dev(device);
1915
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001916 return nulldrv_pipeline_layout_create(dev,
1917 pCreateInfo,
1918 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08001919}
1920
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001921ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
1922 VkDevice device,
1923 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07001924 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001925 const VkDescriptorPoolCreateInfo* pCreateInfo,
1926 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001927{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001928 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001929 struct nulldrv_dev *dev = nulldrv_dev(device);
1930
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001931 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
1932 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07001933}
1934
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001935ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06001936 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001937 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001938{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001939 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001940 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001941}
1942
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001943ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06001944 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001945 VkDescriptorPool descriptorPool,
1946 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07001947 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001948 const VkDescriptorSetLayout* pSetLayouts,
1949 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07001950 uint32_t* pCount)
1951{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001952 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001953 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
1954 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001955 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001956 uint32_t i;
1957
1958 for (i = 0; i < count; i++) {
1959 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001960 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07001961
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001962 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001963 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001964 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07001965 break;
1966 }
1967
1968 if (pCount)
1969 *pCount = i;
1970
1971 return ret;
1972}
1973
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08001974ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
1975 VkDevice device,
1976 uint32_t writeCount,
1977 const VkWriteDescriptorSet* pDescriptorWrites,
1978 uint32_t copyCount,
1979 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07001980{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001981 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08001982 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001983}
1984
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001985ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
1986 VkDevice device,
1987 const VkFramebufferCreateInfo* info,
1988 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07001989{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001990 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001991 struct nulldrv_dev *dev = nulldrv_dev(device);
1992
1993 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
1994}
1995
1996
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001997ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
1998 VkDevice device,
1999 const VkRenderPassCreateInfo* info,
2000 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002001{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002002 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002003 struct nulldrv_dev *dev = nulldrv_dev(device);
2004
2005 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2006}
2007
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002008ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002009 VkCmdBuffer cmdBuffer,
2010 const VkRenderPassBegin* pRenderPassBegin)
David Pinedo0257fbf2015-02-02 18:02:40 -07002011{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002012 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002013}
2014
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002015ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002016 VkCmdBuffer cmdBuffer)
2017{
2018 NULLDRV_LOG_FUNC;
2019}
2020
2021ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2022 VkCmdBuffer cmdBuffer,
2023 uint32_t cmdBuffersCount,
2024 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002025{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002026 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002027}
Ian Elliottf93069f2015-02-19 14:26:19 -07002028
2029ICD_EXPORT void* xcbCreateWindow(
2030 uint16_t width,
2031 uint16_t height)
2032{
2033 static uint32_t window; // Kludge to the max
2034 NULLDRV_LOG_FUNC;
2035 return &window;
2036}
2037
2038// May not be needed, if we stub out stuf in tri.c
2039ICD_EXPORT void xcbDestroyWindow()
2040{
2041 NULLDRV_LOG_FUNC;
2042}
2043
2044ICD_EXPORT int xcbGetMessage(void *msg)
2045{
2046 NULLDRV_LOG_FUNC;
2047 return 0;
2048}
2049
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002050ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002051{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002052 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002053}