blob: fb04339788407fa08076fbf4c0d9142c47ca2d30 [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,
Chris Forbese3105972015-06-24 14:34:53 +1200989 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -0600990 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"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001335
1336 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001337}
1338
Chris Forbesd7576302015-06-21 22:55:02 +12001339ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1340 VkPhysicalDevice physicalDevice,
1341 VkPhysicalDeviceFeatures* pFeatures)
1342{
1343 NULLDRV_LOG_FUNC;
1344 VkResult ret = VK_SUCCESS;
1345
1346 /* TODO: fill out features */
1347 memset(pFeatures, 0, sizeof(*pFeatures));
1348
1349 return ret;
1350}
1351
1352ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatInfo(
1353 VkPhysicalDevice physicalDevice,
1354 VkFormat format,
1355 VkFormatProperties* pFormatInfo)
1356{
1357 NULLDRV_LOG_FUNC;
1358 VkResult ret = VK_SUCCESS;
1359
1360 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1361 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1362
1363 return ret;
1364}
1365
1366ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1367 VkPhysicalDevice physicalDevice,
1368 VkPhysicalDeviceLimits* pLimits)
1369{
1370 NULLDRV_LOG_FUNC;
1371 VkResult ret = VK_SUCCESS;
1372
1373 /* TODO: fill out limits */
1374 memset(pLimits, 0, sizeof(*pLimits));
1375
1376 return ret;
1377}
1378
Tony Barbour426b9052015-06-24 16:06:58 -06001379ICD_EXPORT VkResult VKAPI vkGetPhysicalDevicePerformance(
1380 VkPhysicalDevice gpu_,
1381 VkPhysicalDevicePerformance* pPerformance)
Jon Ashburneb2728b2015-04-10 14:33:07 -06001382{
Tony Barbour426b9052015-06-24 16:06:58 -06001383 pPerformance->maxDeviceClock = 1.0f;
1384 pPerformance->aluPerClock = 1.0f;
1385 pPerformance->texPerClock = 1.0f;
1386 pPerformance->primsPerClock = 1.0f;
1387 pPerformance->pixelsPerClock = 1.0f;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001388
1389 return VK_SUCCESS;
1390}
1391
Tony Barbour426b9052015-06-24 16:06:58 -06001392ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueCount(
1393 VkPhysicalDevice gpu_,
1394 uint32_t* pCount)
David Pinedo0257fbf2015-02-02 18:02:40 -07001395{
Tony Barbour426b9052015-06-24 16:06:58 -06001396 *pCount = 1;
1397 return VK_SUCCESS;
1398}
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001399
Tony Barbour426b9052015-06-24 16:06:58 -06001400ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueProperties(
1401 VkPhysicalDevice gpu_,
1402 uint32_t count,
1403 VkPhysicalDeviceQueueProperties* pProperties)
1404 {
1405 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1406 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001407 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001408
Tony Barbour426b9052015-06-24 16:06:58 -06001409 return VK_SUCCESS;
1410}
1411
1412ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
1413 uint32_t extensionIndex,
1414 VkExtensionProperties* pProperties)
1415{
1416 if (extensionIndex >= NULLDRV_EXT_COUNT)
1417 return VK_ERROR_INVALID_VALUE;
1418
1419 memcpy(pProperties, &intel_gpu_exts[extensionIndex], sizeof(VkExtensionProperties));
1420 return VK_SUCCESS;
1421}
1422
1423ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionCount(uint32_t *pCount)
1424{
1425 *pCount = NULLDRV_EXT_COUNT;
1426
1427 return VK_SUCCESS;
1428}
1429
1430VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
1431 VkPhysicalDevice gpu,
1432 uint32_t extesnionIndex,
1433 VkExtensionProperties* pProperties)
1434{
1435 return VK_ERROR_INVALID_EXTENSION;
1436}
1437
1438VkResult VKAPI vkGetPhysicalDeviceExtensionCount(
1439 VkPhysicalDevice gpu,
1440 uint32_t* pCount)
1441{
1442 *pCount = 0;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001443 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001444}
1445
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001446ICD_EXPORT VkResult VKAPI vkCreateImage(
1447 VkDevice device,
1448 const VkImageCreateInfo* pCreateInfo,
1449 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001450{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001451 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001452 struct nulldrv_dev *dev = nulldrv_dev(device);
1453
1454 return nulldrv_img_create(dev, pCreateInfo, false,
1455 (struct nulldrv_img **) pImage);
1456}
1457
Tony Barbour426b9052015-06-24 16:06:58 -06001458ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001459 VkDevice device,
1460 VkImage image,
1461 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001462 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001463{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001464 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001465
Tony Barbour426b9052015-06-24 16:06:58 -06001466 pLayout->offset = 0;
1467 pLayout->size = 1;
1468 pLayout->rowPitch = 4;
1469 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001470
Tony Barbour426b9052015-06-24 16:06:58 -06001471 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001472}
1473
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001474ICD_EXPORT VkResult VKAPI vkAllocMemory(
1475 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001476 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001477 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001478{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001479 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001480 struct nulldrv_dev *dev = nulldrv_dev(device);
1481
1482 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1483}
1484
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001485ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001486 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001487 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001488{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001489 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001490 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001491}
1492
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001493ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001494 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001495 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001496 VkDeviceSize offset,
1497 VkDeviceSize size,
1498 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001499 void** ppData)
1500{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001501 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001502 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1503 void *ptr = nulldrv_mem_map(mem, flags);
1504
1505 *ppData = ptr;
1506
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001507 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001508}
1509
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001510ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001511 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001512 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001513{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001514 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001515 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001516}
1517
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001518ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001519 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001520 uint32_t memRangeCount,
1521 const VkMappedMemoryRange* pMemRanges)
1522{
1523 NULLDRV_LOG_FUNC;
1524 return VK_SUCCESS;
1525}
1526
1527ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1528 VkDevice device,
1529 uint32_t memRangeCount,
1530 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001531{
1532 NULLDRV_LOG_FUNC;
1533 return VK_SUCCESS;
1534}
1535
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001536ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001537 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001538 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001539{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001540 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001541 struct nulldrv_instance *inst;
1542
1543 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001544 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001545 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001546 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001547
Tony Barbour426b9052015-06-24 16:06:58 -06001548 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001549
Mike Stroyan230e6252015-04-17 12:36:38 -06001550 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001551
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001552 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001553}
1554
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001555ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1556 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001557{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001558 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001559 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001560}
1561
Tony Barbour8205d902015-04-16 15:59:00 -06001562ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001563 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001564 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001565 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001566{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001567 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001568 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001569 struct nulldrv_gpu *gpu;
1570 *pGpuCount = 1;
1571 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001572 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001573 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001574 return ret;
1575}
1576
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001577ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001578 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001579 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001580 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001581 char* const* pOutLayers,
1582 void* pReserved)
1583{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001584 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001585 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001586}
1587
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001588ICD_EXPORT VkResult VKAPI vkDestroyObject(
Mike Stroyan230e6252015-04-17 12:36:38 -06001589 VkDevice device,
1590 VkObjectType objType,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001591 VkObject object)
David Pinedo0257fbf2015-02-02 18:02:40 -07001592{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001593 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001594 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001595}
1596
Tony Barbour426b9052015-06-24 16:06:58 -06001597ICD_EXPORT VkResult VKAPI vkGetObjectMemoryRequirements(
Mike Stroyan230e6252015-04-17 12:36:38 -06001598 VkDevice device,
1599 VkObjectType objType,
1600 VkObject object,
Tony Barbour426b9052015-06-24 16:06:58 -06001601 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -07001602{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001603 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001604 struct nulldrv_base *base = nulldrv_base(object);
1605
Tony Barbour426b9052015-06-24 16:06:58 -06001606 return base->get_memory_requirements(base, pMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -07001607}
1608
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001609ICD_EXPORT VkResult VKAPI vkBindObjectMemory(
1610 VkDevice device,
Mike Stroyan230e6252015-04-17 12:36:38 -06001611 VkObjectType objType,
1612 VkObject object,
Tony Barbour8205d902015-04-16 15:59:00 -06001613 VkDeviceMemory mem_,
1614 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001615{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001616 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001617 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001618}
1619
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001620ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001621 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001622 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001623 VkDeviceSize rangeOffset,
1624 VkDeviceSize rangeSize,
1625 VkDeviceMemory mem,
1626 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001627{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001628 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001629 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001630}
1631
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001632ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001633 VkQueue queue,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001634 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001635 const VkImageMemoryBindInfo* pBindInfo,
1636 VkDeviceMemory mem,
1637 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001638{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001639 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001640 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001641}
1642
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001643ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(
1644 VkDevice device,
1645 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1646 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001647{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001648 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001649 struct nulldrv_dev *dev = nulldrv_dev(device);
1650
1651 return graphics_pipeline_create(dev, pCreateInfo,
1652 (struct nulldrv_pipeline **) pPipeline);
1653}
1654
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001655ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(
1656 VkDevice device,
1657 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1658 VkPipeline basePipeline,
1659 VkPipeline* pPipeline)
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001660{
1661 NULLDRV_LOG_FUNC;
1662 struct nulldrv_dev *dev = nulldrv_dev(device);
1663
1664 return graphics_pipeline_create(dev, pCreateInfo,
1665 (struct nulldrv_pipeline **) pPipeline);
1666}
1667
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001668ICD_EXPORT VkResult VKAPI vkCreateComputePipeline(
1669 VkDevice device,
1670 const VkComputePipelineCreateInfo* pCreateInfo,
1671 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001672{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001673 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001674 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001675}
1676
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001677ICD_EXPORT VkResult VKAPI vkStorePipeline(
Mike Stroyan230e6252015-04-17 12:36:38 -06001678 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001679 VkPipeline pipeline,
David Pinedo0257fbf2015-02-02 18:02:40 -07001680 size_t* pDataSize,
1681 void* pData)
1682{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001683 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001684 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001685}
1686
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001687ICD_EXPORT VkResult VKAPI vkLoadPipeline(
1688 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001689 size_t dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001690 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001691 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001692{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001693 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001694 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001695}
1696
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001697ICD_EXPORT VkResult VKAPI vkLoadPipelineDerivative(
1698 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001699 size_t dataSize,
1700 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001701 VkPipeline basePipeline,
1702 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001703{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001704 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001705 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001706}
1707
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001708ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1709 VkDevice device,
1710 const VkQueryPoolCreateInfo* pCreateInfo,
1711 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001712{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001713 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001714 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001715}
1716
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001717ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001718 VkDevice device,
1719 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001720 uint32_t startQuery,
1721 uint32_t queryCount,
1722 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001723 void* pData,
1724 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001725{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001726 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001727 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001728}
1729
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001730ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1731 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001732{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001733 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001734 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001735}
1736
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001737ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1738 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001739 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001740 const VkCmdBuffer* pCmdBuffers,
1741 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001742{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001743 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001744 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001745}
1746
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001747ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1748 VkDevice device,
1749 const VkSemaphoreCreateInfo* pCreateInfo,
1750 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001751{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001752 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001753 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001754}
1755
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001756ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1757 VkQueue queue,
1758 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001759{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001760 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001761 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001762}
1763
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001764ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1765 VkQueue queue,
1766 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001767{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001768 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001769 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001770}
1771
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001772ICD_EXPORT VkResult VKAPI vkCreateSampler(
1773 VkDevice device,
1774 const VkSamplerCreateInfo* pCreateInfo,
1775 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07001776{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001777 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001778 struct nulldrv_dev *dev = nulldrv_dev(device);
1779
1780 return nulldrv_sampler_create(dev, pCreateInfo,
1781 (struct nulldrv_sampler **) pSampler);
1782}
1783
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001784ICD_EXPORT VkResult VKAPI vkCreateShader(
1785 VkDevice device,
1786 const VkShaderCreateInfo* pCreateInfo,
1787 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07001788{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001789 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001790 struct nulldrv_dev *dev = nulldrv_dev(device);
1791
1792 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
1793}
1794
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001795ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
1796 VkDevice device,
1797 const VkDynamicVpStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001798 VkDynamicVpState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001799{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001800 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001801 struct nulldrv_dev *dev = nulldrv_dev(device);
1802
1803 return nulldrv_viewport_state_create(dev, pCreateInfo,
1804 (struct nulldrv_dynamic_vp **) pState);
1805}
1806
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001807ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
1808 VkDevice device,
1809 const VkDynamicRsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001810 VkDynamicRsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001811{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001812 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001813 struct nulldrv_dev *dev = nulldrv_dev(device);
1814
1815 return nulldrv_raster_state_create(dev, pCreateInfo,
1816 (struct nulldrv_dynamic_rs **) pState);
1817}
1818
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001819ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
1820 VkDevice device,
1821 const VkDynamicCbStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001822 VkDynamicCbState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001823{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001824 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001825 struct nulldrv_dev *dev = nulldrv_dev(device);
1826
1827 return nulldrv_blend_state_create(dev, pCreateInfo,
1828 (struct nulldrv_dynamic_cb **) pState);
1829}
1830
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001831ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
1832 VkDevice device,
1833 const VkDynamicDsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001834 VkDynamicDsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001835{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001836 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001837 struct nulldrv_dev *dev = nulldrv_dev(device);
1838
1839 return nulldrv_ds_state_create(dev, pCreateInfo,
1840 (struct nulldrv_dynamic_ds **) pState);
1841}
1842
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001843ICD_EXPORT VkResult VKAPI vkCreateBufferView(
1844 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001845 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001846 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001847{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001848 NULLDRV_LOG_FUNC;
1849 struct nulldrv_dev *dev = nulldrv_dev(device);
1850
1851 return nulldrv_buf_view_create(dev, pCreateInfo,
1852 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07001853}
1854
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001855ICD_EXPORT VkResult VKAPI vkCreateImageView(
1856 VkDevice device,
1857 const VkImageViewCreateInfo* pCreateInfo,
1858 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001859{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001860 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001861 struct nulldrv_dev *dev = nulldrv_dev(device);
1862
1863 return nulldrv_img_view_create(dev, pCreateInfo,
1864 (struct nulldrv_img_view **) pView);
1865}
1866
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001867ICD_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
1868 VkDevice device,
1869 const VkColorAttachmentViewCreateInfo* pCreateInfo,
1870 VkColorAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001871{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001872 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001873 struct nulldrv_dev *dev = nulldrv_dev(device);
1874
1875 return nulldrv_rt_view_create(dev, pCreateInfo,
1876 (struct nulldrv_rt_view **) pView);
1877}
1878
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001879ICD_EXPORT VkResult VKAPI vkCreateDepthStencilView(
1880 VkDevice device,
1881 const VkDepthStencilViewCreateInfo* pCreateInfo,
1882 VkDepthStencilView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001883{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001884 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001885 struct nulldrv_dev *dev = nulldrv_dev(device);
1886
1887 return nulldrv_ds_view_create(dev, pCreateInfo,
1888 (struct nulldrv_ds_view **) pView);
1889
1890}
1891
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001892ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
1893 VkDevice device,
1894 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
1895 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001896{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001897 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001898 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07001899
Chia-I Wu7732cb22015-03-26 15:27:55 +08001900 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07001901 (struct nulldrv_desc_layout **) pSetLayout);
1902}
1903
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001904ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
1905 VkDevice device,
1906 const VkPipelineLayoutCreateInfo* pCreateInfo,
1907 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08001908{
1909 NULLDRV_LOG_FUNC;
1910 struct nulldrv_dev *dev = nulldrv_dev(device);
1911
Mark Lobodzinski556f7212015-04-17 14:11:39 -05001912 return nulldrv_pipeline_layout_create(dev,
1913 pCreateInfo,
1914 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08001915}
1916
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001917ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
1918 VkDevice device,
1919 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07001920 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001921 const VkDescriptorPoolCreateInfo* pCreateInfo,
1922 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001923{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001924 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001925 struct nulldrv_dev *dev = nulldrv_dev(device);
1926
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001927 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
1928 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07001929}
1930
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001931ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06001932 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001933 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001934{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001935 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001936 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001937}
1938
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001939ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06001940 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001941 VkDescriptorPool descriptorPool,
1942 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07001943 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001944 const VkDescriptorSetLayout* pSetLayouts,
1945 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07001946 uint32_t* pCount)
1947{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001948 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001949 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
1950 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001951 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001952 uint32_t i;
1953
1954 for (i = 0; i < count; i++) {
1955 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001956 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07001957
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001958 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001959 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001960 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07001961 break;
1962 }
1963
1964 if (pCount)
1965 *pCount = i;
1966
1967 return ret;
1968}
1969
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08001970ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
1971 VkDevice device,
1972 uint32_t writeCount,
1973 const VkWriteDescriptorSet* pDescriptorWrites,
1974 uint32_t copyCount,
1975 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07001976{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001977 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08001978 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001979}
1980
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001981ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
1982 VkDevice device,
1983 const VkFramebufferCreateInfo* info,
1984 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07001985{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001986 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001987 struct nulldrv_dev *dev = nulldrv_dev(device);
1988
1989 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
1990}
1991
1992
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001993ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
1994 VkDevice device,
1995 const VkRenderPassCreateInfo* info,
1996 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07001997{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001998 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001999 struct nulldrv_dev *dev = nulldrv_dev(device);
2000
2001 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2002}
2003
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002004ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002005 VkCmdBuffer cmdBuffer,
2006 const VkRenderPassBegin* pRenderPassBegin)
David Pinedo0257fbf2015-02-02 18:02:40 -07002007{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002008 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002009}
2010
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002011ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002012 VkCmdBuffer cmdBuffer)
2013{
2014 NULLDRV_LOG_FUNC;
2015}
2016
2017ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2018 VkCmdBuffer cmdBuffer,
2019 uint32_t cmdBuffersCount,
2020 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002021{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002022 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002023}
Ian Elliottf93069f2015-02-19 14:26:19 -07002024
2025ICD_EXPORT void* xcbCreateWindow(
2026 uint16_t width,
2027 uint16_t height)
2028{
2029 static uint32_t window; // Kludge to the max
2030 NULLDRV_LOG_FUNC;
2031 return &window;
2032}
2033
2034// May not be needed, if we stub out stuf in tri.c
2035ICD_EXPORT void xcbDestroyWindow()
2036{
2037 NULLDRV_LOG_FUNC;
2038}
2039
2040ICD_EXPORT int xcbGetMessage(void *msg)
2041{
2042 NULLDRV_LOG_FUNC;
2043 return 0;
2044}
2045
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002046ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002047{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002048 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002049}