blob: bb67967b22c4ec3e3b7dcfe671947c7821134078 [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 Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600129 const VkDeviceQueueCreateInfo *queues,
David Pinedo0257fbf2015-02-02 18:02:40 -0700130 uint32_t count)
131{
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,
613 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700614 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600615 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800616 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700617{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800618 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700619
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800620 pool = (struct nulldrv_desc_pool *)
621 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600622 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800623 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600624 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700625
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800626 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700627
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800628 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700629
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600630 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700631}
632
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600633static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800634 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600635 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700636 const struct nulldrv_desc_layout *layout,
637 struct nulldrv_desc_set **set_ret)
638{
639 struct nulldrv_desc_set *set;
640
641 set = (struct nulldrv_desc_set *)
642 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600643 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700644 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600645 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700646
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800647 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700648 set->layout = layout;
649 *set_ret = set;
650
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600651 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700652}
653
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600654static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700655{
Tony Barbourde4124d2015-07-03 10:33:54 -0600656 return *(struct nulldrv_desc_pool **) &pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700657}
658
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600659static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
660 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700661 struct nulldrv_framebuffer ** fb_ret)
662{
663
664 struct nulldrv_framebuffer *fb;
665 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600666 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700667 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600668 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700669
670 *fb_ret = fb;
671
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600672 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700673
674}
675
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600676static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
677 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700678 struct nulldrv_render_pass** rp_ret)
679{
680 struct nulldrv_render_pass *rp;
681 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600682 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700683 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600684 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700685
686 *rp_ret = rp;
687
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600688 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700689}
690
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600691static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700692{
Tony Barbourde4124d2015-07-03 10:33:54 -0600693 return *(struct nulldrv_buf **) &buf;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700694}
695
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600696static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600697 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700698 struct nulldrv_buf_view **view_ret)
699{
700 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
701 struct nulldrv_buf_view *view;
702
703 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600704 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700705 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600706 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700707
708 view->buf = buf;
709
710 *view_ret = view;
711
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600712 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700713}
714
David Pinedo0257fbf2015-02-02 18:02:40 -0700715
716//*********************************************
717// Driver entry points
718//*********************************************
719
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600720ICD_EXPORT VkResult VKAPI vkCreateBuffer(
721 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600722 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600723 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700724{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700725 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700726 struct nulldrv_dev *dev = nulldrv_dev(device);
727
728 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
729}
730
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600731ICD_EXPORT void VKAPI vkDestroyBuffer(
Tony Barbourde4124d2015-07-03 10:33:54 -0600732 VkDevice device,
733 VkBuffer buffer)
734{
735 NULLDRV_LOG_FUNC;
736 return VK_SUCCESS;
737}
738
Cody Northropf02f9f82015-07-09 18:08:05 -0600739ICD_EXPORT VkResult VKAPI vkCreateCommandPool(
740 VkDevice device,
741 const VkCmdPoolCreateInfo* pCreateInfo,
742 VkCmdPool* pCmdPool)
743{
744 NULLDRV_LOG_FUNC;
745 return VK_SUCCESS;
746}
747
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600748ICD_EXPORT void VKAPI vkDestroyCommandPool(
Cody Northropf02f9f82015-07-09 18:08:05 -0600749 VkDevice device,
750 VkCmdPool cmdPool)
751{
752 NULLDRV_LOG_FUNC;
753 return VK_SUCCESS;
754}
755
756ICD_EXPORT VkResult VKAPI vkResetCommandPool(
757 VkDevice device,
758 VkCmdPool cmdPool,
759 VkCmdPoolResetFlags flags)
760{
761 NULLDRV_LOG_FUNC;
762 return VK_SUCCESS;
763}
764
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600765ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
766 VkDevice device,
767 const VkCmdBufferCreateInfo* pCreateInfo,
768 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700769{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700770 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700771 struct nulldrv_dev *dev = nulldrv_dev(device);
772
773 return nulldrv_cmd_create(dev, pCreateInfo,
774 (struct nulldrv_cmd **) pCmdBuffer);
775}
776
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600777ICD_EXPORT void VKAPI vkDestroyCommandBuffer(
Tony Barbourde4124d2015-07-03 10:33:54 -0600778 VkDevice device,
779 VkCmdBuffer cmdBuffer)
780{
781 NULLDRV_LOG_FUNC;
782 return VK_SUCCESS;
783}
784
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600785ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
786 VkCmdBuffer cmdBuffer,
787 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700788{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700789 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600790 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700791}
792
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600793ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
794 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700795{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700796 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600797 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700798}
799
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600800ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
Cody Northropf02f9f82015-07-09 18:08:05 -0600801 VkCmdBuffer cmdBuffer,
802 VkCmdBufferResetFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700803{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700804 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600805 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700806}
807
Ian Elliott64a68e12015-04-16 11:57:46 -0600808static const VkFormat nulldrv_presentable_formats[] = {
809 VK_FORMAT_B8G8R8A8_UNORM,
810};
811
Jon Ashburnba4a1952015-06-16 12:44:51 -0600812#if 0
Ian Elliott338dedb2015-08-21 15:09:33 -0600813ICD_EXPORT VkResult VKAPI vkGetDisplayInfoKHR(
814 VkDisplayKHR display,
815 VkDisplayInfoTypeKHR infoType,
Ian Elliott64a68e12015-04-16 11:57:46 -0600816 size_t* pDataSize,
817 void* pData)
818{
819 VkResult ret = VK_SUCCESS;
820
821 NULLDRV_LOG_FUNC;
822
823 if (!pDataSize)
824 return VK_ERROR_INVALID_POINTER;
825
826 switch (infoType) {
Ian Elliott338dedb2015-08-21 15:09:33 -0600827 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_KHR:
Ian Elliott64a68e12015-04-16 11:57:46 -0600828 {
Ian Elliott338dedb2015-08-21 15:09:33 -0600829 VkDisplayFormatPropertiesKHR *dst = pData;
Ian Elliott64a68e12015-04-16 11:57:46 -0600830 size_t size_ret;
831 uint32_t i;
832
833 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
834
835 if (dst && *pDataSize < size_ret)
836 return VK_ERROR_INVALID_VALUE;
837
838 *pDataSize = size_ret;
839 if (!dst)
840 return VK_SUCCESS;
841
842 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
Ian Elliott338dedb2015-08-21 15:09:33 -0600843 dst[i].swapchainFormat = nulldrv_presentable_formats[i];
Ian Elliott64a68e12015-04-16 11:57:46 -0600844 }
845 break;
846 default:
847 ret = VK_ERROR_INVALID_VALUE;
848 break;
849 }
850
851 return ret;
852}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600853#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600854
Ian Elliott338dedb2015-08-21 15:09:33 -0600855ICD_EXPORT VkResult VKAPI vkCreateSwapchainKHR(
Ian Elliott64a68e12015-04-16 11:57:46 -0600856 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600857 const VkSwapchainCreateInfoKHR* pCreateInfo,
858 VkSwapchainKHR* pSwapchain)
Ian Elliott64a68e12015-04-16 11:57:46 -0600859{
860 NULLDRV_LOG_FUNC;
861 struct nulldrv_dev *dev = nulldrv_dev(device);
862 struct nulldrv_swap_chain *sc;
863
864 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Ian Elliott338dedb2015-08-21 15:09:33 -0600865 VK_OBJECT_TYPE_SWAPCHAIN_KHR);
Ian Elliott64a68e12015-04-16 11:57:46 -0600866 if (!sc) {
867 return VK_ERROR_OUT_OF_HOST_MEMORY;
868 }
869 sc->dev = dev;
870
Ian Elliott338dedb2015-08-21 15:09:33 -0600871 *(VkSwapchainKHR **)pSwapchain = *(VkSwapchainKHR **)&sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600872
873 return VK_SUCCESS;
874}
875
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -0600876ICD_EXPORT VkResult VKAPI vkDestroySwapchainKHR(
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600877 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600878 VkSwapchainKHR swapchain)
Ian Elliott64a68e12015-04-16 11:57:46 -0600879{
880 NULLDRV_LOG_FUNC;
Ian Elliott338dedb2015-08-21 15:09:33 -0600881 struct nulldrv_swap_chain *sc = *(struct nulldrv_swap_chain **) &swapchain;
Ian Elliott64a68e12015-04-16 11:57:46 -0600882
883 free(sc);
884
885 return VK_SUCCESS;
886}
887
Ian Elliott338dedb2015-08-21 15:09:33 -0600888ICD_EXPORT VkResult VKAPI vkGetSwapchainImagesKHR(
Ian Elliott3333bb42015-08-10 13:56:08 -0600889 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600890 VkSwapchainKHR swapchain,
Ian Elliott3333bb42015-08-10 13:56:08 -0600891 uint32_t* pCount,
Ian Elliott338dedb2015-08-21 15:09:33 -0600892 VkImage* pSwapchainImages)
Ian Elliott64a68e12015-04-16 11:57:46 -0600893{
894 NULLDRV_LOG_FUNC;
Ian Elliott338dedb2015-08-21 15:09:33 -0600895 struct nulldrv_swap_chain *sc = *(struct nulldrv_swap_chain **) &swapchain;
Ian Elliott64a68e12015-04-16 11:57:46 -0600896 struct nulldrv_dev *dev = sc->dev;
897 VkResult ret = VK_SUCCESS;
898
Ian Elliott3333bb42015-08-10 13:56:08 -0600899 *pCount = 2;
Ian Elliott338dedb2015-08-21 15:09:33 -0600900 if (pSwapchainImages) {
Ian Elliott3333bb42015-08-10 13:56:08 -0600901 uint32_t i;
902 for (i = 0; i < 2; i++) {
Ian Elliott64a68e12015-04-16 11:57:46 -0600903 struct nulldrv_img *img;
Ian Elliott64a68e12015-04-16 11:57:46 -0600904
905 img = (struct nulldrv_img *) nulldrv_base_create(dev,
906 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600907 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600908 if (!img)
909 return VK_ERROR_OUT_OF_HOST_MEMORY;
Ian Elliott338dedb2015-08-21 15:09:33 -0600910 pSwapchainImages[i].handle = (uint64_t) &img;
Ian Elliott64a68e12015-04-16 11:57:46 -0600911 }
Ian Elliott64a68e12015-04-16 11:57:46 -0600912 }
913
914 return ret;
915}
916
Ian Elliott338dedb2015-08-21 15:09:33 -0600917ICD_EXPORT VkResult VKAPI vkAcquireNextImageKHR(
Tony Barbour7910de72015-07-13 16:37:21 -0600918 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600919 VkSwapchainKHR swapchain,
Tony Barbour7910de72015-07-13 16:37:21 -0600920 uint64_t timeout,
921 VkSemaphore semaphore,
922 uint32_t* pImageIndex)
923{
924 NULLDRV_LOG_FUNC;
925
926 return VK_SUCCESS;
927}
928
Ian Elliott338dedb2015-08-21 15:09:33 -0600929VkResult VKAPI vkGetSurfacePropertiesKHR(
Tony Barbour7910de72015-07-13 16:37:21 -0600930 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600931 const VkSurfaceDescriptionKHR* pSurfaceDescription,
932 VkSurfacePropertiesKHR* pSurfaceProperties)
Ian Elliott3333bb42015-08-10 13:56:08 -0600933{
934 NULLDRV_LOG_FUNC;
935
936 return VK_SUCCESS;
937}
938
Ian Elliott338dedb2015-08-21 15:09:33 -0600939VkResult VKAPI vkGetSurfaceFormatsKHR(
Ian Elliott3333bb42015-08-10 13:56:08 -0600940 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600941 const VkSurfaceDescriptionKHR* pSurfaceDescription,
Ian Elliott3333bb42015-08-10 13:56:08 -0600942 uint32_t* pCount,
Ian Elliott338dedb2015-08-21 15:09:33 -0600943 VkSurfaceFormatKHR* pSurfaceFormats)
Ian Elliott3333bb42015-08-10 13:56:08 -0600944{
945 NULLDRV_LOG_FUNC;
946
947 return VK_SUCCESS;
948}
949
Ian Elliott338dedb2015-08-21 15:09:33 -0600950VkResult VKAPI vkGetSurfacePresentModesKHR(
Ian Elliott3333bb42015-08-10 13:56:08 -0600951 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600952 const VkSurfaceDescriptionKHR* pSurfaceDescription,
Ian Elliott3333bb42015-08-10 13:56:08 -0600953 uint32_t* pCount,
Ian Elliott338dedb2015-08-21 15:09:33 -0600954 VkPresentModeKHR* pPresentModes)
Tony Barbour7910de72015-07-13 16:37:21 -0600955{
956 NULLDRV_LOG_FUNC;
957
958 return VK_SUCCESS;
959}
960
Ian Elliott338dedb2015-08-21 15:09:33 -0600961ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSurfaceSupportKHR(
Tony Barbour7910de72015-07-13 16:37:21 -0600962 VkPhysicalDevice physicalDevice,
963 uint32_t queueFamilyIndex,
Ian Elliott338dedb2015-08-21 15:09:33 -0600964 const VkSurfaceDescriptionKHR* pSurfaceDescription,
Tony Barbour7910de72015-07-13 16:37:21 -0600965 VkBool32* pSupported)
966{
967 NULLDRV_LOG_FUNC;
968
969 return VK_SUCCESS;
970}
971
Ian Elliott338dedb2015-08-21 15:09:33 -0600972ICD_EXPORT VkResult VKAPI vkQueuePresentKHR(
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600973 VkQueue queue_,
Ian Elliott338dedb2015-08-21 15:09:33 -0600974 VkPresentInfoKHR* pPresentInfo)
Ian Elliott64a68e12015-04-16 11:57:46 -0600975{
976 NULLDRV_LOG_FUNC;
977
978 return VK_SUCCESS;
979}
980
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600981ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600982 VkCmdBuffer cmdBuffer,
983 VkBuffer srcBuffer,
984 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700985 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600986 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700987{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700988 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700989}
990
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600991ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600992 VkCmdBuffer cmdBuffer,
993 VkImage srcImage,
994 VkImageLayout srcImageLayout,
995 VkImage destImage,
996 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700997 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600998 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700999{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001000 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001001}
1002
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001003ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001004 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001005 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001006 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001007 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001008 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001009 uint32_t regionCount,
1010 const VkImageBlit* pRegions,
1011 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -06001012{
1013 NULLDRV_LOG_FUNC;
1014}
1015
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001016ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001017 VkCmdBuffer cmdBuffer,
1018 VkBuffer srcBuffer,
1019 VkImage destImage,
1020 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001021 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001022 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001023{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001024 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001025}
1026
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001027ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001028 VkCmdBuffer cmdBuffer,
1029 VkImage srcImage,
1030 VkImageLayout srcImageLayout,
1031 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001032 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001033 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001034{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001035 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001036}
1037
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001038ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001039 VkCmdBuffer cmdBuffer,
1040 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001041 VkDeviceSize destOffset,
1042 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001043 const uint32_t* pData)
1044{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001045 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001046}
1047
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001048ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001049 VkCmdBuffer cmdBuffer,
1050 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001051 VkDeviceSize destOffset,
1052 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001053 uint32_t data)
1054{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001055 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001056}
1057
Ian Elliotte924ab22015-07-08 13:24:30 -06001058ICD_EXPORT void VKAPI vkCmdClearDepthStencilImage(
Courtney Goeltzenleuchter315ad992015-09-15 18:03:22 -06001059 VkCmdBuffer cmdBuffer,
1060 VkImage image,
1061 VkImageLayout imageLayout,
1062 const VkClearDepthStencilValue* pDepthStencil,
Ian Elliotte924ab22015-07-08 13:24:30 -06001063 uint32_t rangeCount,
Courtney Goeltzenleuchter315ad992015-09-15 18:03:22 -06001064 const VkImageSubresourceRange* pRanges)
Ian Elliotte924ab22015-07-08 13:24:30 -06001065{
1066 NULLDRV_LOG_FUNC;
1067}
1068
1069ICD_EXPORT void VKAPI vkCmdClearColorAttachment(
1070 VkCmdBuffer cmdBuffer,
1071 uint32_t colorAttachment,
1072 VkImageLayout imageLayout,
1073 const VkClearColorValue *pColor,
1074 uint32_t rectCount,
1075 const VkRect3D *pRects)
1076{
1077 NULLDRV_LOG_FUNC;
1078}
1079
1080ICD_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(
1081 VkCmdBuffer cmdBuffer,
1082 VkImageAspectFlags imageAspectMask,
1083 VkImageLayout imageLayout,
Courtney Goeltzenleuchter315ad992015-09-15 18:03:22 -06001084 const VkClearDepthStencilValue* pDepthStencil,
Ian Elliotte924ab22015-07-08 13:24:30 -06001085 uint32_t rectCount,
1086 const VkRect3D *pRects)
1087{
1088 NULLDRV_LOG_FUNC;
1089}
1090
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001091ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001092 VkCmdBuffer cmdBuffer,
1093 VkImage image,
1094 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +12001095 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001096 uint32_t rangeCount,
1097 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001098{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001099 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001100}
1101
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001102ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001103 VkCmdBuffer cmdBuffer,
1104 VkImage image,
1105 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001106 float depth,
1107 uint32_t stencil,
1108 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001109 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001110{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001111 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001112}
1113
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001114ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001115 VkCmdBuffer cmdBuffer,
1116 VkImage srcImage,
1117 VkImageLayout srcImageLayout,
1118 VkImage destImage,
1119 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001120 uint32_t regionCount,
1121 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001122{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001123 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001124}
1125
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001126ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001127 VkCmdBuffer cmdBuffer,
1128 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001129 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001130 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001131{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001132 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001133}
1134
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001135ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001136 VkCmdBuffer cmdBuffer,
1137 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001138 uint32_t slot)
1139{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001140 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001141}
1142
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001143ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001144 VkCmdBuffer cmdBuffer,
1145 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001146 uint32_t startQuery,
1147 uint32_t queryCount)
1148{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001149 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001150}
1151
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001152ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001153 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001154 VkEvent event_,
1155 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001156{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001157 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001158}
1159
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001160ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001161 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001162 VkEvent event_,
1163 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001164{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001165 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001166}
1167
Ian Elliott63f1edb2015-04-16 18:10:19 -06001168ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1169 VkCmdBuffer cmdBuffer,
1170 VkQueryPool queryPool,
1171 uint32_t startQuery,
1172 uint32_t queryCount,
1173 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001174 VkDeviceSize destOffset,
1175 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001176 VkFlags flags)
1177{
1178 NULLDRV_LOG_FUNC;
1179}
1180
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001181ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001182 VkCmdBuffer cmdBuffer,
1183 VkTimestampType timestampType,
1184 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001185 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001186{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001187 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001188}
1189
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001190ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001191 VkCmdBuffer cmdBuffer,
Tony Barbourde4124d2015-07-03 10:33:54 -06001192 VkPipelineBindPoint pipelineBindPoint,
1193 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001194{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001195 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001196}
1197
Tony Barbourde4124d2015-07-03 10:33:54 -06001198ICD_EXPORT void VKAPI vkCmdBindDynamicViewportState(
1199 VkCmdBuffer cmdBuffer,
1200 VkDynamicViewportState state)
1201{
1202 NULLDRV_LOG_FUNC;
1203}
1204
Cody Northrope4bc6942015-08-26 10:01:32 -06001205ICD_EXPORT void VKAPI vkCmdBindDynamicLineWidthState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001206 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001207 VkDynamicLineWidthState state)
Cody Northropf5bd2252015-08-17 11:10:49 -06001208{
1209 NULLDRV_LOG_FUNC;
1210}
1211
Cody Northrope4bc6942015-08-26 10:01:32 -06001212ICD_EXPORT void VKAPI vkCmdBindDynamicDepthBiasState(
Cody Northropf5bd2252015-08-17 11:10:49 -06001213 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001214 VkDynamicDepthBiasState state)
Tony Barbourde4124d2015-07-03 10:33:54 -06001215{
1216 NULLDRV_LOG_FUNC;
1217}
1218
Cody Northrope4bc6942015-08-26 10:01:32 -06001219ICD_EXPORT void VKAPI vkCmdBindDynamicBlendState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001220 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001221 VkDynamicBlendState state)
Tony Barbourde4124d2015-07-03 10:33:54 -06001222{
1223 NULLDRV_LOG_FUNC;
1224}
1225
Cody Northrope4bc6942015-08-26 10:01:32 -06001226ICD_EXPORT void VKAPI vkCmdBindDynamicDepthBoundsState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001227 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001228 VkDynamicDepthBoundsState state)
Cody Northrop2605cb02015-08-18 15:21:16 -06001229{
1230 NULLDRV_LOG_FUNC;
1231}
1232
1233ICD_EXPORT void VKAPI vkCmdBindDynamicStencilState(
1234 VkCmdBuffer cmdBuffer,
1235 VkDynamicStencilState state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001236{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001237 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001238}
1239
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001240ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001241 VkCmdBuffer cmdBuffer,
1242 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001243 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001244 uint32_t firstSet,
1245 uint32_t setCount,
1246 const VkDescriptorSet* pDescriptorSets,
1247 uint32_t dynamicOffsetCount,
1248 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001249{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001250 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001251}
1252
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001253ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1254 VkCmdBuffer cmdBuffer,
1255 uint32_t startBinding,
1256 uint32_t bindingCount,
1257 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001258 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001259{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001260 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001261}
1262
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001263ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001264 VkCmdBuffer cmdBuffer,
1265 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001266 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001267 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001268{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001269 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001270}
1271
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001272ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001273 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001274 uint32_t firstVertex,
1275 uint32_t vertexCount,
1276 uint32_t firstInstance,
1277 uint32_t instanceCount)
1278{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001279 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001280}
1281
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001282ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001283 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001284 uint32_t firstIndex,
1285 uint32_t indexCount,
1286 int32_t vertexOffset,
1287 uint32_t firstInstance,
1288 uint32_t instanceCount)
1289{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001290 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001291}
1292
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001293ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001294 VkCmdBuffer cmdBuffer,
1295 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001296 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001297 uint32_t count,
1298 uint32_t stride)
1299{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001300 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001301}
1302
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001303ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001304 VkCmdBuffer cmdBuffer,
1305 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001306 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001307 uint32_t count,
1308 uint32_t stride)
1309{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001310 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001311}
1312
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001313ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001314 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001315 uint32_t x,
1316 uint32_t y,
1317 uint32_t z)
1318{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001319 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001320}
1321
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001322ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001323 VkCmdBuffer cmdBuffer,
1324 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001325 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001326{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001327 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001328}
1329
Tony Barbour8205d902015-04-16 15:59:00 -06001330void VKAPI vkCmdWaitEvents(
1331 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001332 uint32_t eventCount,
1333 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001334 VkPipelineStageFlags sourceStageMask,
1335 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001336 uint32_t memBarrierCount,
Courtney Goeltzenleuchterd9ba3422015-07-12 12:58:58 -06001337 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001338{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001339 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001340}
1341
Tony Barbour8205d902015-04-16 15:59:00 -06001342void VKAPI vkCmdPipelineBarrier(
1343 VkCmdBuffer cmdBuffer,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001344 VkPipelineStageFlags srcStageMask,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001345 VkPipelineStageFlags destStageMask,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001346 VkBool32 byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001347 uint32_t memBarrierCount,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001348 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001349{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001350 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001351}
1352
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001353ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001354 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001355 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001356 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001357{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001358 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001359 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1360 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1361}
1362
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001363ICD_EXPORT void VKAPI vkDestroyDevice(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001364 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001365{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001366 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001367 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001368}
1369
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001370ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1371 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001372 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001373 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001374 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001375{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001376 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001377 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001378 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001379 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001380}
1381
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001382ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1383 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001384{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001385 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001386 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001387}
1388
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001389ICD_EXPORT VkResult VKAPI vkCreateEvent(
1390 VkDevice device,
1391 const VkEventCreateInfo* pCreateInfo,
1392 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001393{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001394 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001395 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001396}
1397
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001398ICD_EXPORT void VKAPI vkDestroyEvent(
Tony Barbourde4124d2015-07-03 10:33:54 -06001399 VkDevice device,
1400 VkEvent event)
1401{
1402 NULLDRV_LOG_FUNC;
1403 return VK_SUCCESS;
1404}
1405
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001406ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001407 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001408 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001409{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001410 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001411 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001412}
1413
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001414ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001415 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001416 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001417{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001418 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001419 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001420}
1421
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001422ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001423 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001424 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001425{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001426 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001427 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001428}
1429
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001430ICD_EXPORT VkResult VKAPI vkCreateFence(
1431 VkDevice device,
1432 const VkFenceCreateInfo* pCreateInfo,
1433 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001434{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001435 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001436 struct nulldrv_dev *dev = nulldrv_dev(device);
1437
1438 return nulldrv_fence_create(dev, pCreateInfo,
1439 (struct nulldrv_fence **) pFence);
1440}
1441
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001442ICD_EXPORT void VKAPI vkDestroyFence(
Tony Barbourde4124d2015-07-03 10:33:54 -06001443 VkDevice device,
1444 VkFence fence)
1445{
1446 NULLDRV_LOG_FUNC;
1447 return VK_SUCCESS;
1448}
1449
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001450ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001451 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001452 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001453{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001454 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001455 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001456}
1457
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001458ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001459 VkDevice device,
1460 uint32_t fenceCount,
1461 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001462{
1463 NULLDRV_LOG_FUNC;
1464 return VK_SUCCESS;
1465}
1466
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001467ICD_EXPORT VkResult VKAPI vkWaitForFences(
1468 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001469 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001470 const VkFence* pFences,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001471 VkBool32 waitAll,
David Pinedo0257fbf2015-02-02 18:02:40 -07001472 uint64_t timeout)
1473{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001474 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001475 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001476}
1477
Tony Barbour426b9052015-06-24 16:06:58 -06001478ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1479 VkPhysicalDevice gpu_,
1480 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001481{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001482 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001483 VkResult ret = VK_SUCCESS;
1484
Tony Barbour426b9052015-06-24 16:06:58 -06001485 pProperties->apiVersion = VK_API_VERSION;
1486 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1487 pProperties->vendorId = 0;
1488 pProperties->deviceId = 0;
1489 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1490 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001491
Mark Lobodzinski7dae6862015-09-07 12:56:17 -06001492 /* TODO: fill out limits */
1493 memset(&pProperties->limits, 0, sizeof(VkPhysicalDeviceLimits));
1494 memset(&pProperties->sparseProperties, 0, sizeof(VkPhysicalDeviceSparseProperties));
Ian Elliott64a68e12015-04-16 11:57:46 -06001495 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001496}
1497
Chris Forbesd7576302015-06-21 22:55:02 +12001498ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1499 VkPhysicalDevice physicalDevice,
1500 VkPhysicalDeviceFeatures* pFeatures)
1501{
1502 NULLDRV_LOG_FUNC;
1503 VkResult ret = VK_SUCCESS;
1504
1505 /* TODO: fill out features */
1506 memset(pFeatures, 0, sizeof(*pFeatures));
1507
1508 return ret;
1509}
1510
Courtney Goeltzenleuchter4da96aa2015-07-12 12:52:09 -06001511ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatProperties(
Chris Forbesd7576302015-06-21 22:55:02 +12001512 VkPhysicalDevice physicalDevice,
1513 VkFormat format,
1514 VkFormatProperties* pFormatInfo)
1515{
1516 NULLDRV_LOG_FUNC;
1517 VkResult ret = VK_SUCCESS;
1518
1519 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1520 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
Mark Lobodzinski4b36dd42015-09-03 15:21:52 -06001521 pFormatInfo->bufferFeatures = 0;
Chris Forbesd7576302015-06-21 22:55:02 +12001522
1523 return ret;
1524}
1525
Cody Northropef72e2a2015-08-03 17:04:53 -06001526ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueFamilyProperties(
Tony Barbour426b9052015-06-24 16:06:58 -06001527 VkPhysicalDevice gpu_,
Cody Northropef72e2a2015-08-03 17:04:53 -06001528 uint32_t* pCount,
1529 VkQueueFamilyProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001530 {
Cody Northropef72e2a2015-08-03 17:04:53 -06001531 if (pProperties == NULL) {
1532 *pCount = 1;
1533 return VK_SUCCESS;
1534 }
Tony Barbour426b9052015-06-24 16:06:58 -06001535 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1536 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001537 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001538
Tony Barbour426b9052015-06-24 16:06:58 -06001539 return VK_SUCCESS;
1540}
1541
Ian Elliotte924ab22015-07-08 13:24:30 -06001542ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(
1543 VkPhysicalDevice gpu_,
1544 VkPhysicalDeviceMemoryProperties* pProperties)
1545{
1546 // TODO: Fill in with real data
1547 return VK_SUCCESS;
1548}
1549
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001550ICD_EXPORT VkResult VKAPI vkEnumerateDeviceLayerProperties(
Ian Elliotte924ab22015-07-08 13:24:30 -06001551 VkPhysicalDevice physicalDevice,
1552 uint32_t* pCount,
1553 VkLayerProperties* pProperties)
1554{
1555 // TODO: Fill in with real data
1556 return VK_SUCCESS;
1557}
1558
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001559ICD_EXPORT VkResult VKAPI vkEnumerateInstanceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001560 const char* pLayerName,
1561 uint32_t* pCount,
1562 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001563{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001564 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001565
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001566 if (pProperties == NULL) {
1567 *pCount = NULLDRV_EXT_COUNT;
1568 return VK_SUCCESS;
1569 }
Tony Barbour426b9052015-06-24 16:06:58 -06001570
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001571 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1572 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1573 *pCount = copy_size;
1574 if (copy_size < NULLDRV_EXT_COUNT) {
1575 return VK_INCOMPLETE;
1576 }
Tony Barbour426b9052015-06-24 16:06:58 -06001577 return VK_SUCCESS;
1578}
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001579ICD_EXPORT VkResult VKAPI vkEnumerateInstanceLayerProperties(
Ian Elliotte924ab22015-07-08 13:24:30 -06001580 uint32_t* pCount,
1581 VkLayerProperties* pProperties)
1582{
1583 // TODO: Fill in with real data
1584 return VK_SUCCESS;
1585}
Tony Barbour426b9052015-06-24 16:06:58 -06001586
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001587VkResult VKAPI vkEnumerateDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001588 VkPhysicalDevice physicalDevice,
1589 const char* pLayerName,
1590 uint32_t* pCount,
1591 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001592{
Tony Barbour426b9052015-06-24 16:06:58 -06001593
Tony Barbour426b9052015-06-24 16:06:58 -06001594 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001595
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001596 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001597}
1598
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001599ICD_EXPORT VkResult VKAPI vkCreateImage(
1600 VkDevice device,
1601 const VkImageCreateInfo* pCreateInfo,
1602 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001603{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001604 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001605 struct nulldrv_dev *dev = nulldrv_dev(device);
1606
1607 return nulldrv_img_create(dev, pCreateInfo, false,
1608 (struct nulldrv_img **) pImage);
1609}
1610
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001611ICD_EXPORT void VKAPI vkDestroyImage(
Tony Barbourde4124d2015-07-03 10:33:54 -06001612 VkDevice device,
1613 VkImage image)
1614{
1615 NULLDRV_LOG_FUNC;
1616 return VK_SUCCESS;
1617}
1618
Tony Barbour426b9052015-06-24 16:06:58 -06001619ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001620 VkDevice device,
1621 VkImage image,
1622 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001623 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001624{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001625 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001626
Tony Barbour426b9052015-06-24 16:06:58 -06001627 pLayout->offset = 0;
1628 pLayout->size = 1;
1629 pLayout->rowPitch = 4;
1630 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001631
Tony Barbour426b9052015-06-24 16:06:58 -06001632 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001633}
1634
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001635ICD_EXPORT VkResult VKAPI vkAllocMemory(
1636 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001637 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001638 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001639{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001640 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001641 struct nulldrv_dev *dev = nulldrv_dev(device);
1642
1643 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1644}
1645
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001646ICD_EXPORT void VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001647 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001648 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001649{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001650 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001651 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001652}
1653
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001654ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001655 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001656 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001657 VkDeviceSize offset,
1658 VkDeviceSize size,
1659 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001660 void** ppData)
1661{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001662 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001663 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1664 void *ptr = nulldrv_mem_map(mem, flags);
1665
1666 *ppData = ptr;
1667
Courtney Goeltzenleuchterac544f32015-09-14 18:01:17 -06001668 return (ptr) ? VK_SUCCESS : VK_ERROR_MEMORY_MAP_FAILED;
David Pinedo0257fbf2015-02-02 18:02:40 -07001669}
1670
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001671ICD_EXPORT void VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001672 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001673 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001674{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001675 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001676 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001677}
1678
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001679ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001680 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001681 uint32_t memRangeCount,
1682 const VkMappedMemoryRange* pMemRanges)
1683{
1684 NULLDRV_LOG_FUNC;
1685 return VK_SUCCESS;
1686}
1687
1688ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1689 VkDevice device,
1690 uint32_t memRangeCount,
1691 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001692{
1693 NULLDRV_LOG_FUNC;
1694 return VK_SUCCESS;
1695}
1696
Courtney Goeltzenleuchterd040c5c2015-07-09 21:57:28 -06001697ICD_EXPORT VkResult VKAPI vkGetDeviceMemoryCommitment(
1698 VkDevice device,
1699 VkDeviceMemory memory,
1700 VkDeviceSize* pCommittedMemoryInBytes)
1701{
1702 return VK_SUCCESS;
1703}
1704
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001705ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001706 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001707 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001708{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001709 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001710 struct nulldrv_instance *inst;
1711
1712 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001713 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001714 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001715 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001716
Tony Barbour426b9052015-06-24 16:06:58 -06001717 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001718
Mike Stroyan230e6252015-04-17 12:36:38 -06001719 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001720
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001721 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001722}
1723
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001724ICD_EXPORT void VKAPI vkDestroyInstance(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001725 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001726{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001727 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001728 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001729}
1730
Tony Barbour8205d902015-04-16 15:59:00 -06001731ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001732 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001733 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001734 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001735{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001736 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001737 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001738 struct nulldrv_gpu *gpu;
1739 *pGpuCount = 1;
1740 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001741 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001742 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001743 return ret;
1744}
1745
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001746ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001747 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001748 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001749 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001750 char* const* pOutLayers,
1751 void* pReserved)
1752{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001753 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001754 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001755}
1756
Tony Barbourde4124d2015-07-03 10:33:54 -06001757ICD_EXPORT VkResult VKAPI vkGetBufferMemoryRequirements(
1758 VkDevice device,
1759 VkBuffer buffer,
1760 VkMemoryRequirements* pMemoryRequirements)
1761{
1762 NULLDRV_LOG_FUNC;
1763 struct nulldrv_base *base = nulldrv_base((void*)buffer.handle);
1764
1765 return base->get_memory_requirements(base, pMemoryRequirements);
1766}
1767
1768ICD_EXPORT VkResult VKAPI vkGetImageMemoryRequirements(
1769 VkDevice device,
1770 VkImage image,
1771 VkMemoryRequirements* pMemoryRequirements)
1772{
1773 NULLDRV_LOG_FUNC;
1774 struct nulldrv_base *base = nulldrv_base((void*)image.handle);
1775
1776 return base->get_memory_requirements(base, pMemoryRequirements);
1777}
1778
1779ICD_EXPORT VkResult VKAPI vkBindBufferMemory(
1780 VkDevice device,
1781 VkBuffer buffer,
1782 VkDeviceMemory mem_,
1783 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001784{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001785 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001786 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001787}
1788
Tony Barbourde4124d2015-07-03 10:33:54 -06001789ICD_EXPORT VkResult VKAPI vkBindImageMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001790 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06001791 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001792 VkDeviceMemory mem_,
1793 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001794{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001795 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001796 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001797}
1798
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001799ICD_EXPORT VkResult VKAPI vkGetImageSparseMemoryRequirements(
1800 VkDevice device,
1801 VkImage image,
1802 uint32_t* pNumRequirements,
1803 VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
1804{
1805 NULLDRV_LOG_FUNC;
1806 return VK_SUCCESS;
1807}
1808
1809ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(
1810 VkPhysicalDevice physicalDevice,
1811 VkFormat format,
1812 VkImageType type,
1813 uint32_t samples,
1814 VkImageUsageFlags usage,
1815 VkImageTiling tiling,
1816 uint32_t* pNumProperties,
1817 VkSparseImageFormatProperties* pProperties)
1818{
1819 NULLDRV_LOG_FUNC;
1820 return VK_SUCCESS;
1821}
1822
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001823ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001824 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001825 VkBuffer buffer,
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001826 uint32_t numBindings,
1827 const VkSparseMemoryBindInfo* pBindInfo)
1828{
1829 NULLDRV_LOG_FUNC;
1830 return VK_SUCCESS;
1831}
1832
1833ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageOpaqueMemory(
1834 VkQueue queue,
1835 VkImage image,
1836 uint32_t numBindings,
1837 const VkSparseMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001838{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001839 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001840 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001841}
1842
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001843ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001844 VkQueue queue,
1845 VkImage image,
1846 uint32_t numBindings,
1847 const VkSparseImageMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001848{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001849 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001850 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001851}
Jon Ashburn0e249962015-07-10 09:41:15 -07001852ICD_EXPORT VkResult VKAPI vkCreatePipelineCache(
1853 VkDevice device,
1854 const VkPipelineCacheCreateInfo* pCreateInfo,
1855 VkPipelineCache* pPipelineCache)
1856{
David Pinedo0257fbf2015-02-02 18:02:40 -07001857
Jon Ashburn0e249962015-07-10 09:41:15 -07001858 NULLDRV_LOG_FUNC;
1859 return VK_SUCCESS;
1860}
1861
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001862ICD_EXPORT void VKAPI vkDestroyPipeline(
Tony Barbourde4124d2015-07-03 10:33:54 -06001863 VkDevice device,
1864 VkPipeline pipeline)
1865{
1866 NULLDRV_LOG_FUNC;
1867 return VK_SUCCESS;
1868}
1869
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001870void VKAPI vkDestroyPipelineCache(
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06001871 VkDevice device,
1872 VkPipelineCache pipelineCache)
Jon Ashburn0e249962015-07-10 09:41:15 -07001873{
1874 NULLDRV_LOG_FUNC;
1875 return VK_SUCCESS;
1876}
1877
1878ICD_EXPORT size_t VKAPI vkGetPipelineCacheSize(
1879 VkDevice device,
1880 VkPipelineCache pipelineCache)
1881{
1882 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06001883 return 0;
Jon Ashburn0e249962015-07-10 09:41:15 -07001884}
1885
1886ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
1887 VkDevice device,
1888 VkPipelineCache pipelineCache,
1889 void* pData)
1890{
1891 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06001892 return VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn0e249962015-07-10 09:41:15 -07001893}
1894
1895ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
1896 VkDevice device,
1897 VkPipelineCache destCache,
1898 uint32_t srcCacheCount,
1899 const VkPipelineCache* pSrcCaches)
1900{
1901 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06001902 return VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn0e249962015-07-10 09:41:15 -07001903}
1904ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001905 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001906 VkPipelineCache pipelineCache,
1907 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001908 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1909 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001910{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001911 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001912 struct nulldrv_dev *dev = nulldrv_dev(device);
1913
1914 return graphics_pipeline_create(dev, pCreateInfo,
1915 (struct nulldrv_pipeline **) pPipeline);
1916}
1917
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001918
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001919
Jon Ashburn0e249962015-07-10 09:41:15 -07001920ICD_EXPORT VkResult VKAPI vkCreateComputePipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001921 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001922 VkPipelineCache pipelineCache,
1923 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001924 const VkComputePipelineCreateInfo* pCreateInfo,
1925 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001926{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001927 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001928 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001929}
1930
David Pinedo0257fbf2015-02-02 18:02:40 -07001931
David Pinedo0257fbf2015-02-02 18:02:40 -07001932
Jon Ashburn0e249962015-07-10 09:41:15 -07001933
David Pinedo0257fbf2015-02-02 18:02:40 -07001934
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001935ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1936 VkDevice device,
1937 const VkQueryPoolCreateInfo* pCreateInfo,
1938 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001939{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001940 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001941 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001942}
1943
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001944ICD_EXPORT void VKAPI vkDestroyQueryPool(
Tony Barbourde4124d2015-07-03 10:33:54 -06001945 VkDevice device,
1946 VkQueryPool queryPoool)
1947{
1948 NULLDRV_LOG_FUNC;
1949 return VK_SUCCESS;
1950}
1951
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001952ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001953 VkDevice device,
1954 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001955 uint32_t startQuery,
1956 uint32_t queryCount,
1957 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001958 void* pData,
1959 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001960{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001961 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001962 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001963}
1964
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001965ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1966 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001967{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001968 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001969 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001970}
1971
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001972ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1973 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001974 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001975 const VkCmdBuffer* pCmdBuffers,
1976 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001977{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001978 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001979 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001980}
1981
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001982ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1983 VkDevice device,
1984 const VkSemaphoreCreateInfo* pCreateInfo,
1985 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001986{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001987 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001988 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001989}
1990
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001991ICD_EXPORT void VKAPI vkDestroySemaphore(
Tony Barbourde4124d2015-07-03 10:33:54 -06001992 VkDevice device,
1993 VkSemaphore semaphore)
1994{
1995 NULLDRV_LOG_FUNC;
1996 return VK_SUCCESS;
1997}
1998
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001999ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
2000 VkQueue queue,
2001 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002002{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002003 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002004 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002005}
2006
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002007ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
2008 VkQueue queue,
2009 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002010{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002011 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002012 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002013}
2014
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002015ICD_EXPORT VkResult VKAPI vkCreateSampler(
2016 VkDevice device,
2017 const VkSamplerCreateInfo* pCreateInfo,
2018 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07002019{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002020 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002021 struct nulldrv_dev *dev = nulldrv_dev(device);
2022
2023 return nulldrv_sampler_create(dev, pCreateInfo,
2024 (struct nulldrv_sampler **) pSampler);
2025}
2026
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002027ICD_EXPORT void VKAPI vkDestroySampler(
Tony Barbourde4124d2015-07-03 10:33:54 -06002028 VkDevice device,
2029 VkSampler sampler)
2030{
2031 NULLDRV_LOG_FUNC;
2032 return VK_SUCCESS;
2033}
2034
Ian Elliotte924ab22015-07-08 13:24:30 -06002035ICD_EXPORT VkResult VKAPI vkCreateShaderModule(
2036 VkDevice device,
2037 const VkShaderModuleCreateInfo* pCreateInfo,
2038 VkShaderModule* pShaderModule)
2039{
2040 // TODO: Fill in with real data
Tony Barbourde4124d2015-07-03 10:33:54 -06002041 NULLDRV_LOG_FUNC;
2042 return VK_SUCCESS;
2043}
2044
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002045ICD_EXPORT void VKAPI vkDestroyShaderModule(
Tony Barbourde4124d2015-07-03 10:33:54 -06002046 VkDevice device,
2047 VkShaderModule shaderModule)
2048{
2049 // TODO: Fill in with real data
2050 NULLDRV_LOG_FUNC;
Ian Elliotte924ab22015-07-08 13:24:30 -06002051 return VK_SUCCESS;
2052}
2053
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002054ICD_EXPORT VkResult VKAPI vkCreateShader(
2055 VkDevice device,
2056 const VkShaderCreateInfo* pCreateInfo,
2057 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002058{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002059 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002060 struct nulldrv_dev *dev = nulldrv_dev(device);
2061
2062 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2063}
2064
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002065ICD_EXPORT void VKAPI vkDestroyShader(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002066 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002067 VkShader shader)
2068{
2069 NULLDRV_LOG_FUNC;
2070 return VK_SUCCESS;
2071}
2072
2073ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2074 VkDevice device,
2075 const VkDynamicViewportStateCreateInfo* pCreateInfo,
2076 VkDynamicViewportState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002077{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002078 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002079 struct nulldrv_dev *dev = nulldrv_dev(device);
2080
2081 return nulldrv_viewport_state_create(dev, pCreateInfo,
2082 (struct nulldrv_dynamic_vp **) pState);
2083}
2084
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002085ICD_EXPORT void VKAPI vkDestroyDynamicViewportState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002086 VkDevice device,
2087 VkDynamicViewportState dynamicViewportState)
2088{
2089 NULLDRV_LOG_FUNC;
2090 return VK_SUCCESS;
2091}
2092
Cody Northrope4bc6942015-08-26 10:01:32 -06002093ICD_EXPORT VkResult VKAPI vkCreateDynamicLineWidthState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002094 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002095 const VkDynamicLineWidthStateCreateInfo* pCreateInfo,
2096 VkDynamicLineWidthState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002097{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002098 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002099 struct nulldrv_dev *dev = nulldrv_dev(device);
2100
Cody Northrope4bc6942015-08-26 10:01:32 -06002101 return nulldrv_line_width_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002102 (struct nulldrv_dynamic_line_width **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002103}
2104
Cody Northrope4bc6942015-08-26 10:01:32 -06002105ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthBiasState(
Cody Northropf5bd2252015-08-17 11:10:49 -06002106 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002107 const VkDynamicDepthBiasStateCreateInfo* pCreateInfo,
2108 VkDynamicDepthBiasState* pState)
Cody Northropf5bd2252015-08-17 11:10:49 -06002109{
2110 NULLDRV_LOG_FUNC;
2111 struct nulldrv_dev *dev = nulldrv_dev(device);
2112
Cody Northrope4bc6942015-08-26 10:01:32 -06002113 return nulldrv_depth_bias_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002114 (struct nulldrv_dynamic_depth_bias **) pState);
Cody Northropf5bd2252015-08-17 11:10:49 -06002115}
2116
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002117ICD_EXPORT void VKAPI vkDestroyDynamicLineWidthState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002118 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002119 VkDynamicLineWidthState dynamicLineWidthState)
Cody Northropf5bd2252015-08-17 11:10:49 -06002120{
2121 NULLDRV_LOG_FUNC;
2122 return VK_SUCCESS;
2123}
2124
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002125ICD_EXPORT void VKAPI vkDestroyDynamicDepthBiasState(
Cody Northropf5bd2252015-08-17 11:10:49 -06002126 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002127 VkDynamicDepthBiasState dynamicDepthBiasState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002128{
2129 NULLDRV_LOG_FUNC;
2130 return VK_SUCCESS;
2131}
2132
Cody Northrope4bc6942015-08-26 10:01:32 -06002133ICD_EXPORT VkResult VKAPI vkCreateDynamicBlendState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002134 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002135 const VkDynamicBlendStateCreateInfo* pCreateInfo,
2136 VkDynamicBlendState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002137{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002138 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002139 struct nulldrv_dev *dev = nulldrv_dev(device);
2140
2141 return nulldrv_blend_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002142 (struct nulldrv_dynamic_blend **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002143}
2144
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002145ICD_EXPORT void VKAPI vkDestroyDynamicBlendState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002146 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002147 VkDynamicBlendState dynamicBlendState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002148{
2149 NULLDRV_LOG_FUNC;
2150 return VK_SUCCESS;
2151}
2152
Cody Northrope4bc6942015-08-26 10:01:32 -06002153ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthBoundsState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002154 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002155 const VkDynamicDepthBoundsStateCreateInfo* pCreateInfo,
2156 VkDynamicDepthBoundsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002157{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002158 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002159 struct nulldrv_dev *dev = nulldrv_dev(device);
2160
Cody Northrope4bc6942015-08-26 10:01:32 -06002161 return nulldrv_depth_bounds_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002162 (struct nulldrv_dynamic_depth_bounds **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002163}
2164
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002165ICD_EXPORT void VKAPI vkDestroyDynamicDepthBoundsState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002166 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002167 VkDynamicDepthBoundsState dynamicDepthBoundsState)
Cody Northrop2605cb02015-08-18 15:21:16 -06002168{
2169 NULLDRV_LOG_FUNC;
2170 return VK_SUCCESS;
2171}
2172
2173ICD_EXPORT VkResult VKAPI vkCreateDynamicStencilState(
2174 VkDevice device,
2175 const VkDynamicStencilStateCreateInfo* pCreateInfoFront,
2176 const VkDynamicStencilStateCreateInfo* pCreateInfoBack,
2177 VkDynamicStencilState* pState)
2178{
2179 NULLDRV_LOG_FUNC;
2180 struct nulldrv_dev *dev = nulldrv_dev(device);
2181
2182 return nulldrv_stencil_state_create(dev, pCreateInfoFront, pCreateInfoBack,
2183 (struct nulldrv_dynamic_stencil **) pState);
2184}
2185
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002186ICD_EXPORT void VKAPI vkDestroyDynamicStencilState(
Cody Northrop2605cb02015-08-18 15:21:16 -06002187 VkDevice device,
2188 VkDynamicStencilState dynamicStencilState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002189{
2190 NULLDRV_LOG_FUNC;
2191 return VK_SUCCESS;
2192}
2193
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002194ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2195 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002196 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002197 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002198{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002199 NULLDRV_LOG_FUNC;
2200 struct nulldrv_dev *dev = nulldrv_dev(device);
2201
2202 return nulldrv_buf_view_create(dev, pCreateInfo,
2203 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002204}
2205
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002206ICD_EXPORT void VKAPI vkDestroyBufferView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002207 VkDevice device,
2208 VkBufferView bufferView)
2209{
2210 NULLDRV_LOG_FUNC;
2211 return VK_SUCCESS;
2212}
2213
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002214ICD_EXPORT VkResult VKAPI vkCreateImageView(
2215 VkDevice device,
2216 const VkImageViewCreateInfo* pCreateInfo,
2217 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002218{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002219 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002220 struct nulldrv_dev *dev = nulldrv_dev(device);
2221
2222 return nulldrv_img_view_create(dev, pCreateInfo,
2223 (struct nulldrv_img_view **) pView);
2224}
2225
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002226ICD_EXPORT void VKAPI vkDestroyImageView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002227 VkDevice device,
2228 VkImageView imageView)
2229{
2230 NULLDRV_LOG_FUNC;
2231 return VK_SUCCESS;
2232}
2233
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002234ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2235 VkDevice device,
2236 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2237 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002238{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002239 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002240 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002241
Chia-I Wu7732cb22015-03-26 15:27:55 +08002242 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002243 (struct nulldrv_desc_layout **) pSetLayout);
2244}
2245
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002246ICD_EXPORT void VKAPI vkDestroyDescriptorSetLayout(
Tony Barbourde4124d2015-07-03 10:33:54 -06002247 VkDevice device,
2248 VkDescriptorSetLayout descriptorSetLayout)
2249{
2250 NULLDRV_LOG_FUNC;
2251 return VK_SUCCESS;
2252}
2253
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002254ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2255 VkDevice device,
2256 const VkPipelineLayoutCreateInfo* pCreateInfo,
2257 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002258{
2259 NULLDRV_LOG_FUNC;
2260 struct nulldrv_dev *dev = nulldrv_dev(device);
2261
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002262 return nulldrv_pipeline_layout_create(dev,
2263 pCreateInfo,
2264 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002265}
2266
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002267ICD_EXPORT void VKAPI vkDestroyPipelineLayout(
Tony Barbourde4124d2015-07-03 10:33:54 -06002268 VkDevice device,
2269 VkPipelineLayout pipelineLayout)
2270{
2271 NULLDRV_LOG_FUNC;
2272 return VK_SUCCESS;
2273}
2274
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002275ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2276 VkDevice device,
2277 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002278 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002279 const VkDescriptorPoolCreateInfo* pCreateInfo,
2280 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002281{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002282 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002283 struct nulldrv_dev *dev = nulldrv_dev(device);
2284
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002285 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2286 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002287}
2288
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002289ICD_EXPORT void VKAPI vkDestroyDescriptorPool(
Tony Barbourde4124d2015-07-03 10:33:54 -06002290 VkDevice device,
2291 VkDescriptorPool descriptorPool)
2292{
2293 NULLDRV_LOG_FUNC;
2294 return VK_SUCCESS;
2295}
2296
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002297ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002298 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002299 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002300{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002301 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002302 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002303}
2304
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002305ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002306 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002307 VkDescriptorPool descriptorPool,
2308 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002309 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002310 const VkDescriptorSetLayout* pSetLayouts,
Cody Northropc8aa4a52015-08-03 12:47:29 -06002311 VkDescriptorSet* pDescriptorSets)
David Pinedo0257fbf2015-02-02 18:02:40 -07002312{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002313 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002314 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2315 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002316 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002317 uint32_t i;
2318
2319 for (i = 0; i < count; i++) {
2320 const struct nulldrv_desc_layout *layout =
Tony Barbour8db65372015-07-10 18:32:33 -06002321 nulldrv_desc_layout(pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002322
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002323 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002324 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002325 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002326 break;
2327 }
2328
David Pinedo0257fbf2015-02-02 18:02:40 -07002329 return ret;
2330}
2331
Tony Barbourb857d312015-07-10 10:50:45 -06002332ICD_EXPORT VkResult VKAPI vkFreeDescriptorSets(
2333 VkDevice device,
2334 VkDescriptorPool descriptorPool,
2335 uint32_t count,
2336 const VkDescriptorSet* pDescriptorSets)
2337{
2338 NULLDRV_LOG_FUNC;
2339 return VK_SUCCESS;
2340}
2341
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002342ICD_EXPORT void VKAPI vkUpdateDescriptorSets(
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002343 VkDevice device,
2344 uint32_t writeCount,
2345 const VkWriteDescriptorSet* pDescriptorWrites,
2346 uint32_t copyCount,
2347 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002348{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002349 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002350 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002351}
2352
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002353ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2354 VkDevice device,
2355 const VkFramebufferCreateInfo* info,
2356 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002357{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002358 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002359 struct nulldrv_dev *dev = nulldrv_dev(device);
2360
2361 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2362}
2363
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002364ICD_EXPORT void VKAPI vkDestroyFramebuffer(
Tony Barbourde4124d2015-07-03 10:33:54 -06002365 VkDevice device,
2366 VkFramebuffer framebuffer)
2367{
2368 NULLDRV_LOG_FUNC;
2369 return VK_SUCCESS;
2370}
David Pinedo0257fbf2015-02-02 18:02:40 -07002371
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002372ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2373 VkDevice device,
2374 const VkRenderPassCreateInfo* info,
2375 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002376{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002377 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002378 struct nulldrv_dev *dev = nulldrv_dev(device);
2379
2380 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2381}
2382
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002383ICD_EXPORT void VKAPI vkDestroyRenderPass(
Tony Barbourde4124d2015-07-03 10:33:54 -06002384 VkDevice device,
2385 VkRenderPass renderPass)
2386{
2387 NULLDRV_LOG_FUNC;
2388 return VK_SUCCESS;
2389}
2390
Courtney Goeltzenleuchtera375b622015-07-27 14:04:01 -06002391ICD_EXPORT void VKAPI vkCmdPushConstants(
2392 VkCmdBuffer cmdBuffer,
2393 VkPipelineLayout layout,
2394 VkShaderStageFlags stageFlags,
2395 uint32_t start,
2396 uint32_t length,
2397 const void* values)
2398{
2399 /* TODO: Implement */
2400}
2401
Courtney Goeltzenleuchter07fe0662015-07-27 13:47:08 -06002402ICD_EXPORT VkResult VKAPI vkGetRenderAreaGranularity(
2403 VkDevice device,
2404 VkRenderPass renderPass,
2405 VkExtent2D* pGranularity)
2406{
2407 pGranularity->height = 1;
2408 pGranularity->width = 1;
2409
2410 return VK_SUCCESS;
2411}
2412
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002413ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Chia-I Wuc278df82015-07-07 11:50:03 +08002414 VkCmdBuffer cmdBuffer,
2415 const VkRenderPassBeginInfo* pRenderPassBegin,
2416 VkRenderPassContents contents)
2417{
2418 NULLDRV_LOG_FUNC;
2419}
2420
2421ICD_EXPORT void VKAPI vkCmdNextSubpass(
2422 VkCmdBuffer cmdBuffer,
2423 VkRenderPassContents contents)
David Pinedo0257fbf2015-02-02 18:02:40 -07002424{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002425 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002426}
2427
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002428ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002429 VkCmdBuffer cmdBuffer)
2430{
2431 NULLDRV_LOG_FUNC;
2432}
2433
2434ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2435 VkCmdBuffer cmdBuffer,
2436 uint32_t cmdBuffersCount,
2437 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002438{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002439 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002440}
Ian Elliottf93069f2015-02-19 14:26:19 -07002441
2442ICD_EXPORT void* xcbCreateWindow(
2443 uint16_t width,
2444 uint16_t height)
2445{
2446 static uint32_t window; // Kludge to the max
2447 NULLDRV_LOG_FUNC;
2448 return &window;
2449}
2450
2451// May not be needed, if we stub out stuf in tri.c
2452ICD_EXPORT void xcbDestroyWindow()
2453{
2454 NULLDRV_LOG_FUNC;
2455}
2456
2457ICD_EXPORT int xcbGetMessage(void *msg)
2458{
2459 NULLDRV_LOG_FUNC;
2460 return 0;
2461}
2462
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002463ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002464{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002465 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002466}
David Pinedo07494fd2015-07-24 10:54:41 -06002467
2468ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceImageFormatProperties(
2469 VkPhysicalDevice physicalDevice,
2470 VkFormat format,
2471 VkImageType type,
2472 VkImageTiling tiling,
2473 VkImageUsageFlags usage,
2474 VkImageFormatProperties* pImageFormatProperties)
2475{
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002476 return VK_ERROR_INITIALIZATION_FAILED;
David Pinedo07494fd2015-07-24 10:54:41 -06002477}