blob: dabe668580f1dff0d7128dd5ac9ffc9a491c7167 [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
101 set_loader_magic_value(base);
102
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
128 set_loader_magic_value(gpu);
129
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
918 *pSwapChain = (VkSwapChainWSI *) sc;
919
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 vkCmdCloneImageData(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001058 VkCmdBuffer cmdBuffer,
1059 VkImage srcImage,
1060 VkImageLayout srcImageLayout,
1061 VkImage destImage,
1062 VkImageLayout destImageLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001063{
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 vkCmdUpdateBuffer(
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 dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001072 const uint32_t* pData)
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 vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001078 VkCmdBuffer cmdBuffer,
1079 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001080 VkDeviceSize destOffset,
1081 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001082 uint32_t data)
1083{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001084 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001085}
1086
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001087ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001088 VkCmdBuffer cmdBuffer,
1089 VkImage image,
1090 VkImageLayout imageLayout,
1091 VkClearColor color,
David Pinedo0257fbf2015-02-02 18:02:40 -07001092 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001093 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001094{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001095 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001096}
1097
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001098ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001099 VkCmdBuffer cmdBuffer,
1100 VkImage image,
1101 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001102 float depth,
1103 uint32_t stencil,
1104 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001105 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001106{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001107 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001108}
1109
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001110ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001111 VkCmdBuffer cmdBuffer,
1112 VkImage srcImage,
1113 VkImageLayout srcImageLayout,
1114 VkImage destImage,
1115 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001116 uint32_t regionCount,
1117 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001118{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001119 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001120}
1121
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001122ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001123 VkCmdBuffer cmdBuffer,
1124 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001125 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001126 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001127{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001128 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001129}
1130
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001131ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001132 VkCmdBuffer cmdBuffer,
1133 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001134 uint32_t slot)
1135{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001136 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001137}
1138
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001139ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001140 VkCmdBuffer cmdBuffer,
1141 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001142 uint32_t startQuery,
1143 uint32_t queryCount)
1144{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001145 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001146}
1147
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001148ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001149 VkCmdBuffer cmdBuffer,
1150 VkEvent event_,
1151 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001152{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001153 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001154}
1155
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001156ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001157 VkCmdBuffer cmdBuffer,
1158 VkEvent event_,
1159 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001160{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001161 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001162}
1163
Ian Elliott63f1edb2015-04-16 18:10:19 -06001164ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1165 VkCmdBuffer cmdBuffer,
1166 VkQueryPool queryPool,
1167 uint32_t startQuery,
1168 uint32_t queryCount,
1169 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001170 VkDeviceSize destOffset,
1171 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001172 VkFlags flags)
1173{
1174 NULLDRV_LOG_FUNC;
1175}
1176
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001177ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001178 VkCmdBuffer cmdBuffer,
1179 VkTimestampType timestampType,
1180 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001181 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001182{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001183 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001184}
1185
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001186ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001187 VkCmdBuffer cmdBuffer,
1188 VkPipelineBindPoint pipelineBindPoint,
1189 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001190{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001191 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001192}
1193
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001194ICD_EXPORT void VKAPI vkCmdBindDynamicStateObject(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001195 VkCmdBuffer cmdBuffer,
1196 VkStateBindPoint stateBindPoint,
1197 VkDynamicStateObject state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001198{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001199 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001200}
1201
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001202ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001203 VkCmdBuffer cmdBuffer,
1204 VkPipelineBindPoint pipelineBindPoint,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001205 uint32_t firstSet,
1206 uint32_t setCount,
1207 const VkDescriptorSet* pDescriptorSets,
1208 uint32_t dynamicOffsetCount,
1209 const uint32_t* pDynamicOffsets)
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 Goeltzenleuchter46962942015-04-16 13:38:46 -06001214ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1215 VkCmdBuffer cmdBuffer,
1216 uint32_t startBinding,
1217 uint32_t bindingCount,
1218 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001219 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001220{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001221 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001222}
1223
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001224ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001225 VkCmdBuffer cmdBuffer,
1226 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001227 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001228 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001229{
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 vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001234 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001235 uint32_t firstVertex,
1236 uint32_t vertexCount,
1237 uint32_t firstInstance,
1238 uint32_t instanceCount)
1239{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001240 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001241}
1242
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001243ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001244 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001245 uint32_t firstIndex,
1246 uint32_t indexCount,
1247 int32_t vertexOffset,
1248 uint32_t firstInstance,
1249 uint32_t instanceCount)
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 vkCmdDrawIndirect(
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 vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001265 VkCmdBuffer cmdBuffer,
1266 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001267 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001268 uint32_t count,
1269 uint32_t stride)
1270{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001271 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001272}
1273
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001274ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001275 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001276 uint32_t x,
1277 uint32_t y,
1278 uint32_t z)
1279{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001280 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001281}
1282
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001283ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001284 VkCmdBuffer cmdBuffer,
1285 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001286 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001287{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001288 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001289}
1290
Tony Barbour8205d902015-04-16 15:59:00 -06001291void VKAPI vkCmdWaitEvents(
1292 VkCmdBuffer cmdBuffer,
1293 VkWaitEvent waitEvent,
1294 uint32_t eventCount,
1295 const VkEvent* pEvents,
1296 uint32_t memBarrierCount,
1297 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001298{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001299 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001300}
1301
Tony Barbour8205d902015-04-16 15:59:00 -06001302void VKAPI vkCmdPipelineBarrier(
1303 VkCmdBuffer cmdBuffer,
1304 VkWaitEvent waitEvent,
1305 uint32_t pipeEventCount,
1306 const VkPipeEvent* pPipeEvents,
1307 uint32_t memBarrierCount,
1308 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001309{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001310 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001311}
1312
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001313ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001314 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001315 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001316 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001317{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001318 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001319 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1320 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1321}
1322
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001323ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1324 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001325{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001326 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001327 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001328}
1329
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001330ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1331 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001332 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001333 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001334 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001335{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001336 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001337 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001338 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001339 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001340}
1341
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001342ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1343 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001344{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001345 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001346 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001347}
1348
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001349ICD_EXPORT VkResult VKAPI vkDbgSetValidationLevel(
1350 VkDevice device,
1351 VkValidationLevel validationLevel)
David Pinedo0257fbf2015-02-02 18:02:40 -07001352{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001353 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001354 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001355}
1356
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001357ICD_EXPORT VkResult VKAPI vkDbgSetMessageFilter(
1358 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001359 int32_t msgCode,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001360 VK_DBG_MSG_FILTER filter)
David Pinedo0257fbf2015-02-02 18:02:40 -07001361{
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 vkDbgSetDeviceOption(
1367 VkDevice device,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001368 VK_DBG_DEVICE_OPTION dbgOption,
David Pinedo0257fbf2015-02-02 18:02:40 -07001369 size_t dataSize,
1370 const void* pData)
1371{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001372 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001373 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001374}
1375
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001376ICD_EXPORT VkResult VKAPI vkCreateEvent(
1377 VkDevice device,
1378 const VkEventCreateInfo* pCreateInfo,
1379 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001380{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001381 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001382 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001383}
1384
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001385ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001386 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001387 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001388{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001389 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001390 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001391}
1392
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001393ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001394 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001395 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001396{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001397 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001398 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001399}
1400
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001401ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001402 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001403 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001404{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001405 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001406 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001407}
1408
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001409ICD_EXPORT VkResult VKAPI vkCreateFence(
1410 VkDevice device,
1411 const VkFenceCreateInfo* pCreateInfo,
1412 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001413{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001414 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001415 struct nulldrv_dev *dev = nulldrv_dev(device);
1416
1417 return nulldrv_fence_create(dev, pCreateInfo,
1418 (struct nulldrv_fence **) pFence);
1419}
1420
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001421ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001422 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001423 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001424{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001425 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001426 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001427}
1428
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001429ICD_EXPORT VkResult VKAPI vkResetFences(
1430 VkDevice device,
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001431 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001432 VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001433{
1434 NULLDRV_LOG_FUNC;
1435 return VK_SUCCESS;
1436}
1437
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001438ICD_EXPORT VkResult VKAPI vkWaitForFences(
1439 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001440 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001441 const VkFence* pFences,
David Pinedo0257fbf2015-02-02 18:02:40 -07001442 bool32_t waitAll,
1443 uint64_t timeout)
1444{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001445 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001446 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001447}
1448
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001449ICD_EXPORT VkResult VKAPI vkGetFormatInfo(
1450 VkDevice device,
1451 VkFormat format,
1452 VkFormatInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001453 size_t* pDataSize,
1454 void* pData)
1455{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001456 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001457 struct nulldrv_dev *dev = nulldrv_dev(device);
1458 VkFormatProperties *fmt = (VkFormatProperties *) pData;
1459 VkResult ret = VK_SUCCESS;
1460
1461 switch (infoType) {
1462 case VK_FORMAT_INFO_TYPE_PROPERTIES:
1463 *pDataSize = sizeof(VkFormatProperties);
1464 if (pData == NULL)
1465 return ret;
1466 fmt->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1467 fmt->optimalTilingFeatures = fmt->linearTilingFeatures;
1468 break;
1469 default:
1470 ret = VK_ERROR_INVALID_VALUE;
1471 break;
1472 }
1473
1474 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001475}
1476
Tony Barbour8205d902015-04-16 15:59:00 -06001477ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceInfo(
1478 VkPhysicalDevice gpu_,
1479 VkPhysicalDeviceInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001480 size_t* pDataSize,
1481 void* pData)
1482{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001483 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001484 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1485 VkResult ret = VK_SUCCESS;
1486
1487 switch (infoType) {
1488 case VK_PHYSICAL_DEVICE_INFO_TYPE_PROPERTIES:
1489 {
1490 VkPhysicalDeviceProperties *props =
1491 (VkPhysicalDeviceProperties *) pData;
1492 *pDataSize = sizeof(VkPhysicalDeviceProperties);
1493 if (pData == NULL) {
1494 return ret;
1495 }
1496 props->apiVersion = VK_API_VERSION;
1497 props->driverVersion = 0; // Appropriate that the nulldrv have 0's
1498 props->vendorId = 0;
1499 props->deviceId = 0;
1500 props->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1501 strncpy(props->deviceName, "nulldrv", strlen("nulldrv"));
1502 props->maxInlineMemoryUpdateSize = 0;
1503 props->maxBoundDescriptorSets = 0;
1504 props->maxThreadGroupSize = 0;
1505 props->timestampFrequency = 0;
1506 props->multiColorAttachmentClears = false;
1507 break;
1508 }
1509 case VK_PHYSICAL_DEVICE_INFO_TYPE_PERFORMANCE:
1510 {
1511 VkPhysicalDevicePerformance *perf =
1512 (VkPhysicalDevicePerformance *) pData;
1513 *pDataSize = sizeof(VkPhysicalDevicePerformance);
1514 if (pData == NULL) {
1515 return ret;
1516 }
1517 perf->maxDeviceClock = 1.0f;
1518 perf->aluPerClock = 1.0f;
1519 perf->texPerClock = 1.0f;
1520 perf->primsPerClock = 1.0f;
1521 perf->pixelsPerClock = 1.0f;
1522 break;
1523 }
1524 case VK_PHYSICAL_DEVICE_INFO_TYPE_QUEUE_PROPERTIES:
1525 {
1526 VkPhysicalDeviceQueueProperties *props =
1527 (VkPhysicalDeviceQueueProperties *) pData;
1528 *pDataSize = sizeof(VkPhysicalDeviceQueueProperties);
1529 if (pData == NULL) {
1530 return ret;
1531 }
1532 props->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_MEMMGR_BIT;
1533 props->queueCount = 1;
1534 props->maxAtomicCounters = 1;
1535 props->supportsTimestamps = false;
1536 props->maxMemReferences = 1;
1537 break;
1538 }
1539 default:
1540/* FIXME: WRITE THE REAL CODE*/return ret;
1541 break;
1542 }
1543
1544 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001545}
1546
Jon Ashburneb2728b2015-04-10 14:33:07 -06001547ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionInfo(
1548 VkExtensionInfoType infoType,
1549 uint32_t extensionIndex,
1550 size_t* pDataSize,
1551 void* pData)
1552{
Ian Elliott64a68e12015-04-16 11:57:46 -06001553 VkExtensionProperties *ext_props;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001554 uint32_t *count;
1555
1556 if (pDataSize == NULL)
1557 return VK_ERROR_INVALID_POINTER;
1558
1559 switch (infoType) {
1560 case VK_EXTENSION_INFO_TYPE_COUNT:
1561 *pDataSize = sizeof(uint32_t);
1562 if (pData == NULL)
1563 return VK_SUCCESS;
1564 count = (uint32_t *) pData;
Ian Elliott64a68e12015-04-16 11:57:46 -06001565 *count = 1;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001566 break;
1567 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
Ian Elliott64a68e12015-04-16 11:57:46 -06001568 *pDataSize = sizeof(VkExtensionProperties);
Jon Ashburneb2728b2015-04-10 14:33:07 -06001569 if (pData == NULL)
1570 return VK_SUCCESS;
Ian Elliott64a68e12015-04-16 11:57:46 -06001571 else {
1572 ext_props = (VkExtensionProperties *) pData;
1573 ext_props->version = VK_WSI_LUNARG_REVISION;
1574 strncpy(ext_props->extName, "VK_WSI_LunarG",
1575 strlen("VK_WSI_LunarG")+1);
1576 return VK_SUCCESS;
1577 }
Jon Ashburneb2728b2015-04-10 14:33:07 -06001578 break;
1579 default:
1580 return VK_ERROR_INVALID_VALUE;
1581 };
1582
1583 return VK_SUCCESS;
1584}
1585
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001586VkResult VKAPI vkGetPhysicalDeviceExtensionInfo(
Tony Barbour8205d902015-04-16 15:59:00 -06001587 VkPhysicalDevice gpu,
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001588 VkExtensionInfoType infoType,
1589 uint32_t extensionIndex,
1590 size_t* pDataSize,
1591 void* pData)
David Pinedo0257fbf2015-02-02 18:02:40 -07001592{
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001593 uint32_t *count;
1594
1595 if (pDataSize == NULL)
1596 return VK_ERROR_INVALID_POINTER;
1597
1598 switch (infoType) {
1599 case VK_EXTENSION_INFO_TYPE_COUNT:
1600 *pDataSize = sizeof(uint32_t);
1601 if (pData == NULL)
1602 return VK_SUCCESS;
1603 count = (uint32_t *) pData;
1604 *count = 0;
1605 break;
1606 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
1607 *pDataSize = 0;
1608 if (pData == NULL)
1609 return VK_SUCCESS;
1610 return VK_ERROR_INVALID_EXTENSION;
1611 break;
1612 default:
1613 return VK_ERROR_INVALID_VALUE;
1614 };
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001615 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001616}
1617
Tony Barbour8205d902015-04-16 15:59:00 -06001618ICD_EXPORT VkResult VKAPI vkGetMultiDeviceCompatibility(
1619 VkPhysicalDevice gpu0_,
1620 VkPhysicalDevice gpu1_,
1621 VkPhysicalDeviceCompatibilityInfo* pInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001622{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001623 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001624 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001625}
1626
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001627ICD_EXPORT VkResult VKAPI vkOpenPeerImage(
1628 VkDevice device,
1629 const VkPeerImageOpenInfo* pOpenInfo,
1630 VkImage* pImage,
Tony Barbour8205d902015-04-16 15:59:00 -06001631 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001632{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001633 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001634 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001635}
1636
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001637ICD_EXPORT VkResult VKAPI vkCreateImage(
1638 VkDevice device,
1639 const VkImageCreateInfo* pCreateInfo,
1640 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001641{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001642 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001643 struct nulldrv_dev *dev = nulldrv_dev(device);
1644
1645 return nulldrv_img_create(dev, pCreateInfo, false,
1646 (struct nulldrv_img **) pImage);
1647}
1648
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001649ICD_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(
Mike Stroyan230e6252015-04-17 12:36:38 -06001650 VkDevice device,
1651 VkImage image,
1652 const VkImageSubresource* pSubresource,
1653 VkSubresourceInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001654 size_t* pDataSize,
1655 void* pData)
1656{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001657 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001658 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001659
1660 switch (infoType) {
Tony Barbour8205d902015-04-16 15:59:00 -06001661 case VK_SUBRESOURCE_INFO_TYPE_LAYOUT:
David Pinedo0257fbf2015-02-02 18:02:40 -07001662 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001663 VkSubresourceLayout *layout = (VkSubresourceLayout *) pData;
David Pinedo0257fbf2015-02-02 18:02:40 -07001664
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001665 *pDataSize = sizeof(VkSubresourceLayout);
David Pinedo0257fbf2015-02-02 18:02:40 -07001666
1667 if (pData == NULL)
1668 return ret;
1669 layout->offset = 0;
1670 layout->size = 1;
1671 layout->rowPitch = 4;
1672 layout->depthPitch = 4;
1673 }
1674 break;
1675 default:
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001676 ret = VK_ERROR_INVALID_VALUE;
David Pinedo0257fbf2015-02-02 18:02:40 -07001677 break;
1678 }
1679
1680 return ret;
1681}
1682
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001683ICD_EXPORT VkResult VKAPI vkAllocMemory(
1684 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001685 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001686 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001687{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001688 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001689 struct nulldrv_dev *dev = nulldrv_dev(device);
1690
1691 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1692}
1693
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001694ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001695 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001696 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001697{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001698 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001699 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001700}
1701
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001702ICD_EXPORT VkResult VKAPI vkSetMemoryPriority(
Mike Stroyan230e6252015-04-17 12:36:38 -06001703 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001704 VkDeviceMemory mem_,
Mike Stroyan230e6252015-04-17 12:36:38 -06001705 VkMemoryPriority priority)
David Pinedo0257fbf2015-02-02 18:02:40 -07001706{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001707 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001708 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001709}
1710
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001711ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001712 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001713 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001714 VkDeviceSize offset,
1715 VkDeviceSize size,
1716 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001717 void** ppData)
1718{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001719 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001720 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1721 void *ptr = nulldrv_mem_map(mem, flags);
1722
1723 *ppData = ptr;
1724
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001725 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001726}
1727
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001728ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001729 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001730 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001731{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001732 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001733 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001734}
1735
Ian Elliott07de9232015-04-17 10:04:00 -06001736ICD_EXPORT VkResult VKAPI vkFlushMappedMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001737 VkDevice device,
Ian Elliott07de9232015-04-17 10:04:00 -06001738 VkDeviceMemory mem_,
1739 VkDeviceSize offset,
1740 VkDeviceSize size)
1741{
1742 NULLDRV_LOG_FUNC;
1743 return VK_SUCCESS;
1744}
1745
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001746ICD_EXPORT VkResult VKAPI vkPinSystemMemory(
1747 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001748 const void* pSysMem,
1749 size_t memSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001750 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001751{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001752 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001753 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001754}
1755
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001756ICD_EXPORT VkResult VKAPI vkOpenSharedMemory(
1757 VkDevice device,
1758 const VkMemoryOpenInfo* pOpenInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001759 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001760{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001761 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001762 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001763}
1764
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001765ICD_EXPORT VkResult VKAPI vkOpenPeerMemory(
1766 VkDevice device,
1767 const VkPeerMemoryOpenInfo* pOpenInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001768 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001769{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001770 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001771 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001772}
1773
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001774ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001775 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001776 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001777{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001778 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001779 struct nulldrv_instance *inst;
1780
1781 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001782 VK_DBG_OBJECT_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001783 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001784 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001785
1786 inst->obj.base.get_info = NULL;
1787
Mike Stroyan230e6252015-04-17 12:36:38 -06001788 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001789
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001790 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001791}
1792
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001793ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1794 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001795{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001796 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001797 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001798}
1799
Tony Barbour8205d902015-04-16 15:59:00 -06001800ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001801 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001802 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001803 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001804{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001805 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001806 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001807 struct nulldrv_gpu *gpu;
1808 *pGpuCount = 1;
1809 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001810 if (ret == VK_SUCCESS)
Tony Barbour8205d902015-04-16 15:59:00 -06001811 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001812 return ret;
1813}
1814
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001815ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001816 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001817 size_t maxLayerCount,
1818 size_t maxStringSize,
1819 size_t* pOutLayerCount,
1820 char* const* pOutLayers,
1821 void* pReserved)
1822{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001823 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001824 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001825}
1826
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001827ICD_EXPORT VkResult VKAPI vkDbgRegisterMsgCallback(
1828 VkInstance instance,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001829 VK_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback,
David Pinedo0257fbf2015-02-02 18:02:40 -07001830 void* pUserData)
1831{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001832 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001833 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001834}
1835
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001836ICD_EXPORT VkResult VKAPI vkDbgUnregisterMsgCallback(
1837 VkInstance instance,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001838 VK_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback)
David Pinedo0257fbf2015-02-02 18:02:40 -07001839{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001840 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001841 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001842}
1843
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001844ICD_EXPORT VkResult VKAPI vkDbgSetGlobalOption(
1845 VkInstance instance,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001846 VK_DBG_GLOBAL_OPTION dbgOption,
David Pinedo0257fbf2015-02-02 18:02:40 -07001847 size_t dataSize,
1848 const void* pData)
1849{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001850 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001851 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001852}
1853
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001854ICD_EXPORT VkResult VKAPI vkDestroyObject(
Mike Stroyan230e6252015-04-17 12:36:38 -06001855 VkDevice device,
1856 VkObjectType objType,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001857 VkObject object)
David Pinedo0257fbf2015-02-02 18:02:40 -07001858{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001859 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001860 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001861}
1862
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001863ICD_EXPORT VkResult VKAPI vkGetObjectInfo(
Mike Stroyan230e6252015-04-17 12:36:38 -06001864 VkDevice device,
1865 VkObjectType objType,
1866 VkObject object,
1867 VkObjectInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001868 size_t* pDataSize,
1869 void* pData)
1870{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001871 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001872 struct nulldrv_base *base = nulldrv_base(object);
1873
1874 return base->get_info(base, infoType, pDataSize, pData);
1875}
1876
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001877ICD_EXPORT VkResult VKAPI vkQueueBindObjectMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001878 VkQueue queue,
1879 VkObjectType objType,
1880 VkObject object,
David Pinedo0257fbf2015-02-02 18:02:40 -07001881 uint32_t allocationIdx,
Tony Barbour8205d902015-04-16 15:59:00 -06001882 VkDeviceMemory mem_,
1883 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001884{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001885 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001886 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001887}
1888
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001889ICD_EXPORT VkResult VKAPI vkQueueBindObjectMemoryRange(
Mike Stroyan230e6252015-04-17 12:36:38 -06001890 VkQueue queue,
1891 VkObjectType objType,
1892 VkObject object,
David Pinedo0257fbf2015-02-02 18:02:40 -07001893 uint32_t allocationIdx,
Tony Barbour8205d902015-04-16 15:59:00 -06001894 VkDeviceSize rangeOffset,
1895 VkDeviceSize rangeSize,
1896 VkDeviceMemory mem,
1897 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001898{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001899 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001900 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001901}
1902
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001903ICD_EXPORT VkResult VKAPI vkQueueBindImageMemoryRange(
1904 VkQueue queue,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001905 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001906 uint32_t allocationIdx,
1907 const VkImageMemoryBindInfo* pBindInfo,
1908 VkDeviceMemory mem,
1909 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001910{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001911 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001912 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001913}
1914
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001915ICD_EXPORT VkResult VKAPI vkDbgSetObjectTag(
Mike Stroyan230e6252015-04-17 12:36:38 -06001916 VkDevice device,
1917 VkObject object,
David Pinedo0257fbf2015-02-02 18:02:40 -07001918 size_t tagSize,
1919 const void* pTag)
1920{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001921 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001922 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001923}
1924
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001925ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(
1926 VkDevice device,
1927 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1928 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001929{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001930 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001931 struct nulldrv_dev *dev = nulldrv_dev(device);
1932
1933 return graphics_pipeline_create(dev, pCreateInfo,
1934 (struct nulldrv_pipeline **) pPipeline);
1935}
1936
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001937ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(
1938 VkDevice device,
1939 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1940 VkPipeline basePipeline,
1941 VkPipeline* pPipeline)
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001942{
1943 NULLDRV_LOG_FUNC;
1944 struct nulldrv_dev *dev = nulldrv_dev(device);
1945
1946 return graphics_pipeline_create(dev, pCreateInfo,
1947 (struct nulldrv_pipeline **) pPipeline);
1948}
1949
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001950ICD_EXPORT VkResult VKAPI vkCreateComputePipeline(
1951 VkDevice device,
1952 const VkComputePipelineCreateInfo* pCreateInfo,
1953 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001954{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001955 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001956 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001957}
1958
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001959ICD_EXPORT VkResult VKAPI vkStorePipeline(
Mike Stroyan230e6252015-04-17 12:36:38 -06001960 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001961 VkPipeline pipeline,
David Pinedo0257fbf2015-02-02 18:02:40 -07001962 size_t* pDataSize,
1963 void* pData)
1964{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001965 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001966 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001967}
1968
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001969ICD_EXPORT VkResult VKAPI vkLoadPipeline(
1970 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001971 size_t dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001972 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001973 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001974{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001975 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001976 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001977}
1978
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001979ICD_EXPORT VkResult VKAPI vkLoadPipelineDerivative(
1980 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001981 size_t dataSize,
1982 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001983 VkPipeline basePipeline,
1984 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 vkCreateQueryPool(
1991 VkDevice device,
1992 const VkQueryPoolCreateInfo* pCreateInfo,
1993 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001994{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001995 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001996 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001997}
1998
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001999ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06002000 VkDevice device,
2001 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07002002 uint32_t startQuery,
2003 uint32_t queryCount,
2004 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06002005 void* pData,
2006 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07002007{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002008 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002009 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002010}
2011
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06002012ICD_EXPORT VkResult VKAPI vkQueueAddMemReferences(
2013 VkQueue queue,
2014 uint32_t count,
Tony Barbour8205d902015-04-16 15:59:00 -06002015 const VkDeviceMemory* pMems)
Courtney Goeltzenleuchtercfedf362015-04-02 13:39:07 -06002016{
2017 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002018 return VK_SUCCESS;
Courtney Goeltzenleuchtercfedf362015-04-02 13:39:07 -06002019}
2020
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06002021ICD_EXPORT VkResult VKAPI vkQueueRemoveMemReferences(
2022 VkQueue queue,
2023 uint32_t count,
Tony Barbour8205d902015-04-16 15:59:00 -06002024 const VkDeviceMemory* pMems)
Courtney Goeltzenleuchtercfedf362015-04-02 13:39:07 -06002025{
2026 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002027 return VK_SUCCESS;
Courtney Goeltzenleuchtercfedf362015-04-02 13:39:07 -06002028}
2029
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002030ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
2031 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07002032{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002033 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002034 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002035}
2036
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002037ICD_EXPORT VkResult VKAPI vkQueueSubmit(
2038 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07002039 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002040 const VkCmdBuffer* pCmdBuffers,
2041 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07002042{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002043 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002044 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002045}
2046
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002047ICD_EXPORT VkResult VKAPI vkOpenSharedSemaphore(
2048 VkDevice device,
2049 const VkSemaphoreOpenInfo* pOpenInfo,
2050 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002051{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002052 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002053 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002054}
2055
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002056ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
2057 VkDevice device,
2058 const VkSemaphoreCreateInfo* pCreateInfo,
2059 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002060{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002061 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002062 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002063}
2064
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002065ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
2066 VkQueue queue,
2067 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002068{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002069 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002070 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002071}
2072
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002073ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
2074 VkQueue queue,
2075 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002076{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002077 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002078 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002079}
2080
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002081ICD_EXPORT VkResult VKAPI vkCreateSampler(
2082 VkDevice device,
2083 const VkSamplerCreateInfo* pCreateInfo,
2084 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07002085{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002086 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002087 struct nulldrv_dev *dev = nulldrv_dev(device);
2088
2089 return nulldrv_sampler_create(dev, pCreateInfo,
2090 (struct nulldrv_sampler **) pSampler);
2091}
2092
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002093ICD_EXPORT VkResult VKAPI vkCreateShader(
2094 VkDevice device,
2095 const VkShaderCreateInfo* pCreateInfo,
2096 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002097{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002098 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002099 struct nulldrv_dev *dev = nulldrv_dev(device);
2100
2101 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2102}
2103
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002104ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2105 VkDevice device,
2106 const VkDynamicVpStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002107 VkDynamicVpState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002108{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002109 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002110 struct nulldrv_dev *dev = nulldrv_dev(device);
2111
2112 return nulldrv_viewport_state_create(dev, pCreateInfo,
2113 (struct nulldrv_dynamic_vp **) pState);
2114}
2115
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002116ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
2117 VkDevice device,
2118 const VkDynamicRsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002119 VkDynamicRsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002120{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002121 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002122 struct nulldrv_dev *dev = nulldrv_dev(device);
2123
2124 return nulldrv_raster_state_create(dev, pCreateInfo,
2125 (struct nulldrv_dynamic_rs **) pState);
2126}
2127
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002128ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
2129 VkDevice device,
2130 const VkDynamicCbStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002131 VkDynamicCbState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002132{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002133 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002134 struct nulldrv_dev *dev = nulldrv_dev(device);
2135
2136 return nulldrv_blend_state_create(dev, pCreateInfo,
2137 (struct nulldrv_dynamic_cb **) pState);
2138}
2139
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002140ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
2141 VkDevice device,
2142 const VkDynamicDsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002143 VkDynamicDsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002144{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002145 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002146 struct nulldrv_dev *dev = nulldrv_dev(device);
2147
2148 return nulldrv_ds_state_create(dev, pCreateInfo,
2149 (struct nulldrv_dynamic_ds **) pState);
2150}
2151
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002152ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2153 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002154 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002155 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002156{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002157 NULLDRV_LOG_FUNC;
2158 struct nulldrv_dev *dev = nulldrv_dev(device);
2159
2160 return nulldrv_buf_view_create(dev, pCreateInfo,
2161 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002162}
2163
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002164ICD_EXPORT VkResult VKAPI vkCreateImageView(
2165 VkDevice device,
2166 const VkImageViewCreateInfo* pCreateInfo,
2167 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002168{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002169 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002170 struct nulldrv_dev *dev = nulldrv_dev(device);
2171
2172 return nulldrv_img_view_create(dev, pCreateInfo,
2173 (struct nulldrv_img_view **) pView);
2174}
2175
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002176ICD_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
2177 VkDevice device,
2178 const VkColorAttachmentViewCreateInfo* pCreateInfo,
2179 VkColorAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002180{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002181 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002182 struct nulldrv_dev *dev = nulldrv_dev(device);
2183
2184 return nulldrv_rt_view_create(dev, pCreateInfo,
2185 (struct nulldrv_rt_view **) pView);
2186}
2187
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002188ICD_EXPORT VkResult VKAPI vkCreateDepthStencilView(
2189 VkDevice device,
2190 const VkDepthStencilViewCreateInfo* pCreateInfo,
2191 VkDepthStencilView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002192{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002193 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002194 struct nulldrv_dev *dev = nulldrv_dev(device);
2195
2196 return nulldrv_ds_view_create(dev, pCreateInfo,
2197 (struct nulldrv_ds_view **) pView);
2198
2199}
2200
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002201ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2202 VkDevice device,
2203 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2204 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002205{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002206 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002207 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002208
Chia-I Wu7732cb22015-03-26 15:27:55 +08002209 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002210 (struct nulldrv_desc_layout **) pSetLayout);
2211}
2212
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002213ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2214 VkDevice device,
2215 const VkPipelineLayoutCreateInfo* pCreateInfo,
2216 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002217{
2218 NULLDRV_LOG_FUNC;
2219 struct nulldrv_dev *dev = nulldrv_dev(device);
2220
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002221 return nulldrv_pipeline_layout_create(dev,
2222 pCreateInfo,
2223 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002224}
2225
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002226ICD_EXPORT VkResult VKAPI vkBeginDescriptorPoolUpdate(
2227 VkDevice device,
2228 VkDescriptorUpdateMode updateMode)
David Pinedo0257fbf2015-02-02 18:02:40 -07002229{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002230 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002231 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002232}
2233
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002234ICD_EXPORT VkResult VKAPI vkEndDescriptorPoolUpdate(
2235 VkDevice device,
2236 VkCmdBuffer cmd_)
David Pinedo0257fbf2015-02-02 18:02:40 -07002237{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002238 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002239 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002240}
2241
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002242ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2243 VkDevice device,
2244 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002245 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002246 const VkDescriptorPoolCreateInfo* pCreateInfo,
2247 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002248{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002249 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002250 struct nulldrv_dev *dev = nulldrv_dev(device);
2251
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002252 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2253 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002254}
2255
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002256ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002257 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002258 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002259{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002260 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002261 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002262}
2263
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002264ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002265 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002266 VkDescriptorPool descriptorPool,
2267 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002268 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002269 const VkDescriptorSetLayout* pSetLayouts,
2270 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07002271 uint32_t* pCount)
2272{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002273 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002274 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2275 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002276 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002277 uint32_t i;
2278
2279 for (i = 0; i < count; i++) {
2280 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002281 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002282
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002283 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002284 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002285 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002286 break;
2287 }
2288
2289 if (pCount)
2290 *pCount = i;
2291
2292 return ret;
2293}
2294
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002295ICD_EXPORT void VKAPI vkClearDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002296 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002297 VkDescriptorPool descriptorPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07002298 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002299 const VkDescriptorSet* pDescriptorSets)
David Pinedo0257fbf2015-02-02 18:02:40 -07002300{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002301 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002302}
2303
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002304ICD_EXPORT void VKAPI vkUpdateDescriptors(
Mike Stroyan230e6252015-04-17 12:36:38 -06002305 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002306 VkDescriptorSet descriptorSet,
Chia-I Wu7732cb22015-03-26 15:27:55 +08002307 uint32_t updateCount,
2308 const void** ppUpdateArray)
David Pinedo0257fbf2015-02-02 18:02:40 -07002309{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002310 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002311}
2312
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002313ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2314 VkDevice device,
2315 const VkFramebufferCreateInfo* info,
2316 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002317{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002318 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002319 struct nulldrv_dev *dev = nulldrv_dev(device);
2320
2321 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2322}
2323
2324
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002325ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2326 VkDevice device,
2327 const VkRenderPassCreateInfo* info,
2328 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002329{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002330 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002331 struct nulldrv_dev *dev = nulldrv_dev(device);
2332
2333 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2334}
2335
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002336ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002337 VkCmdBuffer cmdBuffer,
2338 const VkRenderPassBegin* pRenderPassBegin)
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}
2342
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002343ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002344 VkCmdBuffer cmdBuffer,
2345 VkRenderPass renderPass)
David Pinedo0257fbf2015-02-02 18:02:40 -07002346{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002347 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002348}
Ian Elliottf93069f2015-02-19 14:26:19 -07002349
2350ICD_EXPORT void* xcbCreateWindow(
2351 uint16_t width,
2352 uint16_t height)
2353{
2354 static uint32_t window; // Kludge to the max
2355 NULLDRV_LOG_FUNC;
2356 return &window;
2357}
2358
2359// May not be needed, if we stub out stuf in tri.c
2360ICD_EXPORT void xcbDestroyWindow()
2361{
2362 NULLDRV_LOG_FUNC;
2363}
2364
2365ICD_EXPORT int xcbGetMessage(void *msg)
2366{
2367 NULLDRV_LOG_FUNC;
2368 return 0;
2369}
2370
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002371ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002372{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002373 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002374}