blob: 2f4713734f55305aa74c6863f1b38608ea958a26 [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)
205 return VK_ERROR_INVALID_EXTENSION;
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(
1059 VkCmdBuffer cmdBuffer,
1060 VkImage image,
1061 VkImageLayout imageLayout,
1062 float depth,
1063 uint32_t stencil,
1064 uint32_t rangeCount,
1065 const VkImageSubresourceRange* pRanges)
1066{
1067 NULLDRV_LOG_FUNC;
1068}
1069
1070ICD_EXPORT void VKAPI vkCmdClearColorAttachment(
1071 VkCmdBuffer cmdBuffer,
1072 uint32_t colorAttachment,
1073 VkImageLayout imageLayout,
1074 const VkClearColorValue *pColor,
1075 uint32_t rectCount,
1076 const VkRect3D *pRects)
1077{
1078 NULLDRV_LOG_FUNC;
1079}
1080
1081ICD_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(
1082 VkCmdBuffer cmdBuffer,
1083 VkImageAspectFlags imageAspectMask,
1084 VkImageLayout imageLayout,
1085 float depth,
1086 uint32_t stencil,
1087 uint32_t rectCount,
1088 const VkRect3D *pRects)
1089{
1090 NULLDRV_LOG_FUNC;
1091}
1092
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001093ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001094 VkCmdBuffer cmdBuffer,
1095 VkImage image,
1096 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +12001097 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001098 uint32_t rangeCount,
1099 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001100{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001101 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001102}
1103
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001104ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001105 VkCmdBuffer cmdBuffer,
1106 VkImage image,
1107 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001108 float depth,
1109 uint32_t stencil,
1110 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001111 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001112{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001113 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001114}
1115
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001116ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001117 VkCmdBuffer cmdBuffer,
1118 VkImage srcImage,
1119 VkImageLayout srcImageLayout,
1120 VkImage destImage,
1121 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001122 uint32_t regionCount,
1123 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001124{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001125 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001126}
1127
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001128ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001129 VkCmdBuffer cmdBuffer,
1130 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001131 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001132 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001133{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001134 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001135}
1136
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001137ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001138 VkCmdBuffer cmdBuffer,
1139 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001140 uint32_t slot)
1141{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001142 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001143}
1144
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001145ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001146 VkCmdBuffer cmdBuffer,
1147 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001148 uint32_t startQuery,
1149 uint32_t queryCount)
1150{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001151 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001152}
1153
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001154ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001155 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001156 VkEvent event_,
1157 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001158{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001159 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001160}
1161
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001162ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001163 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001164 VkEvent event_,
1165 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001166{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001167 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001168}
1169
Ian Elliott63f1edb2015-04-16 18:10:19 -06001170ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1171 VkCmdBuffer cmdBuffer,
1172 VkQueryPool queryPool,
1173 uint32_t startQuery,
1174 uint32_t queryCount,
1175 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001176 VkDeviceSize destOffset,
1177 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001178 VkFlags flags)
1179{
1180 NULLDRV_LOG_FUNC;
1181}
1182
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001183ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001184 VkCmdBuffer cmdBuffer,
1185 VkTimestampType timestampType,
1186 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001187 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001188{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001189 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001190}
1191
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001192ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001193 VkCmdBuffer cmdBuffer,
Tony Barbourde4124d2015-07-03 10:33:54 -06001194 VkPipelineBindPoint pipelineBindPoint,
1195 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001196{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001197 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001198}
1199
Tony Barbourde4124d2015-07-03 10:33:54 -06001200ICD_EXPORT void VKAPI vkCmdBindDynamicViewportState(
1201 VkCmdBuffer cmdBuffer,
1202 VkDynamicViewportState state)
1203{
1204 NULLDRV_LOG_FUNC;
1205}
1206
Cody Northrope4bc6942015-08-26 10:01:32 -06001207ICD_EXPORT void VKAPI vkCmdBindDynamicLineWidthState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001208 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001209 VkDynamicLineWidthState state)
Cody Northropf5bd2252015-08-17 11:10:49 -06001210{
1211 NULLDRV_LOG_FUNC;
1212}
1213
Cody Northrope4bc6942015-08-26 10:01:32 -06001214ICD_EXPORT void VKAPI vkCmdBindDynamicDepthBiasState(
Cody Northropf5bd2252015-08-17 11:10:49 -06001215 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001216 VkDynamicDepthBiasState state)
Tony Barbourde4124d2015-07-03 10:33:54 -06001217{
1218 NULLDRV_LOG_FUNC;
1219}
1220
Cody Northrope4bc6942015-08-26 10:01:32 -06001221ICD_EXPORT void VKAPI vkCmdBindDynamicBlendState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001222 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001223 VkDynamicBlendState state)
Tony Barbourde4124d2015-07-03 10:33:54 -06001224{
1225 NULLDRV_LOG_FUNC;
1226}
1227
Cody Northrope4bc6942015-08-26 10:01:32 -06001228ICD_EXPORT void VKAPI vkCmdBindDynamicDepthBoundsState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001229 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001230 VkDynamicDepthBoundsState state)
Cody Northrop2605cb02015-08-18 15:21:16 -06001231{
1232 NULLDRV_LOG_FUNC;
1233}
1234
1235ICD_EXPORT void VKAPI vkCmdBindDynamicStencilState(
1236 VkCmdBuffer cmdBuffer,
1237 VkDynamicStencilState state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001238{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001239 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001240}
1241
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001242ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001243 VkCmdBuffer cmdBuffer,
1244 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001245 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001246 uint32_t firstSet,
1247 uint32_t setCount,
1248 const VkDescriptorSet* pDescriptorSets,
1249 uint32_t dynamicOffsetCount,
1250 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001251{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001252 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001253}
1254
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001255ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1256 VkCmdBuffer cmdBuffer,
1257 uint32_t startBinding,
1258 uint32_t bindingCount,
1259 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001260 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001261{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001262 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001263}
1264
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001265ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001266 VkCmdBuffer cmdBuffer,
1267 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001268 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001269 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001270{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001271 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001272}
1273
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001274ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001275 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001276 uint32_t firstVertex,
1277 uint32_t vertexCount,
1278 uint32_t firstInstance,
1279 uint32_t instanceCount)
1280{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001281 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001282}
1283
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001284ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001285 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001286 uint32_t firstIndex,
1287 uint32_t indexCount,
1288 int32_t vertexOffset,
1289 uint32_t firstInstance,
1290 uint32_t instanceCount)
1291{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001292 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001293}
1294
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001295ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001296 VkCmdBuffer cmdBuffer,
1297 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001298 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001299 uint32_t count,
1300 uint32_t stride)
1301{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001302 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001303}
1304
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001305ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001306 VkCmdBuffer cmdBuffer,
1307 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001308 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001309 uint32_t count,
1310 uint32_t stride)
1311{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001312 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001313}
1314
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001315ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001316 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001317 uint32_t x,
1318 uint32_t y,
1319 uint32_t z)
1320{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001321 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001322}
1323
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001324ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001325 VkCmdBuffer cmdBuffer,
1326 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001327 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001328{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001329 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001330}
1331
Tony Barbour8205d902015-04-16 15:59:00 -06001332void VKAPI vkCmdWaitEvents(
1333 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001334 uint32_t eventCount,
1335 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001336 VkPipelineStageFlags sourceStageMask,
1337 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001338 uint32_t memBarrierCount,
Courtney Goeltzenleuchterd9ba3422015-07-12 12:58:58 -06001339 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001340{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001341 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001342}
1343
Tony Barbour8205d902015-04-16 15:59:00 -06001344void VKAPI vkCmdPipelineBarrier(
1345 VkCmdBuffer cmdBuffer,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001346 VkPipelineStageFlags srcStageMask,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001347 VkPipelineStageFlags destStageMask,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001348 VkBool32 byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001349 uint32_t memBarrierCount,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001350 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001351{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001352 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001353}
1354
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001355ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001356 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001357 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001358 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001359{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001360 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001361 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1362 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1363}
1364
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001365ICD_EXPORT void VKAPI vkDestroyDevice(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001366 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001367{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001368 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001369 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001370}
1371
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001372ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1373 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001374 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001375 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001376 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001377{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001378 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001379 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001380 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001381 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001382}
1383
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001384ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1385 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001386{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001387 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001388 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001389}
1390
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001391ICD_EXPORT VkResult VKAPI vkCreateEvent(
1392 VkDevice device,
1393 const VkEventCreateInfo* pCreateInfo,
1394 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001395{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001396 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001397 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001398}
1399
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001400ICD_EXPORT void VKAPI vkDestroyEvent(
Tony Barbourde4124d2015-07-03 10:33:54 -06001401 VkDevice device,
1402 VkEvent event)
1403{
1404 NULLDRV_LOG_FUNC;
1405 return VK_SUCCESS;
1406}
1407
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001408ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001409 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001410 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001411{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001412 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001413 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001414}
1415
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001416ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001417 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001418 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001419{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001420 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001421 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001422}
1423
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001424ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001425 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001426 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001427{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001428 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001429 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001430}
1431
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001432ICD_EXPORT VkResult VKAPI vkCreateFence(
1433 VkDevice device,
1434 const VkFenceCreateInfo* pCreateInfo,
1435 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001436{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001437 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001438 struct nulldrv_dev *dev = nulldrv_dev(device);
1439
1440 return nulldrv_fence_create(dev, pCreateInfo,
1441 (struct nulldrv_fence **) pFence);
1442}
1443
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001444ICD_EXPORT void VKAPI vkDestroyFence(
Tony Barbourde4124d2015-07-03 10:33:54 -06001445 VkDevice device,
1446 VkFence fence)
1447{
1448 NULLDRV_LOG_FUNC;
1449 return VK_SUCCESS;
1450}
1451
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001452ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001453 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001454 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001455{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001456 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001457 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001458}
1459
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001460ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001461 VkDevice device,
1462 uint32_t fenceCount,
1463 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001464{
1465 NULLDRV_LOG_FUNC;
1466 return VK_SUCCESS;
1467}
1468
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001469ICD_EXPORT VkResult VKAPI vkWaitForFences(
1470 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001471 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001472 const VkFence* pFences,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001473 VkBool32 waitAll,
David Pinedo0257fbf2015-02-02 18:02:40 -07001474 uint64_t timeout)
1475{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001476 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001477 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001478}
1479
Tony Barbour426b9052015-06-24 16:06:58 -06001480ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1481 VkPhysicalDevice gpu_,
1482 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001483{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001484 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001485 VkResult ret = VK_SUCCESS;
1486
Tony Barbour426b9052015-06-24 16:06:58 -06001487 pProperties->apiVersion = VK_API_VERSION;
1488 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1489 pProperties->vendorId = 0;
1490 pProperties->deviceId = 0;
1491 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1492 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001493
Mark Lobodzinski7dae6862015-09-07 12:56:17 -06001494 /* TODO: fill out limits */
1495 memset(&pProperties->limits, 0, sizeof(VkPhysicalDeviceLimits));
1496 memset(&pProperties->sparseProperties, 0, sizeof(VkPhysicalDeviceSparseProperties));
Ian Elliott64a68e12015-04-16 11:57:46 -06001497 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001498}
1499
Chris Forbesd7576302015-06-21 22:55:02 +12001500ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1501 VkPhysicalDevice physicalDevice,
1502 VkPhysicalDeviceFeatures* pFeatures)
1503{
1504 NULLDRV_LOG_FUNC;
1505 VkResult ret = VK_SUCCESS;
1506
1507 /* TODO: fill out features */
1508 memset(pFeatures, 0, sizeof(*pFeatures));
1509
1510 return ret;
1511}
1512
Courtney Goeltzenleuchter4da96aa2015-07-12 12:52:09 -06001513ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatProperties(
Chris Forbesd7576302015-06-21 22:55:02 +12001514 VkPhysicalDevice physicalDevice,
1515 VkFormat format,
1516 VkFormatProperties* pFormatInfo)
1517{
1518 NULLDRV_LOG_FUNC;
1519 VkResult ret = VK_SUCCESS;
1520
1521 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1522 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
Mark Lobodzinski4b36dd42015-09-03 15:21:52 -06001523 pFormatInfo->bufferFeatures = 0;
Chris Forbesd7576302015-06-21 22:55:02 +12001524
1525 return ret;
1526}
1527
Cody Northropef72e2a2015-08-03 17:04:53 -06001528ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueFamilyProperties(
Tony Barbour426b9052015-06-24 16:06:58 -06001529 VkPhysicalDevice gpu_,
Cody Northropef72e2a2015-08-03 17:04:53 -06001530 uint32_t* pCount,
1531 VkQueueFamilyProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001532 {
Cody Northropef72e2a2015-08-03 17:04:53 -06001533 if (pProperties == NULL) {
1534 *pCount = 1;
1535 return VK_SUCCESS;
1536 }
Tony Barbour426b9052015-06-24 16:06:58 -06001537 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1538 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001539 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001540
Tony Barbour426b9052015-06-24 16:06:58 -06001541 return VK_SUCCESS;
1542}
1543
Ian Elliotte924ab22015-07-08 13:24:30 -06001544ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(
1545 VkPhysicalDevice gpu_,
1546 VkPhysicalDeviceMemoryProperties* pProperties)
1547{
1548 // TODO: Fill in with real data
1549 return VK_SUCCESS;
1550}
1551
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001552ICD_EXPORT VkResult VKAPI vkEnumerateDeviceLayerProperties(
Ian Elliotte924ab22015-07-08 13:24:30 -06001553 VkPhysicalDevice physicalDevice,
1554 uint32_t* pCount,
1555 VkLayerProperties* pProperties)
1556{
1557 // TODO: Fill in with real data
1558 return VK_SUCCESS;
1559}
1560
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001561ICD_EXPORT VkResult VKAPI vkEnumerateInstanceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001562 const char* pLayerName,
1563 uint32_t* pCount,
1564 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001565{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001566 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001567
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001568 if (pProperties == NULL) {
1569 *pCount = NULLDRV_EXT_COUNT;
1570 return VK_SUCCESS;
1571 }
Tony Barbour426b9052015-06-24 16:06:58 -06001572
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001573 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1574 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1575 *pCount = copy_size;
1576 if (copy_size < NULLDRV_EXT_COUNT) {
1577 return VK_INCOMPLETE;
1578 }
Tony Barbour426b9052015-06-24 16:06:58 -06001579 return VK_SUCCESS;
1580}
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001581ICD_EXPORT VkResult VKAPI vkEnumerateInstanceLayerProperties(
Ian Elliotte924ab22015-07-08 13:24:30 -06001582 uint32_t* pCount,
1583 VkLayerProperties* pProperties)
1584{
1585 // TODO: Fill in with real data
1586 return VK_SUCCESS;
1587}
Tony Barbour426b9052015-06-24 16:06:58 -06001588
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001589VkResult VKAPI vkEnumerateDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001590 VkPhysicalDevice physicalDevice,
1591 const char* pLayerName,
1592 uint32_t* pCount,
1593 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001594{
Tony Barbour426b9052015-06-24 16:06:58 -06001595
Tony Barbour426b9052015-06-24 16:06:58 -06001596 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001597
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001598 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001599}
1600
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001601ICD_EXPORT VkResult VKAPI vkCreateImage(
1602 VkDevice device,
1603 const VkImageCreateInfo* pCreateInfo,
1604 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001605{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001606 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001607 struct nulldrv_dev *dev = nulldrv_dev(device);
1608
1609 return nulldrv_img_create(dev, pCreateInfo, false,
1610 (struct nulldrv_img **) pImage);
1611}
1612
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001613ICD_EXPORT void VKAPI vkDestroyImage(
Tony Barbourde4124d2015-07-03 10:33:54 -06001614 VkDevice device,
1615 VkImage image)
1616{
1617 NULLDRV_LOG_FUNC;
1618 return VK_SUCCESS;
1619}
1620
Tony Barbour426b9052015-06-24 16:06:58 -06001621ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001622 VkDevice device,
1623 VkImage image,
1624 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001625 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001626{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001627 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001628
Tony Barbour426b9052015-06-24 16:06:58 -06001629 pLayout->offset = 0;
1630 pLayout->size = 1;
1631 pLayout->rowPitch = 4;
1632 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001633
Tony Barbour426b9052015-06-24 16:06:58 -06001634 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001635}
1636
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001637ICD_EXPORT VkResult VKAPI vkAllocMemory(
1638 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001639 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001640 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001641{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001642 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001643 struct nulldrv_dev *dev = nulldrv_dev(device);
1644
1645 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1646}
1647
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001648ICD_EXPORT void VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001649 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001650 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001651{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001652 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001653 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001654}
1655
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001656ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001657 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001658 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001659 VkDeviceSize offset,
1660 VkDeviceSize size,
1661 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001662 void** ppData)
1663{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001664 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001665 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1666 void *ptr = nulldrv_mem_map(mem, flags);
1667
1668 *ppData = ptr;
1669
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001670 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001671}
1672
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001673ICD_EXPORT void VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001674 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001675 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001676{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001677 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001678 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001679}
1680
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001681ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001682 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001683 uint32_t memRangeCount,
1684 const VkMappedMemoryRange* pMemRanges)
1685{
1686 NULLDRV_LOG_FUNC;
1687 return VK_SUCCESS;
1688}
1689
1690ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1691 VkDevice device,
1692 uint32_t memRangeCount,
1693 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001694{
1695 NULLDRV_LOG_FUNC;
1696 return VK_SUCCESS;
1697}
1698
Courtney Goeltzenleuchterd040c5c2015-07-09 21:57:28 -06001699ICD_EXPORT VkResult VKAPI vkGetDeviceMemoryCommitment(
1700 VkDevice device,
1701 VkDeviceMemory memory,
1702 VkDeviceSize* pCommittedMemoryInBytes)
1703{
1704 return VK_SUCCESS;
1705}
1706
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001707ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001708 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001709 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001710{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001711 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001712 struct nulldrv_instance *inst;
1713
1714 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001715 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001716 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001717 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001718
Tony Barbour426b9052015-06-24 16:06:58 -06001719 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001720
Mike Stroyan230e6252015-04-17 12:36:38 -06001721 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001722
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001723 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001724}
1725
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001726ICD_EXPORT void VKAPI vkDestroyInstance(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001727 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001728{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001729 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001730 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001731}
1732
Tony Barbour8205d902015-04-16 15:59:00 -06001733ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001734 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001735 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001736 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001737{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001738 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001739 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001740 struct nulldrv_gpu *gpu;
1741 *pGpuCount = 1;
1742 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001743 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001744 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001745 return ret;
1746}
1747
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001748ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001749 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001750 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001751 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001752 char* const* pOutLayers,
1753 void* pReserved)
1754{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001755 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001756 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001757}
1758
Tony Barbourde4124d2015-07-03 10:33:54 -06001759ICD_EXPORT VkResult VKAPI vkGetBufferMemoryRequirements(
1760 VkDevice device,
1761 VkBuffer buffer,
1762 VkMemoryRequirements* pMemoryRequirements)
1763{
1764 NULLDRV_LOG_FUNC;
1765 struct nulldrv_base *base = nulldrv_base((void*)buffer.handle);
1766
1767 return base->get_memory_requirements(base, pMemoryRequirements);
1768}
1769
1770ICD_EXPORT VkResult VKAPI vkGetImageMemoryRequirements(
1771 VkDevice device,
1772 VkImage image,
1773 VkMemoryRequirements* pMemoryRequirements)
1774{
1775 NULLDRV_LOG_FUNC;
1776 struct nulldrv_base *base = nulldrv_base((void*)image.handle);
1777
1778 return base->get_memory_requirements(base, pMemoryRequirements);
1779}
1780
1781ICD_EXPORT VkResult VKAPI vkBindBufferMemory(
1782 VkDevice device,
1783 VkBuffer buffer,
1784 VkDeviceMemory mem_,
1785 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001786{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001787 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001788 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001789}
1790
Tony Barbourde4124d2015-07-03 10:33:54 -06001791ICD_EXPORT VkResult VKAPI vkBindImageMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001792 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06001793 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001794 VkDeviceMemory mem_,
1795 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001796{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001797 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001798 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001799}
1800
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001801ICD_EXPORT VkResult VKAPI vkGetImageSparseMemoryRequirements(
1802 VkDevice device,
1803 VkImage image,
1804 uint32_t* pNumRequirements,
1805 VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
1806{
1807 NULLDRV_LOG_FUNC;
1808 return VK_SUCCESS;
1809}
1810
1811ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(
1812 VkPhysicalDevice physicalDevice,
1813 VkFormat format,
1814 VkImageType type,
1815 uint32_t samples,
1816 VkImageUsageFlags usage,
1817 VkImageTiling tiling,
1818 uint32_t* pNumProperties,
1819 VkSparseImageFormatProperties* pProperties)
1820{
1821 NULLDRV_LOG_FUNC;
1822 return VK_SUCCESS;
1823}
1824
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001825ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001826 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001827 VkBuffer buffer,
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001828 uint32_t numBindings,
1829 const VkSparseMemoryBindInfo* pBindInfo)
1830{
1831 NULLDRV_LOG_FUNC;
1832 return VK_SUCCESS;
1833}
1834
1835ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageOpaqueMemory(
1836 VkQueue queue,
1837 VkImage image,
1838 uint32_t numBindings,
1839 const VkSparseMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001840{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001841 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001842 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001843}
1844
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001845ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001846 VkQueue queue,
1847 VkImage image,
1848 uint32_t numBindings,
1849 const VkSparseImageMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001850{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001851 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001852 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001853}
Jon Ashburn0e249962015-07-10 09:41:15 -07001854ICD_EXPORT VkResult VKAPI vkCreatePipelineCache(
1855 VkDevice device,
1856 const VkPipelineCacheCreateInfo* pCreateInfo,
1857 VkPipelineCache* pPipelineCache)
1858{
David Pinedo0257fbf2015-02-02 18:02:40 -07001859
Jon Ashburn0e249962015-07-10 09:41:15 -07001860 NULLDRV_LOG_FUNC;
1861 return VK_SUCCESS;
1862}
1863
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001864ICD_EXPORT void VKAPI vkDestroyPipeline(
Tony Barbourde4124d2015-07-03 10:33:54 -06001865 VkDevice device,
1866 VkPipeline pipeline)
1867{
1868 NULLDRV_LOG_FUNC;
1869 return VK_SUCCESS;
1870}
1871
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001872void VKAPI vkDestroyPipelineCache(
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06001873 VkDevice device,
1874 VkPipelineCache pipelineCache)
Jon Ashburn0e249962015-07-10 09:41:15 -07001875{
1876 NULLDRV_LOG_FUNC;
1877 return VK_SUCCESS;
1878}
1879
1880ICD_EXPORT size_t VKAPI vkGetPipelineCacheSize(
1881 VkDevice device,
1882 VkPipelineCache pipelineCache)
1883{
1884 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06001885 return 0;
Jon Ashburn0e249962015-07-10 09:41:15 -07001886}
1887
1888ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
1889 VkDevice device,
1890 VkPipelineCache pipelineCache,
1891 void* pData)
1892{
1893 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06001894 return VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn0e249962015-07-10 09:41:15 -07001895}
1896
1897ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
1898 VkDevice device,
1899 VkPipelineCache destCache,
1900 uint32_t srcCacheCount,
1901 const VkPipelineCache* pSrcCaches)
1902{
1903 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06001904 return VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn0e249962015-07-10 09:41:15 -07001905}
1906ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001907 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001908 VkPipelineCache pipelineCache,
1909 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001910 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1911 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001912{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001913 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001914 struct nulldrv_dev *dev = nulldrv_dev(device);
1915
1916 return graphics_pipeline_create(dev, pCreateInfo,
1917 (struct nulldrv_pipeline **) pPipeline);
1918}
1919
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001920
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001921
Jon Ashburn0e249962015-07-10 09:41:15 -07001922ICD_EXPORT VkResult VKAPI vkCreateComputePipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001923 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001924 VkPipelineCache pipelineCache,
1925 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001926 const VkComputePipelineCreateInfo* pCreateInfo,
1927 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001928{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001929 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001930 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001931}
1932
David Pinedo0257fbf2015-02-02 18:02:40 -07001933
David Pinedo0257fbf2015-02-02 18:02:40 -07001934
Jon Ashburn0e249962015-07-10 09:41:15 -07001935
David Pinedo0257fbf2015-02-02 18:02:40 -07001936
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001937ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1938 VkDevice device,
1939 const VkQueryPoolCreateInfo* pCreateInfo,
1940 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001941{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001942 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001943 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001944}
1945
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001946ICD_EXPORT void VKAPI vkDestroyQueryPool(
Tony Barbourde4124d2015-07-03 10:33:54 -06001947 VkDevice device,
1948 VkQueryPool queryPoool)
1949{
1950 NULLDRV_LOG_FUNC;
1951 return VK_SUCCESS;
1952}
1953
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001954ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001955 VkDevice device,
1956 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001957 uint32_t startQuery,
1958 uint32_t queryCount,
1959 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001960 void* pData,
1961 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001962{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001963 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001964 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001965}
1966
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001967ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1968 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001969{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001970 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001971 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001972}
1973
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001974ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1975 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001976 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001977 const VkCmdBuffer* pCmdBuffers,
1978 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001979{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001980 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001981 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001982}
1983
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001984ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1985 VkDevice device,
1986 const VkSemaphoreCreateInfo* pCreateInfo,
1987 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001988{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001989 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001990 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001991}
1992
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001993ICD_EXPORT void VKAPI vkDestroySemaphore(
Tony Barbourde4124d2015-07-03 10:33:54 -06001994 VkDevice device,
1995 VkSemaphore semaphore)
1996{
1997 NULLDRV_LOG_FUNC;
1998 return VK_SUCCESS;
1999}
2000
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002001ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
2002 VkQueue queue,
2003 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002004{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002005 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002006 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002007}
2008
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002009ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
2010 VkQueue queue,
2011 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002012{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002013 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002014 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002015}
2016
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002017ICD_EXPORT VkResult VKAPI vkCreateSampler(
2018 VkDevice device,
2019 const VkSamplerCreateInfo* pCreateInfo,
2020 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07002021{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002022 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002023 struct nulldrv_dev *dev = nulldrv_dev(device);
2024
2025 return nulldrv_sampler_create(dev, pCreateInfo,
2026 (struct nulldrv_sampler **) pSampler);
2027}
2028
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002029ICD_EXPORT void VKAPI vkDestroySampler(
Tony Barbourde4124d2015-07-03 10:33:54 -06002030 VkDevice device,
2031 VkSampler sampler)
2032{
2033 NULLDRV_LOG_FUNC;
2034 return VK_SUCCESS;
2035}
2036
Ian Elliotte924ab22015-07-08 13:24:30 -06002037ICD_EXPORT VkResult VKAPI vkCreateShaderModule(
2038 VkDevice device,
2039 const VkShaderModuleCreateInfo* pCreateInfo,
2040 VkShaderModule* pShaderModule)
2041{
2042 // TODO: Fill in with real data
Tony Barbourde4124d2015-07-03 10:33:54 -06002043 NULLDRV_LOG_FUNC;
2044 return VK_SUCCESS;
2045}
2046
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002047ICD_EXPORT void VKAPI vkDestroyShaderModule(
Tony Barbourde4124d2015-07-03 10:33:54 -06002048 VkDevice device,
2049 VkShaderModule shaderModule)
2050{
2051 // TODO: Fill in with real data
2052 NULLDRV_LOG_FUNC;
Ian Elliotte924ab22015-07-08 13:24:30 -06002053 return VK_SUCCESS;
2054}
2055
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002056ICD_EXPORT VkResult VKAPI vkCreateShader(
2057 VkDevice device,
2058 const VkShaderCreateInfo* pCreateInfo,
2059 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002060{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002061 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002062 struct nulldrv_dev *dev = nulldrv_dev(device);
2063
2064 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2065}
2066
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002067ICD_EXPORT void VKAPI vkDestroyShader(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002068 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002069 VkShader shader)
2070{
2071 NULLDRV_LOG_FUNC;
2072 return VK_SUCCESS;
2073}
2074
2075ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2076 VkDevice device,
2077 const VkDynamicViewportStateCreateInfo* pCreateInfo,
2078 VkDynamicViewportState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002079{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002080 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002081 struct nulldrv_dev *dev = nulldrv_dev(device);
2082
2083 return nulldrv_viewport_state_create(dev, pCreateInfo,
2084 (struct nulldrv_dynamic_vp **) pState);
2085}
2086
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002087ICD_EXPORT void VKAPI vkDestroyDynamicViewportState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002088 VkDevice device,
2089 VkDynamicViewportState dynamicViewportState)
2090{
2091 NULLDRV_LOG_FUNC;
2092 return VK_SUCCESS;
2093}
2094
Cody Northrope4bc6942015-08-26 10:01:32 -06002095ICD_EXPORT VkResult VKAPI vkCreateDynamicLineWidthState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002096 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002097 const VkDynamicLineWidthStateCreateInfo* pCreateInfo,
2098 VkDynamicLineWidthState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002099{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002100 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002101 struct nulldrv_dev *dev = nulldrv_dev(device);
2102
Cody Northrope4bc6942015-08-26 10:01:32 -06002103 return nulldrv_line_width_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002104 (struct nulldrv_dynamic_line_width **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002105}
2106
Cody Northrope4bc6942015-08-26 10:01:32 -06002107ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthBiasState(
Cody Northropf5bd2252015-08-17 11:10:49 -06002108 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002109 const VkDynamicDepthBiasStateCreateInfo* pCreateInfo,
2110 VkDynamicDepthBiasState* pState)
Cody Northropf5bd2252015-08-17 11:10:49 -06002111{
2112 NULLDRV_LOG_FUNC;
2113 struct nulldrv_dev *dev = nulldrv_dev(device);
2114
Cody Northrope4bc6942015-08-26 10:01:32 -06002115 return nulldrv_depth_bias_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002116 (struct nulldrv_dynamic_depth_bias **) pState);
Cody Northropf5bd2252015-08-17 11:10:49 -06002117}
2118
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002119ICD_EXPORT void VKAPI vkDestroyDynamicLineWidthState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002120 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002121 VkDynamicLineWidthState dynamicLineWidthState)
Cody Northropf5bd2252015-08-17 11:10:49 -06002122{
2123 NULLDRV_LOG_FUNC;
2124 return VK_SUCCESS;
2125}
2126
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002127ICD_EXPORT void VKAPI vkDestroyDynamicDepthBiasState(
Cody Northropf5bd2252015-08-17 11:10:49 -06002128 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002129 VkDynamicDepthBiasState dynamicDepthBiasState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002130{
2131 NULLDRV_LOG_FUNC;
2132 return VK_SUCCESS;
2133}
2134
Cody Northrope4bc6942015-08-26 10:01:32 -06002135ICD_EXPORT VkResult VKAPI vkCreateDynamicBlendState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002136 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002137 const VkDynamicBlendStateCreateInfo* pCreateInfo,
2138 VkDynamicBlendState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002139{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002140 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002141 struct nulldrv_dev *dev = nulldrv_dev(device);
2142
2143 return nulldrv_blend_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002144 (struct nulldrv_dynamic_blend **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002145}
2146
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002147ICD_EXPORT void VKAPI vkDestroyDynamicBlendState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002148 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002149 VkDynamicBlendState dynamicBlendState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002150{
2151 NULLDRV_LOG_FUNC;
2152 return VK_SUCCESS;
2153}
2154
Cody Northrope4bc6942015-08-26 10:01:32 -06002155ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthBoundsState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002156 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002157 const VkDynamicDepthBoundsStateCreateInfo* pCreateInfo,
2158 VkDynamicDepthBoundsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002159{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002160 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002161 struct nulldrv_dev *dev = nulldrv_dev(device);
2162
Cody Northrope4bc6942015-08-26 10:01:32 -06002163 return nulldrv_depth_bounds_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002164 (struct nulldrv_dynamic_depth_bounds **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002165}
2166
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002167ICD_EXPORT void VKAPI vkDestroyDynamicDepthBoundsState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002168 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002169 VkDynamicDepthBoundsState dynamicDepthBoundsState)
Cody Northrop2605cb02015-08-18 15:21:16 -06002170{
2171 NULLDRV_LOG_FUNC;
2172 return VK_SUCCESS;
2173}
2174
2175ICD_EXPORT VkResult VKAPI vkCreateDynamicStencilState(
2176 VkDevice device,
2177 const VkDynamicStencilStateCreateInfo* pCreateInfoFront,
2178 const VkDynamicStencilStateCreateInfo* pCreateInfoBack,
2179 VkDynamicStencilState* pState)
2180{
2181 NULLDRV_LOG_FUNC;
2182 struct nulldrv_dev *dev = nulldrv_dev(device);
2183
2184 return nulldrv_stencil_state_create(dev, pCreateInfoFront, pCreateInfoBack,
2185 (struct nulldrv_dynamic_stencil **) pState);
2186}
2187
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002188ICD_EXPORT void VKAPI vkDestroyDynamicStencilState(
Cody Northrop2605cb02015-08-18 15:21:16 -06002189 VkDevice device,
2190 VkDynamicStencilState dynamicStencilState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002191{
2192 NULLDRV_LOG_FUNC;
2193 return VK_SUCCESS;
2194}
2195
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002196ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2197 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002198 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002199 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002200{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002201 NULLDRV_LOG_FUNC;
2202 struct nulldrv_dev *dev = nulldrv_dev(device);
2203
2204 return nulldrv_buf_view_create(dev, pCreateInfo,
2205 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002206}
2207
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002208ICD_EXPORT void VKAPI vkDestroyBufferView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002209 VkDevice device,
2210 VkBufferView bufferView)
2211{
2212 NULLDRV_LOG_FUNC;
2213 return VK_SUCCESS;
2214}
2215
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002216ICD_EXPORT VkResult VKAPI vkCreateImageView(
2217 VkDevice device,
2218 const VkImageViewCreateInfo* pCreateInfo,
2219 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002220{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002221 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002222 struct nulldrv_dev *dev = nulldrv_dev(device);
2223
2224 return nulldrv_img_view_create(dev, pCreateInfo,
2225 (struct nulldrv_img_view **) pView);
2226}
2227
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002228ICD_EXPORT void VKAPI vkDestroyImageView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002229 VkDevice device,
2230 VkImageView imageView)
2231{
2232 NULLDRV_LOG_FUNC;
2233 return VK_SUCCESS;
2234}
2235
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002236ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2237 VkDevice device,
2238 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2239 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002240{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002241 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002242 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002243
Chia-I Wu7732cb22015-03-26 15:27:55 +08002244 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002245 (struct nulldrv_desc_layout **) pSetLayout);
2246}
2247
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002248ICD_EXPORT void VKAPI vkDestroyDescriptorSetLayout(
Tony Barbourde4124d2015-07-03 10:33:54 -06002249 VkDevice device,
2250 VkDescriptorSetLayout descriptorSetLayout)
2251{
2252 NULLDRV_LOG_FUNC;
2253 return VK_SUCCESS;
2254}
2255
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002256ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2257 VkDevice device,
2258 const VkPipelineLayoutCreateInfo* pCreateInfo,
2259 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002260{
2261 NULLDRV_LOG_FUNC;
2262 struct nulldrv_dev *dev = nulldrv_dev(device);
2263
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002264 return nulldrv_pipeline_layout_create(dev,
2265 pCreateInfo,
2266 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002267}
2268
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002269ICD_EXPORT void VKAPI vkDestroyPipelineLayout(
Tony Barbourde4124d2015-07-03 10:33:54 -06002270 VkDevice device,
2271 VkPipelineLayout pipelineLayout)
2272{
2273 NULLDRV_LOG_FUNC;
2274 return VK_SUCCESS;
2275}
2276
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002277ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2278 VkDevice device,
2279 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002280 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002281 const VkDescriptorPoolCreateInfo* pCreateInfo,
2282 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002283{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002284 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002285 struct nulldrv_dev *dev = nulldrv_dev(device);
2286
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002287 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2288 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002289}
2290
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002291ICD_EXPORT void VKAPI vkDestroyDescriptorPool(
Tony Barbourde4124d2015-07-03 10:33:54 -06002292 VkDevice device,
2293 VkDescriptorPool descriptorPool)
2294{
2295 NULLDRV_LOG_FUNC;
2296 return VK_SUCCESS;
2297}
2298
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002299ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002300 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002301 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002302{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002303 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002304 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002305}
2306
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002307ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002308 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002309 VkDescriptorPool descriptorPool,
2310 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002311 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002312 const VkDescriptorSetLayout* pSetLayouts,
Cody Northropc8aa4a52015-08-03 12:47:29 -06002313 VkDescriptorSet* pDescriptorSets)
David Pinedo0257fbf2015-02-02 18:02:40 -07002314{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002315 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002316 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2317 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002318 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002319 uint32_t i;
2320
2321 for (i = 0; i < count; i++) {
2322 const struct nulldrv_desc_layout *layout =
Tony Barbour8db65372015-07-10 18:32:33 -06002323 nulldrv_desc_layout(pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002324
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002325 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002326 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002327 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002328 break;
2329 }
2330
David Pinedo0257fbf2015-02-02 18:02:40 -07002331 return ret;
2332}
2333
Tony Barbourb857d312015-07-10 10:50:45 -06002334ICD_EXPORT VkResult VKAPI vkFreeDescriptorSets(
2335 VkDevice device,
2336 VkDescriptorPool descriptorPool,
2337 uint32_t count,
2338 const VkDescriptorSet* pDescriptorSets)
2339{
2340 NULLDRV_LOG_FUNC;
2341 return VK_SUCCESS;
2342}
2343
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002344ICD_EXPORT void VKAPI vkUpdateDescriptorSets(
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002345 VkDevice device,
2346 uint32_t writeCount,
2347 const VkWriteDescriptorSet* pDescriptorWrites,
2348 uint32_t copyCount,
2349 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002350{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002351 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002352 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002353}
2354
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002355ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2356 VkDevice device,
2357 const VkFramebufferCreateInfo* info,
2358 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002359{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002360 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002361 struct nulldrv_dev *dev = nulldrv_dev(device);
2362
2363 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2364}
2365
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002366ICD_EXPORT void VKAPI vkDestroyFramebuffer(
Tony Barbourde4124d2015-07-03 10:33:54 -06002367 VkDevice device,
2368 VkFramebuffer framebuffer)
2369{
2370 NULLDRV_LOG_FUNC;
2371 return VK_SUCCESS;
2372}
David Pinedo0257fbf2015-02-02 18:02:40 -07002373
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002374ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2375 VkDevice device,
2376 const VkRenderPassCreateInfo* info,
2377 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002378{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002379 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002380 struct nulldrv_dev *dev = nulldrv_dev(device);
2381
2382 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2383}
2384
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002385ICD_EXPORT void VKAPI vkDestroyRenderPass(
Tony Barbourde4124d2015-07-03 10:33:54 -06002386 VkDevice device,
2387 VkRenderPass renderPass)
2388{
2389 NULLDRV_LOG_FUNC;
2390 return VK_SUCCESS;
2391}
2392
Courtney Goeltzenleuchtera375b622015-07-27 14:04:01 -06002393ICD_EXPORT void VKAPI vkCmdPushConstants(
2394 VkCmdBuffer cmdBuffer,
2395 VkPipelineLayout layout,
2396 VkShaderStageFlags stageFlags,
2397 uint32_t start,
2398 uint32_t length,
2399 const void* values)
2400{
2401 /* TODO: Implement */
2402}
2403
Courtney Goeltzenleuchter07fe0662015-07-27 13:47:08 -06002404ICD_EXPORT VkResult VKAPI vkGetRenderAreaGranularity(
2405 VkDevice device,
2406 VkRenderPass renderPass,
2407 VkExtent2D* pGranularity)
2408{
2409 pGranularity->height = 1;
2410 pGranularity->width = 1;
2411
2412 return VK_SUCCESS;
2413}
2414
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002415ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Chia-I Wuc278df82015-07-07 11:50:03 +08002416 VkCmdBuffer cmdBuffer,
2417 const VkRenderPassBeginInfo* pRenderPassBegin,
2418 VkRenderPassContents contents)
2419{
2420 NULLDRV_LOG_FUNC;
2421}
2422
2423ICD_EXPORT void VKAPI vkCmdNextSubpass(
2424 VkCmdBuffer cmdBuffer,
2425 VkRenderPassContents contents)
David Pinedo0257fbf2015-02-02 18:02:40 -07002426{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002427 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002428}
2429
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002430ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002431 VkCmdBuffer cmdBuffer)
2432{
2433 NULLDRV_LOG_FUNC;
2434}
2435
2436ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2437 VkCmdBuffer cmdBuffer,
2438 uint32_t cmdBuffersCount,
2439 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002440{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002441 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002442}
Ian Elliottf93069f2015-02-19 14:26:19 -07002443
2444ICD_EXPORT void* xcbCreateWindow(
2445 uint16_t width,
2446 uint16_t height)
2447{
2448 static uint32_t window; // Kludge to the max
2449 NULLDRV_LOG_FUNC;
2450 return &window;
2451}
2452
2453// May not be needed, if we stub out stuf in tri.c
2454ICD_EXPORT void xcbDestroyWindow()
2455{
2456 NULLDRV_LOG_FUNC;
2457}
2458
2459ICD_EXPORT int xcbGetMessage(void *msg)
2460{
2461 NULLDRV_LOG_FUNC;
2462 return 0;
2463}
2464
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002465ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002466{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002467 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002468}
David Pinedo07494fd2015-07-24 10:54:41 -06002469
2470ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceImageFormatProperties(
2471 VkPhysicalDevice physicalDevice,
2472 VkFormat format,
2473 VkImageType type,
2474 VkImageTiling tiling,
2475 VkImageUsageFlags usage,
2476 VkImageFormatProperties* pImageFormatProperties)
2477{
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002478 return VK_ERROR_INITIALIZATION_FAILED;
David Pinedo07494fd2015-07-24 10:54:41 -06002479}