blob: bc30671b9744a270cab2a78a79333f42b08a4bfc [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] = {
Chia-I Wu5b66aa52015-04-16 22:02:10 +080043 [NULLDRV_EXT_WSI_LUNARG] = "VK_WSI_LunarG",
David Pinedo0257fbf2015-02-02 18:02:40 -070044};
45
Mike Stroyan230e6252015-04-17 12:36:38 -060046static struct nulldrv_base *nulldrv_base(VkObject base)
David Pinedo0257fbf2015-02-02 18:02:40 -070047{
48 return (struct nulldrv_base *) base;
49}
50
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060051static VkResult nulldrv_base_get_info(struct nulldrv_base *base, int type,
David Pinedo0257fbf2015-02-02 18:02:40 -070052 size_t *size, void *data)
53{
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060054 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -070055 size_t s;
56 uint32_t *count;
57
58 switch (type) {
Tony Barbour8205d902015-04-16 15:59:00 -060059 case VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS:
David Pinedo0257fbf2015-02-02 18:02:40 -070060 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060061 s = sizeof(VkMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -070062 *size = s;
63 if (data == NULL)
64 return ret;
65 memset(data, 0, s);
David Pinedo0257fbf2015-02-02 18:02:40 -070066 break;
67 }
Tony Barbour8205d902015-04-16 15:59:00 -060068 case VK_OBJECT_INFO_TYPE_MEMORY_ALLOCATION_COUNT:
David Pinedo0257fbf2015-02-02 18:02:40 -070069 *size = sizeof(uint32_t);
70 if (data == NULL)
71 return ret;
72 count = (uint32_t *) data;
73 *count = 1;
74 break;
David Pinedo0257fbf2015-02-02 18:02:40 -070075 default:
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060076 ret = VK_ERROR_INVALID_VALUE;
David Pinedo0257fbf2015-02-02 18:02:40 -070077 break;
78 }
79
80 return ret;
81}
82
83static struct nulldrv_base *nulldrv_base_create(struct nulldrv_dev *dev,
84 size_t obj_size,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060085 VK_DBG_OBJECT_TYPE type)
David Pinedo0257fbf2015-02-02 18:02:40 -070086{
87 struct nulldrv_base *base;
88
89 if (!obj_size)
90 obj_size = sizeof(*base);
91
92 assert(obj_size >= sizeof(*base));
93
Chia-I Wu493a1752015-02-22 14:40:25 +080094 base = (struct nulldrv_base*)malloc(obj_size);
David Pinedo0257fbf2015-02-02 18:02:40 -070095 if (!base)
96 return NULL;
97
98 memset(base, 0, obj_size);
99
100 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbour11e76ac2015-04-20 16:28:46 -0600101 set_loader_magic_value((VkObject) base);
David Pinedo0257fbf2015-02-02 18:02:40 -0700102
103 if (dev == NULL) {
104 /*
105 * dev is NULL when we are creating the base device object
106 * Set dev now so that debug setup happens correctly
107 */
108 dev = (struct nulldrv_dev *) base;
109 }
110
111
112 base->get_info = NULL;
113
114 return base;
115}
116
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600117static VkResult nulldrv_gpu_add(int devid, const char *primary_node,
David Pinedo0257fbf2015-02-02 18:02:40 -0700118 const char *render_node, struct nulldrv_gpu **gpu_ret)
119{
120 struct nulldrv_gpu *gpu;
121
Chia-I Wu493a1752015-02-22 14:40:25 +0800122 gpu = malloc(sizeof(*gpu));
David Pinedo0257fbf2015-02-02 18:02:40 -0700123 if (!gpu)
Tony Barbour8205d902015-04-16 15:59:00 -0600124 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700125 memset(gpu, 0, sizeof(*gpu));
Mark Lobodzinski97dcd042015-04-16 08:52:00 -0500126
David Pinedo0257fbf2015-02-02 18:02:40 -0700127 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbour11e76ac2015-04-20 16:28:46 -0600128 set_loader_magic_value((VkObject) gpu);
David Pinedo0257fbf2015-02-02 18:02:40 -0700129
130 *gpu_ret = gpu;
131
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600132 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700133}
134
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600135static VkResult nulldrv_queue_create(struct nulldrv_dev *dev,
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700136 uint32_t node_index,
David Pinedo0257fbf2015-02-02 18:02:40 -0700137 struct nulldrv_queue **queue_ret)
138{
139 struct nulldrv_queue *queue;
140
141 queue = (struct nulldrv_queue *) nulldrv_base_create(dev, sizeof(*queue),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600142 VK_DBG_OBJECT_QUEUE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700143 if (!queue)
Tony Barbour8205d902015-04-16 15:59:00 -0600144 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700145
146 queue->dev = dev;
147
148 *queue_ret = queue;
149
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600150 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700151}
152
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600153static VkResult dev_create_queues(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600154 const VkDeviceQueueCreateInfo *queues,
David Pinedo0257fbf2015-02-02 18:02:40 -0700155 uint32_t count)
156{
157 uint32_t i;
158
159 if (!count)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600160 return VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700161
162 for (i = 0; i < count; i++) {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600163 const VkDeviceQueueCreateInfo *q = &queues[i];
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600164 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700165
166 if (q->queueCount == 1 && !dev->queues[q->queueNodeIndex]) {
167 ret = nulldrv_queue_create(dev, q->queueNodeIndex,
168 &dev->queues[q->queueNodeIndex]);
169 }
170 else {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600171 ret = VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700172 }
173
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600174 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700175 return ret;
176 }
177 }
178
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600179 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700180}
181
182static enum nulldrv_ext_type nulldrv_gpu_lookup_extension(const struct nulldrv_gpu *gpu,
183 const char *ext)
184{
185 enum nulldrv_ext_type type;
186
187 for (type = 0; type < ARRAY_SIZE(nulldrv_gpu_exts); type++) {
188 if (nulldrv_gpu_exts[type] && strcmp(nulldrv_gpu_exts[type], ext) == 0)
189 break;
190 }
191
192 assert(type < NULLDRV_EXT_COUNT || type == NULLDRV_EXT_INVALID);
193
194 return type;
195}
196
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600197static VkResult nulldrv_desc_ooxx_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800198 struct nulldrv_desc_ooxx **ooxx_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700199{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800200 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700201
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800202 ooxx = malloc(sizeof(*ooxx));
203 if (!ooxx)
Tony Barbour8205d902015-04-16 15:59:00 -0600204 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700205
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800206 memset(ooxx, 0, sizeof(*ooxx));
David Pinedo0257fbf2015-02-02 18:02:40 -0700207
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800208 ooxx->surface_desc_size = 0;
209 ooxx->sampler_desc_size = 0;
David Pinedo0257fbf2015-02-02 18:02:40 -0700210
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800211 *ooxx_ret = ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700212
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600213 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700214}
215
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600216static VkResult nulldrv_dev_create(struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600217 const VkDeviceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700218 struct nulldrv_dev **dev_ret)
219{
220 struct nulldrv_dev *dev;
221 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600222 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -0700223
224 dev = (struct nulldrv_dev *) nulldrv_base_create(NULL, sizeof(*dev),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600225 VK_DBG_OBJECT_DEVICE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700226 if (!dev)
Tony Barbour8205d902015-04-16 15:59:00 -0600227 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700228
229 for (i = 0; i < info->extensionCount; i++) {
230 const enum nulldrv_ext_type ext = nulldrv_gpu_lookup_extension(gpu,
231 info->ppEnabledExtensionNames[i]);
232
233 if (ext == NULLDRV_EXT_INVALID)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600234 return VK_ERROR_INVALID_EXTENSION;
David Pinedo0257fbf2015-02-02 18:02:40 -0700235
236 dev->exts[ext] = true;
237 }
238
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800239 ret = nulldrv_desc_ooxx_create(dev, &dev->desc_ooxx);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600240 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700241 return ret;
242 }
243
244 ret = dev_create_queues(dev, info->pRequestedQueues,
245 info->queueRecordCount);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600246 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700247 return ret;
248 }
249
250 *dev_ret = dev;
251
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600252 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700253}
254
Tony Barbour8205d902015-04-16 15:59:00 -0600255static struct nulldrv_gpu *nulldrv_gpu(VkPhysicalDevice gpu)
David Pinedo0257fbf2015-02-02 18:02:40 -0700256{
257 return (struct nulldrv_gpu *) gpu;
258}
259
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600260static VkResult nulldrv_rt_view_create(struct nulldrv_dev *dev,
261 const VkColorAttachmentViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700262 struct nulldrv_rt_view **view_ret)
263{
264 struct nulldrv_rt_view *view;
265
266 view = (struct nulldrv_rt_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600267 VK_DBG_OBJECT_COLOR_TARGET_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700268 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600269 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700270
271 *view_ret = view;
272
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600273 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700274}
275
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600276static VkResult nulldrv_fence_create(struct nulldrv_dev *dev,
277 const VkFenceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700278 struct nulldrv_fence **fence_ret)
279{
280 struct nulldrv_fence *fence;
281
282 fence = (struct nulldrv_fence *) nulldrv_base_create(dev, sizeof(*fence),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600283 VK_DBG_OBJECT_FENCE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700284 if (!fence)
Tony Barbour8205d902015-04-16 15:59:00 -0600285 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700286
287 *fence_ret = fence;
288
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600289 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700290}
291
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600292static struct nulldrv_dev *nulldrv_dev(VkDevice dev)
David Pinedo0257fbf2015-02-02 18:02:40 -0700293{
294 return (struct nulldrv_dev *) dev;
295}
296
297static struct nulldrv_img *nulldrv_img_from_base(struct nulldrv_base *base)
298{
299 return (struct nulldrv_img *) base;
300}
301
302
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600303static VkResult img_get_info(struct nulldrv_base *base, int type,
David Pinedo0257fbf2015-02-02 18:02:40 -0700304 size_t *size, void *data)
305{
306 struct nulldrv_img *img = nulldrv_img_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600307 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700308
309 switch (type) {
Tony Barbour8205d902015-04-16 15:59:00 -0600310 case VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS:
David Pinedo0257fbf2015-02-02 18:02:40 -0700311 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600312 VkMemoryRequirements *mem_req = data;
David Pinedo0257fbf2015-02-02 18:02:40 -0700313
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600314 *size = sizeof(VkMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -0700315 if (data == NULL)
316 return ret;
317 mem_req->size = img->total_size;
318 mem_req->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700319 }
320 break;
321 default:
322 ret = nulldrv_base_get_info(base, type, size, data);
323 break;
324 }
325
326 return ret;
327}
328
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600329static VkResult nulldrv_img_create(struct nulldrv_dev *dev,
330 const VkImageCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700331 bool scanout,
332 struct nulldrv_img **img_ret)
333{
334 struct nulldrv_img *img;
335
336 img = (struct nulldrv_img *) nulldrv_base_create(dev, sizeof(*img),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600337 VK_DBG_OBJECT_IMAGE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700338 if (!img)
Tony Barbour8205d902015-04-16 15:59:00 -0600339 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700340
341 img->type = info->imageType;
342 img->depth = info->extent.depth;
343 img->mip_levels = info->mipLevels;
344 img->array_size = info->arraySize;
345 img->usage = info->usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700346 img->samples = info->samples;
347
348 img->obj.base.get_info = img_get_info;
349
350 *img_ret = img;
351
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600352 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700353}
354
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600355static struct nulldrv_img *nulldrv_img(VkImage image)
David Pinedo0257fbf2015-02-02 18:02:40 -0700356{
357 return (struct nulldrv_img *) image;
358}
359
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600360static VkResult nulldrv_mem_alloc(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600361 const VkMemoryAllocInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700362 struct nulldrv_mem **mem_ret)
363{
364 struct nulldrv_mem *mem;
365
366 mem = (struct nulldrv_mem *) nulldrv_base_create(dev, sizeof(*mem),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600367 VK_DBG_OBJECT_GPU_MEMORY);
David Pinedo0257fbf2015-02-02 18:02:40 -0700368 if (!mem)
Tony Barbour8205d902015-04-16 15:59:00 -0600369 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700370
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700371 mem->bo = malloc(info->allocationSize);
David Pinedo0257fbf2015-02-02 18:02:40 -0700372 if (!mem->bo) {
Tony Barbour8205d902015-04-16 15:59:00 -0600373 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700374 }
375
376 mem->size = info->allocationSize;
377
378 *mem_ret = mem;
379
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600380 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700381}
382
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600383static VkResult nulldrv_ds_view_create(struct nulldrv_dev *dev,
384 const VkDepthStencilViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700385 struct nulldrv_ds_view **view_ret)
386{
387 struct nulldrv_img *img = nulldrv_img(info->image);
388 struct nulldrv_ds_view *view;
389
390 view = (struct nulldrv_ds_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600391 VK_DBG_OBJECT_DEPTH_STENCIL_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700392 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600393 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700394
395 view->img = img;
396
397 view->array_size = info->arraySize;
398
399 *view_ret = view;
400
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600401 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700402}
403
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600404static VkResult nulldrv_sampler_create(struct nulldrv_dev *dev,
405 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700406 struct nulldrv_sampler **sampler_ret)
407{
408 struct nulldrv_sampler *sampler;
409
410 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600411 sizeof(*sampler), VK_DBG_OBJECT_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700412 if (!sampler)
Tony Barbour8205d902015-04-16 15:59:00 -0600413 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700414
415 *sampler_ret = sampler;
416
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600417 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700418}
419
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600420static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
421 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700422 struct nulldrv_img_view **view_ret)
423{
424 struct nulldrv_img *img = nulldrv_img(info->image);
425 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700426
427 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600428 VK_DBG_OBJECT_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700429 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600430 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700431
432 view->img = img;
433 view->min_lod = info->minLod;
434
David Pinedo0257fbf2015-02-02 18:02:40 -0700435 view->cmd_len = 8;
436
437 *view_ret = view;
438
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600439 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700440}
441
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600442static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700443{
444 return mem->bo;
445}
446
Tony Barbour8205d902015-04-16 15:59:00 -0600447static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700448{
449 return (struct nulldrv_mem *) mem;
450}
451
452static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
453{
454 return (struct nulldrv_buf *) base;
455}
456
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600457static VkResult buf_get_info(struct nulldrv_base *base, int type,
David Pinedo0257fbf2015-02-02 18:02:40 -0700458 size_t *size, void *data)
459{
460 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600461 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700462
463 switch (type) {
Tony Barbour8205d902015-04-16 15:59:00 -0600464 case VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS:
David Pinedo0257fbf2015-02-02 18:02:40 -0700465 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600466 VkMemoryRequirements *mem_req = data;
David Pinedo0257fbf2015-02-02 18:02:40 -0700467
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600468 *size = sizeof(VkMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -0700469 if (data == NULL)
470 return ret;
471
472 mem_req->size = buf->size;
473 mem_req->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700474
475 }
476 break;
David Pinedo0257fbf2015-02-02 18:02:40 -0700477 default:
478 ret = nulldrv_base_get_info(base, type, size, data);
479 break;
480 }
481
482 return ret;
483}
484
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600485static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600486 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700487 struct nulldrv_buf **buf_ret)
488{
489 struct nulldrv_buf *buf;
490
491 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600492 VK_DBG_OBJECT_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700493 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600494 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700495
496 buf->size = info->size;
497 buf->usage = info->usage;
498
499 buf->obj.base.get_info = buf_get_info;
500
501 *buf_ret = buf;
502
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600503 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700504}
505
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600506static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
507 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700508 struct nulldrv_desc_layout **layout_ret)
509{
510 struct nulldrv_desc_layout *layout;
511
512 layout = (struct nulldrv_desc_layout *)
513 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600514 VK_DBG_OBJECT_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700515 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600516 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700517
518 *layout_ret = layout;
519
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600520 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700521}
522
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500523static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
524 const VkPipelineLayoutCreateInfo* pCreateInfo,
525 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800526{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500527 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800528
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500529 pipeline_layout = (struct nulldrv_pipeline_layout *)
530 nulldrv_base_create(dev, sizeof(*pipeline_layout),
531 VK_DBG_OBJECT_PIPELINE_LAYOUT);
532 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600533 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800534
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500535 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800536
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600537 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800538}
539
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600540static struct nulldrv_desc_layout *nulldrv_desc_layout(VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700541{
542 return (struct nulldrv_desc_layout *) layout;
543}
544
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600545static VkResult shader_create(struct nulldrv_dev *dev,
546 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700547 struct nulldrv_shader **sh_ret)
548{
David Pinedo0257fbf2015-02-02 18:02:40 -0700549 struct nulldrv_shader *sh;
550
551 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600552 VK_DBG_OBJECT_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700553 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600554 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700555
556 *sh_ret = sh;
557
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600558 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700559}
560
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600561static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
562 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700563 struct nulldrv_pipeline **pipeline_ret)
564{
565 struct nulldrv_pipeline *pipeline;
566
567 pipeline = (struct nulldrv_pipeline *)
568 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600569 VK_DBG_OBJECT_GRAPHICS_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700570 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600571 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700572
573 *pipeline_ret = pipeline;
574
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600575 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700576}
577
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600578static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
579 const VkDynamicVpStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700580 struct nulldrv_dynamic_vp **state_ret)
581{
582 struct nulldrv_dynamic_vp *state;
583
584 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600585 sizeof(*state), VK_DBG_OBJECT_VIEWPORT_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700586 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600587 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700588
589 *state_ret = state;
590
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600591 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700592}
593
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600594static VkResult nulldrv_raster_state_create(struct nulldrv_dev *dev,
595 const VkDynamicRsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700596 struct nulldrv_dynamic_rs **state_ret)
597{
598 struct nulldrv_dynamic_rs *state;
599
600 state = (struct nulldrv_dynamic_rs *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600601 sizeof(*state), VK_DBG_OBJECT_RASTER_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700602 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600603 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700604
605 *state_ret = state;
606
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600607 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700608}
609
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600610static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
611 const VkDynamicCbStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700612 struct nulldrv_dynamic_cb **state_ret)
613{
614 struct nulldrv_dynamic_cb *state;
615
616 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600617 sizeof(*state), VK_DBG_OBJECT_COLOR_BLEND_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700618 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600619 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700620
621 *state_ret = state;
622
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600623 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700624}
625
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600626static VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
627 const VkDynamicDsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700628 struct nulldrv_dynamic_ds **state_ret)
629{
630 struct nulldrv_dynamic_ds *state;
631
632 state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600633 sizeof(*state), VK_DBG_OBJECT_DEPTH_STENCIL_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700634 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600635 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700636
637 *state_ret = state;
638
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600639 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700640}
641
642
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600643static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
644 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700645 struct nulldrv_cmd **cmd_ret)
646{
David Pinedo0257fbf2015-02-02 18:02:40 -0700647 struct nulldrv_cmd *cmd;
648
David Pinedo0257fbf2015-02-02 18:02:40 -0700649 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600650 VK_DBG_OBJECT_CMD_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700651 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600652 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700653
654 *cmd_ret = cmd;
655
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600656 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700657}
658
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600659static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
660 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700661 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600662 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800663 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700664{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800665 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700666
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800667 pool = (struct nulldrv_desc_pool *)
668 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600669 VK_DBG_OBJECT_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800670 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600671 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700672
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800673 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700674
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800675 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700676
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600677 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700678}
679
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600680static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800681 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600682 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700683 const struct nulldrv_desc_layout *layout,
684 struct nulldrv_desc_set **set_ret)
685{
686 struct nulldrv_desc_set *set;
687
688 set = (struct nulldrv_desc_set *)
689 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600690 VK_DBG_OBJECT_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700691 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600692 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700693
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800694 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700695 set->layout = layout;
696 *set_ret = set;
697
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600698 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700699}
700
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600701static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700702{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800703 return (struct nulldrv_desc_pool *) pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700704}
705
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600706static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
707 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700708 struct nulldrv_framebuffer ** fb_ret)
709{
710
711 struct nulldrv_framebuffer *fb;
712 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600713 VK_DBG_OBJECT_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700714 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600715 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700716
717 *fb_ret = fb;
718
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600719 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700720
721}
722
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600723static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
724 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700725 struct nulldrv_render_pass** rp_ret)
726{
727 struct nulldrv_render_pass *rp;
728 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600729 VK_DBG_OBJECT_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700730 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600731 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700732
733 *rp_ret = rp;
734
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600735 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700736}
737
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600738static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700739{
740 return (struct nulldrv_buf *) buf;
741}
742
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600743static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600744 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700745 struct nulldrv_buf_view **view_ret)
746{
747 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
748 struct nulldrv_buf_view *view;
749
750 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600751 VK_DBG_OBJECT_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700752 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600753 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700754
755 view->buf = buf;
756
757 *view_ret = view;
758
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600759 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700760}
761
David Pinedo0257fbf2015-02-02 18:02:40 -0700762
763//*********************************************
764// Driver entry points
765//*********************************************
766
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600767ICD_EXPORT VkResult VKAPI vkCreateBuffer(
768 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600769 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600770 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700771{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700772 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700773 struct nulldrv_dev *dev = nulldrv_dev(device);
774
775 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
776}
777
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600778ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
779 VkDevice device,
780 const VkCmdBufferCreateInfo* pCreateInfo,
781 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700782{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700783 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700784 struct nulldrv_dev *dev = nulldrv_dev(device);
785
786 return nulldrv_cmd_create(dev, pCreateInfo,
787 (struct nulldrv_cmd **) pCmdBuffer);
788}
789
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600790ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
791 VkCmdBuffer cmdBuffer,
792 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700793{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700794 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600795 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700796}
797
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600798ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
799 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700800{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700801 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600802 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700803}
804
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600805ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
806 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700807{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700808 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600809 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700810}
811
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600812ICD_EXPORT void VKAPI vkCmdInitAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600813 VkCmdBuffer cmdBuffer,
814 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700815 uint32_t startCounter,
816 uint32_t counterCount,
817 const uint32_t* pData)
818{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700819 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700820}
821
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600822ICD_EXPORT void VKAPI vkCmdLoadAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600823 VkCmdBuffer cmdBuffer,
824 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700825 uint32_t startCounter,
826 uint32_t counterCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600827 VkBuffer srcBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600828 VkDeviceSize srcOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700829{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700830 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700831}
832
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600833ICD_EXPORT void VKAPI vkCmdSaveAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600834 VkCmdBuffer cmdBuffer,
835 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700836 uint32_t startCounter,
837 uint32_t counterCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600838 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600839 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700840{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700841 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700842}
843
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600844ICD_EXPORT void VKAPI vkCmdDbgMarkerBegin(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600845 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700846 const char* pMarker)
847{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700848 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700849}
850
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600851ICD_EXPORT void VKAPI vkCmdDbgMarkerEnd(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600852 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700853{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700854 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700855}
856
Ian Elliott64a68e12015-04-16 11:57:46 -0600857static const VkFormat nulldrv_presentable_formats[] = {
858 VK_FORMAT_B8G8R8A8_UNORM,
859};
860
861ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
862 VkDisplayWSI display,
863 VkDisplayInfoTypeWSI infoType,
864 size_t* pDataSize,
865 void* pData)
866{
867 VkResult ret = VK_SUCCESS;
868
869 NULLDRV_LOG_FUNC;
870
871 if (!pDataSize)
872 return VK_ERROR_INVALID_POINTER;
873
874 switch (infoType) {
875 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
876 {
877 VkDisplayFormatPropertiesWSI *dst = pData;
878 size_t size_ret;
879 uint32_t i;
880
881 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
882
883 if (dst && *pDataSize < size_ret)
884 return VK_ERROR_INVALID_VALUE;
885
886 *pDataSize = size_ret;
887 if (!dst)
888 return VK_SUCCESS;
889
890 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
891 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
892 }
893 break;
894 default:
895 ret = VK_ERROR_INVALID_VALUE;
896 break;
897 }
898
899 return ret;
900}
901
902ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
903 VkDevice device,
904 const VkSwapChainCreateInfoWSI* pCreateInfo,
905 VkSwapChainWSI* pSwapChain)
906{
907 NULLDRV_LOG_FUNC;
908 struct nulldrv_dev *dev = nulldrv_dev(device);
909 struct nulldrv_swap_chain *sc;
910
911 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
912 /*VK_OBJECT_TYPE_SWAP_CHAIN_WSI*//* FIXME: DELETE THIS HACK: */VK_DBG_OBJECT_QUEUE);
913 if (!sc) {
914 return VK_ERROR_OUT_OF_HOST_MEMORY;
915 }
916 sc->dev = dev;
917
Tony Barbour11e76ac2015-04-20 16:28:46 -0600918 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600919
920 return VK_SUCCESS;
921}
922
923ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
924 VkSwapChainWSI swapChain)
925{
926 NULLDRV_LOG_FUNC;
927 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
928
929 free(sc);
930
931 return VK_SUCCESS;
932}
933
934ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
935 VkSwapChainWSI swapChain,
936 VkSwapChainInfoTypeWSI infoType,
937 size_t* pDataSize,
938 void* pData)
939{
940 NULLDRV_LOG_FUNC;
941 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
942 struct nulldrv_dev *dev = sc->dev;
943 VkResult ret = VK_SUCCESS;
944
945 if (!pDataSize)
946 return VK_ERROR_INVALID_POINTER;
947
948 switch (infoType) {
949 case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
950 {
951 VkSwapChainImageInfoWSI *images;
952 const size_t size = sizeof(*images) * 2;
953 uint32_t i;
954
955 if (pData && *pDataSize < size)
956 return VK_ERROR_INVALID_VALUE;
957
958 *pDataSize = size;
959 if (!pData)
960 return VK_SUCCESS;
961
962 images = (VkSwapChainImageInfoWSI *) pData;
963 for (i = 0; i < 2; i++) {
964 struct nulldrv_img *img;
965 struct nulldrv_mem *mem;
966
967 img = (struct nulldrv_img *) nulldrv_base_create(dev,
968 sizeof(*img),
969 VK_DBG_OBJECT_IMAGE);
970 if (!img)
971 return VK_ERROR_OUT_OF_HOST_MEMORY;
972
973 mem = (struct nulldrv_mem *) nulldrv_base_create(dev,
974 sizeof(*mem),
975 VK_DBG_OBJECT_GPU_MEMORY);
976 if (!mem)
977 return VK_ERROR_OUT_OF_HOST_MEMORY;
978
979 images[i].image = (VkImage) img;
980 images[i].memory = (VkDeviceMemory) mem;
981 }
982 }
983 break;
984 default:
985 ret = VK_ERROR_INVALID_VALUE;
986 break;
987 }
988
989 return ret;
990}
991
992ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
993 VkQueue queue_,
994 const VkPresentInfoWSI* pPresentInfo)
995{
996 NULLDRV_LOG_FUNC;
997
998 return VK_SUCCESS;
999}
1000
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001001ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001002 VkCmdBuffer cmdBuffer,
1003 VkBuffer srcBuffer,
1004 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001005 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001006 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001007{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001008 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001009}
1010
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001011ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001012 VkCmdBuffer cmdBuffer,
1013 VkImage srcImage,
1014 VkImageLayout srcImageLayout,
1015 VkImage destImage,
1016 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001017 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001018 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001019{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001020 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001021}
1022
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001023ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001024 VkCmdBuffer cmdBuffer,
1025 VkImage srcImage,
1026 VkImageLayout srcImageLayout,
1027 VkImage destImage,
1028 VkImageLayout destImageLayout,
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -06001029 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001030 const VkImageBlit* pRegions)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -06001031{
1032 NULLDRV_LOG_FUNC;
1033}
1034
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001035ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001036 VkCmdBuffer cmdBuffer,
1037 VkBuffer srcBuffer,
1038 VkImage destImage,
1039 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001040 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001041 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001042{
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 vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001047 VkCmdBuffer cmdBuffer,
1048 VkImage srcImage,
1049 VkImageLayout srcImageLayout,
1050 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001051 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001052 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001053{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001054 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001055}
1056
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001057ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001058 VkCmdBuffer cmdBuffer,
1059 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001060 VkDeviceSize destOffset,
1061 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001062 const uint32_t* pData)
1063{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001064 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001065}
1066
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001067ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001068 VkCmdBuffer cmdBuffer,
1069 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001070 VkDeviceSize destOffset,
1071 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001072 uint32_t data)
1073{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001074 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001075}
1076
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001077ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001078 VkCmdBuffer cmdBuffer,
1079 VkImage image,
1080 VkImageLayout imageLayout,
1081 const VkClearColor *pColor,
1082 uint32_t rangeCount,
1083 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001084{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001085 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001086}
1087
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001088ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001089 VkCmdBuffer cmdBuffer,
1090 VkImage image,
1091 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001092 float depth,
1093 uint32_t stencil,
1094 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001095 const VkImageSubresourceRange* pRanges)
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 vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001101 VkCmdBuffer cmdBuffer,
1102 VkImage srcImage,
1103 VkImageLayout srcImageLayout,
1104 VkImage destImage,
1105 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001106 uint32_t regionCount,
1107 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001108{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001109 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001110}
1111
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001112ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001113 VkCmdBuffer cmdBuffer,
1114 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001115 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001116 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001117{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001118 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001119}
1120
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001121ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001122 VkCmdBuffer cmdBuffer,
1123 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001124 uint32_t slot)
1125{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001126 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001127}
1128
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001129ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001130 VkCmdBuffer cmdBuffer,
1131 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001132 uint32_t startQuery,
1133 uint32_t queryCount)
1134{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001135 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001136}
1137
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001138ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001139 VkCmdBuffer cmdBuffer,
1140 VkEvent event_,
1141 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001142{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001143 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001144}
1145
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001146ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001147 VkCmdBuffer cmdBuffer,
1148 VkEvent event_,
1149 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001150{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001151 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001152}
1153
Ian Elliott63f1edb2015-04-16 18:10:19 -06001154ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1155 VkCmdBuffer cmdBuffer,
1156 VkQueryPool queryPool,
1157 uint32_t startQuery,
1158 uint32_t queryCount,
1159 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001160 VkDeviceSize destOffset,
1161 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001162 VkFlags flags)
1163{
1164 NULLDRV_LOG_FUNC;
1165}
1166
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001167ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001168 VkCmdBuffer cmdBuffer,
1169 VkTimestampType timestampType,
1170 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001171 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001172{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001173 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001174}
1175
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001176ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001177 VkCmdBuffer cmdBuffer,
1178 VkPipelineBindPoint pipelineBindPoint,
1179 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001180{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001181 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001182}
1183
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001184ICD_EXPORT void VKAPI vkCmdBindDynamicStateObject(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001185 VkCmdBuffer cmdBuffer,
1186 VkStateBindPoint stateBindPoint,
1187 VkDynamicStateObject state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001188{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001189 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001190}
1191
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001192ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001193 VkCmdBuffer cmdBuffer,
1194 VkPipelineBindPoint pipelineBindPoint,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001195 uint32_t firstSet,
1196 uint32_t setCount,
1197 const VkDescriptorSet* pDescriptorSets,
1198 uint32_t dynamicOffsetCount,
1199 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001200{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001201 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001202}
1203
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001204ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1205 VkCmdBuffer cmdBuffer,
1206 uint32_t startBinding,
1207 uint32_t bindingCount,
1208 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001209 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001210{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001211 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001212}
1213
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001214ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001215 VkCmdBuffer cmdBuffer,
1216 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001217 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001218 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001219{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001220 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001221}
1222
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001223ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001224 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001225 uint32_t firstVertex,
1226 uint32_t vertexCount,
1227 uint32_t firstInstance,
1228 uint32_t instanceCount)
1229{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001230 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001231}
1232
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001233ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001234 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001235 uint32_t firstIndex,
1236 uint32_t indexCount,
1237 int32_t vertexOffset,
1238 uint32_t firstInstance,
1239 uint32_t instanceCount)
1240{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001241 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001242}
1243
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001244ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001245 VkCmdBuffer cmdBuffer,
1246 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001247 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001248 uint32_t count,
1249 uint32_t stride)
1250{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001251 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001252}
1253
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001254ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001255 VkCmdBuffer cmdBuffer,
1256 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001257 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001258 uint32_t count,
1259 uint32_t stride)
1260{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001261 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001262}
1263
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001264ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001265 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001266 uint32_t x,
1267 uint32_t y,
1268 uint32_t z)
1269{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001270 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001271}
1272
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001273ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001274 VkCmdBuffer cmdBuffer,
1275 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001276 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001277{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001278 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001279}
1280
Tony Barbour8205d902015-04-16 15:59:00 -06001281void VKAPI vkCmdWaitEvents(
1282 VkCmdBuffer cmdBuffer,
1283 VkWaitEvent waitEvent,
1284 uint32_t eventCount,
1285 const VkEvent* pEvents,
1286 uint32_t memBarrierCount,
1287 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001288{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001289 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001290}
1291
Tony Barbour8205d902015-04-16 15:59:00 -06001292void VKAPI vkCmdPipelineBarrier(
1293 VkCmdBuffer cmdBuffer,
1294 VkWaitEvent waitEvent,
1295 uint32_t pipeEventCount,
1296 const VkPipeEvent* pPipeEvents,
1297 uint32_t memBarrierCount,
1298 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001299{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001300 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001301}
1302
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001303ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001304 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001305 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001306 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001307{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001308 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001309 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1310 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1311}
1312
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001313ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1314 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001315{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001316 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001317 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001318}
1319
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001320ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1321 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001322 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001323 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001324 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001325{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001326 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001327 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001328 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001329 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001330}
1331
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001332ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1333 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001334{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001335 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001336 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001337}
1338
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001339ICD_EXPORT VkResult VKAPI vkDbgSetValidationLevel(
1340 VkDevice device,
1341 VkValidationLevel validationLevel)
David Pinedo0257fbf2015-02-02 18:02:40 -07001342{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001343 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001344 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001345}
1346
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001347ICD_EXPORT VkResult VKAPI vkDbgSetMessageFilter(
1348 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001349 int32_t msgCode,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001350 VK_DBG_MSG_FILTER filter)
David Pinedo0257fbf2015-02-02 18:02:40 -07001351{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001352 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001353 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001354}
1355
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001356ICD_EXPORT VkResult VKAPI vkDbgSetDeviceOption(
1357 VkDevice device,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001358 VK_DBG_DEVICE_OPTION dbgOption,
David Pinedo0257fbf2015-02-02 18:02:40 -07001359 size_t dataSize,
1360 const void* pData)
1361{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001362 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001363 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001364}
1365
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001366ICD_EXPORT VkResult VKAPI vkCreateEvent(
1367 VkDevice device,
1368 const VkEventCreateInfo* pCreateInfo,
1369 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001370{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001371 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001372 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001373}
1374
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001375ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001376 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001377 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001378{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001379 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001380 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001381}
1382
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001383ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001384 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001385 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001386{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001387 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001388 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001389}
1390
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001391ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001392 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001393 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001394{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001395 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001396 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001397}
1398
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001399ICD_EXPORT VkResult VKAPI vkCreateFence(
1400 VkDevice device,
1401 const VkFenceCreateInfo* pCreateInfo,
1402 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001403{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001404 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001405 struct nulldrv_dev *dev = nulldrv_dev(device);
1406
1407 return nulldrv_fence_create(dev, pCreateInfo,
1408 (struct nulldrv_fence **) pFence);
1409}
1410
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001411ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001412 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001413 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001414{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001415 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001416 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001417}
1418
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001419ICD_EXPORT VkResult VKAPI vkResetFences(
1420 VkDevice device,
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001421 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001422 VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001423{
1424 NULLDRV_LOG_FUNC;
1425 return VK_SUCCESS;
1426}
1427
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001428ICD_EXPORT VkResult VKAPI vkWaitForFences(
1429 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001430 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001431 const VkFence* pFences,
David Pinedo0257fbf2015-02-02 18:02:40 -07001432 bool32_t waitAll,
1433 uint64_t timeout)
1434{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001435 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001436 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001437}
1438
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001439ICD_EXPORT VkResult VKAPI vkGetFormatInfo(
1440 VkDevice device,
1441 VkFormat format,
1442 VkFormatInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001443 size_t* pDataSize,
1444 void* pData)
1445{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001446 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001447 VkFormatProperties *fmt = (VkFormatProperties *) pData;
1448 VkResult ret = VK_SUCCESS;
1449
1450 switch (infoType) {
1451 case VK_FORMAT_INFO_TYPE_PROPERTIES:
1452 *pDataSize = sizeof(VkFormatProperties);
1453 if (pData == NULL)
1454 return ret;
1455 fmt->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1456 fmt->optimalTilingFeatures = fmt->linearTilingFeatures;
1457 break;
1458 default:
1459 ret = VK_ERROR_INVALID_VALUE;
1460 break;
1461 }
1462
1463 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001464}
1465
Tony Barbour8205d902015-04-16 15:59:00 -06001466ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceInfo(
1467 VkPhysicalDevice gpu_,
1468 VkPhysicalDeviceInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001469 size_t* pDataSize,
1470 void* pData)
1471{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001472 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001473 VkResult ret = VK_SUCCESS;
1474
Ian Elliott32536f92015-04-21 16:41:02 -06001475 if (infoType == VK_PHYSICAL_DEVICE_INFO_TYPE_DISPLAY_PROPERTIES_WSI) {
1476 // NOTE: Handle this extension value as a special case:
1477 struct nulldrv_display *display;
1478 VkDisplayPropertiesWSI *props =
1479 (VkDisplayPropertiesWSI *) pData;
1480 *pDataSize = sizeof(VkDisplayPropertiesWSI);
1481 if (pData == NULL) {
1482 return ret;
1483 }
1484 display = (struct nulldrv_display *) nulldrv_base_create(NULL, sizeof(*display),
1485 /*VK_OBJECT_TYPE_SWAP_CHAIN_WSI*//* FIXME: DELETE THIS HACK: */VK_DBG_OBJECT_QUEUE);
1486 props->display = (VkDisplayWSI) display;
1487 props->physicalResolution.width = 1920;
1488 props->physicalResolution.height = 1080;
1489
1490 return ret;
1491 }
1492
Ian Elliott64a68e12015-04-16 11:57:46 -06001493 switch (infoType) {
1494 case VK_PHYSICAL_DEVICE_INFO_TYPE_PROPERTIES:
1495 {
1496 VkPhysicalDeviceProperties *props =
1497 (VkPhysicalDeviceProperties *) pData;
1498 *pDataSize = sizeof(VkPhysicalDeviceProperties);
1499 if (pData == NULL) {
1500 return ret;
1501 }
1502 props->apiVersion = VK_API_VERSION;
1503 props->driverVersion = 0; // Appropriate that the nulldrv have 0's
1504 props->vendorId = 0;
1505 props->deviceId = 0;
1506 props->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1507 strncpy(props->deviceName, "nulldrv", strlen("nulldrv"));
1508 props->maxInlineMemoryUpdateSize = 0;
1509 props->maxBoundDescriptorSets = 0;
1510 props->maxThreadGroupSize = 0;
1511 props->timestampFrequency = 0;
1512 props->multiColorAttachmentClears = false;
1513 break;
1514 }
1515 case VK_PHYSICAL_DEVICE_INFO_TYPE_PERFORMANCE:
1516 {
1517 VkPhysicalDevicePerformance *perf =
1518 (VkPhysicalDevicePerformance *) pData;
1519 *pDataSize = sizeof(VkPhysicalDevicePerformance);
1520 if (pData == NULL) {
1521 return ret;
1522 }
1523 perf->maxDeviceClock = 1.0f;
1524 perf->aluPerClock = 1.0f;
1525 perf->texPerClock = 1.0f;
1526 perf->primsPerClock = 1.0f;
1527 perf->pixelsPerClock = 1.0f;
1528 break;
1529 }
1530 case VK_PHYSICAL_DEVICE_INFO_TYPE_QUEUE_PROPERTIES:
1531 {
1532 VkPhysicalDeviceQueueProperties *props =
1533 (VkPhysicalDeviceQueueProperties *) pData;
1534 *pDataSize = sizeof(VkPhysicalDeviceQueueProperties);
1535 if (pData == NULL) {
1536 return ret;
1537 }
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001538 props->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
Ian Elliott64a68e12015-04-16 11:57:46 -06001539 props->queueCount = 1;
1540 props->maxAtomicCounters = 1;
1541 props->supportsTimestamps = false;
Ian Elliott64a68e12015-04-16 11:57:46 -06001542 break;
1543 }
1544 default:
1545/* FIXME: WRITE THE REAL CODE*/return ret;
1546 break;
1547 }
1548
1549 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001550}
1551
Jon Ashburneb2728b2015-04-10 14:33:07 -06001552ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionInfo(
1553 VkExtensionInfoType infoType,
1554 uint32_t extensionIndex,
1555 size_t* pDataSize,
1556 void* pData)
1557{
Ian Elliott64a68e12015-04-16 11:57:46 -06001558 VkExtensionProperties *ext_props;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001559 uint32_t *count;
1560
1561 if (pDataSize == NULL)
1562 return VK_ERROR_INVALID_POINTER;
1563
1564 switch (infoType) {
1565 case VK_EXTENSION_INFO_TYPE_COUNT:
1566 *pDataSize = sizeof(uint32_t);
1567 if (pData == NULL)
1568 return VK_SUCCESS;
1569 count = (uint32_t *) pData;
Ian Elliott64a68e12015-04-16 11:57:46 -06001570 *count = 1;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001571 break;
1572 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
Ian Elliott64a68e12015-04-16 11:57:46 -06001573 *pDataSize = sizeof(VkExtensionProperties);
Jon Ashburneb2728b2015-04-10 14:33:07 -06001574 if (pData == NULL)
1575 return VK_SUCCESS;
Ian Elliott64a68e12015-04-16 11:57:46 -06001576 else {
1577 ext_props = (VkExtensionProperties *) pData;
1578 ext_props->version = VK_WSI_LUNARG_REVISION;
1579 strncpy(ext_props->extName, "VK_WSI_LunarG",
1580 strlen("VK_WSI_LunarG")+1);
1581 return VK_SUCCESS;
1582 }
Jon Ashburneb2728b2015-04-10 14:33:07 -06001583 break;
1584 default:
1585 return VK_ERROR_INVALID_VALUE;
1586 };
1587
1588 return VK_SUCCESS;
1589}
1590
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001591VkResult VKAPI vkGetPhysicalDeviceExtensionInfo(
Tony Barbour8205d902015-04-16 15:59:00 -06001592 VkPhysicalDevice gpu,
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001593 VkExtensionInfoType infoType,
1594 uint32_t extensionIndex,
1595 size_t* pDataSize,
1596 void* pData)
David Pinedo0257fbf2015-02-02 18:02:40 -07001597{
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001598 uint32_t *count;
1599
1600 if (pDataSize == NULL)
1601 return VK_ERROR_INVALID_POINTER;
1602
1603 switch (infoType) {
1604 case VK_EXTENSION_INFO_TYPE_COUNT:
1605 *pDataSize = sizeof(uint32_t);
1606 if (pData == NULL)
1607 return VK_SUCCESS;
1608 count = (uint32_t *) pData;
1609 *count = 0;
1610 break;
1611 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
1612 *pDataSize = 0;
1613 if (pData == NULL)
1614 return VK_SUCCESS;
1615 return VK_ERROR_INVALID_EXTENSION;
1616 break;
1617 default:
1618 return VK_ERROR_INVALID_VALUE;
1619 };
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001620 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001621}
1622
Tony Barbour8205d902015-04-16 15:59:00 -06001623ICD_EXPORT VkResult VKAPI vkGetMultiDeviceCompatibility(
1624 VkPhysicalDevice gpu0_,
1625 VkPhysicalDevice gpu1_,
1626 VkPhysicalDeviceCompatibilityInfo* pInfo)
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
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001632ICD_EXPORT VkResult VKAPI vkOpenPeerImage(
1633 VkDevice device,
1634 const VkPeerImageOpenInfo* pOpenInfo,
1635 VkImage* pImage,
Tony Barbour8205d902015-04-16 15:59:00 -06001636 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001637{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001638 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001639 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001640}
1641
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001642ICD_EXPORT VkResult VKAPI vkCreateImage(
1643 VkDevice device,
1644 const VkImageCreateInfo* pCreateInfo,
1645 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001646{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001647 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001648 struct nulldrv_dev *dev = nulldrv_dev(device);
1649
1650 return nulldrv_img_create(dev, pCreateInfo, false,
1651 (struct nulldrv_img **) pImage);
1652}
1653
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001654ICD_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(
Mike Stroyan230e6252015-04-17 12:36:38 -06001655 VkDevice device,
1656 VkImage image,
1657 const VkImageSubresource* pSubresource,
1658 VkSubresourceInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001659 size_t* pDataSize,
1660 void* pData)
1661{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001662 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001663 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001664
1665 switch (infoType) {
Tony Barbour8205d902015-04-16 15:59:00 -06001666 case VK_SUBRESOURCE_INFO_TYPE_LAYOUT:
David Pinedo0257fbf2015-02-02 18:02:40 -07001667 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001668 VkSubresourceLayout *layout = (VkSubresourceLayout *) pData;
David Pinedo0257fbf2015-02-02 18:02:40 -07001669
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001670 *pDataSize = sizeof(VkSubresourceLayout);
David Pinedo0257fbf2015-02-02 18:02:40 -07001671
1672 if (pData == NULL)
1673 return ret;
1674 layout->offset = 0;
1675 layout->size = 1;
1676 layout->rowPitch = 4;
1677 layout->depthPitch = 4;
1678 }
1679 break;
1680 default:
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001681 ret = VK_ERROR_INVALID_VALUE;
David Pinedo0257fbf2015-02-02 18:02:40 -07001682 break;
1683 }
1684
1685 return ret;
1686}
1687
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001688ICD_EXPORT VkResult VKAPI vkAllocMemory(
1689 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001690 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001691 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001692{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001693 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001694 struct nulldrv_dev *dev = nulldrv_dev(device);
1695
1696 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1697}
1698
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001699ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001700 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001701 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001702{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001703 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001704 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001705}
1706
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001707ICD_EXPORT VkResult VKAPI vkSetMemoryPriority(
Mike Stroyan230e6252015-04-17 12:36:38 -06001708 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001709 VkDeviceMemory mem_,
Mike Stroyan230e6252015-04-17 12:36:38 -06001710 VkMemoryPriority priority)
David Pinedo0257fbf2015-02-02 18:02:40 -07001711{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001712 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001713 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001714}
1715
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001716ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001717 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001718 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001719 VkDeviceSize offset,
1720 VkDeviceSize size,
1721 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001722 void** ppData)
1723{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001724 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001725 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1726 void *ptr = nulldrv_mem_map(mem, flags);
1727
1728 *ppData = ptr;
1729
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001730 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001731}
1732
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001733ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001734 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001735 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001736{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001737 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001738 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001739}
1740
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001741ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001742 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001743 uint32_t memRangeCount,
1744 const VkMappedMemoryRange* pMemRanges)
1745{
1746 NULLDRV_LOG_FUNC;
1747 return VK_SUCCESS;
1748}
1749
1750ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1751 VkDevice device,
1752 uint32_t memRangeCount,
1753 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001754{
1755 NULLDRV_LOG_FUNC;
1756 return VK_SUCCESS;
1757}
1758
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001759ICD_EXPORT VkResult VKAPI vkPinSystemMemory(
1760 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001761 const void* pSysMem,
1762 size_t memSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001763 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001764{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001765 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001766 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001767}
1768
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001769ICD_EXPORT VkResult VKAPI vkOpenSharedMemory(
1770 VkDevice device,
1771 const VkMemoryOpenInfo* pOpenInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001772 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001773{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001774 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001775 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001776}
1777
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001778ICD_EXPORT VkResult VKAPI vkOpenPeerMemory(
1779 VkDevice device,
1780 const VkPeerMemoryOpenInfo* pOpenInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001781 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001782{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001783 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001784 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001785}
1786
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001787ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001788 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001789 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001790{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001791 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001792 struct nulldrv_instance *inst;
1793
1794 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001795 VK_DBG_OBJECT_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001796 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001797 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001798
1799 inst->obj.base.get_info = NULL;
1800
Mike Stroyan230e6252015-04-17 12:36:38 -06001801 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001802
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001803 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001804}
1805
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001806ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1807 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001808{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001809 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001810 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001811}
1812
Tony Barbour8205d902015-04-16 15:59:00 -06001813ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001814 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001815 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001816 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001817{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001818 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001819 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001820 struct nulldrv_gpu *gpu;
1821 *pGpuCount = 1;
1822 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001823 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001824 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001825 return ret;
1826}
1827
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001828ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001829 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001830 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001831 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001832 char* const* pOutLayers,
1833 void* pReserved)
1834{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001835 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001836 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001837}
1838
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001839ICD_EXPORT VkResult VKAPI vkDbgRegisterMsgCallback(
1840 VkInstance instance,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001841 VK_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback,
David Pinedo0257fbf2015-02-02 18:02:40 -07001842 void* pUserData)
1843{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001844 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001845 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001846}
1847
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001848ICD_EXPORT VkResult VKAPI vkDbgUnregisterMsgCallback(
1849 VkInstance instance,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001850 VK_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback)
David Pinedo0257fbf2015-02-02 18:02:40 -07001851{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001852 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001853 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001854}
1855
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001856ICD_EXPORT VkResult VKAPI vkDbgSetGlobalOption(
1857 VkInstance instance,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001858 VK_DBG_GLOBAL_OPTION dbgOption,
David Pinedo0257fbf2015-02-02 18:02:40 -07001859 size_t dataSize,
1860 const void* pData)
1861{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001862 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001863 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001864}
1865
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001866ICD_EXPORT VkResult VKAPI vkDestroyObject(
Mike Stroyan230e6252015-04-17 12:36:38 -06001867 VkDevice device,
1868 VkObjectType objType,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001869 VkObject object)
David Pinedo0257fbf2015-02-02 18:02:40 -07001870{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001871 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001872 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001873}
1874
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001875ICD_EXPORT VkResult VKAPI vkGetObjectInfo(
Mike Stroyan230e6252015-04-17 12:36:38 -06001876 VkDevice device,
1877 VkObjectType objType,
1878 VkObject object,
1879 VkObjectInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001880 size_t* pDataSize,
1881 void* pData)
1882{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001883 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001884 struct nulldrv_base *base = nulldrv_base(object);
1885
1886 return base->get_info(base, infoType, pDataSize, pData);
1887}
1888
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001889ICD_EXPORT VkResult VKAPI vkBindObjectMemory(
1890 VkDevice device,
Mike Stroyan230e6252015-04-17 12:36:38 -06001891 VkObjectType objType,
1892 VkObject object,
David Pinedo0257fbf2015-02-02 18:02:40 -07001893 uint32_t allocationIdx,
Tony Barbour8205d902015-04-16 15:59:00 -06001894 VkDeviceMemory mem_,
1895 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001896{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001897 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001898 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001899}
1900
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001901ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001902 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001903 VkBuffer buffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001904 uint32_t allocationIdx,
Tony Barbour8205d902015-04-16 15:59:00 -06001905 VkDeviceSize rangeOffset,
1906 VkDeviceSize rangeSize,
1907 VkDeviceMemory mem,
1908 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001909{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001910 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001911 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001912}
1913
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001914ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001915 VkQueue queue,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001916 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001917 uint32_t allocationIdx,
1918 const VkImageMemoryBindInfo* pBindInfo,
1919 VkDeviceMemory mem,
1920 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001921{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001922 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001923 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001924}
1925
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001926ICD_EXPORT VkResult VKAPI vkDbgSetObjectTag(
Mike Stroyan230e6252015-04-17 12:36:38 -06001927 VkDevice device,
1928 VkObject object,
David Pinedo0257fbf2015-02-02 18:02:40 -07001929 size_t tagSize,
1930 const void* pTag)
1931{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001932 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001933 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001934}
1935
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001936ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(
1937 VkDevice device,
1938 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1939 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001940{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001941 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001942 struct nulldrv_dev *dev = nulldrv_dev(device);
1943
1944 return graphics_pipeline_create(dev, pCreateInfo,
1945 (struct nulldrv_pipeline **) pPipeline);
1946}
1947
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001948ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(
1949 VkDevice device,
1950 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1951 VkPipeline basePipeline,
1952 VkPipeline* pPipeline)
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001953{
1954 NULLDRV_LOG_FUNC;
1955 struct nulldrv_dev *dev = nulldrv_dev(device);
1956
1957 return graphics_pipeline_create(dev, pCreateInfo,
1958 (struct nulldrv_pipeline **) pPipeline);
1959}
1960
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001961ICD_EXPORT VkResult VKAPI vkCreateComputePipeline(
1962 VkDevice device,
1963 const VkComputePipelineCreateInfo* pCreateInfo,
1964 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001965{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001966 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001967 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001968}
1969
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001970ICD_EXPORT VkResult VKAPI vkStorePipeline(
Mike Stroyan230e6252015-04-17 12:36:38 -06001971 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001972 VkPipeline pipeline,
David Pinedo0257fbf2015-02-02 18:02:40 -07001973 size_t* pDataSize,
1974 void* pData)
1975{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001976 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001977 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001978}
1979
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001980ICD_EXPORT VkResult VKAPI vkLoadPipeline(
1981 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001982 size_t dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001983 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001984 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001985{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001986 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001987 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001988}
1989
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001990ICD_EXPORT VkResult VKAPI vkLoadPipelineDerivative(
1991 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001992 size_t dataSize,
1993 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001994 VkPipeline basePipeline,
1995 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001996{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001997 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001998 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001999}
2000
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002001ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
2002 VkDevice device,
2003 const VkQueryPoolCreateInfo* pCreateInfo,
2004 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002005{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002006 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002007 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002008}
2009
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002010ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06002011 VkDevice device,
2012 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07002013 uint32_t startQuery,
2014 uint32_t queryCount,
2015 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06002016 void* pData,
2017 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07002018{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002019 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002020 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002021}
2022
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002023ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
2024 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07002025{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002026 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002027 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002028}
2029
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002030ICD_EXPORT VkResult VKAPI vkQueueSubmit(
2031 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07002032 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002033 const VkCmdBuffer* pCmdBuffers,
2034 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07002035{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002036 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002037 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002038}
2039
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002040ICD_EXPORT VkResult VKAPI vkOpenSharedSemaphore(
2041 VkDevice device,
2042 const VkSemaphoreOpenInfo* pOpenInfo,
2043 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002044{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002045 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002046 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002047}
2048
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002049ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
2050 VkDevice device,
2051 const VkSemaphoreCreateInfo* pCreateInfo,
2052 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002053{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002054 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002055 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002056}
2057
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002058ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
2059 VkQueue queue,
2060 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002061{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002062 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002063 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002064}
2065
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002066ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
2067 VkQueue queue,
2068 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002069{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002070 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002071 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002072}
2073
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002074ICD_EXPORT VkResult VKAPI vkCreateSampler(
2075 VkDevice device,
2076 const VkSamplerCreateInfo* pCreateInfo,
2077 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07002078{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002079 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002080 struct nulldrv_dev *dev = nulldrv_dev(device);
2081
2082 return nulldrv_sampler_create(dev, pCreateInfo,
2083 (struct nulldrv_sampler **) pSampler);
2084}
2085
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002086ICD_EXPORT VkResult VKAPI vkCreateShader(
2087 VkDevice device,
2088 const VkShaderCreateInfo* pCreateInfo,
2089 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002090{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002091 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002092 struct nulldrv_dev *dev = nulldrv_dev(device);
2093
2094 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2095}
2096
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002097ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2098 VkDevice device,
2099 const VkDynamicVpStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002100 VkDynamicVpState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002101{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002102 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002103 struct nulldrv_dev *dev = nulldrv_dev(device);
2104
2105 return nulldrv_viewport_state_create(dev, pCreateInfo,
2106 (struct nulldrv_dynamic_vp **) pState);
2107}
2108
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002109ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
2110 VkDevice device,
2111 const VkDynamicRsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002112 VkDynamicRsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002113{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002114 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002115 struct nulldrv_dev *dev = nulldrv_dev(device);
2116
2117 return nulldrv_raster_state_create(dev, pCreateInfo,
2118 (struct nulldrv_dynamic_rs **) pState);
2119}
2120
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002121ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
2122 VkDevice device,
2123 const VkDynamicCbStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002124 VkDynamicCbState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002125{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002126 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002127 struct nulldrv_dev *dev = nulldrv_dev(device);
2128
2129 return nulldrv_blend_state_create(dev, pCreateInfo,
2130 (struct nulldrv_dynamic_cb **) pState);
2131}
2132
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002133ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
2134 VkDevice device,
2135 const VkDynamicDsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002136 VkDynamicDsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002137{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002138 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002139 struct nulldrv_dev *dev = nulldrv_dev(device);
2140
2141 return nulldrv_ds_state_create(dev, pCreateInfo,
2142 (struct nulldrv_dynamic_ds **) pState);
2143}
2144
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002145ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2146 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002147 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002148 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002149{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002150 NULLDRV_LOG_FUNC;
2151 struct nulldrv_dev *dev = nulldrv_dev(device);
2152
2153 return nulldrv_buf_view_create(dev, pCreateInfo,
2154 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002155}
2156
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002157ICD_EXPORT VkResult VKAPI vkCreateImageView(
2158 VkDevice device,
2159 const VkImageViewCreateInfo* pCreateInfo,
2160 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002161{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002162 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002163 struct nulldrv_dev *dev = nulldrv_dev(device);
2164
2165 return nulldrv_img_view_create(dev, pCreateInfo,
2166 (struct nulldrv_img_view **) pView);
2167}
2168
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002169ICD_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
2170 VkDevice device,
2171 const VkColorAttachmentViewCreateInfo* pCreateInfo,
2172 VkColorAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002173{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002174 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002175 struct nulldrv_dev *dev = nulldrv_dev(device);
2176
2177 return nulldrv_rt_view_create(dev, pCreateInfo,
2178 (struct nulldrv_rt_view **) pView);
2179}
2180
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002181ICD_EXPORT VkResult VKAPI vkCreateDepthStencilView(
2182 VkDevice device,
2183 const VkDepthStencilViewCreateInfo* pCreateInfo,
2184 VkDepthStencilView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002185{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002186 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002187 struct nulldrv_dev *dev = nulldrv_dev(device);
2188
2189 return nulldrv_ds_view_create(dev, pCreateInfo,
2190 (struct nulldrv_ds_view **) pView);
2191
2192}
2193
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002194ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2195 VkDevice device,
2196 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2197 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002198{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002199 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002200 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002201
Chia-I Wu7732cb22015-03-26 15:27:55 +08002202 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002203 (struct nulldrv_desc_layout **) pSetLayout);
2204}
2205
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002206ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2207 VkDevice device,
2208 const VkPipelineLayoutCreateInfo* pCreateInfo,
2209 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002210{
2211 NULLDRV_LOG_FUNC;
2212 struct nulldrv_dev *dev = nulldrv_dev(device);
2213
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002214 return nulldrv_pipeline_layout_create(dev,
2215 pCreateInfo,
2216 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002217}
2218
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002219ICD_EXPORT VkResult VKAPI vkBeginDescriptorPoolUpdate(
2220 VkDevice device,
2221 VkDescriptorUpdateMode updateMode)
David Pinedo0257fbf2015-02-02 18:02:40 -07002222{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002223 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002224 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002225}
2226
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002227ICD_EXPORT VkResult VKAPI vkEndDescriptorPoolUpdate(
2228 VkDevice device,
2229 VkCmdBuffer cmd_)
David Pinedo0257fbf2015-02-02 18:02:40 -07002230{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002231 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002232 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002233}
2234
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002235ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2236 VkDevice device,
2237 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002238 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002239 const VkDescriptorPoolCreateInfo* pCreateInfo,
2240 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002241{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002242 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002243 struct nulldrv_dev *dev = nulldrv_dev(device);
2244
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002245 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2246 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002247}
2248
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002249ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002250 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002251 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002252{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002253 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002254 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002255}
2256
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002257ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002258 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002259 VkDescriptorPool descriptorPool,
2260 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002261 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002262 const VkDescriptorSetLayout* pSetLayouts,
2263 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07002264 uint32_t* pCount)
2265{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002266 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002267 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2268 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002269 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002270 uint32_t i;
2271
2272 for (i = 0; i < count; i++) {
2273 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002274 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002275
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002276 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002277 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002278 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002279 break;
2280 }
2281
2282 if (pCount)
2283 *pCount = i;
2284
2285 return ret;
2286}
2287
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002288ICD_EXPORT void VKAPI vkClearDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002289 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002290 VkDescriptorPool descriptorPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07002291 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002292 const VkDescriptorSet* pDescriptorSets)
David Pinedo0257fbf2015-02-02 18:02:40 -07002293{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002294 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002295}
2296
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002297ICD_EXPORT void VKAPI vkUpdateDescriptors(
Mike Stroyan230e6252015-04-17 12:36:38 -06002298 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002299 VkDescriptorSet descriptorSet,
Chia-I Wu7732cb22015-03-26 15:27:55 +08002300 uint32_t updateCount,
2301 const void** ppUpdateArray)
David Pinedo0257fbf2015-02-02 18:02:40 -07002302{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002303 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002304}
2305
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002306ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2307 VkDevice device,
2308 const VkFramebufferCreateInfo* info,
2309 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002310{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002311 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002312 struct nulldrv_dev *dev = nulldrv_dev(device);
2313
2314 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2315}
2316
2317
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002318ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2319 VkDevice device,
2320 const VkRenderPassCreateInfo* info,
2321 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002322{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002323 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002324 struct nulldrv_dev *dev = nulldrv_dev(device);
2325
2326 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2327}
2328
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002329ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002330 VkCmdBuffer cmdBuffer,
2331 const VkRenderPassBegin* pRenderPassBegin)
David Pinedo0257fbf2015-02-02 18:02:40 -07002332{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002333 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002334}
2335
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002336ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002337 VkCmdBuffer cmdBuffer,
2338 VkRenderPass renderPass)
David Pinedo0257fbf2015-02-02 18:02:40 -07002339{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002340 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002341}
Ian Elliottf93069f2015-02-19 14:26:19 -07002342
2343ICD_EXPORT void* xcbCreateWindow(
2344 uint16_t width,
2345 uint16_t height)
2346{
2347 static uint32_t window; // Kludge to the max
2348 NULLDRV_LOG_FUNC;
2349 return &window;
2350}
2351
2352// May not be needed, if we stub out stuf in tri.c
2353ICD_EXPORT void xcbDestroyWindow()
2354{
2355 NULLDRV_LOG_FUNC;
2356}
2357
2358ICD_EXPORT int xcbGetMessage(void *msg)
2359{
2360 NULLDRV_LOG_FUNC;
2361 return 0;
2362}
2363
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002364ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002365{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002366 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002367}