blob: 80ceb19e51bd9620197d80ff24d3dd9d4e014dbd [file] [log] [blame]
David Pinedo0257fbf2015-02-02 18:02:40 -07001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan null driver
David Pinedo0257fbf2015-02-02 18:02:40 -07003 *
4 * Copyright (C) 2015 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 */
25
26#include "nulldrv.h"
David Pinedo8e9cb3b2015-02-10 15:02:08 -070027#include <stdio.h>
David Pinedo0257fbf2015-02-02 18:02:40 -070028
David Pinedo8e9cb3b2015-02-10 15:02:08 -070029#if 0
30#define NULLDRV_LOG_FUNC \
31 do { \
32 fflush(stdout); \
33 fflush(stderr); \
34 printf("null driver: %s\n", __FUNCTION__); \
35 fflush(stdout); \
36 } while (0)
37#else
38 #define NULLDRV_LOG_FUNC do { } while (0)
39#endif
40
41// The null driver supports all WSI extenstions ... for now ...
David Pinedo0257fbf2015-02-02 18:02:40 -070042static const char * const nulldrv_gpu_exts[NULLDRV_EXT_COUNT] = {
Jon Ashburncedc15f2015-05-21 18:13:33 -060043 [NULLDRV_EXT_WSI_LUNARG] = VK_WSI_LUNARG_EXTENSION_NAME,
David Pinedo0257fbf2015-02-02 18:02:40 -070044};
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;
David Pinedo0257fbf2015-02-02 18:02:40 -070056
57 switch (type) {
Tony Barbour8205d902015-04-16 15:59:00 -060058 case VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS:
David Pinedo0257fbf2015-02-02 18:02:40 -070059 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060060 s = sizeof(VkMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -070061 *size = s;
62 if (data == NULL)
63 return ret;
64 memset(data, 0, s);
David Pinedo0257fbf2015-02-02 18:02:40 -070065 break;
66 }
David Pinedo0257fbf2015-02-02 18:02:40 -070067 default:
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060068 ret = VK_ERROR_INVALID_VALUE;
David Pinedo0257fbf2015-02-02 18:02:40 -070069 break;
70 }
71
72 return ret;
73}
74
75static struct nulldrv_base *nulldrv_base_create(struct nulldrv_dev *dev,
76 size_t obj_size,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060077 VK_DBG_OBJECT_TYPE type)
David Pinedo0257fbf2015-02-02 18:02:40 -070078{
79 struct nulldrv_base *base;
80
81 if (!obj_size)
82 obj_size = sizeof(*base);
83
84 assert(obj_size >= sizeof(*base));
85
Chia-I Wu493a1752015-02-22 14:40:25 +080086 base = (struct nulldrv_base*)malloc(obj_size);
David Pinedo0257fbf2015-02-02 18:02:40 -070087 if (!base)
88 return NULL;
89
90 memset(base, 0, obj_size);
91
92 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbour11e76ac2015-04-20 16:28:46 -060093 set_loader_magic_value((VkObject) base);
David Pinedo0257fbf2015-02-02 18:02:40 -070094
95 if (dev == NULL) {
96 /*
97 * dev is NULL when we are creating the base device object
98 * Set dev now so that debug setup happens correctly
99 */
100 dev = (struct nulldrv_dev *) base;
101 }
102
103
104 base->get_info = NULL;
105
106 return base;
107}
108
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600109static VkResult nulldrv_gpu_add(int devid, const char *primary_node,
David Pinedo0257fbf2015-02-02 18:02:40 -0700110 const char *render_node, struct nulldrv_gpu **gpu_ret)
111{
112 struct nulldrv_gpu *gpu;
113
Chia-I Wu493a1752015-02-22 14:40:25 +0800114 gpu = malloc(sizeof(*gpu));
David Pinedo0257fbf2015-02-02 18:02:40 -0700115 if (!gpu)
Tony Barbour8205d902015-04-16 15:59:00 -0600116 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700117 memset(gpu, 0, sizeof(*gpu));
Mark Lobodzinski97dcd042015-04-16 08:52:00 -0500118
David Pinedo0257fbf2015-02-02 18:02:40 -0700119 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbour11e76ac2015-04-20 16:28:46 -0600120 set_loader_magic_value((VkObject) gpu);
David Pinedo0257fbf2015-02-02 18:02:40 -0700121
122 *gpu_ret = gpu;
123
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600124 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700125}
126
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600127static VkResult nulldrv_queue_create(struct nulldrv_dev *dev,
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700128 uint32_t node_index,
David Pinedo0257fbf2015-02-02 18:02:40 -0700129 struct nulldrv_queue **queue_ret)
130{
131 struct nulldrv_queue *queue;
132
133 queue = (struct nulldrv_queue *) nulldrv_base_create(dev, sizeof(*queue),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600134 VK_DBG_OBJECT_QUEUE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700135 if (!queue)
Tony Barbour8205d902015-04-16 15:59:00 -0600136 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700137
138 queue->dev = dev;
139
140 *queue_ret = queue;
141
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600142 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700143}
144
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600145static VkResult dev_create_queues(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600146 const VkDeviceQueueCreateInfo *queues,
David Pinedo0257fbf2015-02-02 18:02:40 -0700147 uint32_t count)
148{
149 uint32_t i;
150
151 if (!count)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600152 return VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700153
154 for (i = 0; i < count; i++) {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600155 const VkDeviceQueueCreateInfo *q = &queues[i];
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600156 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700157
158 if (q->queueCount == 1 && !dev->queues[q->queueNodeIndex]) {
159 ret = nulldrv_queue_create(dev, q->queueNodeIndex,
160 &dev->queues[q->queueNodeIndex]);
161 }
162 else {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600163 ret = VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700164 }
165
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600166 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700167 return ret;
168 }
169 }
170
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600171 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700172}
173
174static enum nulldrv_ext_type nulldrv_gpu_lookup_extension(const struct nulldrv_gpu *gpu,
175 const char *ext)
176{
177 enum nulldrv_ext_type type;
178
179 for (type = 0; type < ARRAY_SIZE(nulldrv_gpu_exts); type++) {
180 if (nulldrv_gpu_exts[type] && strcmp(nulldrv_gpu_exts[type], ext) == 0)
181 break;
182 }
183
184 assert(type < NULLDRV_EXT_COUNT || type == NULLDRV_EXT_INVALID);
185
186 return type;
187}
188
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600189static VkResult nulldrv_desc_ooxx_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800190 struct nulldrv_desc_ooxx **ooxx_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700191{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800192 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700193
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800194 ooxx = malloc(sizeof(*ooxx));
195 if (!ooxx)
Tony Barbour8205d902015-04-16 15:59:00 -0600196 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700197
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800198 memset(ooxx, 0, sizeof(*ooxx));
David Pinedo0257fbf2015-02-02 18:02:40 -0700199
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800200 ooxx->surface_desc_size = 0;
201 ooxx->sampler_desc_size = 0;
David Pinedo0257fbf2015-02-02 18:02:40 -0700202
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800203 *ooxx_ret = ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700204
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600205 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700206}
207
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600208static VkResult nulldrv_dev_create(struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600209 const VkDeviceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700210 struct nulldrv_dev **dev_ret)
211{
212 struct nulldrv_dev *dev;
213 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600214 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -0700215
216 dev = (struct nulldrv_dev *) nulldrv_base_create(NULL, sizeof(*dev),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600217 VK_DBG_OBJECT_DEVICE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700218 if (!dev)
Tony Barbour8205d902015-04-16 15:59:00 -0600219 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700220
221 for (i = 0; i < info->extensionCount; i++) {
222 const enum nulldrv_ext_type ext = nulldrv_gpu_lookup_extension(gpu,
223 info->ppEnabledExtensionNames[i]);
224
225 if (ext == NULLDRV_EXT_INVALID)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600226 return VK_ERROR_INVALID_EXTENSION;
David Pinedo0257fbf2015-02-02 18:02:40 -0700227
228 dev->exts[ext] = true;
229 }
230
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800231 ret = nulldrv_desc_ooxx_create(dev, &dev->desc_ooxx);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600232 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700233 return ret;
234 }
235
236 ret = dev_create_queues(dev, info->pRequestedQueues,
237 info->queueRecordCount);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600238 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700239 return ret;
240 }
241
242 *dev_ret = dev;
243
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600244 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700245}
246
Tony Barbour8205d902015-04-16 15:59:00 -0600247static struct nulldrv_gpu *nulldrv_gpu(VkPhysicalDevice gpu)
David Pinedo0257fbf2015-02-02 18:02:40 -0700248{
249 return (struct nulldrv_gpu *) gpu;
250}
251
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600252static VkResult nulldrv_rt_view_create(struct nulldrv_dev *dev,
253 const VkColorAttachmentViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700254 struct nulldrv_rt_view **view_ret)
255{
256 struct nulldrv_rt_view *view;
257
258 view = (struct nulldrv_rt_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600259 VK_DBG_OBJECT_COLOR_TARGET_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700260 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600261 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700262
263 *view_ret = view;
264
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600265 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700266}
267
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600268static VkResult nulldrv_fence_create(struct nulldrv_dev *dev,
269 const VkFenceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700270 struct nulldrv_fence **fence_ret)
271{
272 struct nulldrv_fence *fence;
273
274 fence = (struct nulldrv_fence *) nulldrv_base_create(dev, sizeof(*fence),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600275 VK_DBG_OBJECT_FENCE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700276 if (!fence)
Tony Barbour8205d902015-04-16 15:59:00 -0600277 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700278
279 *fence_ret = fence;
280
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600281 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700282}
283
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600284static struct nulldrv_dev *nulldrv_dev(VkDevice dev)
David Pinedo0257fbf2015-02-02 18:02:40 -0700285{
286 return (struct nulldrv_dev *) dev;
287}
288
289static struct nulldrv_img *nulldrv_img_from_base(struct nulldrv_base *base)
290{
291 return (struct nulldrv_img *) base;
292}
293
294
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600295static VkResult img_get_info(struct nulldrv_base *base, int type,
David Pinedo0257fbf2015-02-02 18:02:40 -0700296 size_t *size, void *data)
297{
298 struct nulldrv_img *img = nulldrv_img_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600299 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700300
301 switch (type) {
Tony Barbour8205d902015-04-16 15:59:00 -0600302 case VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS:
David Pinedo0257fbf2015-02-02 18:02:40 -0700303 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600304 VkMemoryRequirements *mem_req = data;
David Pinedo0257fbf2015-02-02 18:02:40 -0700305
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600306 *size = sizeof(VkMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -0700307 if (data == NULL)
308 return ret;
309 mem_req->size = img->total_size;
310 mem_req->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700311 }
312 break;
313 default:
314 ret = nulldrv_base_get_info(base, type, size, data);
315 break;
316 }
317
318 return ret;
319}
320
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600321static VkResult nulldrv_img_create(struct nulldrv_dev *dev,
322 const VkImageCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700323 bool scanout,
324 struct nulldrv_img **img_ret)
325{
326 struct nulldrv_img *img;
327
328 img = (struct nulldrv_img *) nulldrv_base_create(dev, sizeof(*img),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600329 VK_DBG_OBJECT_IMAGE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700330 if (!img)
Tony Barbour8205d902015-04-16 15:59:00 -0600331 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700332
333 img->type = info->imageType;
334 img->depth = info->extent.depth;
335 img->mip_levels = info->mipLevels;
336 img->array_size = info->arraySize;
337 img->usage = info->usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700338 img->samples = info->samples;
339
340 img->obj.base.get_info = img_get_info;
341
342 *img_ret = img;
343
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600344 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700345}
346
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600347static struct nulldrv_img *nulldrv_img(VkImage image)
David Pinedo0257fbf2015-02-02 18:02:40 -0700348{
349 return (struct nulldrv_img *) image;
350}
351
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600352static VkResult nulldrv_mem_alloc(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600353 const VkMemoryAllocInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700354 struct nulldrv_mem **mem_ret)
355{
356 struct nulldrv_mem *mem;
357
358 mem = (struct nulldrv_mem *) nulldrv_base_create(dev, sizeof(*mem),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600359 VK_DBG_OBJECT_GPU_MEMORY);
David Pinedo0257fbf2015-02-02 18:02:40 -0700360 if (!mem)
Tony Barbour8205d902015-04-16 15:59:00 -0600361 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700362
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700363 mem->bo = malloc(info->allocationSize);
David Pinedo0257fbf2015-02-02 18:02:40 -0700364 if (!mem->bo) {
Tony Barbour8205d902015-04-16 15:59:00 -0600365 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700366 }
367
368 mem->size = info->allocationSize;
369
370 *mem_ret = mem;
371
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600372 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700373}
374
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600375static VkResult nulldrv_ds_view_create(struct nulldrv_dev *dev,
376 const VkDepthStencilViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700377 struct nulldrv_ds_view **view_ret)
378{
379 struct nulldrv_img *img = nulldrv_img(info->image);
380 struct nulldrv_ds_view *view;
381
382 view = (struct nulldrv_ds_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600383 VK_DBG_OBJECT_DEPTH_STENCIL_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700384 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600385 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700386
387 view->img = img;
388
389 view->array_size = info->arraySize;
390
391 *view_ret = view;
392
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600393 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700394}
395
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600396static VkResult nulldrv_sampler_create(struct nulldrv_dev *dev,
397 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700398 struct nulldrv_sampler **sampler_ret)
399{
400 struct nulldrv_sampler *sampler;
401
402 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600403 sizeof(*sampler), VK_DBG_OBJECT_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700404 if (!sampler)
Tony Barbour8205d902015-04-16 15:59:00 -0600405 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700406
407 *sampler_ret = sampler;
408
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600409 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700410}
411
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600412static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
413 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700414 struct nulldrv_img_view **view_ret)
415{
416 struct nulldrv_img *img = nulldrv_img(info->image);
417 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700418
419 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600420 VK_DBG_OBJECT_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700421 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600422 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700423
424 view->img = img;
425 view->min_lod = info->minLod;
426
David Pinedo0257fbf2015-02-02 18:02:40 -0700427 view->cmd_len = 8;
428
429 *view_ret = view;
430
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600431 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700432}
433
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600434static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700435{
436 return mem->bo;
437}
438
Tony Barbour8205d902015-04-16 15:59:00 -0600439static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700440{
441 return (struct nulldrv_mem *) mem;
442}
443
444static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
445{
446 return (struct nulldrv_buf *) base;
447}
448
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600449static VkResult buf_get_info(struct nulldrv_base *base, int type,
David Pinedo0257fbf2015-02-02 18:02:40 -0700450 size_t *size, void *data)
451{
452 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600453 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700454
455 switch (type) {
Tony Barbour8205d902015-04-16 15:59:00 -0600456 case VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS:
David Pinedo0257fbf2015-02-02 18:02:40 -0700457 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600458 VkMemoryRequirements *mem_req = data;
David Pinedo0257fbf2015-02-02 18:02:40 -0700459
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600460 *size = sizeof(VkMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -0700461 if (data == NULL)
462 return ret;
463
464 mem_req->size = buf->size;
465 mem_req->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700466
467 }
468 break;
David Pinedo0257fbf2015-02-02 18:02:40 -0700469 default:
470 ret = nulldrv_base_get_info(base, type, size, data);
471 break;
472 }
473
474 return ret;
475}
476
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600477static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600478 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700479 struct nulldrv_buf **buf_ret)
480{
481 struct nulldrv_buf *buf;
482
483 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600484 VK_DBG_OBJECT_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700485 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600486 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700487
488 buf->size = info->size;
489 buf->usage = info->usage;
490
491 buf->obj.base.get_info = buf_get_info;
492
493 *buf_ret = buf;
494
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600495 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700496}
497
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600498static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
499 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700500 struct nulldrv_desc_layout **layout_ret)
501{
502 struct nulldrv_desc_layout *layout;
503
504 layout = (struct nulldrv_desc_layout *)
505 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600506 VK_DBG_OBJECT_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700507 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600508 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700509
510 *layout_ret = layout;
511
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600512 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700513}
514
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500515static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
516 const VkPipelineLayoutCreateInfo* pCreateInfo,
517 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800518{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500519 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800520
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500521 pipeline_layout = (struct nulldrv_pipeline_layout *)
522 nulldrv_base_create(dev, sizeof(*pipeline_layout),
523 VK_DBG_OBJECT_PIPELINE_LAYOUT);
524 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600525 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800526
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500527 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800528
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600529 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800530}
531
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600532static struct nulldrv_desc_layout *nulldrv_desc_layout(VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700533{
534 return (struct nulldrv_desc_layout *) layout;
535}
536
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600537static VkResult shader_create(struct nulldrv_dev *dev,
538 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700539 struct nulldrv_shader **sh_ret)
540{
David Pinedo0257fbf2015-02-02 18:02:40 -0700541 struct nulldrv_shader *sh;
542
543 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600544 VK_DBG_OBJECT_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700545 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600546 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700547
548 *sh_ret = sh;
549
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600550 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700551}
552
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600553static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
554 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700555 struct nulldrv_pipeline **pipeline_ret)
556{
557 struct nulldrv_pipeline *pipeline;
558
559 pipeline = (struct nulldrv_pipeline *)
560 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600561 VK_DBG_OBJECT_GRAPHICS_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700562 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600563 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700564
565 *pipeline_ret = pipeline;
566
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600567 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700568}
569
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600570static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
571 const VkDynamicVpStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700572 struct nulldrv_dynamic_vp **state_ret)
573{
574 struct nulldrv_dynamic_vp *state;
575
576 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600577 sizeof(*state), VK_DBG_OBJECT_VIEWPORT_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700578 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600579 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700580
581 *state_ret = state;
582
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600583 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700584}
585
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600586static VkResult nulldrv_raster_state_create(struct nulldrv_dev *dev,
587 const VkDynamicRsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700588 struct nulldrv_dynamic_rs **state_ret)
589{
590 struct nulldrv_dynamic_rs *state;
591
592 state = (struct nulldrv_dynamic_rs *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600593 sizeof(*state), VK_DBG_OBJECT_RASTER_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700594 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600595 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700596
597 *state_ret = state;
598
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600599 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700600}
601
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600602static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
603 const VkDynamicCbStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700604 struct nulldrv_dynamic_cb **state_ret)
605{
606 struct nulldrv_dynamic_cb *state;
607
608 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600609 sizeof(*state), VK_DBG_OBJECT_COLOR_BLEND_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700610 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600611 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700612
613 *state_ret = state;
614
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600615 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700616}
617
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600618static VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
619 const VkDynamicDsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700620 struct nulldrv_dynamic_ds **state_ret)
621{
622 struct nulldrv_dynamic_ds *state;
623
624 state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600625 sizeof(*state), VK_DBG_OBJECT_DEPTH_STENCIL_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700626 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600627 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700628
629 *state_ret = state;
630
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600631 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700632}
633
634
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600635static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
636 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700637 struct nulldrv_cmd **cmd_ret)
638{
David Pinedo0257fbf2015-02-02 18:02:40 -0700639 struct nulldrv_cmd *cmd;
640
David Pinedo0257fbf2015-02-02 18:02:40 -0700641 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600642 VK_DBG_OBJECT_CMD_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700643 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600644 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700645
646 *cmd_ret = cmd;
647
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600648 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700649}
650
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600651static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
652 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700653 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600654 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800655 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700656{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800657 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700658
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800659 pool = (struct nulldrv_desc_pool *)
660 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600661 VK_DBG_OBJECT_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800662 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600663 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700664
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800665 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700666
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800667 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700668
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600669 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700670}
671
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600672static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800673 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600674 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700675 const struct nulldrv_desc_layout *layout,
676 struct nulldrv_desc_set **set_ret)
677{
678 struct nulldrv_desc_set *set;
679
680 set = (struct nulldrv_desc_set *)
681 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600682 VK_DBG_OBJECT_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700683 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600684 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700685
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800686 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700687 set->layout = layout;
688 *set_ret = set;
689
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600690 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700691}
692
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600693static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700694{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800695 return (struct nulldrv_desc_pool *) pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700696}
697
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600698static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
699 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700700 struct nulldrv_framebuffer ** fb_ret)
701{
702
703 struct nulldrv_framebuffer *fb;
704 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600705 VK_DBG_OBJECT_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700706 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600707 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700708
709 *fb_ret = fb;
710
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600711 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700712
713}
714
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600715static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
716 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700717 struct nulldrv_render_pass** rp_ret)
718{
719 struct nulldrv_render_pass *rp;
720 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600721 VK_DBG_OBJECT_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700722 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600723 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700724
725 *rp_ret = rp;
726
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600727 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700728}
729
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600730static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700731{
732 return (struct nulldrv_buf *) buf;
733}
734
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600735static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600736 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700737 struct nulldrv_buf_view **view_ret)
738{
739 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
740 struct nulldrv_buf_view *view;
741
742 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600743 VK_DBG_OBJECT_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700744 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600745 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700746
747 view->buf = buf;
748
749 *view_ret = view;
750
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600751 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700752}
753
David Pinedo0257fbf2015-02-02 18:02:40 -0700754
755//*********************************************
756// Driver entry points
757//*********************************************
758
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600759ICD_EXPORT VkResult VKAPI vkCreateBuffer(
760 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600761 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600762 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700763{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700764 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700765 struct nulldrv_dev *dev = nulldrv_dev(device);
766
767 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
768}
769
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600770ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
771 VkDevice device,
772 const VkCmdBufferCreateInfo* pCreateInfo,
773 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700774{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700775 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700776 struct nulldrv_dev *dev = nulldrv_dev(device);
777
778 return nulldrv_cmd_create(dev, pCreateInfo,
779 (struct nulldrv_cmd **) pCmdBuffer);
780}
781
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600782ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
783 VkCmdBuffer cmdBuffer,
784 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700785{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700786 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600787 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700788}
789
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600790ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
791 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700792{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700793 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600794 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700795}
796
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600797ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
798 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700799{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700800 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600801 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700802}
803
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600804ICD_EXPORT void VKAPI vkCmdInitAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600805 VkCmdBuffer cmdBuffer,
806 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700807 uint32_t startCounter,
808 uint32_t counterCount,
809 const uint32_t* pData)
810{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700811 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700812}
813
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600814ICD_EXPORT void VKAPI vkCmdLoadAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600815 VkCmdBuffer cmdBuffer,
816 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700817 uint32_t startCounter,
818 uint32_t counterCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600819 VkBuffer srcBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600820 VkDeviceSize srcOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700821{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700822 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700823}
824
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600825ICD_EXPORT void VKAPI vkCmdSaveAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600826 VkCmdBuffer cmdBuffer,
827 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700828 uint32_t startCounter,
829 uint32_t counterCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600830 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600831 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700832{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700833 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700834}
835
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600836ICD_EXPORT void VKAPI vkCmdDbgMarkerBegin(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600837 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700838 const char* pMarker)
839{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700840 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700841}
842
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600843ICD_EXPORT void VKAPI vkCmdDbgMarkerEnd(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600844 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700845{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700846 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700847}
848
Ian Elliott64a68e12015-04-16 11:57:46 -0600849static const VkFormat nulldrv_presentable_formats[] = {
850 VK_FORMAT_B8G8R8A8_UNORM,
851};
852
853ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
854 VkDisplayWSI display,
855 VkDisplayInfoTypeWSI infoType,
856 size_t* pDataSize,
857 void* pData)
858{
859 VkResult ret = VK_SUCCESS;
860
861 NULLDRV_LOG_FUNC;
862
863 if (!pDataSize)
864 return VK_ERROR_INVALID_POINTER;
865
866 switch (infoType) {
867 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
868 {
869 VkDisplayFormatPropertiesWSI *dst = pData;
870 size_t size_ret;
871 uint32_t i;
872
873 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
874
875 if (dst && *pDataSize < size_ret)
876 return VK_ERROR_INVALID_VALUE;
877
878 *pDataSize = size_ret;
879 if (!dst)
880 return VK_SUCCESS;
881
882 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
883 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
884 }
885 break;
886 default:
887 ret = VK_ERROR_INVALID_VALUE;
888 break;
889 }
890
891 return ret;
892}
893
894ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
895 VkDevice device,
896 const VkSwapChainCreateInfoWSI* pCreateInfo,
897 VkSwapChainWSI* pSwapChain)
898{
899 NULLDRV_LOG_FUNC;
900 struct nulldrv_dev *dev = nulldrv_dev(device);
901 struct nulldrv_swap_chain *sc;
902
903 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
904 /*VK_OBJECT_TYPE_SWAP_CHAIN_WSI*//* FIXME: DELETE THIS HACK: */VK_DBG_OBJECT_QUEUE);
905 if (!sc) {
906 return VK_ERROR_OUT_OF_HOST_MEMORY;
907 }
908 sc->dev = dev;
909
Tony Barbour11e76ac2015-04-20 16:28:46 -0600910 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600911
912 return VK_SUCCESS;
913}
914
915ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
916 VkSwapChainWSI swapChain)
917{
918 NULLDRV_LOG_FUNC;
919 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
920
921 free(sc);
922
923 return VK_SUCCESS;
924}
925
926ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
927 VkSwapChainWSI swapChain,
928 VkSwapChainInfoTypeWSI infoType,
929 size_t* pDataSize,
930 void* pData)
931{
932 NULLDRV_LOG_FUNC;
933 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
934 struct nulldrv_dev *dev = sc->dev;
935 VkResult ret = VK_SUCCESS;
936
937 if (!pDataSize)
938 return VK_ERROR_INVALID_POINTER;
939
940 switch (infoType) {
941 case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
942 {
943 VkSwapChainImageInfoWSI *images;
944 const size_t size = sizeof(*images) * 2;
945 uint32_t i;
946
947 if (pData && *pDataSize < size)
948 return VK_ERROR_INVALID_VALUE;
949
950 *pDataSize = size;
951 if (!pData)
952 return VK_SUCCESS;
953
954 images = (VkSwapChainImageInfoWSI *) pData;
955 for (i = 0; i < 2; i++) {
956 struct nulldrv_img *img;
957 struct nulldrv_mem *mem;
958
959 img = (struct nulldrv_img *) nulldrv_base_create(dev,
960 sizeof(*img),
961 VK_DBG_OBJECT_IMAGE);
962 if (!img)
963 return VK_ERROR_OUT_OF_HOST_MEMORY;
964
965 mem = (struct nulldrv_mem *) nulldrv_base_create(dev,
966 sizeof(*mem),
967 VK_DBG_OBJECT_GPU_MEMORY);
968 if (!mem)
969 return VK_ERROR_OUT_OF_HOST_MEMORY;
970
971 images[i].image = (VkImage) img;
972 images[i].memory = (VkDeviceMemory) mem;
973 }
974 }
975 break;
976 default:
977 ret = VK_ERROR_INVALID_VALUE;
978 break;
979 }
980
981 return ret;
982}
983
984ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
985 VkQueue queue_,
986 const VkPresentInfoWSI* pPresentInfo)
987{
988 NULLDRV_LOG_FUNC;
989
990 return VK_SUCCESS;
991}
992
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600993ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600994 VkCmdBuffer cmdBuffer,
995 VkBuffer srcBuffer,
996 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700997 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600998 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700999{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001000 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001001}
1002
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001003ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001004 VkCmdBuffer cmdBuffer,
1005 VkImage srcImage,
1006 VkImageLayout srcImageLayout,
1007 VkImage destImage,
1008 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001009 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001010 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001011{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001012 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001013}
1014
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001015ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001016 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001017 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001018 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001019 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001020 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001021 uint32_t regionCount,
1022 const VkImageBlit* pRegions,
1023 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -06001024{
1025 NULLDRV_LOG_FUNC;
1026}
1027
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001028ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001029 VkCmdBuffer cmdBuffer,
1030 VkBuffer srcBuffer,
1031 VkImage destImage,
1032 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001033 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001034 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001035{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001036 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001037}
1038
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001039ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001040 VkCmdBuffer cmdBuffer,
1041 VkImage srcImage,
1042 VkImageLayout srcImageLayout,
1043 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001044 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001045 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001046{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001047 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001048}
1049
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001050ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001051 VkCmdBuffer cmdBuffer,
1052 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001053 VkDeviceSize destOffset,
1054 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001055 const uint32_t* pData)
1056{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001057 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001058}
1059
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001060ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001061 VkCmdBuffer cmdBuffer,
1062 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001063 VkDeviceSize destOffset,
1064 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001065 uint32_t data)
1066{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001067 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001068}
1069
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001070ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001071 VkCmdBuffer cmdBuffer,
1072 VkImage image,
1073 VkImageLayout imageLayout,
1074 const VkClearColor *pColor,
1075 uint32_t rangeCount,
1076 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001077{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001078 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001079}
1080
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001081ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001082 VkCmdBuffer cmdBuffer,
1083 VkImage image,
1084 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001085 float depth,
1086 uint32_t stencil,
1087 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001088 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001089{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001090 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001091}
1092
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001093ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001094 VkCmdBuffer cmdBuffer,
1095 VkImage srcImage,
1096 VkImageLayout srcImageLayout,
1097 VkImage destImage,
1098 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001099 uint32_t regionCount,
1100 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001101{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001102 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001103}
1104
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001105ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001106 VkCmdBuffer cmdBuffer,
1107 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001108 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001109 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001110{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001111 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001112}
1113
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001114ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001115 VkCmdBuffer cmdBuffer,
1116 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001117 uint32_t slot)
1118{
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 vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001123 VkCmdBuffer cmdBuffer,
1124 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001125 uint32_t startQuery,
1126 uint32_t queryCount)
1127{
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 vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001132 VkCmdBuffer cmdBuffer,
1133 VkEvent event_,
1134 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001135{
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 vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001140 VkCmdBuffer cmdBuffer,
1141 VkEvent event_,
1142 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001143{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001144 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001145}
1146
Ian Elliott63f1edb2015-04-16 18:10:19 -06001147ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1148 VkCmdBuffer cmdBuffer,
1149 VkQueryPool queryPool,
1150 uint32_t startQuery,
1151 uint32_t queryCount,
1152 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001153 VkDeviceSize destOffset,
1154 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001155 VkFlags flags)
1156{
1157 NULLDRV_LOG_FUNC;
1158}
1159
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001160ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001161 VkCmdBuffer cmdBuffer,
1162 VkTimestampType timestampType,
1163 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001164 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001165{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001166 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001167}
1168
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001169ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001170 VkCmdBuffer cmdBuffer,
1171 VkPipelineBindPoint pipelineBindPoint,
1172 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001173{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001174 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001175}
1176
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001177ICD_EXPORT void VKAPI vkCmdBindDynamicStateObject(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001178 VkCmdBuffer cmdBuffer,
1179 VkStateBindPoint stateBindPoint,
1180 VkDynamicStateObject state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001181{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001182 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001183}
1184
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001185ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001186 VkCmdBuffer cmdBuffer,
1187 VkPipelineBindPoint pipelineBindPoint,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001188 uint32_t firstSet,
1189 uint32_t setCount,
1190 const VkDescriptorSet* pDescriptorSets,
1191 uint32_t dynamicOffsetCount,
1192 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001193{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001194 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001195}
1196
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001197ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1198 VkCmdBuffer cmdBuffer,
1199 uint32_t startBinding,
1200 uint32_t bindingCount,
1201 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001202 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001203{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001204 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001205}
1206
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001207ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001208 VkCmdBuffer cmdBuffer,
1209 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001210 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001211 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001212{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001213 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001214}
1215
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001216ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001217 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001218 uint32_t firstVertex,
1219 uint32_t vertexCount,
1220 uint32_t firstInstance,
1221 uint32_t instanceCount)
1222{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001223 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001224}
1225
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001226ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001227 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001228 uint32_t firstIndex,
1229 uint32_t indexCount,
1230 int32_t vertexOffset,
1231 uint32_t firstInstance,
1232 uint32_t instanceCount)
1233{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001234 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001235}
1236
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001237ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001238 VkCmdBuffer cmdBuffer,
1239 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001240 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001241 uint32_t count,
1242 uint32_t stride)
1243{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001244 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001245}
1246
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001247ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001248 VkCmdBuffer cmdBuffer,
1249 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001250 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001251 uint32_t count,
1252 uint32_t stride)
1253{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001254 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001255}
1256
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001257ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001258 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001259 uint32_t x,
1260 uint32_t y,
1261 uint32_t z)
1262{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001263 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001264}
1265
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001266ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001267 VkCmdBuffer cmdBuffer,
1268 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001269 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001270{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001271 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001272}
1273
Tony Barbour8205d902015-04-16 15:59:00 -06001274void VKAPI vkCmdWaitEvents(
1275 VkCmdBuffer cmdBuffer,
1276 VkWaitEvent waitEvent,
1277 uint32_t eventCount,
1278 const VkEvent* pEvents,
1279 uint32_t memBarrierCount,
1280 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001281{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001282 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001283}
1284
Tony Barbour8205d902015-04-16 15:59:00 -06001285void VKAPI vkCmdPipelineBarrier(
1286 VkCmdBuffer cmdBuffer,
1287 VkWaitEvent waitEvent,
1288 uint32_t pipeEventCount,
1289 const VkPipeEvent* pPipeEvents,
1290 uint32_t memBarrierCount,
1291 const void** ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001292{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001293 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001294}
1295
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001296ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001297 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001298 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001299 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001300{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001301 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001302 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1303 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1304}
1305
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001306ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1307 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001308{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001309 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001310 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001311}
1312
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001313ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1314 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001315 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001316 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001317 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001318{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001319 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001320 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001321 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001322 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001323}
1324
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001325ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1326 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001327{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001328 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001329 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001330}
1331
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001332ICD_EXPORT VkResult VKAPI vkDbgSetValidationLevel(
1333 VkDevice device,
1334 VkValidationLevel validationLevel)
David Pinedo0257fbf2015-02-02 18:02:40 -07001335{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001336 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001337 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001338}
1339
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001340ICD_EXPORT VkResult VKAPI vkDbgSetMessageFilter(
1341 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001342 int32_t msgCode,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001343 VK_DBG_MSG_FILTER filter)
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 vkDbgSetDeviceOption(
1350 VkDevice device,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001351 VK_DBG_DEVICE_OPTION dbgOption,
David Pinedo0257fbf2015-02-02 18:02:40 -07001352 size_t dataSize,
1353 const void* pData)
1354{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001355 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001356 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001357}
1358
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001359ICD_EXPORT VkResult VKAPI vkCreateEvent(
1360 VkDevice device,
1361 const VkEventCreateInfo* pCreateInfo,
1362 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001363{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001364 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001365 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001366}
1367
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001368ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001369 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001370 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001371{
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 vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001377 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001378 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001379{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001380 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001381 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001382}
1383
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001384ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001385 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001386 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001387{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001388 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001389 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001390}
1391
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001392ICD_EXPORT VkResult VKAPI vkCreateFence(
1393 VkDevice device,
1394 const VkFenceCreateInfo* pCreateInfo,
1395 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001396{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001397 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001398 struct nulldrv_dev *dev = nulldrv_dev(device);
1399
1400 return nulldrv_fence_create(dev, pCreateInfo,
1401 (struct nulldrv_fence **) pFence);
1402}
1403
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001404ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001405 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001406 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001407{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001408 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001409 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001410}
1411
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001412ICD_EXPORT VkResult VKAPI vkResetFences(
1413 VkDevice device,
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001414 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001415 VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001416{
1417 NULLDRV_LOG_FUNC;
1418 return VK_SUCCESS;
1419}
1420
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001421ICD_EXPORT VkResult VKAPI vkWaitForFences(
1422 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001423 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001424 const VkFence* pFences,
David Pinedo0257fbf2015-02-02 18:02:40 -07001425 bool32_t waitAll,
1426 uint64_t timeout)
1427{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001428 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001429 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001430}
1431
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001432ICD_EXPORT VkResult VKAPI vkGetFormatInfo(
1433 VkDevice device,
1434 VkFormat format,
1435 VkFormatInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001436 size_t* pDataSize,
1437 void* pData)
1438{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001439 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001440 VkFormatProperties *fmt = (VkFormatProperties *) pData;
1441 VkResult ret = VK_SUCCESS;
1442
1443 switch (infoType) {
1444 case VK_FORMAT_INFO_TYPE_PROPERTIES:
1445 *pDataSize = sizeof(VkFormatProperties);
1446 if (pData == NULL)
1447 return ret;
1448 fmt->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1449 fmt->optimalTilingFeatures = fmt->linearTilingFeatures;
1450 break;
1451 default:
1452 ret = VK_ERROR_INVALID_VALUE;
1453 break;
1454 }
1455
1456 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001457}
1458
Tony Barbour8205d902015-04-16 15:59:00 -06001459ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceInfo(
1460 VkPhysicalDevice gpu_,
1461 VkPhysicalDeviceInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001462 size_t* pDataSize,
1463 void* pData)
1464{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001465 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001466 VkResult ret = VK_SUCCESS;
1467
Ian Elliott32536f92015-04-21 16:41:02 -06001468 if (infoType == VK_PHYSICAL_DEVICE_INFO_TYPE_DISPLAY_PROPERTIES_WSI) {
1469 // NOTE: Handle this extension value as a special case:
1470 struct nulldrv_display *display;
1471 VkDisplayPropertiesWSI *props =
1472 (VkDisplayPropertiesWSI *) pData;
1473 *pDataSize = sizeof(VkDisplayPropertiesWSI);
1474 if (pData == NULL) {
1475 return ret;
1476 }
1477 display = (struct nulldrv_display *) nulldrv_base_create(NULL, sizeof(*display),
1478 /*VK_OBJECT_TYPE_SWAP_CHAIN_WSI*//* FIXME: DELETE THIS HACK: */VK_DBG_OBJECT_QUEUE);
1479 props->display = (VkDisplayWSI) display;
1480 props->physicalResolution.width = 1920;
1481 props->physicalResolution.height = 1080;
1482
1483 return ret;
1484 }
1485
Ian Elliott64a68e12015-04-16 11:57:46 -06001486 switch (infoType) {
1487 case VK_PHYSICAL_DEVICE_INFO_TYPE_PROPERTIES:
1488 {
1489 VkPhysicalDeviceProperties *props =
1490 (VkPhysicalDeviceProperties *) pData;
1491 *pDataSize = sizeof(VkPhysicalDeviceProperties);
1492 if (pData == NULL) {
1493 return ret;
1494 }
1495 props->apiVersion = VK_API_VERSION;
1496 props->driverVersion = 0; // Appropriate that the nulldrv have 0's
1497 props->vendorId = 0;
1498 props->deviceId = 0;
1499 props->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1500 strncpy(props->deviceName, "nulldrv", strlen("nulldrv"));
1501 props->maxInlineMemoryUpdateSize = 0;
1502 props->maxBoundDescriptorSets = 0;
1503 props->maxThreadGroupSize = 0;
1504 props->timestampFrequency = 0;
1505 props->multiColorAttachmentClears = false;
1506 break;
1507 }
1508 case VK_PHYSICAL_DEVICE_INFO_TYPE_PERFORMANCE:
1509 {
1510 VkPhysicalDevicePerformance *perf =
1511 (VkPhysicalDevicePerformance *) pData;
1512 *pDataSize = sizeof(VkPhysicalDevicePerformance);
1513 if (pData == NULL) {
1514 return ret;
1515 }
1516 perf->maxDeviceClock = 1.0f;
1517 perf->aluPerClock = 1.0f;
1518 perf->texPerClock = 1.0f;
1519 perf->primsPerClock = 1.0f;
1520 perf->pixelsPerClock = 1.0f;
1521 break;
1522 }
1523 case VK_PHYSICAL_DEVICE_INFO_TYPE_QUEUE_PROPERTIES:
1524 {
1525 VkPhysicalDeviceQueueProperties *props =
1526 (VkPhysicalDeviceQueueProperties *) pData;
1527 *pDataSize = sizeof(VkPhysicalDeviceQueueProperties);
1528 if (pData == NULL) {
1529 return ret;
1530 }
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001531 props->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
Ian Elliott64a68e12015-04-16 11:57:46 -06001532 props->queueCount = 1;
1533 props->maxAtomicCounters = 1;
1534 props->supportsTimestamps = false;
Ian Elliott64a68e12015-04-16 11:57:46 -06001535 break;
1536 }
1537 default:
1538/* FIXME: WRITE THE REAL CODE*/return ret;
1539 break;
1540 }
1541
1542 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001543}
1544
Jon Ashburneb2728b2015-04-10 14:33:07 -06001545ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionInfo(
1546 VkExtensionInfoType infoType,
1547 uint32_t extensionIndex,
1548 size_t* pDataSize,
1549 void* pData)
1550{
Ian Elliott64a68e12015-04-16 11:57:46 -06001551 VkExtensionProperties *ext_props;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001552 uint32_t *count;
1553
1554 if (pDataSize == NULL)
1555 return VK_ERROR_INVALID_POINTER;
1556
1557 switch (infoType) {
1558 case VK_EXTENSION_INFO_TYPE_COUNT:
1559 *pDataSize = sizeof(uint32_t);
1560 if (pData == NULL)
1561 return VK_SUCCESS;
1562 count = (uint32_t *) pData;
Ian Elliott64a68e12015-04-16 11:57:46 -06001563 *count = 1;
Jon Ashburneb2728b2015-04-10 14:33:07 -06001564 break;
1565 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
Ian Elliott64a68e12015-04-16 11:57:46 -06001566 *pDataSize = sizeof(VkExtensionProperties);
Jon Ashburneb2728b2015-04-10 14:33:07 -06001567 if (pData == NULL)
1568 return VK_SUCCESS;
Ian Elliott64a68e12015-04-16 11:57:46 -06001569 else {
1570 ext_props = (VkExtensionProperties *) pData;
1571 ext_props->version = VK_WSI_LUNARG_REVISION;
Jon Ashburncedc15f2015-05-21 18:13:33 -06001572 strncpy(ext_props->extName, VK_WSI_LUNARG_EXTENSION_NAME,
1573 strlen(VK_WSI_LUNARG_EXTENSION_NAME)+1);
Ian Elliott64a68e12015-04-16 11:57:46 -06001574 return VK_SUCCESS;
1575 }
Jon Ashburneb2728b2015-04-10 14:33:07 -06001576 break;
1577 default:
1578 return VK_ERROR_INVALID_VALUE;
1579 };
1580
1581 return VK_SUCCESS;
1582}
1583
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001584VkResult VKAPI vkGetPhysicalDeviceExtensionInfo(
Tony Barbour8205d902015-04-16 15:59:00 -06001585 VkPhysicalDevice gpu,
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001586 VkExtensionInfoType infoType,
1587 uint32_t extensionIndex,
1588 size_t* pDataSize,
1589 void* pData)
David Pinedo0257fbf2015-02-02 18:02:40 -07001590{
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001591 uint32_t *count;
1592
1593 if (pDataSize == NULL)
1594 return VK_ERROR_INVALID_POINTER;
1595
1596 switch (infoType) {
1597 case VK_EXTENSION_INFO_TYPE_COUNT:
1598 *pDataSize = sizeof(uint32_t);
1599 if (pData == NULL)
1600 return VK_SUCCESS;
1601 count = (uint32_t *) pData;
1602 *count = 0;
1603 break;
1604 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
1605 *pDataSize = 0;
1606 if (pData == NULL)
1607 return VK_SUCCESS;
1608 return VK_ERROR_INVALID_EXTENSION;
1609 break;
1610 default:
1611 return VK_ERROR_INVALID_VALUE;
1612 };
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001613 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001614}
1615
Tony Barbour8205d902015-04-16 15:59:00 -06001616ICD_EXPORT VkResult VKAPI vkGetMultiDeviceCompatibility(
1617 VkPhysicalDevice gpu0_,
1618 VkPhysicalDevice gpu1_,
1619 VkPhysicalDeviceCompatibilityInfo* pInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001620{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001621 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001622 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001623}
1624
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001625ICD_EXPORT VkResult VKAPI vkOpenPeerImage(
1626 VkDevice device,
1627 const VkPeerImageOpenInfo* pOpenInfo,
1628 VkImage* pImage,
Tony Barbour8205d902015-04-16 15:59:00 -06001629 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001630{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001631 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001632 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001633}
1634
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001635ICD_EXPORT VkResult VKAPI vkCreateImage(
1636 VkDevice device,
1637 const VkImageCreateInfo* pCreateInfo,
1638 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001639{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001640 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001641 struct nulldrv_dev *dev = nulldrv_dev(device);
1642
1643 return nulldrv_img_create(dev, pCreateInfo, false,
1644 (struct nulldrv_img **) pImage);
1645}
1646
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001647ICD_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(
Mike Stroyan230e6252015-04-17 12:36:38 -06001648 VkDevice device,
1649 VkImage image,
1650 const VkImageSubresource* pSubresource,
1651 VkSubresourceInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001652 size_t* pDataSize,
1653 void* pData)
1654{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001655 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001656 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001657
1658 switch (infoType) {
Tony Barbour8205d902015-04-16 15:59:00 -06001659 case VK_SUBRESOURCE_INFO_TYPE_LAYOUT:
David Pinedo0257fbf2015-02-02 18:02:40 -07001660 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001661 VkSubresourceLayout *layout = (VkSubresourceLayout *) pData;
David Pinedo0257fbf2015-02-02 18:02:40 -07001662
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001663 *pDataSize = sizeof(VkSubresourceLayout);
David Pinedo0257fbf2015-02-02 18:02:40 -07001664
1665 if (pData == NULL)
1666 return ret;
1667 layout->offset = 0;
1668 layout->size = 1;
1669 layout->rowPitch = 4;
1670 layout->depthPitch = 4;
1671 }
1672 break;
1673 default:
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001674 ret = VK_ERROR_INVALID_VALUE;
David Pinedo0257fbf2015-02-02 18:02:40 -07001675 break;
1676 }
1677
1678 return ret;
1679}
1680
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001681ICD_EXPORT VkResult VKAPI vkAllocMemory(
1682 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001683 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001684 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001685{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001686 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001687 struct nulldrv_dev *dev = nulldrv_dev(device);
1688
1689 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1690}
1691
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001692ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001693 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001694 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001695{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001696 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001697 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001698}
1699
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001700ICD_EXPORT VkResult VKAPI vkSetMemoryPriority(
Mike Stroyan230e6252015-04-17 12:36:38 -06001701 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001702 VkDeviceMemory mem_,
Mike Stroyan230e6252015-04-17 12:36:38 -06001703 VkMemoryPriority priority)
David Pinedo0257fbf2015-02-02 18:02:40 -07001704{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001705 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001706 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001707}
1708
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001709ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001710 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001711 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001712 VkDeviceSize offset,
1713 VkDeviceSize size,
1714 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001715 void** ppData)
1716{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001717 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001718 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1719 void *ptr = nulldrv_mem_map(mem, flags);
1720
1721 *ppData = ptr;
1722
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001723 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001724}
1725
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001726ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001727 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001728 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001729{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001730 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001731 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001732}
1733
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001734ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001735 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001736 uint32_t memRangeCount,
1737 const VkMappedMemoryRange* pMemRanges)
1738{
1739 NULLDRV_LOG_FUNC;
1740 return VK_SUCCESS;
1741}
1742
1743ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1744 VkDevice device,
1745 uint32_t memRangeCount,
1746 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001747{
1748 NULLDRV_LOG_FUNC;
1749 return VK_SUCCESS;
1750}
1751
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001752ICD_EXPORT VkResult VKAPI vkPinSystemMemory(
1753 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001754 const void* pSysMem,
1755 size_t memSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001756 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001757{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001758 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001759 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001760}
1761
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001762ICD_EXPORT VkResult VKAPI vkOpenSharedMemory(
1763 VkDevice device,
1764 const VkMemoryOpenInfo* pOpenInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001765 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001766{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001767 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001768 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001769}
1770
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001771ICD_EXPORT VkResult VKAPI vkOpenPeerMemory(
1772 VkDevice device,
1773 const VkPeerMemoryOpenInfo* pOpenInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001774 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001775{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001776 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001777 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001778}
1779
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001780ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001781 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001782 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001783{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001784 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001785 struct nulldrv_instance *inst;
1786
1787 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001788 VK_DBG_OBJECT_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001789 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001790 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001791
1792 inst->obj.base.get_info = NULL;
1793
Mike Stroyan230e6252015-04-17 12:36:38 -06001794 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001795
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001796 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001797}
1798
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001799ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1800 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001801{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001802 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001803 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001804}
1805
Tony Barbour8205d902015-04-16 15:59:00 -06001806ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001807 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001808 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001809 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001810{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001811 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001812 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001813 struct nulldrv_gpu *gpu;
1814 *pGpuCount = 1;
1815 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001816 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001817 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001818 return ret;
1819}
1820
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001821ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001822 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001823 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001824 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001825 char* const* pOutLayers,
1826 void* pReserved)
1827{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001828 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001829 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001830}
1831
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001832ICD_EXPORT VkResult VKAPI vkDbgRegisterMsgCallback(
1833 VkInstance instance,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001834 VK_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback,
David Pinedo0257fbf2015-02-02 18:02:40 -07001835 void* pUserData)
1836{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001837 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001838 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001839}
1840
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001841ICD_EXPORT VkResult VKAPI vkDbgUnregisterMsgCallback(
1842 VkInstance instance,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001843 VK_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback)
David Pinedo0257fbf2015-02-02 18:02:40 -07001844{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001845 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001846 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001847}
1848
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001849ICD_EXPORT VkResult VKAPI vkDbgSetGlobalOption(
1850 VkInstance instance,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001851 VK_DBG_GLOBAL_OPTION dbgOption,
David Pinedo0257fbf2015-02-02 18:02:40 -07001852 size_t dataSize,
1853 const void* pData)
1854{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001855 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001856 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001857}
1858
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001859ICD_EXPORT VkResult VKAPI vkDestroyObject(
Mike Stroyan230e6252015-04-17 12:36:38 -06001860 VkDevice device,
1861 VkObjectType objType,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001862 VkObject object)
David Pinedo0257fbf2015-02-02 18:02:40 -07001863{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001864 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001865 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001866}
1867
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001868ICD_EXPORT VkResult VKAPI vkGetObjectInfo(
Mike Stroyan230e6252015-04-17 12:36:38 -06001869 VkDevice device,
1870 VkObjectType objType,
1871 VkObject object,
1872 VkObjectInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001873 size_t* pDataSize,
1874 void* pData)
1875{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001876 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001877 struct nulldrv_base *base = nulldrv_base(object);
1878
1879 return base->get_info(base, infoType, pDataSize, pData);
1880}
1881
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001882ICD_EXPORT VkResult VKAPI vkBindObjectMemory(
1883 VkDevice device,
Mike Stroyan230e6252015-04-17 12:36:38 -06001884 VkObjectType objType,
1885 VkObject object,
Tony Barbour8205d902015-04-16 15:59:00 -06001886 VkDeviceMemory mem_,
1887 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001888{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001889 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001890 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001891}
1892
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001893ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001894 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001895 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001896 VkDeviceSize rangeOffset,
1897 VkDeviceSize rangeSize,
1898 VkDeviceMemory mem,
1899 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001900{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001901 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001902 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001903}
1904
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001905ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001906 VkQueue queue,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001907 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001908 const VkImageMemoryBindInfo* pBindInfo,
1909 VkDeviceMemory mem,
1910 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001911{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001912 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001913 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001914}
1915
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001916ICD_EXPORT VkResult VKAPI vkDbgSetObjectTag(
Mike Stroyan230e6252015-04-17 12:36:38 -06001917 VkDevice device,
1918 VkObject object,
David Pinedo0257fbf2015-02-02 18:02:40 -07001919 size_t tagSize,
1920 const void* pTag)
1921{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001922 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001923 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001924}
1925
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001926ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(
1927 VkDevice device,
1928 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1929 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001930{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001931 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001932 struct nulldrv_dev *dev = nulldrv_dev(device);
1933
1934 return graphics_pipeline_create(dev, pCreateInfo,
1935 (struct nulldrv_pipeline **) pPipeline);
1936}
1937
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001938ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(
1939 VkDevice device,
1940 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1941 VkPipeline basePipeline,
1942 VkPipeline* pPipeline)
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001943{
1944 NULLDRV_LOG_FUNC;
1945 struct nulldrv_dev *dev = nulldrv_dev(device);
1946
1947 return graphics_pipeline_create(dev, pCreateInfo,
1948 (struct nulldrv_pipeline **) pPipeline);
1949}
1950
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001951ICD_EXPORT VkResult VKAPI vkCreateComputePipeline(
1952 VkDevice device,
1953 const VkComputePipelineCreateInfo* pCreateInfo,
1954 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001955{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001956 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001957 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001958}
1959
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001960ICD_EXPORT VkResult VKAPI vkStorePipeline(
Mike Stroyan230e6252015-04-17 12:36:38 -06001961 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001962 VkPipeline pipeline,
David Pinedo0257fbf2015-02-02 18:02:40 -07001963 size_t* pDataSize,
1964 void* pData)
1965{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001966 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001967 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001968}
1969
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001970ICD_EXPORT VkResult VKAPI vkLoadPipeline(
1971 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001972 size_t dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001973 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001974 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001975{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001976 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001977 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001978}
1979
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001980ICD_EXPORT VkResult VKAPI vkLoadPipelineDerivative(
1981 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001982 size_t dataSize,
1983 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001984 VkPipeline basePipeline,
1985 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001986{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001987 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001988 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001989}
1990
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001991ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1992 VkDevice device,
1993 const VkQueryPoolCreateInfo* pCreateInfo,
1994 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001995{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001996 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001997 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001998}
1999
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002000ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06002001 VkDevice device,
2002 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07002003 uint32_t startQuery,
2004 uint32_t queryCount,
2005 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06002006 void* pData,
2007 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07002008{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002009 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002010 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002011}
2012
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002013ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
2014 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07002015{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002016 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002017 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002018}
2019
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002020ICD_EXPORT VkResult VKAPI vkQueueSubmit(
2021 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07002022 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002023 const VkCmdBuffer* pCmdBuffers,
2024 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07002025{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002026 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002027 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002028}
2029
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002030ICD_EXPORT VkResult VKAPI vkOpenSharedSemaphore(
2031 VkDevice device,
2032 const VkSemaphoreOpenInfo* pOpenInfo,
2033 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002034{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002035 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002036 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002037}
2038
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002039ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
2040 VkDevice device,
2041 const VkSemaphoreCreateInfo* pCreateInfo,
2042 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002043{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002044 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002045 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002046}
2047
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002048ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
2049 VkQueue queue,
2050 VkSemaphore semaphore)
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 vkQueueWaitSemaphore(
2057 VkQueue queue,
2058 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002059{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002060 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002061 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002062}
2063
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002064ICD_EXPORT VkResult VKAPI vkCreateSampler(
2065 VkDevice device,
2066 const VkSamplerCreateInfo* pCreateInfo,
2067 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07002068{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002069 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002070 struct nulldrv_dev *dev = nulldrv_dev(device);
2071
2072 return nulldrv_sampler_create(dev, pCreateInfo,
2073 (struct nulldrv_sampler **) pSampler);
2074}
2075
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002076ICD_EXPORT VkResult VKAPI vkCreateShader(
2077 VkDevice device,
2078 const VkShaderCreateInfo* pCreateInfo,
2079 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002080{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002081 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002082 struct nulldrv_dev *dev = nulldrv_dev(device);
2083
2084 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2085}
2086
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002087ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2088 VkDevice device,
2089 const VkDynamicVpStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002090 VkDynamicVpState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002091{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002092 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002093 struct nulldrv_dev *dev = nulldrv_dev(device);
2094
2095 return nulldrv_viewport_state_create(dev, pCreateInfo,
2096 (struct nulldrv_dynamic_vp **) pState);
2097}
2098
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002099ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
2100 VkDevice device,
2101 const VkDynamicRsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002102 VkDynamicRsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002103{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002104 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002105 struct nulldrv_dev *dev = nulldrv_dev(device);
2106
2107 return nulldrv_raster_state_create(dev, pCreateInfo,
2108 (struct nulldrv_dynamic_rs **) pState);
2109}
2110
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002111ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
2112 VkDevice device,
2113 const VkDynamicCbStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002114 VkDynamicCbState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002115{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002116 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002117 struct nulldrv_dev *dev = nulldrv_dev(device);
2118
2119 return nulldrv_blend_state_create(dev, pCreateInfo,
2120 (struct nulldrv_dynamic_cb **) pState);
2121}
2122
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002123ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
2124 VkDevice device,
2125 const VkDynamicDsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06002126 VkDynamicDsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002127{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002128 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002129 struct nulldrv_dev *dev = nulldrv_dev(device);
2130
2131 return nulldrv_ds_state_create(dev, pCreateInfo,
2132 (struct nulldrv_dynamic_ds **) pState);
2133}
2134
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002135ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2136 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002137 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002138 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002139{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002140 NULLDRV_LOG_FUNC;
2141 struct nulldrv_dev *dev = nulldrv_dev(device);
2142
2143 return nulldrv_buf_view_create(dev, pCreateInfo,
2144 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002145}
2146
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002147ICD_EXPORT VkResult VKAPI vkCreateImageView(
2148 VkDevice device,
2149 const VkImageViewCreateInfo* pCreateInfo,
2150 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002151{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002152 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002153 struct nulldrv_dev *dev = nulldrv_dev(device);
2154
2155 return nulldrv_img_view_create(dev, pCreateInfo,
2156 (struct nulldrv_img_view **) pView);
2157}
2158
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002159ICD_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
2160 VkDevice device,
2161 const VkColorAttachmentViewCreateInfo* pCreateInfo,
2162 VkColorAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002163{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002164 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002165 struct nulldrv_dev *dev = nulldrv_dev(device);
2166
2167 return nulldrv_rt_view_create(dev, pCreateInfo,
2168 (struct nulldrv_rt_view **) pView);
2169}
2170
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002171ICD_EXPORT VkResult VKAPI vkCreateDepthStencilView(
2172 VkDevice device,
2173 const VkDepthStencilViewCreateInfo* pCreateInfo,
2174 VkDepthStencilView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002175{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002176 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002177 struct nulldrv_dev *dev = nulldrv_dev(device);
2178
2179 return nulldrv_ds_view_create(dev, pCreateInfo,
2180 (struct nulldrv_ds_view **) pView);
2181
2182}
2183
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002184ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2185 VkDevice device,
2186 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2187 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002188{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002189 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002190 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002191
Chia-I Wu7732cb22015-03-26 15:27:55 +08002192 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002193 (struct nulldrv_desc_layout **) pSetLayout);
2194}
2195
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002196ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2197 VkDevice device,
2198 const VkPipelineLayoutCreateInfo* pCreateInfo,
2199 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002200{
2201 NULLDRV_LOG_FUNC;
2202 struct nulldrv_dev *dev = nulldrv_dev(device);
2203
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002204 return nulldrv_pipeline_layout_create(dev,
2205 pCreateInfo,
2206 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002207}
2208
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002209ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2210 VkDevice device,
2211 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002212 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002213 const VkDescriptorPoolCreateInfo* pCreateInfo,
2214 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002215{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002216 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002217 struct nulldrv_dev *dev = nulldrv_dev(device);
2218
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002219 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2220 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002221}
2222
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002223ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002224 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002225 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002226{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002227 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002228 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002229}
2230
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002231ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002232 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002233 VkDescriptorPool descriptorPool,
2234 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002235 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002236 const VkDescriptorSetLayout* pSetLayouts,
2237 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07002238 uint32_t* pCount)
2239{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002240 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002241 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2242 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002243 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002244 uint32_t i;
2245
2246 for (i = 0; i < count; i++) {
2247 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002248 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002249
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002250 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002251 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002252 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002253 break;
2254 }
2255
2256 if (pCount)
2257 *pCount = i;
2258
2259 return ret;
2260}
2261
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002262ICD_EXPORT void VKAPI vkClearDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002263 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002264 VkDescriptorPool descriptorPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07002265 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002266 const VkDescriptorSet* pDescriptorSets)
David Pinedo0257fbf2015-02-02 18:02:40 -07002267{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002268 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002269}
2270
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002271ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2272 VkDevice device,
2273 uint32_t writeCount,
2274 const VkWriteDescriptorSet* pDescriptorWrites,
2275 uint32_t copyCount,
2276 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002277{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002278 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002279 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002280}
2281
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002282ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2283 VkDevice device,
2284 const VkFramebufferCreateInfo* info,
2285 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002286{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002287 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002288 struct nulldrv_dev *dev = nulldrv_dev(device);
2289
2290 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2291}
2292
2293
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002294ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2295 VkDevice device,
2296 const VkRenderPassCreateInfo* info,
2297 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002298{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002299 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002300 struct nulldrv_dev *dev = nulldrv_dev(device);
2301
2302 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2303}
2304
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002305ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002306 VkCmdBuffer cmdBuffer,
2307 const VkRenderPassBegin* pRenderPassBegin)
David Pinedo0257fbf2015-02-02 18:02:40 -07002308{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002309 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002310}
2311
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002312ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002313 VkCmdBuffer cmdBuffer,
2314 VkRenderPass renderPass)
David Pinedo0257fbf2015-02-02 18:02:40 -07002315{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002316 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002317}
Ian Elliottf93069f2015-02-19 14:26:19 -07002318
2319ICD_EXPORT void* xcbCreateWindow(
2320 uint16_t width,
2321 uint16_t height)
2322{
2323 static uint32_t window; // Kludge to the max
2324 NULLDRV_LOG_FUNC;
2325 return &window;
2326}
2327
2328// May not be needed, if we stub out stuf in tri.c
2329ICD_EXPORT void xcbDestroyWindow()
2330{
2331 NULLDRV_LOG_FUNC;
2332}
2333
2334ICD_EXPORT int xcbGetMessage(void *msg)
2335{
2336 NULLDRV_LOG_FUNC;
2337 return 0;
2338}
2339
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002340ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002341{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002342 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002343}