blob: 0fb52befab07de20c1e534daf1c5a69226a594c6 [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] = {
Ian Elliott338dedb2015-08-21 15:09:33 -060043 [NULLDRV_EXT_KHR_SWAPCHAIN] = VK_EXT_KHR_SWAPCHAIN_EXTENSION_NAME,
David Pinedo0257fbf2015-02-02 18:02:40 -070044};
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060045static const VkExtensionProperties intel_gpu_exts[NULLDRV_EXT_COUNT] = {
46 {
Ian Elliott338dedb2015-08-21 15:09:33 -060047 .extName = VK_EXT_KHR_SWAPCHAIN_EXTENSION_NAME,
David Pinedob0833bd2015-09-04 15:33:22 -060048 .specVersion = VK_EXT_KHR_SWAPCHAIN_REVISION,
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060049 }
50};
David Pinedo0257fbf2015-02-02 18:02:40 -070051
Tony Barbourde4124d2015-07-03 10:33:54 -060052static struct nulldrv_base *nulldrv_base(void* base)
David Pinedo0257fbf2015-02-02 18:02:40 -070053{
54 return (struct nulldrv_base *) base;
55}
56
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060057static struct nulldrv_base *nulldrv_base_create(
58 struct nulldrv_dev *dev,
59 size_t obj_size,
Tony Barbourde4124d2015-07-03 10:33:54 -060060 VkDbgObjectType type)
David Pinedo0257fbf2015-02-02 18:02:40 -070061{
62 struct nulldrv_base *base;
63
64 if (!obj_size)
65 obj_size = sizeof(*base);
66
67 assert(obj_size >= sizeof(*base));
68
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060069 base = (struct nulldrv_base*)malloc(obj_size);
David Pinedo0257fbf2015-02-02 18:02:40 -070070 if (!base)
71 return NULL;
72
73 memset(base, 0, obj_size);
74
75 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbourde4124d2015-07-03 10:33:54 -060076 set_loader_magic_value(base);
David Pinedo0257fbf2015-02-02 18:02:40 -070077
78 if (dev == NULL) {
79 /*
80 * dev is NULL when we are creating the base device object
81 * Set dev now so that debug setup happens correctly
82 */
83 dev = (struct nulldrv_dev *) base;
84 }
85
86
Tony Barbour426b9052015-06-24 16:06:58 -060087 base->get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -070088
89 return base;
90}
91
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060092static VkResult nulldrv_gpu_add(int devid, const char *primary_node,
David Pinedo0257fbf2015-02-02 18:02:40 -070093 const char *render_node, struct nulldrv_gpu **gpu_ret)
94{
95 struct nulldrv_gpu *gpu;
96
Chia-I Wu493a1752015-02-22 14:40:25 +080097 gpu = malloc(sizeof(*gpu));
David Pinedo0257fbf2015-02-02 18:02:40 -070098 if (!gpu)
Tony Barbour8205d902015-04-16 15:59:00 -060099 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700100 memset(gpu, 0, sizeof(*gpu));
Mark Lobodzinski97dcd042015-04-16 08:52:00 -0500101
David Pinedo0257fbf2015-02-02 18:02:40 -0700102 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbourde4124d2015-07-03 10:33:54 -0600103 set_loader_magic_value(gpu);
David Pinedo0257fbf2015-02-02 18:02:40 -0700104
105 *gpu_ret = gpu;
106
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600107 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700108}
109
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600110static VkResult nulldrv_queue_create(struct nulldrv_dev *dev,
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700111 uint32_t node_index,
David Pinedo0257fbf2015-02-02 18:02:40 -0700112 struct nulldrv_queue **queue_ret)
113{
114 struct nulldrv_queue *queue;
115
116 queue = (struct nulldrv_queue *) nulldrv_base_create(dev, sizeof(*queue),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600117 VK_OBJECT_TYPE_QUEUE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700118 if (!queue)
Tony Barbour8205d902015-04-16 15:59:00 -0600119 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700120
121 queue->dev = dev;
122
123 *queue_ret = queue;
124
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600125 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700126}
127
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600128static VkResult dev_create_queues(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterea975642015-09-16 16:23:55 -0600129 const VkDeviceQueueCreateInfo *queues,
130 uint32_t count)
David Pinedo0257fbf2015-02-02 18:02:40 -0700131{
132 uint32_t i;
133
David Pinedo0257fbf2015-02-02 18:02:40 -0700134 for (i = 0; i < count; i++) {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600135 const VkDeviceQueueCreateInfo *q = &queues[i];
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600136 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700137
Tony Barbour29b12062015-07-13 13:37:24 -0600138 if (q->queueCount == 1 && !dev->queues[q->queueFamilyIndex]) {
139 ret = nulldrv_queue_create(dev, q->queueFamilyIndex,
140 &dev->queues[q->queueFamilyIndex]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700141 }
David Pinedo0257fbf2015-02-02 18:02:40 -0700142
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600143 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700144 return ret;
145 }
146 }
147
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600148 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700149}
150
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600151static enum nulldrv_ext_type nulldrv_gpu_lookup_extension(
152 const struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600153 const char* extName)
David Pinedo0257fbf2015-02-02 18:02:40 -0700154{
155 enum nulldrv_ext_type type;
156
157 for (type = 0; type < ARRAY_SIZE(nulldrv_gpu_exts); type++) {
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600158 if (strcmp(nulldrv_gpu_exts[type], extName) == 0)
David Pinedo0257fbf2015-02-02 18:02:40 -0700159 break;
160 }
161
162 assert(type < NULLDRV_EXT_COUNT || type == NULLDRV_EXT_INVALID);
163
164 return type;
165}
166
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600167static VkResult nulldrv_desc_ooxx_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800168 struct nulldrv_desc_ooxx **ooxx_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700169{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800170 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700171
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800172 ooxx = malloc(sizeof(*ooxx));
173 if (!ooxx)
Tony Barbour8205d902015-04-16 15:59:00 -0600174 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700175
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800176 memset(ooxx, 0, sizeof(*ooxx));
David Pinedo0257fbf2015-02-02 18:02:40 -0700177
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800178 ooxx->surface_desc_size = 0;
179 ooxx->sampler_desc_size = 0;
David Pinedo0257fbf2015-02-02 18:02:40 -0700180
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800181 *ooxx_ret = ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700182
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600183 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700184}
185
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600186static VkResult nulldrv_dev_create(struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600187 const VkDeviceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700188 struct nulldrv_dev **dev_ret)
189{
190 struct nulldrv_dev *dev;
191 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600192 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -0700193
194 dev = (struct nulldrv_dev *) nulldrv_base_create(NULL, sizeof(*dev),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600195 VK_OBJECT_TYPE_DEVICE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700196 if (!dev)
Tony Barbour8205d902015-04-16 15:59:00 -0600197 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700198
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600199 for (i = 0; i < info->extensionCount; i++) {
200 const enum nulldrv_ext_type ext = nulldrv_gpu_lookup_extension(
201 gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600202 info->ppEnabledExtensionNames[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700203
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600204 if (ext == NULLDRV_EXT_INVALID)
Courtney Goeltzenleuchterac544f32015-09-14 18:01:17 -0600205 return VK_ERROR_EXTENSION_NOT_PRESENT;
David Pinedo0257fbf2015-02-02 18:02:40 -0700206
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600207 dev->exts[ext] = true;
208 }
David Pinedo0257fbf2015-02-02 18:02:40 -0700209
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800210 ret = nulldrv_desc_ooxx_create(dev, &dev->desc_ooxx);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600211 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700212 return ret;
213 }
214
215 ret = dev_create_queues(dev, info->pRequestedQueues,
216 info->queueRecordCount);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600217 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700218 return ret;
219 }
220
221 *dev_ret = dev;
222
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600223 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700224}
225
Tony Barbour8205d902015-04-16 15:59:00 -0600226static struct nulldrv_gpu *nulldrv_gpu(VkPhysicalDevice gpu)
David Pinedo0257fbf2015-02-02 18:02:40 -0700227{
228 return (struct nulldrv_gpu *) gpu;
229}
230
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600231static VkResult nulldrv_rt_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchter1856d6f2015-09-01 17:30:39 -0600232 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700233 struct nulldrv_rt_view **view_ret)
234{
235 struct nulldrv_rt_view *view;
236
237 view = (struct nulldrv_rt_view *) nulldrv_base_create(dev, sizeof(*view),
Chia-I Wuc278df82015-07-07 11:50:03 +0800238 VK_OBJECT_TYPE_ATTACHMENT_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700239 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600240 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700241
242 *view_ret = view;
243
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600244 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700245}
246
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600247static VkResult nulldrv_fence_create(struct nulldrv_dev *dev,
248 const VkFenceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700249 struct nulldrv_fence **fence_ret)
250{
251 struct nulldrv_fence *fence;
252
253 fence = (struct nulldrv_fence *) nulldrv_base_create(dev, sizeof(*fence),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600254 VK_OBJECT_TYPE_FENCE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700255 if (!fence)
Tony Barbour8205d902015-04-16 15:59:00 -0600256 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700257
258 *fence_ret = fence;
259
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600260 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700261}
262
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600263static struct nulldrv_dev *nulldrv_dev(VkDevice dev)
David Pinedo0257fbf2015-02-02 18:02:40 -0700264{
265 return (struct nulldrv_dev *) dev;
266}
267
268static struct nulldrv_img *nulldrv_img_from_base(struct nulldrv_base *base)
269{
270 return (struct nulldrv_img *) base;
271}
272
273
Tony Barbour426b9052015-06-24 16:06:58 -0600274static VkResult img_get_memory_requirements(struct nulldrv_base *base,
275 VkMemoryRequirements *pRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700276{
277 struct nulldrv_img *img = nulldrv_img_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600278 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700279
Tony Barbour426b9052015-06-24 16:06:58 -0600280 pRequirements->size = img->total_size;
281 pRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700282
283 return ret;
284}
285
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600286static VkResult nulldrv_img_create(struct nulldrv_dev *dev,
287 const VkImageCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700288 bool scanout,
289 struct nulldrv_img **img_ret)
290{
291 struct nulldrv_img *img;
292
293 img = (struct nulldrv_img *) nulldrv_base_create(dev, sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600294 VK_OBJECT_TYPE_IMAGE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700295 if (!img)
Tony Barbour8205d902015-04-16 15:59:00 -0600296 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700297
298 img->type = info->imageType;
299 img->depth = info->extent.depth;
300 img->mip_levels = info->mipLevels;
301 img->array_size = info->arraySize;
302 img->usage = info->usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700303 img->samples = info->samples;
304
Tony Barbour426b9052015-06-24 16:06:58 -0600305 img->obj.base.get_memory_requirements = img_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700306
307 *img_ret = img;
308
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600309 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700310}
311
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600312static struct nulldrv_img *nulldrv_img(VkImage image)
David Pinedo0257fbf2015-02-02 18:02:40 -0700313{
Tony Barbourde4124d2015-07-03 10:33:54 -0600314 return *(struct nulldrv_img **) &image;
David Pinedo0257fbf2015-02-02 18:02:40 -0700315}
316
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600317static VkResult nulldrv_mem_alloc(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600318 const VkMemoryAllocInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700319 struct nulldrv_mem **mem_ret)
320{
321 struct nulldrv_mem *mem;
322
323 mem = (struct nulldrv_mem *) nulldrv_base_create(dev, sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600324 VK_OBJECT_TYPE_DEVICE_MEMORY);
David Pinedo0257fbf2015-02-02 18:02:40 -0700325 if (!mem)
Tony Barbour8205d902015-04-16 15:59:00 -0600326 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700327
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700328 mem->bo = malloc(info->allocationSize);
David Pinedo0257fbf2015-02-02 18:02:40 -0700329 if (!mem->bo) {
Tony Barbour8205d902015-04-16 15:59:00 -0600330 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700331 }
332
333 mem->size = info->allocationSize;
334
335 *mem_ret = mem;
336
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600337 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700338}
339
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600340static VkResult nulldrv_sampler_create(struct nulldrv_dev *dev,
341 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700342 struct nulldrv_sampler **sampler_ret)
343{
344 struct nulldrv_sampler *sampler;
345
346 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600347 sizeof(*sampler), VK_OBJECT_TYPE_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700348 if (!sampler)
Tony Barbour8205d902015-04-16 15:59:00 -0600349 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700350
351 *sampler_ret = sampler;
352
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600353 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700354}
355
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600356static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
357 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700358 struct nulldrv_img_view **view_ret)
359{
360 struct nulldrv_img *img = nulldrv_img(info->image);
361 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700362
363 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600364 VK_OBJECT_TYPE_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700365 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600366 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700367
368 view->img = img;
David Pinedo0257fbf2015-02-02 18:02:40 -0700369
David Pinedo0257fbf2015-02-02 18:02:40 -0700370 view->cmd_len = 8;
371
372 *view_ret = view;
373
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600374 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700375}
376
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600377static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700378{
379 return mem->bo;
380}
381
Tony Barbour8205d902015-04-16 15:59:00 -0600382static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700383{
Tony Barbourde4124d2015-07-03 10:33:54 -0600384 return *(struct nulldrv_mem **) &mem;
David Pinedo0257fbf2015-02-02 18:02:40 -0700385}
386
387static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
388{
389 return (struct nulldrv_buf *) base;
390}
391
Tony Barbour426b9052015-06-24 16:06:58 -0600392static VkResult buf_get_memory_requirements(struct nulldrv_base *base,
393 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700394{
395 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
David Pinedo0257fbf2015-02-02 18:02:40 -0700396
Tony Barbour426b9052015-06-24 16:06:58 -0600397 if (pMemoryRequirements == NULL)
398 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700399
Tony Barbour426b9052015-06-24 16:06:58 -0600400 pMemoryRequirements->size = buf->size;
401 pMemoryRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700402
Tony Barbour426b9052015-06-24 16:06:58 -0600403 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700404}
405
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600406static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600407 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700408 struct nulldrv_buf **buf_ret)
409{
410 struct nulldrv_buf *buf;
411
412 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600413 VK_OBJECT_TYPE_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700414 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600415 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700416
417 buf->size = info->size;
418 buf->usage = info->usage;
419
Tony Barbour426b9052015-06-24 16:06:58 -0600420 buf->obj.base.get_memory_requirements = buf_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700421
422 *buf_ret = buf;
423
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600424 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700425}
426
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600427static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
428 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700429 struct nulldrv_desc_layout **layout_ret)
430{
431 struct nulldrv_desc_layout *layout;
432
433 layout = (struct nulldrv_desc_layout *)
434 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600435 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700436 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600437 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700438
439 *layout_ret = layout;
440
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600441 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700442}
443
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500444static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
445 const VkPipelineLayoutCreateInfo* pCreateInfo,
446 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800447{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500448 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800449
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500450 pipeline_layout = (struct nulldrv_pipeline_layout *)
451 nulldrv_base_create(dev, sizeof(*pipeline_layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600452 VK_OBJECT_TYPE_PIPELINE_LAYOUT);
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500453 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600454 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800455
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500456 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800457
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600458 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800459}
460
Tony Barbour8db65372015-07-10 18:32:33 -0600461static struct nulldrv_desc_layout *nulldrv_desc_layout(const VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700462{
Tony Barbourde4124d2015-07-03 10:33:54 -0600463 return *(struct nulldrv_desc_layout **) &layout;
David Pinedo0257fbf2015-02-02 18:02:40 -0700464}
465
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600466static VkResult shader_create(struct nulldrv_dev *dev,
467 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700468 struct nulldrv_shader **sh_ret)
469{
David Pinedo0257fbf2015-02-02 18:02:40 -0700470 struct nulldrv_shader *sh;
471
472 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600473 VK_OBJECT_TYPE_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700474 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600475 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700476
477 *sh_ret = sh;
478
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600479 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700480}
481
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600482static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
483 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700484 struct nulldrv_pipeline **pipeline_ret)
485{
486 struct nulldrv_pipeline *pipeline;
487
488 pipeline = (struct nulldrv_pipeline *)
489 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600490 VK_OBJECT_TYPE_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700491 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600492 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700493
494 *pipeline_ret = pipeline;
495
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600496 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700497}
498
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600499static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600500 const VkDynamicViewportStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700501 struct nulldrv_dynamic_vp **state_ret)
502{
503 struct nulldrv_dynamic_vp *state;
504
505 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600506 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_VIEWPORT_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700507 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600508 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700509
510 *state_ret = state;
511
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600512 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700513}
514
Cody Northrope4bc6942015-08-26 10:01:32 -0600515static VkResult nulldrv_line_width_state_create(struct nulldrv_dev *dev,
516 const VkDynamicLineWidthStateCreateInfo *info,
517 struct nulldrv_dynamic_line_width **state_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700518{
Cody Northrope4bc6942015-08-26 10:01:32 -0600519 struct nulldrv_dynamic_line_width *state;
David Pinedo0257fbf2015-02-02 18:02:40 -0700520
Cody Northrope4bc6942015-08-26 10:01:32 -0600521 state = (struct nulldrv_dynamic_line_width *) nulldrv_base_create(dev,
522 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_LINE_WIDTH_STATE);
Cody Northropf5bd2252015-08-17 11:10:49 -0600523 if (!state)
524 return VK_ERROR_OUT_OF_HOST_MEMORY;
525
526 *state_ret = state;
527
528 return VK_SUCCESS;
529}
530
Cody Northrope4bc6942015-08-26 10:01:32 -0600531static VkResult nulldrv_depth_bias_state_create(struct nulldrv_dev *dev,
532 const VkDynamicDepthBiasStateCreateInfo *info,
533 struct nulldrv_dynamic_depth_bias **state_ret)
Cody Northropf5bd2252015-08-17 11:10:49 -0600534{
Cody Northrope4bc6942015-08-26 10:01:32 -0600535 struct nulldrv_dynamic_depth_bias *state;
Cody Northropf5bd2252015-08-17 11:10:49 -0600536
Cody Northrope4bc6942015-08-26 10:01:32 -0600537 state = (struct nulldrv_dynamic_depth_bias *) nulldrv_base_create(dev,
538 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DEPTH_BIAS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700539 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600540 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700541
542 *state_ret = state;
543
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600544 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700545}
546
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600547static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
Cody Northrope4bc6942015-08-26 10:01:32 -0600548 const VkDynamicBlendStateCreateInfo *info,
549 struct nulldrv_dynamic_blend **state_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700550{
Cody Northrope4bc6942015-08-26 10:01:32 -0600551 struct nulldrv_dynamic_blend *state;
David Pinedo0257fbf2015-02-02 18:02:40 -0700552
Cody Northrope4bc6942015-08-26 10:01:32 -0600553 state = (struct nulldrv_dynamic_blend *) nulldrv_base_create(dev,
554 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_BLEND_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700555 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600556 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700557
558 *state_ret = state;
559
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600560 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700561}
562
Cody Northrope4bc6942015-08-26 10:01:32 -0600563static VkResult nulldrv_depth_bounds_state_create(struct nulldrv_dev *dev,
564 const VkDynamicDepthBoundsStateCreateInfo *info,
565 struct nulldrv_dynamic_depth_bounds **state_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700566{
Cody Northrope4bc6942015-08-26 10:01:32 -0600567 struct nulldrv_dynamic_depth_bounds *state;
David Pinedo0257fbf2015-02-02 18:02:40 -0700568
Cody Northrope4bc6942015-08-26 10:01:32 -0600569 state = (struct nulldrv_dynamic_depth_bounds *) nulldrv_base_create(dev,
570 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DEPTH_BOUNDS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700571 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600572 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700573
574 *state_ret = state;
575
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600576 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700577}
578
Cody Northrop2605cb02015-08-18 15:21:16 -0600579static VkResult nulldrv_stencil_state_create(struct nulldrv_dev *dev,
580 const VkDynamicStencilStateCreateInfo *infoFront,
581 const VkDynamicStencilStateCreateInfo *infoBack,
582 struct nulldrv_dynamic_stencil **state_ret)
583{
584 struct nulldrv_dynamic_stencil *state;
585
586 state = (struct nulldrv_dynamic_stencil *) nulldrv_base_create(dev,
587 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE);
588 if (!state)
589 return VK_ERROR_OUT_OF_HOST_MEMORY;
590
591 *state_ret = state;
592
593 return VK_SUCCESS;
594}
David Pinedo0257fbf2015-02-02 18:02:40 -0700595
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600596static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
597 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700598 struct nulldrv_cmd **cmd_ret)
599{
David Pinedo0257fbf2015-02-02 18:02:40 -0700600 struct nulldrv_cmd *cmd;
601
David Pinedo0257fbf2015-02-02 18:02:40 -0700602 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600603 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700604 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600605 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700606
607 *cmd_ret = cmd;
608
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600609 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700610}
611
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600612static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600613 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800614 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700615{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800616 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700617
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800618 pool = (struct nulldrv_desc_pool *)
619 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600620 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800621 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600622 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700623
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800624 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700625
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800626 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700627
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600628 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700629}
630
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600631static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800632 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600633 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700634 const struct nulldrv_desc_layout *layout,
635 struct nulldrv_desc_set **set_ret)
636{
637 struct nulldrv_desc_set *set;
638
639 set = (struct nulldrv_desc_set *)
640 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600641 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700642 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600643 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700644
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800645 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700646 set->layout = layout;
647 *set_ret = set;
648
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600649 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700650}
651
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600652static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700653{
Tony Barbourde4124d2015-07-03 10:33:54 -0600654 return *(struct nulldrv_desc_pool **) &pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700655}
656
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600657static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
658 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700659 struct nulldrv_framebuffer ** fb_ret)
660{
661
662 struct nulldrv_framebuffer *fb;
663 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600664 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700665 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600666 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700667
668 *fb_ret = fb;
669
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600670 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700671
672}
673
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600674static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
675 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700676 struct nulldrv_render_pass** rp_ret)
677{
678 struct nulldrv_render_pass *rp;
679 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600680 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700681 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600682 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700683
684 *rp_ret = rp;
685
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600686 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700687}
688
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600689static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700690{
Tony Barbourde4124d2015-07-03 10:33:54 -0600691 return *(struct nulldrv_buf **) &buf;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700692}
693
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600694static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600695 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700696 struct nulldrv_buf_view **view_ret)
697{
698 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
699 struct nulldrv_buf_view *view;
700
701 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600702 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700703 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600704 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700705
706 view->buf = buf;
707
708 *view_ret = view;
709
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600710 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700711}
712
David Pinedo0257fbf2015-02-02 18:02:40 -0700713
714//*********************************************
715// Driver entry points
716//*********************************************
717
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600718ICD_EXPORT VkResult VKAPI vkCreateBuffer(
719 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600720 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600721 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700722{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700723 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700724 struct nulldrv_dev *dev = nulldrv_dev(device);
725
726 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
727}
728
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600729ICD_EXPORT void VKAPI vkDestroyBuffer(
Tony Barbourde4124d2015-07-03 10:33:54 -0600730 VkDevice device,
731 VkBuffer buffer)
732{
733 NULLDRV_LOG_FUNC;
734 return VK_SUCCESS;
735}
736
Cody Northropf02f9f82015-07-09 18:08:05 -0600737ICD_EXPORT VkResult VKAPI vkCreateCommandPool(
738 VkDevice device,
739 const VkCmdPoolCreateInfo* pCreateInfo,
740 VkCmdPool* pCmdPool)
741{
742 NULLDRV_LOG_FUNC;
743 return VK_SUCCESS;
744}
745
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600746ICD_EXPORT void VKAPI vkDestroyCommandPool(
Cody Northropf02f9f82015-07-09 18:08:05 -0600747 VkDevice device,
748 VkCmdPool cmdPool)
749{
750 NULLDRV_LOG_FUNC;
751 return VK_SUCCESS;
752}
753
754ICD_EXPORT VkResult VKAPI vkResetCommandPool(
755 VkDevice device,
756 VkCmdPool cmdPool,
757 VkCmdPoolResetFlags flags)
758{
759 NULLDRV_LOG_FUNC;
760 return VK_SUCCESS;
761}
762
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600763ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
764 VkDevice device,
765 const VkCmdBufferCreateInfo* pCreateInfo,
766 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700767{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700768 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700769 struct nulldrv_dev *dev = nulldrv_dev(device);
770
771 return nulldrv_cmd_create(dev, pCreateInfo,
772 (struct nulldrv_cmd **) pCmdBuffer);
773}
774
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600775ICD_EXPORT void VKAPI vkDestroyCommandBuffer(
Tony Barbourde4124d2015-07-03 10:33:54 -0600776 VkDevice device,
777 VkCmdBuffer cmdBuffer)
778{
779 NULLDRV_LOG_FUNC;
780 return VK_SUCCESS;
781}
782
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600783ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
784 VkCmdBuffer cmdBuffer,
785 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700786{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700787 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600788 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700789}
790
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600791ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
792 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700793{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700794 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600795 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700796}
797
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600798ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
Cody Northropf02f9f82015-07-09 18:08:05 -0600799 VkCmdBuffer cmdBuffer,
800 VkCmdBufferResetFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700801{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700802 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600803 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700804}
805
Ian Elliott64a68e12015-04-16 11:57:46 -0600806static const VkFormat nulldrv_presentable_formats[] = {
807 VK_FORMAT_B8G8R8A8_UNORM,
808};
809
Jon Ashburnba4a1952015-06-16 12:44:51 -0600810#if 0
Ian Elliott338dedb2015-08-21 15:09:33 -0600811ICD_EXPORT VkResult VKAPI vkGetDisplayInfoKHR(
812 VkDisplayKHR display,
813 VkDisplayInfoTypeKHR infoType,
Ian Elliott64a68e12015-04-16 11:57:46 -0600814 size_t* pDataSize,
815 void* pData)
816{
817 VkResult ret = VK_SUCCESS;
818
819 NULLDRV_LOG_FUNC;
820
821 if (!pDataSize)
822 return VK_ERROR_INVALID_POINTER;
823
824 switch (infoType) {
Ian Elliott338dedb2015-08-21 15:09:33 -0600825 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_KHR:
Ian Elliott64a68e12015-04-16 11:57:46 -0600826 {
Ian Elliott338dedb2015-08-21 15:09:33 -0600827 VkDisplayFormatPropertiesKHR *dst = pData;
Ian Elliott64a68e12015-04-16 11:57:46 -0600828 size_t size_ret;
829 uint32_t i;
830
831 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
832
833 if (dst && *pDataSize < size_ret)
834 return VK_ERROR_INVALID_VALUE;
835
836 *pDataSize = size_ret;
837 if (!dst)
838 return VK_SUCCESS;
839
840 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
Ian Elliott338dedb2015-08-21 15:09:33 -0600841 dst[i].swapchainFormat = nulldrv_presentable_formats[i];
Ian Elliott64a68e12015-04-16 11:57:46 -0600842 }
843 break;
844 default:
845 ret = VK_ERROR_INVALID_VALUE;
846 break;
847 }
848
849 return ret;
850}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600851#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600852
Ian Elliott338dedb2015-08-21 15:09:33 -0600853ICD_EXPORT VkResult VKAPI vkCreateSwapchainKHR(
Ian Elliott64a68e12015-04-16 11:57:46 -0600854 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600855 const VkSwapchainCreateInfoKHR* pCreateInfo,
856 VkSwapchainKHR* pSwapchain)
Ian Elliott64a68e12015-04-16 11:57:46 -0600857{
858 NULLDRV_LOG_FUNC;
859 struct nulldrv_dev *dev = nulldrv_dev(device);
860 struct nulldrv_swap_chain *sc;
861
862 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Ian Elliott338dedb2015-08-21 15:09:33 -0600863 VK_OBJECT_TYPE_SWAPCHAIN_KHR);
Ian Elliott64a68e12015-04-16 11:57:46 -0600864 if (!sc) {
865 return VK_ERROR_OUT_OF_HOST_MEMORY;
866 }
867 sc->dev = dev;
868
Ian Elliott338dedb2015-08-21 15:09:33 -0600869 *(VkSwapchainKHR **)pSwapchain = *(VkSwapchainKHR **)&sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600870
871 return VK_SUCCESS;
872}
873
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -0600874ICD_EXPORT VkResult VKAPI vkDestroySwapchainKHR(
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600875 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600876 VkSwapchainKHR swapchain)
Ian Elliott64a68e12015-04-16 11:57:46 -0600877{
878 NULLDRV_LOG_FUNC;
Ian Elliott338dedb2015-08-21 15:09:33 -0600879 struct nulldrv_swap_chain *sc = *(struct nulldrv_swap_chain **) &swapchain;
Ian Elliott64a68e12015-04-16 11:57:46 -0600880
881 free(sc);
882
883 return VK_SUCCESS;
884}
885
Ian Elliott338dedb2015-08-21 15:09:33 -0600886ICD_EXPORT VkResult VKAPI vkGetSwapchainImagesKHR(
Ian Elliott3333bb42015-08-10 13:56:08 -0600887 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600888 VkSwapchainKHR swapchain,
Ian Elliott3333bb42015-08-10 13:56:08 -0600889 uint32_t* pCount,
Ian Elliott338dedb2015-08-21 15:09:33 -0600890 VkImage* pSwapchainImages)
Ian Elliott64a68e12015-04-16 11:57:46 -0600891{
892 NULLDRV_LOG_FUNC;
Ian Elliott338dedb2015-08-21 15:09:33 -0600893 struct nulldrv_swap_chain *sc = *(struct nulldrv_swap_chain **) &swapchain;
Ian Elliott64a68e12015-04-16 11:57:46 -0600894 struct nulldrv_dev *dev = sc->dev;
895 VkResult ret = VK_SUCCESS;
896
Ian Elliott3333bb42015-08-10 13:56:08 -0600897 *pCount = 2;
Ian Elliott338dedb2015-08-21 15:09:33 -0600898 if (pSwapchainImages) {
Ian Elliott3333bb42015-08-10 13:56:08 -0600899 uint32_t i;
900 for (i = 0; i < 2; i++) {
Ian Elliott64a68e12015-04-16 11:57:46 -0600901 struct nulldrv_img *img;
Ian Elliott64a68e12015-04-16 11:57:46 -0600902
903 img = (struct nulldrv_img *) nulldrv_base_create(dev,
904 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600905 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600906 if (!img)
907 return VK_ERROR_OUT_OF_HOST_MEMORY;
Ian Elliott338dedb2015-08-21 15:09:33 -0600908 pSwapchainImages[i].handle = (uint64_t) &img;
Ian Elliott64a68e12015-04-16 11:57:46 -0600909 }
Ian Elliott64a68e12015-04-16 11:57:46 -0600910 }
911
912 return ret;
913}
914
Ian Elliott338dedb2015-08-21 15:09:33 -0600915ICD_EXPORT VkResult VKAPI vkAcquireNextImageKHR(
Tony Barbour7910de72015-07-13 16:37:21 -0600916 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600917 VkSwapchainKHR swapchain,
Tony Barbour7910de72015-07-13 16:37:21 -0600918 uint64_t timeout,
919 VkSemaphore semaphore,
920 uint32_t* pImageIndex)
921{
922 NULLDRV_LOG_FUNC;
923
924 return VK_SUCCESS;
925}
926
Ian Elliott338dedb2015-08-21 15:09:33 -0600927VkResult VKAPI vkGetSurfacePropertiesKHR(
Tony Barbour7910de72015-07-13 16:37:21 -0600928 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600929 const VkSurfaceDescriptionKHR* pSurfaceDescription,
930 VkSurfacePropertiesKHR* pSurfaceProperties)
Ian Elliott3333bb42015-08-10 13:56:08 -0600931{
932 NULLDRV_LOG_FUNC;
933
934 return VK_SUCCESS;
935}
936
Ian Elliott338dedb2015-08-21 15:09:33 -0600937VkResult VKAPI vkGetSurfaceFormatsKHR(
Ian Elliott3333bb42015-08-10 13:56:08 -0600938 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600939 const VkSurfaceDescriptionKHR* pSurfaceDescription,
Ian Elliott3333bb42015-08-10 13:56:08 -0600940 uint32_t* pCount,
Ian Elliott338dedb2015-08-21 15:09:33 -0600941 VkSurfaceFormatKHR* pSurfaceFormats)
Ian Elliott3333bb42015-08-10 13:56:08 -0600942{
943 NULLDRV_LOG_FUNC;
944
945 return VK_SUCCESS;
946}
947
Ian Elliott338dedb2015-08-21 15:09:33 -0600948VkResult VKAPI vkGetSurfacePresentModesKHR(
Ian Elliott3333bb42015-08-10 13:56:08 -0600949 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600950 const VkSurfaceDescriptionKHR* pSurfaceDescription,
Ian Elliott3333bb42015-08-10 13:56:08 -0600951 uint32_t* pCount,
Ian Elliott338dedb2015-08-21 15:09:33 -0600952 VkPresentModeKHR* pPresentModes)
Tony Barbour7910de72015-07-13 16:37:21 -0600953{
954 NULLDRV_LOG_FUNC;
955
956 return VK_SUCCESS;
957}
958
Ian Elliott338dedb2015-08-21 15:09:33 -0600959ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSurfaceSupportKHR(
Tony Barbour7910de72015-07-13 16:37:21 -0600960 VkPhysicalDevice physicalDevice,
961 uint32_t queueFamilyIndex,
Ian Elliott338dedb2015-08-21 15:09:33 -0600962 const VkSurfaceDescriptionKHR* pSurfaceDescription,
Tony Barbour7910de72015-07-13 16:37:21 -0600963 VkBool32* pSupported)
964{
965 NULLDRV_LOG_FUNC;
966
967 return VK_SUCCESS;
968}
969
Ian Elliott338dedb2015-08-21 15:09:33 -0600970ICD_EXPORT VkResult VKAPI vkQueuePresentKHR(
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600971 VkQueue queue_,
Ian Elliott338dedb2015-08-21 15:09:33 -0600972 VkPresentInfoKHR* pPresentInfo)
Ian Elliott64a68e12015-04-16 11:57:46 -0600973{
974 NULLDRV_LOG_FUNC;
975
976 return VK_SUCCESS;
977}
978
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600979ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600980 VkCmdBuffer cmdBuffer,
981 VkBuffer srcBuffer,
982 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700983 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600984 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700985{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700986 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700987}
988
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600989ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600990 VkCmdBuffer cmdBuffer,
991 VkImage srcImage,
992 VkImageLayout srcImageLayout,
993 VkImage destImage,
994 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700995 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600996 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700997{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700998 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700999}
1000
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001001ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001002 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001003 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001004 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001005 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001006 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001007 uint32_t regionCount,
1008 const VkImageBlit* pRegions,
1009 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -06001010{
1011 NULLDRV_LOG_FUNC;
1012}
1013
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001014ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001015 VkCmdBuffer cmdBuffer,
1016 VkBuffer srcBuffer,
1017 VkImage destImage,
1018 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001019 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001020 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001021{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001022 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001023}
1024
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001025ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001026 VkCmdBuffer cmdBuffer,
1027 VkImage srcImage,
1028 VkImageLayout srcImageLayout,
1029 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001030 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001031 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001032{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001033 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001034}
1035
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001036ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001037 VkCmdBuffer cmdBuffer,
1038 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001039 VkDeviceSize destOffset,
1040 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001041 const uint32_t* pData)
1042{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001043 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001044}
1045
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001046ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001047 VkCmdBuffer cmdBuffer,
1048 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001049 VkDeviceSize destOffset,
1050 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001051 uint32_t data)
1052{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001053 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001054}
1055
Ian Elliotte924ab22015-07-08 13:24:30 -06001056ICD_EXPORT void VKAPI vkCmdClearDepthStencilImage(
Courtney Goeltzenleuchter315ad992015-09-15 18:03:22 -06001057 VkCmdBuffer cmdBuffer,
1058 VkImage image,
1059 VkImageLayout imageLayout,
1060 const VkClearDepthStencilValue* pDepthStencil,
Ian Elliotte924ab22015-07-08 13:24:30 -06001061 uint32_t rangeCount,
Courtney Goeltzenleuchter315ad992015-09-15 18:03:22 -06001062 const VkImageSubresourceRange* pRanges)
Ian Elliotte924ab22015-07-08 13:24:30 -06001063{
1064 NULLDRV_LOG_FUNC;
1065}
1066
1067ICD_EXPORT void VKAPI vkCmdClearColorAttachment(
1068 VkCmdBuffer cmdBuffer,
1069 uint32_t colorAttachment,
1070 VkImageLayout imageLayout,
1071 const VkClearColorValue *pColor,
1072 uint32_t rectCount,
1073 const VkRect3D *pRects)
1074{
1075 NULLDRV_LOG_FUNC;
1076}
1077
1078ICD_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(
1079 VkCmdBuffer cmdBuffer,
1080 VkImageAspectFlags imageAspectMask,
1081 VkImageLayout imageLayout,
Courtney Goeltzenleuchter315ad992015-09-15 18:03:22 -06001082 const VkClearDepthStencilValue* pDepthStencil,
Ian Elliotte924ab22015-07-08 13:24:30 -06001083 uint32_t rectCount,
1084 const VkRect3D *pRects)
1085{
1086 NULLDRV_LOG_FUNC;
1087}
1088
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001089ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001090 VkCmdBuffer cmdBuffer,
1091 VkImage image,
1092 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +12001093 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001094 uint32_t rangeCount,
1095 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001096{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001097 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001098}
1099
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001100ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001101 VkCmdBuffer cmdBuffer,
1102 VkImage image,
1103 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001104 float depth,
1105 uint32_t stencil,
1106 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001107 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001108{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001109 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001110}
1111
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001112ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001113 VkCmdBuffer cmdBuffer,
1114 VkImage srcImage,
1115 VkImageLayout srcImageLayout,
1116 VkImage destImage,
1117 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001118 uint32_t regionCount,
1119 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001120{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001121 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001122}
1123
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001124ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001125 VkCmdBuffer cmdBuffer,
1126 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001127 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001128 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001129{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001130 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001131}
1132
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001133ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001134 VkCmdBuffer cmdBuffer,
1135 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001136 uint32_t slot)
1137{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001138 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001139}
1140
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001141ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001142 VkCmdBuffer cmdBuffer,
1143 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001144 uint32_t startQuery,
1145 uint32_t queryCount)
1146{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001147 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001148}
1149
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001150ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001151 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001152 VkEvent event_,
1153 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001154{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001155 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001156}
1157
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001158ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001159 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001160 VkEvent event_,
1161 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001162{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001163 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001164}
1165
Ian Elliott63f1edb2015-04-16 18:10:19 -06001166ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1167 VkCmdBuffer cmdBuffer,
1168 VkQueryPool queryPool,
1169 uint32_t startQuery,
1170 uint32_t queryCount,
1171 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001172 VkDeviceSize destOffset,
1173 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001174 VkFlags flags)
1175{
1176 NULLDRV_LOG_FUNC;
1177}
1178
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001179ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001180 VkCmdBuffer cmdBuffer,
1181 VkTimestampType timestampType,
1182 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001183 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001184{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001185 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001186}
1187
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001188ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001189 VkCmdBuffer cmdBuffer,
Tony Barbourde4124d2015-07-03 10:33:54 -06001190 VkPipelineBindPoint pipelineBindPoint,
1191 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001192{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001193 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001194}
1195
Tony Barbourde4124d2015-07-03 10:33:54 -06001196ICD_EXPORT void VKAPI vkCmdBindDynamicViewportState(
1197 VkCmdBuffer cmdBuffer,
1198 VkDynamicViewportState state)
1199{
1200 NULLDRV_LOG_FUNC;
1201}
1202
Cody Northrope4bc6942015-08-26 10:01:32 -06001203ICD_EXPORT void VKAPI vkCmdBindDynamicLineWidthState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001204 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001205 VkDynamicLineWidthState state)
Cody Northropf5bd2252015-08-17 11:10:49 -06001206{
1207 NULLDRV_LOG_FUNC;
1208}
1209
Cody Northrope4bc6942015-08-26 10:01:32 -06001210ICD_EXPORT void VKAPI vkCmdBindDynamicDepthBiasState(
Cody Northropf5bd2252015-08-17 11:10:49 -06001211 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001212 VkDynamicDepthBiasState state)
Tony Barbourde4124d2015-07-03 10:33:54 -06001213{
1214 NULLDRV_LOG_FUNC;
1215}
1216
Cody Northrope4bc6942015-08-26 10:01:32 -06001217ICD_EXPORT void VKAPI vkCmdBindDynamicBlendState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001218 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001219 VkDynamicBlendState state)
Tony Barbourde4124d2015-07-03 10:33:54 -06001220{
1221 NULLDRV_LOG_FUNC;
1222}
1223
Cody Northrope4bc6942015-08-26 10:01:32 -06001224ICD_EXPORT void VKAPI vkCmdBindDynamicDepthBoundsState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001225 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001226 VkDynamicDepthBoundsState state)
Cody Northrop2605cb02015-08-18 15:21:16 -06001227{
1228 NULLDRV_LOG_FUNC;
1229}
1230
1231ICD_EXPORT void VKAPI vkCmdBindDynamicStencilState(
1232 VkCmdBuffer cmdBuffer,
1233 VkDynamicStencilState state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001234{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001235 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001236}
1237
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001238ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001239 VkCmdBuffer cmdBuffer,
1240 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001241 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001242 uint32_t firstSet,
1243 uint32_t setCount,
1244 const VkDescriptorSet* pDescriptorSets,
1245 uint32_t dynamicOffsetCount,
1246 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001247{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001248 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001249}
1250
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001251ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1252 VkCmdBuffer cmdBuffer,
1253 uint32_t startBinding,
1254 uint32_t bindingCount,
1255 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001256 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001257{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001258 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001259}
1260
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001261ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001262 VkCmdBuffer cmdBuffer,
1263 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001264 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001265 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001266{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001267 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001268}
1269
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001270ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001271 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001272 uint32_t firstVertex,
1273 uint32_t vertexCount,
1274 uint32_t firstInstance,
1275 uint32_t instanceCount)
1276{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001277 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001278}
1279
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001280ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001281 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001282 uint32_t firstIndex,
1283 uint32_t indexCount,
1284 int32_t vertexOffset,
1285 uint32_t firstInstance,
1286 uint32_t instanceCount)
1287{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001288 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001289}
1290
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001291ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001292 VkCmdBuffer cmdBuffer,
1293 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001294 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001295 uint32_t count,
1296 uint32_t stride)
1297{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001298 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001299}
1300
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001301ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001302 VkCmdBuffer cmdBuffer,
1303 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001304 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001305 uint32_t count,
1306 uint32_t stride)
1307{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001308 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001309}
1310
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001311ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001312 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001313 uint32_t x,
1314 uint32_t y,
1315 uint32_t z)
1316{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001317 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001318}
1319
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001320ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001321 VkCmdBuffer cmdBuffer,
1322 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001323 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001324{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001325 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001326}
1327
Tony Barbour8205d902015-04-16 15:59:00 -06001328void VKAPI vkCmdWaitEvents(
1329 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001330 uint32_t eventCount,
1331 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001332 VkPipelineStageFlags sourceStageMask,
1333 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001334 uint32_t memBarrierCount,
Courtney Goeltzenleuchterd9ba3422015-07-12 12:58:58 -06001335 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001336{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001337 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001338}
1339
Tony Barbour8205d902015-04-16 15:59:00 -06001340void VKAPI vkCmdPipelineBarrier(
1341 VkCmdBuffer cmdBuffer,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001342 VkPipelineStageFlags srcStageMask,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001343 VkPipelineStageFlags destStageMask,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001344 VkBool32 byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001345 uint32_t memBarrierCount,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001346 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001347{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001348 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001349}
1350
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001351ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001352 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001353 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001354 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001355{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001356 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001357 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1358 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1359}
1360
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001361ICD_EXPORT void VKAPI vkDestroyDevice(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001362 VkDevice device)
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 vkGetDeviceQueue(
1369 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001370 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001371 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001372 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001373{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001374 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001375 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001376 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001377 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001378}
1379
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001380ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1381 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001382{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001383 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001384 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001385}
1386
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001387ICD_EXPORT VkResult VKAPI vkCreateEvent(
1388 VkDevice device,
1389 const VkEventCreateInfo* pCreateInfo,
1390 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001391{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001392 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001393 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001394}
1395
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001396ICD_EXPORT void VKAPI vkDestroyEvent(
Tony Barbourde4124d2015-07-03 10:33:54 -06001397 VkDevice device,
1398 VkEvent event)
1399{
1400 NULLDRV_LOG_FUNC;
1401 return VK_SUCCESS;
1402}
1403
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001404ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001405 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001406 VkEvent event_)
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 vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001413 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001414 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001415{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001416 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001417 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001418}
1419
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001420ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001421 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001422 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001423{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001424 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001425 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001426}
1427
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001428ICD_EXPORT VkResult VKAPI vkCreateFence(
1429 VkDevice device,
1430 const VkFenceCreateInfo* pCreateInfo,
1431 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001432{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001433 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001434 struct nulldrv_dev *dev = nulldrv_dev(device);
1435
1436 return nulldrv_fence_create(dev, pCreateInfo,
1437 (struct nulldrv_fence **) pFence);
1438}
1439
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001440ICD_EXPORT void VKAPI vkDestroyFence(
Tony Barbourde4124d2015-07-03 10:33:54 -06001441 VkDevice device,
1442 VkFence fence)
1443{
1444 NULLDRV_LOG_FUNC;
1445 return VK_SUCCESS;
1446}
1447
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001448ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001449 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001450 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001451{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001452 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001453 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001454}
1455
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001456ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001457 VkDevice device,
1458 uint32_t fenceCount,
1459 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001460{
1461 NULLDRV_LOG_FUNC;
1462 return VK_SUCCESS;
1463}
1464
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001465ICD_EXPORT VkResult VKAPI vkWaitForFences(
1466 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001467 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001468 const VkFence* pFences,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001469 VkBool32 waitAll,
David Pinedo0257fbf2015-02-02 18:02:40 -07001470 uint64_t timeout)
1471{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001472 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001473 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001474}
1475
Tony Barbour426b9052015-06-24 16:06:58 -06001476ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1477 VkPhysicalDevice gpu_,
1478 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001479{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001480 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001481 VkResult ret = VK_SUCCESS;
1482
Tony Barbour426b9052015-06-24 16:06:58 -06001483 pProperties->apiVersion = VK_API_VERSION;
1484 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1485 pProperties->vendorId = 0;
1486 pProperties->deviceId = 0;
1487 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1488 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001489
Mark Lobodzinski7dae6862015-09-07 12:56:17 -06001490 /* TODO: fill out limits */
1491 memset(&pProperties->limits, 0, sizeof(VkPhysicalDeviceLimits));
1492 memset(&pProperties->sparseProperties, 0, sizeof(VkPhysicalDeviceSparseProperties));
Ian Elliott64a68e12015-04-16 11:57:46 -06001493 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001494}
1495
Chris Forbesd7576302015-06-21 22:55:02 +12001496ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1497 VkPhysicalDevice physicalDevice,
1498 VkPhysicalDeviceFeatures* pFeatures)
1499{
1500 NULLDRV_LOG_FUNC;
1501 VkResult ret = VK_SUCCESS;
1502
1503 /* TODO: fill out features */
1504 memset(pFeatures, 0, sizeof(*pFeatures));
1505
1506 return ret;
1507}
1508
Courtney Goeltzenleuchter4da96aa2015-07-12 12:52:09 -06001509ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatProperties(
Chris Forbesd7576302015-06-21 22:55:02 +12001510 VkPhysicalDevice physicalDevice,
1511 VkFormat format,
1512 VkFormatProperties* pFormatInfo)
1513{
1514 NULLDRV_LOG_FUNC;
1515 VkResult ret = VK_SUCCESS;
1516
1517 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1518 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
Mark Lobodzinski4b36dd42015-09-03 15:21:52 -06001519 pFormatInfo->bufferFeatures = 0;
Chris Forbesd7576302015-06-21 22:55:02 +12001520
1521 return ret;
1522}
1523
Cody Northropef72e2a2015-08-03 17:04:53 -06001524ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueFamilyProperties(
Tony Barbour426b9052015-06-24 16:06:58 -06001525 VkPhysicalDevice gpu_,
Cody Northropef72e2a2015-08-03 17:04:53 -06001526 uint32_t* pCount,
1527 VkQueueFamilyProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001528 {
Cody Northropef72e2a2015-08-03 17:04:53 -06001529 if (pProperties == NULL) {
1530 *pCount = 1;
1531 return VK_SUCCESS;
1532 }
Tony Barbour426b9052015-06-24 16:06:58 -06001533 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1534 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001535 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001536
Tony Barbour426b9052015-06-24 16:06:58 -06001537 return VK_SUCCESS;
1538}
1539
Ian Elliotte924ab22015-07-08 13:24:30 -06001540ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(
1541 VkPhysicalDevice gpu_,
1542 VkPhysicalDeviceMemoryProperties* pProperties)
1543{
1544 // TODO: Fill in with real data
1545 return VK_SUCCESS;
1546}
1547
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001548ICD_EXPORT VkResult VKAPI vkEnumerateDeviceLayerProperties(
Ian Elliotte924ab22015-07-08 13:24:30 -06001549 VkPhysicalDevice physicalDevice,
1550 uint32_t* pCount,
1551 VkLayerProperties* pProperties)
1552{
1553 // TODO: Fill in with real data
1554 return VK_SUCCESS;
1555}
1556
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001557ICD_EXPORT VkResult VKAPI vkEnumerateInstanceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001558 const char* pLayerName,
1559 uint32_t* pCount,
1560 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001561{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001562 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001563
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001564 if (pProperties == NULL) {
1565 *pCount = NULLDRV_EXT_COUNT;
1566 return VK_SUCCESS;
1567 }
Tony Barbour426b9052015-06-24 16:06:58 -06001568
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001569 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1570 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1571 *pCount = copy_size;
1572 if (copy_size < NULLDRV_EXT_COUNT) {
1573 return VK_INCOMPLETE;
1574 }
Tony Barbour426b9052015-06-24 16:06:58 -06001575 return VK_SUCCESS;
1576}
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001577ICD_EXPORT VkResult VKAPI vkEnumerateInstanceLayerProperties(
Ian Elliotte924ab22015-07-08 13:24:30 -06001578 uint32_t* pCount,
1579 VkLayerProperties* pProperties)
1580{
1581 // TODO: Fill in with real data
1582 return VK_SUCCESS;
1583}
Tony Barbour426b9052015-06-24 16:06:58 -06001584
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001585VkResult VKAPI vkEnumerateDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001586 VkPhysicalDevice physicalDevice,
1587 const char* pLayerName,
1588 uint32_t* pCount,
1589 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001590{
Tony Barbour426b9052015-06-24 16:06:58 -06001591
Tony Barbour426b9052015-06-24 16:06:58 -06001592 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001593
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001594 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001595}
1596
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001597ICD_EXPORT VkResult VKAPI vkCreateImage(
1598 VkDevice device,
1599 const VkImageCreateInfo* pCreateInfo,
1600 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001601{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001602 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001603 struct nulldrv_dev *dev = nulldrv_dev(device);
1604
1605 return nulldrv_img_create(dev, pCreateInfo, false,
1606 (struct nulldrv_img **) pImage);
1607}
1608
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001609ICD_EXPORT void VKAPI vkDestroyImage(
Tony Barbourde4124d2015-07-03 10:33:54 -06001610 VkDevice device,
1611 VkImage image)
1612{
1613 NULLDRV_LOG_FUNC;
1614 return VK_SUCCESS;
1615}
1616
Tony Barbour426b9052015-06-24 16:06:58 -06001617ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001618 VkDevice device,
1619 VkImage image,
1620 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001621 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001622{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001623 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001624
Tony Barbour426b9052015-06-24 16:06:58 -06001625 pLayout->offset = 0;
1626 pLayout->size = 1;
1627 pLayout->rowPitch = 4;
1628 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001629
Tony Barbour426b9052015-06-24 16:06:58 -06001630 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001631}
1632
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001633ICD_EXPORT VkResult VKAPI vkAllocMemory(
1634 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001635 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001636 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001637{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001638 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001639 struct nulldrv_dev *dev = nulldrv_dev(device);
1640
1641 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1642}
1643
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001644ICD_EXPORT void VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001645 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001646 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001647{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001648 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001649 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001650}
1651
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001652ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001653 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001654 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001655 VkDeviceSize offset,
1656 VkDeviceSize size,
1657 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001658 void** ppData)
1659{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001660 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001661 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1662 void *ptr = nulldrv_mem_map(mem, flags);
1663
1664 *ppData = ptr;
1665
Courtney Goeltzenleuchterac544f32015-09-14 18:01:17 -06001666 return (ptr) ? VK_SUCCESS : VK_ERROR_MEMORY_MAP_FAILED;
David Pinedo0257fbf2015-02-02 18:02:40 -07001667}
1668
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001669ICD_EXPORT void VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001670 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001671 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001672{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001673 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001674 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001675}
1676
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001677ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001678 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001679 uint32_t memRangeCount,
1680 const VkMappedMemoryRange* pMemRanges)
1681{
1682 NULLDRV_LOG_FUNC;
1683 return VK_SUCCESS;
1684}
1685
1686ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1687 VkDevice device,
1688 uint32_t memRangeCount,
1689 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001690{
1691 NULLDRV_LOG_FUNC;
1692 return VK_SUCCESS;
1693}
1694
Courtney Goeltzenleuchterd040c5c2015-07-09 21:57:28 -06001695ICD_EXPORT VkResult VKAPI vkGetDeviceMemoryCommitment(
1696 VkDevice device,
1697 VkDeviceMemory memory,
1698 VkDeviceSize* pCommittedMemoryInBytes)
1699{
1700 return VK_SUCCESS;
1701}
1702
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001703ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001704 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001705 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001706{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001707 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001708 struct nulldrv_instance *inst;
1709
1710 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001711 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001712 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001713 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001714
Tony Barbour426b9052015-06-24 16:06:58 -06001715 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001716
Mike Stroyan230e6252015-04-17 12:36:38 -06001717 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001718
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001719 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001720}
1721
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001722ICD_EXPORT void VKAPI vkDestroyInstance(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001723 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001724{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001725 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001726 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001727}
1728
Tony Barbour8205d902015-04-16 15:59:00 -06001729ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001730 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001731 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001732 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001733{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001734 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001735 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001736 struct nulldrv_gpu *gpu;
1737 *pGpuCount = 1;
1738 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001739 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001740 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001741 return ret;
1742}
1743
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001744ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001745 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001746 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001747 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001748 char* const* pOutLayers,
1749 void* pReserved)
1750{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001751 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001752 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001753}
1754
Tony Barbourde4124d2015-07-03 10:33:54 -06001755ICD_EXPORT VkResult VKAPI vkGetBufferMemoryRequirements(
1756 VkDevice device,
1757 VkBuffer buffer,
1758 VkMemoryRequirements* pMemoryRequirements)
1759{
1760 NULLDRV_LOG_FUNC;
1761 struct nulldrv_base *base = nulldrv_base((void*)buffer.handle);
1762
1763 return base->get_memory_requirements(base, pMemoryRequirements);
1764}
1765
1766ICD_EXPORT VkResult VKAPI vkGetImageMemoryRequirements(
1767 VkDevice device,
1768 VkImage image,
1769 VkMemoryRequirements* pMemoryRequirements)
1770{
1771 NULLDRV_LOG_FUNC;
1772 struct nulldrv_base *base = nulldrv_base((void*)image.handle);
1773
1774 return base->get_memory_requirements(base, pMemoryRequirements);
1775}
1776
1777ICD_EXPORT VkResult VKAPI vkBindBufferMemory(
1778 VkDevice device,
1779 VkBuffer buffer,
1780 VkDeviceMemory mem_,
1781 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001782{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001783 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001784 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001785}
1786
Tony Barbourde4124d2015-07-03 10:33:54 -06001787ICD_EXPORT VkResult VKAPI vkBindImageMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001788 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06001789 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001790 VkDeviceMemory mem_,
1791 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001792{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001793 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001794 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001795}
1796
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001797ICD_EXPORT VkResult VKAPI vkGetImageSparseMemoryRequirements(
1798 VkDevice device,
1799 VkImage image,
1800 uint32_t* pNumRequirements,
1801 VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
1802{
1803 NULLDRV_LOG_FUNC;
1804 return VK_SUCCESS;
1805}
1806
1807ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(
1808 VkPhysicalDevice physicalDevice,
1809 VkFormat format,
1810 VkImageType type,
1811 uint32_t samples,
1812 VkImageUsageFlags usage,
1813 VkImageTiling tiling,
1814 uint32_t* pNumProperties,
1815 VkSparseImageFormatProperties* pProperties)
1816{
1817 NULLDRV_LOG_FUNC;
1818 return VK_SUCCESS;
1819}
1820
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001821ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001822 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001823 VkBuffer buffer,
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001824 uint32_t numBindings,
1825 const VkSparseMemoryBindInfo* pBindInfo)
1826{
1827 NULLDRV_LOG_FUNC;
1828 return VK_SUCCESS;
1829}
1830
1831ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageOpaqueMemory(
1832 VkQueue queue,
1833 VkImage image,
1834 uint32_t numBindings,
1835 const VkSparseMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001836{
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
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001841ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001842 VkQueue queue,
1843 VkImage image,
1844 uint32_t numBindings,
1845 const VkSparseImageMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001846{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001847 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001848 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001849}
Jon Ashburn0e249962015-07-10 09:41:15 -07001850ICD_EXPORT VkResult VKAPI vkCreatePipelineCache(
1851 VkDevice device,
1852 const VkPipelineCacheCreateInfo* pCreateInfo,
1853 VkPipelineCache* pPipelineCache)
1854{
David Pinedo0257fbf2015-02-02 18:02:40 -07001855
Jon Ashburn0e249962015-07-10 09:41:15 -07001856 NULLDRV_LOG_FUNC;
1857 return VK_SUCCESS;
1858}
1859
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001860ICD_EXPORT void VKAPI vkDestroyPipeline(
Tony Barbourde4124d2015-07-03 10:33:54 -06001861 VkDevice device,
1862 VkPipeline pipeline)
1863{
1864 NULLDRV_LOG_FUNC;
1865 return VK_SUCCESS;
1866}
1867
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001868void VKAPI vkDestroyPipelineCache(
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06001869 VkDevice device,
1870 VkPipelineCache pipelineCache)
Jon Ashburn0e249962015-07-10 09:41:15 -07001871{
1872 NULLDRV_LOG_FUNC;
1873 return VK_SUCCESS;
1874}
1875
1876ICD_EXPORT size_t VKAPI vkGetPipelineCacheSize(
1877 VkDevice device,
1878 VkPipelineCache pipelineCache)
1879{
1880 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06001881 return 0;
Jon Ashburn0e249962015-07-10 09:41:15 -07001882}
1883
1884ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
1885 VkDevice device,
1886 VkPipelineCache pipelineCache,
1887 void* pData)
1888{
1889 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06001890 return VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn0e249962015-07-10 09:41:15 -07001891}
1892
1893ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
1894 VkDevice device,
1895 VkPipelineCache destCache,
1896 uint32_t srcCacheCount,
1897 const VkPipelineCache* pSrcCaches)
1898{
1899 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06001900 return VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn0e249962015-07-10 09:41:15 -07001901}
1902ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001903 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001904 VkPipelineCache pipelineCache,
1905 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001906 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1907 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001908{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001909 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001910 struct nulldrv_dev *dev = nulldrv_dev(device);
1911
1912 return graphics_pipeline_create(dev, pCreateInfo,
1913 (struct nulldrv_pipeline **) pPipeline);
1914}
1915
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001916
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001917
Jon Ashburn0e249962015-07-10 09:41:15 -07001918ICD_EXPORT VkResult VKAPI vkCreateComputePipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001919 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001920 VkPipelineCache pipelineCache,
1921 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001922 const VkComputePipelineCreateInfo* pCreateInfo,
1923 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001924{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001925 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001926 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001927}
1928
David Pinedo0257fbf2015-02-02 18:02:40 -07001929
David Pinedo0257fbf2015-02-02 18:02:40 -07001930
Jon Ashburn0e249962015-07-10 09:41:15 -07001931
David Pinedo0257fbf2015-02-02 18:02:40 -07001932
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001933ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1934 VkDevice device,
1935 const VkQueryPoolCreateInfo* pCreateInfo,
1936 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001937{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001938 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001939 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001940}
1941
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001942ICD_EXPORT void VKAPI vkDestroyQueryPool(
Tony Barbourde4124d2015-07-03 10:33:54 -06001943 VkDevice device,
1944 VkQueryPool queryPoool)
1945{
1946 NULLDRV_LOG_FUNC;
1947 return VK_SUCCESS;
1948}
1949
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001950ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001951 VkDevice device,
1952 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001953 uint32_t startQuery,
1954 uint32_t queryCount,
1955 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001956 void* pData,
1957 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001958{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001959 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001960 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001961}
1962
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001963ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1964 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001965{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001966 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001967 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001968}
1969
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001970ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1971 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001972 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001973 const VkCmdBuffer* pCmdBuffers,
1974 VkFence fence_)
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 vkCreateSemaphore(
1981 VkDevice device,
1982 const VkSemaphoreCreateInfo* pCreateInfo,
1983 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001984{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001985 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001986 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001987}
1988
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001989ICD_EXPORT void VKAPI vkDestroySemaphore(
Tony Barbourde4124d2015-07-03 10:33:54 -06001990 VkDevice device,
1991 VkSemaphore semaphore)
1992{
1993 NULLDRV_LOG_FUNC;
1994 return VK_SUCCESS;
1995}
1996
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001997ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1998 VkQueue queue,
1999 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002000{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002001 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002002 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002003}
2004
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002005ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
2006 VkQueue queue,
2007 VkSemaphore semaphore)
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 vkCreateSampler(
2014 VkDevice device,
2015 const VkSamplerCreateInfo* pCreateInfo,
2016 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07002017{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002018 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002019 struct nulldrv_dev *dev = nulldrv_dev(device);
2020
2021 return nulldrv_sampler_create(dev, pCreateInfo,
2022 (struct nulldrv_sampler **) pSampler);
2023}
2024
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002025ICD_EXPORT void VKAPI vkDestroySampler(
Tony Barbourde4124d2015-07-03 10:33:54 -06002026 VkDevice device,
2027 VkSampler sampler)
2028{
2029 NULLDRV_LOG_FUNC;
2030 return VK_SUCCESS;
2031}
2032
Ian Elliotte924ab22015-07-08 13:24:30 -06002033ICD_EXPORT VkResult VKAPI vkCreateShaderModule(
2034 VkDevice device,
2035 const VkShaderModuleCreateInfo* pCreateInfo,
2036 VkShaderModule* pShaderModule)
2037{
2038 // TODO: Fill in with real data
Tony Barbourde4124d2015-07-03 10:33:54 -06002039 NULLDRV_LOG_FUNC;
2040 return VK_SUCCESS;
2041}
2042
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002043ICD_EXPORT void VKAPI vkDestroyShaderModule(
Tony Barbourde4124d2015-07-03 10:33:54 -06002044 VkDevice device,
2045 VkShaderModule shaderModule)
2046{
2047 // TODO: Fill in with real data
2048 NULLDRV_LOG_FUNC;
Ian Elliotte924ab22015-07-08 13:24:30 -06002049 return VK_SUCCESS;
2050}
2051
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002052ICD_EXPORT VkResult VKAPI vkCreateShader(
2053 VkDevice device,
2054 const VkShaderCreateInfo* pCreateInfo,
2055 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002056{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002057 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002058 struct nulldrv_dev *dev = nulldrv_dev(device);
2059
2060 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2061}
2062
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002063ICD_EXPORT void VKAPI vkDestroyShader(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002064 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002065 VkShader shader)
2066{
2067 NULLDRV_LOG_FUNC;
2068 return VK_SUCCESS;
2069}
2070
2071ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2072 VkDevice device,
2073 const VkDynamicViewportStateCreateInfo* pCreateInfo,
2074 VkDynamicViewportState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002075{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002076 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002077 struct nulldrv_dev *dev = nulldrv_dev(device);
2078
2079 return nulldrv_viewport_state_create(dev, pCreateInfo,
2080 (struct nulldrv_dynamic_vp **) pState);
2081}
2082
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002083ICD_EXPORT void VKAPI vkDestroyDynamicViewportState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002084 VkDevice device,
2085 VkDynamicViewportState dynamicViewportState)
2086{
2087 NULLDRV_LOG_FUNC;
2088 return VK_SUCCESS;
2089}
2090
Cody Northrope4bc6942015-08-26 10:01:32 -06002091ICD_EXPORT VkResult VKAPI vkCreateDynamicLineWidthState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002092 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002093 const VkDynamicLineWidthStateCreateInfo* pCreateInfo,
2094 VkDynamicLineWidthState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002095{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002096 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002097 struct nulldrv_dev *dev = nulldrv_dev(device);
2098
Cody Northrope4bc6942015-08-26 10:01:32 -06002099 return nulldrv_line_width_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002100 (struct nulldrv_dynamic_line_width **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002101}
2102
Cody Northrope4bc6942015-08-26 10:01:32 -06002103ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthBiasState(
Cody Northropf5bd2252015-08-17 11:10:49 -06002104 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002105 const VkDynamicDepthBiasStateCreateInfo* pCreateInfo,
2106 VkDynamicDepthBiasState* pState)
Cody Northropf5bd2252015-08-17 11:10:49 -06002107{
2108 NULLDRV_LOG_FUNC;
2109 struct nulldrv_dev *dev = nulldrv_dev(device);
2110
Cody Northrope4bc6942015-08-26 10:01:32 -06002111 return nulldrv_depth_bias_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002112 (struct nulldrv_dynamic_depth_bias **) pState);
Cody Northropf5bd2252015-08-17 11:10:49 -06002113}
2114
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002115ICD_EXPORT void VKAPI vkDestroyDynamicLineWidthState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002116 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002117 VkDynamicLineWidthState dynamicLineWidthState)
Cody Northropf5bd2252015-08-17 11:10:49 -06002118{
2119 NULLDRV_LOG_FUNC;
2120 return VK_SUCCESS;
2121}
2122
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002123ICD_EXPORT void VKAPI vkDestroyDynamicDepthBiasState(
Cody Northropf5bd2252015-08-17 11:10:49 -06002124 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002125 VkDynamicDepthBiasState dynamicDepthBiasState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002126{
2127 NULLDRV_LOG_FUNC;
2128 return VK_SUCCESS;
2129}
2130
Cody Northrope4bc6942015-08-26 10:01:32 -06002131ICD_EXPORT VkResult VKAPI vkCreateDynamicBlendState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002132 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002133 const VkDynamicBlendStateCreateInfo* pCreateInfo,
2134 VkDynamicBlendState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002135{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002136 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002137 struct nulldrv_dev *dev = nulldrv_dev(device);
2138
2139 return nulldrv_blend_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002140 (struct nulldrv_dynamic_blend **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002141}
2142
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002143ICD_EXPORT void VKAPI vkDestroyDynamicBlendState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002144 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002145 VkDynamicBlendState dynamicBlendState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002146{
2147 NULLDRV_LOG_FUNC;
2148 return VK_SUCCESS;
2149}
2150
Cody Northrope4bc6942015-08-26 10:01:32 -06002151ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthBoundsState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002152 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002153 const VkDynamicDepthBoundsStateCreateInfo* pCreateInfo,
2154 VkDynamicDepthBoundsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002155{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002156 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002157 struct nulldrv_dev *dev = nulldrv_dev(device);
2158
Cody Northrope4bc6942015-08-26 10:01:32 -06002159 return nulldrv_depth_bounds_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002160 (struct nulldrv_dynamic_depth_bounds **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002161}
2162
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002163ICD_EXPORT void VKAPI vkDestroyDynamicDepthBoundsState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002164 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002165 VkDynamicDepthBoundsState dynamicDepthBoundsState)
Cody Northrop2605cb02015-08-18 15:21:16 -06002166{
2167 NULLDRV_LOG_FUNC;
2168 return VK_SUCCESS;
2169}
2170
2171ICD_EXPORT VkResult VKAPI vkCreateDynamicStencilState(
2172 VkDevice device,
2173 const VkDynamicStencilStateCreateInfo* pCreateInfoFront,
2174 const VkDynamicStencilStateCreateInfo* pCreateInfoBack,
2175 VkDynamicStencilState* pState)
2176{
2177 NULLDRV_LOG_FUNC;
2178 struct nulldrv_dev *dev = nulldrv_dev(device);
2179
2180 return nulldrv_stencil_state_create(dev, pCreateInfoFront, pCreateInfoBack,
2181 (struct nulldrv_dynamic_stencil **) pState);
2182}
2183
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002184ICD_EXPORT void VKAPI vkDestroyDynamicStencilState(
Cody Northrop2605cb02015-08-18 15:21:16 -06002185 VkDevice device,
2186 VkDynamicStencilState dynamicStencilState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002187{
2188 NULLDRV_LOG_FUNC;
2189 return VK_SUCCESS;
2190}
2191
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002192ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2193 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002194 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002195 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002196{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002197 NULLDRV_LOG_FUNC;
2198 struct nulldrv_dev *dev = nulldrv_dev(device);
2199
2200 return nulldrv_buf_view_create(dev, pCreateInfo,
2201 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002202}
2203
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002204ICD_EXPORT void VKAPI vkDestroyBufferView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002205 VkDevice device,
2206 VkBufferView bufferView)
2207{
2208 NULLDRV_LOG_FUNC;
2209 return VK_SUCCESS;
2210}
2211
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002212ICD_EXPORT VkResult VKAPI vkCreateImageView(
2213 VkDevice device,
2214 const VkImageViewCreateInfo* pCreateInfo,
2215 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002216{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002217 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002218 struct nulldrv_dev *dev = nulldrv_dev(device);
2219
2220 return nulldrv_img_view_create(dev, pCreateInfo,
2221 (struct nulldrv_img_view **) pView);
2222}
2223
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002224ICD_EXPORT void VKAPI vkDestroyImageView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002225 VkDevice device,
2226 VkImageView imageView)
2227{
2228 NULLDRV_LOG_FUNC;
2229 return VK_SUCCESS;
2230}
2231
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002232ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2233 VkDevice device,
2234 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2235 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002236{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002237 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002238 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002239
Chia-I Wu7732cb22015-03-26 15:27:55 +08002240 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002241 (struct nulldrv_desc_layout **) pSetLayout);
2242}
2243
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002244ICD_EXPORT void VKAPI vkDestroyDescriptorSetLayout(
Tony Barbourde4124d2015-07-03 10:33:54 -06002245 VkDevice device,
2246 VkDescriptorSetLayout descriptorSetLayout)
2247{
2248 NULLDRV_LOG_FUNC;
2249 return VK_SUCCESS;
2250}
2251
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002252ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2253 VkDevice device,
2254 const VkPipelineLayoutCreateInfo* pCreateInfo,
2255 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002256{
2257 NULLDRV_LOG_FUNC;
2258 struct nulldrv_dev *dev = nulldrv_dev(device);
2259
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002260 return nulldrv_pipeline_layout_create(dev,
2261 pCreateInfo,
2262 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002263}
2264
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002265ICD_EXPORT void VKAPI vkDestroyPipelineLayout(
Tony Barbourde4124d2015-07-03 10:33:54 -06002266 VkDevice device,
2267 VkPipelineLayout pipelineLayout)
2268{
2269 NULLDRV_LOG_FUNC;
2270 return VK_SUCCESS;
2271}
2272
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002273ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
Courtney Goeltzenleuchterd9e966a2015-09-16 16:12:45 -06002274 VkDevice device,
2275 const VkDescriptorPoolCreateInfo* pCreateInfo,
2276 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002277{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002278 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002279 struct nulldrv_dev *dev = nulldrv_dev(device);
2280
Courtney Goeltzenleuchterd9e966a2015-09-16 16:12:45 -06002281 return nulldrv_desc_pool_create(dev, pCreateInfo,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002282 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002283}
2284
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002285ICD_EXPORT void VKAPI vkDestroyDescriptorPool(
Tony Barbourde4124d2015-07-03 10:33:54 -06002286 VkDevice device,
2287 VkDescriptorPool descriptorPool)
2288{
2289 NULLDRV_LOG_FUNC;
2290 return VK_SUCCESS;
2291}
2292
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002293ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002294 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002295 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002296{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002297 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002298 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002299}
2300
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002301ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002302 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002303 VkDescriptorPool descriptorPool,
2304 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002305 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002306 const VkDescriptorSetLayout* pSetLayouts,
Cody Northropc8aa4a52015-08-03 12:47:29 -06002307 VkDescriptorSet* pDescriptorSets)
David Pinedo0257fbf2015-02-02 18:02:40 -07002308{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002309 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002310 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2311 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002312 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002313 uint32_t i;
2314
2315 for (i = 0; i < count; i++) {
2316 const struct nulldrv_desc_layout *layout =
Tony Barbour8db65372015-07-10 18:32:33 -06002317 nulldrv_desc_layout(pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002318
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002319 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002320 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002321 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002322 break;
2323 }
2324
David Pinedo0257fbf2015-02-02 18:02:40 -07002325 return ret;
2326}
2327
Tony Barbourb857d312015-07-10 10:50:45 -06002328ICD_EXPORT VkResult VKAPI vkFreeDescriptorSets(
2329 VkDevice device,
2330 VkDescriptorPool descriptorPool,
2331 uint32_t count,
2332 const VkDescriptorSet* pDescriptorSets)
2333{
2334 NULLDRV_LOG_FUNC;
2335 return VK_SUCCESS;
2336}
2337
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002338ICD_EXPORT void VKAPI vkUpdateDescriptorSets(
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002339 VkDevice device,
2340 uint32_t writeCount,
2341 const VkWriteDescriptorSet* pDescriptorWrites,
2342 uint32_t copyCount,
2343 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002344{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002345 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002346 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002347}
2348
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002349ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2350 VkDevice device,
2351 const VkFramebufferCreateInfo* info,
2352 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002353{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002354 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002355 struct nulldrv_dev *dev = nulldrv_dev(device);
2356
2357 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2358}
2359
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002360ICD_EXPORT void VKAPI vkDestroyFramebuffer(
Tony Barbourde4124d2015-07-03 10:33:54 -06002361 VkDevice device,
2362 VkFramebuffer framebuffer)
2363{
2364 NULLDRV_LOG_FUNC;
2365 return VK_SUCCESS;
2366}
David Pinedo0257fbf2015-02-02 18:02:40 -07002367
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002368ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2369 VkDevice device,
2370 const VkRenderPassCreateInfo* info,
2371 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002372{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002373 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002374 struct nulldrv_dev *dev = nulldrv_dev(device);
2375
2376 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2377}
2378
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002379ICD_EXPORT void VKAPI vkDestroyRenderPass(
Tony Barbourde4124d2015-07-03 10:33:54 -06002380 VkDevice device,
2381 VkRenderPass renderPass)
2382{
2383 NULLDRV_LOG_FUNC;
2384 return VK_SUCCESS;
2385}
2386
Courtney Goeltzenleuchtera375b622015-07-27 14:04:01 -06002387ICD_EXPORT void VKAPI vkCmdPushConstants(
2388 VkCmdBuffer cmdBuffer,
2389 VkPipelineLayout layout,
2390 VkShaderStageFlags stageFlags,
2391 uint32_t start,
2392 uint32_t length,
2393 const void* values)
2394{
2395 /* TODO: Implement */
2396}
2397
Courtney Goeltzenleuchter07fe0662015-07-27 13:47:08 -06002398ICD_EXPORT VkResult VKAPI vkGetRenderAreaGranularity(
2399 VkDevice device,
2400 VkRenderPass renderPass,
2401 VkExtent2D* pGranularity)
2402{
2403 pGranularity->height = 1;
2404 pGranularity->width = 1;
2405
2406 return VK_SUCCESS;
2407}
2408
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002409ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Chia-I Wuc278df82015-07-07 11:50:03 +08002410 VkCmdBuffer cmdBuffer,
2411 const VkRenderPassBeginInfo* pRenderPassBegin,
2412 VkRenderPassContents contents)
2413{
2414 NULLDRV_LOG_FUNC;
2415}
2416
2417ICD_EXPORT void VKAPI vkCmdNextSubpass(
2418 VkCmdBuffer cmdBuffer,
2419 VkRenderPassContents contents)
David Pinedo0257fbf2015-02-02 18:02:40 -07002420{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002421 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002422}
2423
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002424ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002425 VkCmdBuffer cmdBuffer)
2426{
2427 NULLDRV_LOG_FUNC;
2428}
2429
2430ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2431 VkCmdBuffer cmdBuffer,
2432 uint32_t cmdBuffersCount,
2433 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002434{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002435 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002436}
Ian Elliottf93069f2015-02-19 14:26:19 -07002437
2438ICD_EXPORT void* xcbCreateWindow(
2439 uint16_t width,
2440 uint16_t height)
2441{
2442 static uint32_t window; // Kludge to the max
2443 NULLDRV_LOG_FUNC;
2444 return &window;
2445}
2446
2447// May not be needed, if we stub out stuf in tri.c
2448ICD_EXPORT void xcbDestroyWindow()
2449{
2450 NULLDRV_LOG_FUNC;
2451}
2452
2453ICD_EXPORT int xcbGetMessage(void *msg)
2454{
2455 NULLDRV_LOG_FUNC;
2456 return 0;
2457}
2458
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002459ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002460{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002461 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002462}
David Pinedo07494fd2015-07-24 10:54:41 -06002463
2464ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceImageFormatProperties(
2465 VkPhysicalDevice physicalDevice,
2466 VkFormat format,
2467 VkImageType type,
2468 VkImageTiling tiling,
2469 VkImageUsageFlags usage,
2470 VkImageFormatProperties* pImageFormatProperties)
2471{
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002472 return VK_ERROR_INITIALIZATION_FAILED;
David Pinedo07494fd2015-07-24 10:54:41 -06002473}