blob: 539b7305787a4e030e58295cc07148cccd680f33 [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
134 if (!count)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600135 return VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700136
137 for (i = 0; i < count; i++) {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600138 const VkDeviceQueueCreateInfo *q = &queues[i];
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600139 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700140
Tony Barbour29b12062015-07-13 13:37:24 -0600141 if (q->queueCount == 1 && !dev->queues[q->queueFamilyIndex]) {
142 ret = nulldrv_queue_create(dev, q->queueFamilyIndex,
143 &dev->queues[q->queueFamilyIndex]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700144 }
145 else {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600146 ret = VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700147 }
148
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600149 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700150 return ret;
151 }
152 }
153
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600154 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700155}
156
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600157static enum nulldrv_ext_type nulldrv_gpu_lookup_extension(
158 const struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600159 const char* extName)
David Pinedo0257fbf2015-02-02 18:02:40 -0700160{
161 enum nulldrv_ext_type type;
162
163 for (type = 0; type < ARRAY_SIZE(nulldrv_gpu_exts); type++) {
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600164 if (strcmp(nulldrv_gpu_exts[type], extName) == 0)
David Pinedo0257fbf2015-02-02 18:02:40 -0700165 break;
166 }
167
168 assert(type < NULLDRV_EXT_COUNT || type == NULLDRV_EXT_INVALID);
169
170 return type;
171}
172
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600173static VkResult nulldrv_desc_ooxx_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800174 struct nulldrv_desc_ooxx **ooxx_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700175{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800176 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700177
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800178 ooxx = malloc(sizeof(*ooxx));
179 if (!ooxx)
Tony Barbour8205d902015-04-16 15:59:00 -0600180 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700181
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800182 memset(ooxx, 0, sizeof(*ooxx));
David Pinedo0257fbf2015-02-02 18:02:40 -0700183
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800184 ooxx->surface_desc_size = 0;
185 ooxx->sampler_desc_size = 0;
David Pinedo0257fbf2015-02-02 18:02:40 -0700186
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800187 *ooxx_ret = ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700188
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600189 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700190}
191
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600192static VkResult nulldrv_dev_create(struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600193 const VkDeviceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700194 struct nulldrv_dev **dev_ret)
195{
196 struct nulldrv_dev *dev;
197 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600198 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -0700199
200 dev = (struct nulldrv_dev *) nulldrv_base_create(NULL, sizeof(*dev),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600201 VK_OBJECT_TYPE_DEVICE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700202 if (!dev)
Tony Barbour8205d902015-04-16 15:59:00 -0600203 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700204
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600205 for (i = 0; i < info->extensionCount; i++) {
206 const enum nulldrv_ext_type ext = nulldrv_gpu_lookup_extension(
207 gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600208 info->ppEnabledExtensionNames[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700209
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600210 if (ext == NULLDRV_EXT_INVALID)
211 return VK_ERROR_INVALID_EXTENSION;
David Pinedo0257fbf2015-02-02 18:02:40 -0700212
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600213 dev->exts[ext] = true;
214 }
David Pinedo0257fbf2015-02-02 18:02:40 -0700215
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800216 ret = nulldrv_desc_ooxx_create(dev, &dev->desc_ooxx);
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 ret = dev_create_queues(dev, info->pRequestedQueues,
222 info->queueRecordCount);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600223 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700224 return ret;
225 }
226
227 *dev_ret = dev;
228
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600229 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700230}
231
Tony Barbour8205d902015-04-16 15:59:00 -0600232static struct nulldrv_gpu *nulldrv_gpu(VkPhysicalDevice gpu)
David Pinedo0257fbf2015-02-02 18:02:40 -0700233{
234 return (struct nulldrv_gpu *) gpu;
235}
236
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600237static VkResult nulldrv_rt_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchter1856d6f2015-09-01 17:30:39 -0600238 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700239 struct nulldrv_rt_view **view_ret)
240{
241 struct nulldrv_rt_view *view;
242
243 view = (struct nulldrv_rt_view *) nulldrv_base_create(dev, sizeof(*view),
Chia-I Wuc278df82015-07-07 11:50:03 +0800244 VK_OBJECT_TYPE_ATTACHMENT_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700245 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600246 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700247
248 *view_ret = view;
249
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600250 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700251}
252
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600253static VkResult nulldrv_fence_create(struct nulldrv_dev *dev,
254 const VkFenceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700255 struct nulldrv_fence **fence_ret)
256{
257 struct nulldrv_fence *fence;
258
259 fence = (struct nulldrv_fence *) nulldrv_base_create(dev, sizeof(*fence),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600260 VK_OBJECT_TYPE_FENCE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700261 if (!fence)
Tony Barbour8205d902015-04-16 15:59:00 -0600262 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700263
264 *fence_ret = fence;
265
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600266 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700267}
268
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600269static struct nulldrv_dev *nulldrv_dev(VkDevice dev)
David Pinedo0257fbf2015-02-02 18:02:40 -0700270{
271 return (struct nulldrv_dev *) dev;
272}
273
274static struct nulldrv_img *nulldrv_img_from_base(struct nulldrv_base *base)
275{
276 return (struct nulldrv_img *) base;
277}
278
279
Tony Barbour426b9052015-06-24 16:06:58 -0600280static VkResult img_get_memory_requirements(struct nulldrv_base *base,
281 VkMemoryRequirements *pRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700282{
283 struct nulldrv_img *img = nulldrv_img_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600284 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700285
Tony Barbour426b9052015-06-24 16:06:58 -0600286 pRequirements->size = img->total_size;
287 pRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700288
289 return ret;
290}
291
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600292static VkResult nulldrv_img_create(struct nulldrv_dev *dev,
293 const VkImageCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700294 bool scanout,
295 struct nulldrv_img **img_ret)
296{
297 struct nulldrv_img *img;
298
299 img = (struct nulldrv_img *) nulldrv_base_create(dev, sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600300 VK_OBJECT_TYPE_IMAGE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700301 if (!img)
Tony Barbour8205d902015-04-16 15:59:00 -0600302 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700303
304 img->type = info->imageType;
305 img->depth = info->extent.depth;
306 img->mip_levels = info->mipLevels;
307 img->array_size = info->arraySize;
308 img->usage = info->usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700309 img->samples = info->samples;
310
Tony Barbour426b9052015-06-24 16:06:58 -0600311 img->obj.base.get_memory_requirements = img_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700312
313 *img_ret = img;
314
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600315 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700316}
317
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600318static struct nulldrv_img *nulldrv_img(VkImage image)
David Pinedo0257fbf2015-02-02 18:02:40 -0700319{
Tony Barbourde4124d2015-07-03 10:33:54 -0600320 return *(struct nulldrv_img **) &image;
David Pinedo0257fbf2015-02-02 18:02:40 -0700321}
322
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600323static VkResult nulldrv_mem_alloc(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600324 const VkMemoryAllocInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700325 struct nulldrv_mem **mem_ret)
326{
327 struct nulldrv_mem *mem;
328
329 mem = (struct nulldrv_mem *) nulldrv_base_create(dev, sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600330 VK_OBJECT_TYPE_DEVICE_MEMORY);
David Pinedo0257fbf2015-02-02 18:02:40 -0700331 if (!mem)
Tony Barbour8205d902015-04-16 15:59:00 -0600332 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700333
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700334 mem->bo = malloc(info->allocationSize);
David Pinedo0257fbf2015-02-02 18:02:40 -0700335 if (!mem->bo) {
Tony Barbour8205d902015-04-16 15:59:00 -0600336 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700337 }
338
339 mem->size = info->allocationSize;
340
341 *mem_ret = mem;
342
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600343 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700344}
345
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600346static VkResult nulldrv_sampler_create(struct nulldrv_dev *dev,
347 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700348 struct nulldrv_sampler **sampler_ret)
349{
350 struct nulldrv_sampler *sampler;
351
352 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600353 sizeof(*sampler), VK_OBJECT_TYPE_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700354 if (!sampler)
Tony Barbour8205d902015-04-16 15:59:00 -0600355 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700356
357 *sampler_ret = sampler;
358
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600359 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700360}
361
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600362static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
363 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700364 struct nulldrv_img_view **view_ret)
365{
366 struct nulldrv_img *img = nulldrv_img(info->image);
367 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700368
369 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600370 VK_OBJECT_TYPE_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700371 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600372 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700373
374 view->img = img;
David Pinedo0257fbf2015-02-02 18:02:40 -0700375
David Pinedo0257fbf2015-02-02 18:02:40 -0700376 view->cmd_len = 8;
377
378 *view_ret = view;
379
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600380 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700381}
382
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600383static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700384{
385 return mem->bo;
386}
387
Tony Barbour8205d902015-04-16 15:59:00 -0600388static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700389{
Tony Barbourde4124d2015-07-03 10:33:54 -0600390 return *(struct nulldrv_mem **) &mem;
David Pinedo0257fbf2015-02-02 18:02:40 -0700391}
392
393static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
394{
395 return (struct nulldrv_buf *) base;
396}
397
Tony Barbour426b9052015-06-24 16:06:58 -0600398static VkResult buf_get_memory_requirements(struct nulldrv_base *base,
399 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700400{
401 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
David Pinedo0257fbf2015-02-02 18:02:40 -0700402
Tony Barbour426b9052015-06-24 16:06:58 -0600403 if (pMemoryRequirements == NULL)
404 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700405
Tony Barbour426b9052015-06-24 16:06:58 -0600406 pMemoryRequirements->size = buf->size;
407 pMemoryRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700408
Tony Barbour426b9052015-06-24 16:06:58 -0600409 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700410}
411
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600412static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600413 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700414 struct nulldrv_buf **buf_ret)
415{
416 struct nulldrv_buf *buf;
417
418 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600419 VK_OBJECT_TYPE_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700420 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600421 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700422
423 buf->size = info->size;
424 buf->usage = info->usage;
425
Tony Barbour426b9052015-06-24 16:06:58 -0600426 buf->obj.base.get_memory_requirements = buf_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700427
428 *buf_ret = buf;
429
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600430 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700431}
432
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600433static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
434 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700435 struct nulldrv_desc_layout **layout_ret)
436{
437 struct nulldrv_desc_layout *layout;
438
439 layout = (struct nulldrv_desc_layout *)
440 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600441 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700442 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600443 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700444
445 *layout_ret = layout;
446
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600447 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700448}
449
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500450static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
451 const VkPipelineLayoutCreateInfo* pCreateInfo,
452 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800453{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500454 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800455
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500456 pipeline_layout = (struct nulldrv_pipeline_layout *)
457 nulldrv_base_create(dev, sizeof(*pipeline_layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600458 VK_OBJECT_TYPE_PIPELINE_LAYOUT);
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500459 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600460 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800461
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500462 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800463
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600464 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800465}
466
Tony Barbour8db65372015-07-10 18:32:33 -0600467static struct nulldrv_desc_layout *nulldrv_desc_layout(const VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700468{
Tony Barbourde4124d2015-07-03 10:33:54 -0600469 return *(struct nulldrv_desc_layout **) &layout;
David Pinedo0257fbf2015-02-02 18:02:40 -0700470}
471
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600472static VkResult shader_create(struct nulldrv_dev *dev,
473 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700474 struct nulldrv_shader **sh_ret)
475{
David Pinedo0257fbf2015-02-02 18:02:40 -0700476 struct nulldrv_shader *sh;
477
478 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600479 VK_OBJECT_TYPE_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700480 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600481 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700482
483 *sh_ret = sh;
484
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600485 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700486}
487
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600488static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
489 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700490 struct nulldrv_pipeline **pipeline_ret)
491{
492 struct nulldrv_pipeline *pipeline;
493
494 pipeline = (struct nulldrv_pipeline *)
495 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600496 VK_OBJECT_TYPE_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700497 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600498 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700499
500 *pipeline_ret = pipeline;
501
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600502 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700503}
504
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600505static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600506 const VkDynamicViewportStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700507 struct nulldrv_dynamic_vp **state_ret)
508{
509 struct nulldrv_dynamic_vp *state;
510
511 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600512 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_VIEWPORT_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700513 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600514 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700515
516 *state_ret = state;
517
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600518 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700519}
520
Cody Northrope4bc6942015-08-26 10:01:32 -0600521static VkResult nulldrv_line_width_state_create(struct nulldrv_dev *dev,
522 const VkDynamicLineWidthStateCreateInfo *info,
523 struct nulldrv_dynamic_line_width **state_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700524{
Cody Northrope4bc6942015-08-26 10:01:32 -0600525 struct nulldrv_dynamic_line_width *state;
David Pinedo0257fbf2015-02-02 18:02:40 -0700526
Cody Northrope4bc6942015-08-26 10:01:32 -0600527 state = (struct nulldrv_dynamic_line_width *) nulldrv_base_create(dev,
528 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_LINE_WIDTH_STATE);
Cody Northropf5bd2252015-08-17 11:10:49 -0600529 if (!state)
530 return VK_ERROR_OUT_OF_HOST_MEMORY;
531
532 *state_ret = state;
533
534 return VK_SUCCESS;
535}
536
Cody Northrope4bc6942015-08-26 10:01:32 -0600537static VkResult nulldrv_depth_bias_state_create(struct nulldrv_dev *dev,
538 const VkDynamicDepthBiasStateCreateInfo *info,
539 struct nulldrv_dynamic_depth_bias **state_ret)
Cody Northropf5bd2252015-08-17 11:10:49 -0600540{
Cody Northrope4bc6942015-08-26 10:01:32 -0600541 struct nulldrv_dynamic_depth_bias *state;
Cody Northropf5bd2252015-08-17 11:10:49 -0600542
Cody Northrope4bc6942015-08-26 10:01:32 -0600543 state = (struct nulldrv_dynamic_depth_bias *) nulldrv_base_create(dev,
544 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DEPTH_BIAS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700545 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600546 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700547
548 *state_ret = state;
549
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600550 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700551}
552
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600553static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
Cody Northrope4bc6942015-08-26 10:01:32 -0600554 const VkDynamicBlendStateCreateInfo *info,
555 struct nulldrv_dynamic_blend **state_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700556{
Cody Northrope4bc6942015-08-26 10:01:32 -0600557 struct nulldrv_dynamic_blend *state;
David Pinedo0257fbf2015-02-02 18:02:40 -0700558
Cody Northrope4bc6942015-08-26 10:01:32 -0600559 state = (struct nulldrv_dynamic_blend *) nulldrv_base_create(dev,
560 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_BLEND_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700561 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600562 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700563
564 *state_ret = state;
565
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600566 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700567}
568
Cody Northrope4bc6942015-08-26 10:01:32 -0600569static VkResult nulldrv_depth_bounds_state_create(struct nulldrv_dev *dev,
570 const VkDynamicDepthBoundsStateCreateInfo *info,
571 struct nulldrv_dynamic_depth_bounds **state_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700572{
Cody Northrope4bc6942015-08-26 10:01:32 -0600573 struct nulldrv_dynamic_depth_bounds *state;
David Pinedo0257fbf2015-02-02 18:02:40 -0700574
Cody Northrope4bc6942015-08-26 10:01:32 -0600575 state = (struct nulldrv_dynamic_depth_bounds *) nulldrv_base_create(dev,
576 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DEPTH_BOUNDS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700577 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600578 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700579
580 *state_ret = state;
581
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600582 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700583}
584
Cody Northrop2605cb02015-08-18 15:21:16 -0600585static VkResult nulldrv_stencil_state_create(struct nulldrv_dev *dev,
586 const VkDynamicStencilStateCreateInfo *infoFront,
587 const VkDynamicStencilStateCreateInfo *infoBack,
588 struct nulldrv_dynamic_stencil **state_ret)
589{
590 struct nulldrv_dynamic_stencil *state;
591
592 state = (struct nulldrv_dynamic_stencil *) nulldrv_base_create(dev,
593 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE);
594 if (!state)
595 return VK_ERROR_OUT_OF_HOST_MEMORY;
596
597 *state_ret = state;
598
599 return VK_SUCCESS;
600}
David Pinedo0257fbf2015-02-02 18:02:40 -0700601
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600602static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
603 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700604 struct nulldrv_cmd **cmd_ret)
605{
David Pinedo0257fbf2015-02-02 18:02:40 -0700606 struct nulldrv_cmd *cmd;
607
David Pinedo0257fbf2015-02-02 18:02:40 -0700608 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600609 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700610 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600611 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700612
613 *cmd_ret = cmd;
614
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600615 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700616}
617
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600618static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
619 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700620 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600621 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800622 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700623{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800624 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700625
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800626 pool = (struct nulldrv_desc_pool *)
627 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600628 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800629 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600630 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700631
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800632 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700633
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800634 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700635
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600636 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700637}
638
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600639static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800640 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600641 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700642 const struct nulldrv_desc_layout *layout,
643 struct nulldrv_desc_set **set_ret)
644{
645 struct nulldrv_desc_set *set;
646
647 set = (struct nulldrv_desc_set *)
648 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600649 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700650 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600651 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700652
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800653 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700654 set->layout = layout;
655 *set_ret = set;
656
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600657 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700658}
659
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600660static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700661{
Tony Barbourde4124d2015-07-03 10:33:54 -0600662 return *(struct nulldrv_desc_pool **) &pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700663}
664
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600665static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
666 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700667 struct nulldrv_framebuffer ** fb_ret)
668{
669
670 struct nulldrv_framebuffer *fb;
671 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600672 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700673 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600674 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700675
676 *fb_ret = fb;
677
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600678 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700679
680}
681
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600682static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
683 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700684 struct nulldrv_render_pass** rp_ret)
685{
686 struct nulldrv_render_pass *rp;
687 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600688 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700689 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600690 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700691
692 *rp_ret = rp;
693
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600694 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700695}
696
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600697static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700698{
Tony Barbourde4124d2015-07-03 10:33:54 -0600699 return *(struct nulldrv_buf **) &buf;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700700}
701
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600702static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600703 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700704 struct nulldrv_buf_view **view_ret)
705{
706 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
707 struct nulldrv_buf_view *view;
708
709 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600710 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700711 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600712 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700713
714 view->buf = buf;
715
716 *view_ret = view;
717
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600718 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700719}
720
David Pinedo0257fbf2015-02-02 18:02:40 -0700721
722//*********************************************
723// Driver entry points
724//*********************************************
725
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600726ICD_EXPORT VkResult VKAPI vkCreateBuffer(
727 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600728 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600729 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700730{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700731 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700732 struct nulldrv_dev *dev = nulldrv_dev(device);
733
734 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
735}
736
Tony Barbourde4124d2015-07-03 10:33:54 -0600737ICD_EXPORT VkResult VKAPI vkDestroyBuffer(
738 VkDevice device,
739 VkBuffer buffer)
740{
741 NULLDRV_LOG_FUNC;
742 return VK_SUCCESS;
743}
744
Cody Northropf02f9f82015-07-09 18:08:05 -0600745ICD_EXPORT VkResult VKAPI vkCreateCommandPool(
746 VkDevice device,
747 const VkCmdPoolCreateInfo* pCreateInfo,
748 VkCmdPool* pCmdPool)
749{
750 NULLDRV_LOG_FUNC;
751 return VK_SUCCESS;
752}
753
754ICD_EXPORT VkResult VKAPI vkDestroyCommandPool(
755 VkDevice device,
756 VkCmdPool cmdPool)
757{
758 NULLDRV_LOG_FUNC;
759 return VK_SUCCESS;
760}
761
762ICD_EXPORT VkResult VKAPI vkResetCommandPool(
763 VkDevice device,
764 VkCmdPool cmdPool,
765 VkCmdPoolResetFlags flags)
766{
767 NULLDRV_LOG_FUNC;
768 return VK_SUCCESS;
769}
770
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600771ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
772 VkDevice device,
773 const VkCmdBufferCreateInfo* pCreateInfo,
774 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700775{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700776 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700777 struct nulldrv_dev *dev = nulldrv_dev(device);
778
779 return nulldrv_cmd_create(dev, pCreateInfo,
780 (struct nulldrv_cmd **) pCmdBuffer);
781}
782
Tony Barbourde4124d2015-07-03 10:33:54 -0600783ICD_EXPORT VkResult VKAPI vkDestroyCommandBuffer(
784 VkDevice device,
785 VkCmdBuffer cmdBuffer)
786{
787 NULLDRV_LOG_FUNC;
788 return VK_SUCCESS;
789}
790
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600791ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
792 VkCmdBuffer cmdBuffer,
793 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700794{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700795 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600796 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700797}
798
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600799ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
800 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700801{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700802 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600803 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700804}
805
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600806ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
Cody Northropf02f9f82015-07-09 18:08:05 -0600807 VkCmdBuffer cmdBuffer,
808 VkCmdBufferResetFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700809{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700810 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600811 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700812}
813
Ian Elliott64a68e12015-04-16 11:57:46 -0600814static const VkFormat nulldrv_presentable_formats[] = {
815 VK_FORMAT_B8G8R8A8_UNORM,
816};
817
Jon Ashburnba4a1952015-06-16 12:44:51 -0600818#if 0
Ian Elliott338dedb2015-08-21 15:09:33 -0600819ICD_EXPORT VkResult VKAPI vkGetDisplayInfoKHR(
820 VkDisplayKHR display,
821 VkDisplayInfoTypeKHR infoType,
Ian Elliott64a68e12015-04-16 11:57:46 -0600822 size_t* pDataSize,
823 void* pData)
824{
825 VkResult ret = VK_SUCCESS;
826
827 NULLDRV_LOG_FUNC;
828
829 if (!pDataSize)
830 return VK_ERROR_INVALID_POINTER;
831
832 switch (infoType) {
Ian Elliott338dedb2015-08-21 15:09:33 -0600833 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_KHR:
Ian Elliott64a68e12015-04-16 11:57:46 -0600834 {
Ian Elliott338dedb2015-08-21 15:09:33 -0600835 VkDisplayFormatPropertiesKHR *dst = pData;
Ian Elliott64a68e12015-04-16 11:57:46 -0600836 size_t size_ret;
837 uint32_t i;
838
839 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
840
841 if (dst && *pDataSize < size_ret)
842 return VK_ERROR_INVALID_VALUE;
843
844 *pDataSize = size_ret;
845 if (!dst)
846 return VK_SUCCESS;
847
848 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
Ian Elliott338dedb2015-08-21 15:09:33 -0600849 dst[i].swapchainFormat = nulldrv_presentable_formats[i];
Ian Elliott64a68e12015-04-16 11:57:46 -0600850 }
851 break;
852 default:
853 ret = VK_ERROR_INVALID_VALUE;
854 break;
855 }
856
857 return ret;
858}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600859#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600860
Ian Elliott338dedb2015-08-21 15:09:33 -0600861ICD_EXPORT VkResult VKAPI vkCreateSwapchainKHR(
Ian Elliott64a68e12015-04-16 11:57:46 -0600862 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600863 const VkSwapchainCreateInfoKHR* pCreateInfo,
864 VkSwapchainKHR* pSwapchain)
Ian Elliott64a68e12015-04-16 11:57:46 -0600865{
866 NULLDRV_LOG_FUNC;
867 struct nulldrv_dev *dev = nulldrv_dev(device);
868 struct nulldrv_swap_chain *sc;
869
870 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Ian Elliott338dedb2015-08-21 15:09:33 -0600871 VK_OBJECT_TYPE_SWAPCHAIN_KHR);
Ian Elliott64a68e12015-04-16 11:57:46 -0600872 if (!sc) {
873 return VK_ERROR_OUT_OF_HOST_MEMORY;
874 }
875 sc->dev = dev;
876
Ian Elliott338dedb2015-08-21 15:09:33 -0600877 *(VkSwapchainKHR **)pSwapchain = *(VkSwapchainKHR **)&sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600878
879 return VK_SUCCESS;
880}
881
Ian Elliott338dedb2015-08-21 15:09:33 -0600882ICD_EXPORT VkResult VKAPI vkDestroySwapchainKHR(
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600883 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600884 VkSwapchainKHR swapchain)
Ian Elliott64a68e12015-04-16 11:57:46 -0600885{
886 NULLDRV_LOG_FUNC;
Ian Elliott338dedb2015-08-21 15:09:33 -0600887 struct nulldrv_swap_chain *sc = *(struct nulldrv_swap_chain **) &swapchain;
Ian Elliott64a68e12015-04-16 11:57:46 -0600888
889 free(sc);
890
891 return VK_SUCCESS;
892}
893
Ian Elliott338dedb2015-08-21 15:09:33 -0600894ICD_EXPORT VkResult VKAPI vkGetSwapchainImagesKHR(
Ian Elliott3333bb42015-08-10 13:56:08 -0600895 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600896 VkSwapchainKHR swapchain,
Ian Elliott3333bb42015-08-10 13:56:08 -0600897 uint32_t* pCount,
Ian Elliott338dedb2015-08-21 15:09:33 -0600898 VkImage* pSwapchainImages)
Ian Elliott64a68e12015-04-16 11:57:46 -0600899{
900 NULLDRV_LOG_FUNC;
Ian Elliott338dedb2015-08-21 15:09:33 -0600901 struct nulldrv_swap_chain *sc = *(struct nulldrv_swap_chain **) &swapchain;
Ian Elliott64a68e12015-04-16 11:57:46 -0600902 struct nulldrv_dev *dev = sc->dev;
903 VkResult ret = VK_SUCCESS;
904
Ian Elliott3333bb42015-08-10 13:56:08 -0600905 *pCount = 2;
Ian Elliott338dedb2015-08-21 15:09:33 -0600906 if (pSwapchainImages) {
Ian Elliott3333bb42015-08-10 13:56:08 -0600907 uint32_t i;
908 for (i = 0; i < 2; i++) {
Ian Elliott64a68e12015-04-16 11:57:46 -0600909 struct nulldrv_img *img;
Ian Elliott64a68e12015-04-16 11:57:46 -0600910
911 img = (struct nulldrv_img *) nulldrv_base_create(dev,
912 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600913 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600914 if (!img)
915 return VK_ERROR_OUT_OF_HOST_MEMORY;
Ian Elliott338dedb2015-08-21 15:09:33 -0600916 pSwapchainImages[i].handle = (uint64_t) &img;
Ian Elliott64a68e12015-04-16 11:57:46 -0600917 }
Ian Elliott64a68e12015-04-16 11:57:46 -0600918 }
919
920 return ret;
921}
922
Ian Elliott338dedb2015-08-21 15:09:33 -0600923ICD_EXPORT VkResult VKAPI vkAcquireNextImageKHR(
Tony Barbour7910de72015-07-13 16:37:21 -0600924 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600925 VkSwapchainKHR swapchain,
Tony Barbour7910de72015-07-13 16:37:21 -0600926 uint64_t timeout,
927 VkSemaphore semaphore,
928 uint32_t* pImageIndex)
929{
930 NULLDRV_LOG_FUNC;
931
932 return VK_SUCCESS;
933}
934
Ian Elliott338dedb2015-08-21 15:09:33 -0600935VkResult VKAPI vkGetSurfacePropertiesKHR(
Tony Barbour7910de72015-07-13 16:37:21 -0600936 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600937 const VkSurfaceDescriptionKHR* pSurfaceDescription,
938 VkSurfacePropertiesKHR* pSurfaceProperties)
Ian Elliott3333bb42015-08-10 13:56:08 -0600939{
940 NULLDRV_LOG_FUNC;
941
942 return VK_SUCCESS;
943}
944
Ian Elliott338dedb2015-08-21 15:09:33 -0600945VkResult VKAPI vkGetSurfaceFormatsKHR(
Ian Elliott3333bb42015-08-10 13:56:08 -0600946 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600947 const VkSurfaceDescriptionKHR* pSurfaceDescription,
Ian Elliott3333bb42015-08-10 13:56:08 -0600948 uint32_t* pCount,
Ian Elliott338dedb2015-08-21 15:09:33 -0600949 VkSurfaceFormatKHR* pSurfaceFormats)
Ian Elliott3333bb42015-08-10 13:56:08 -0600950{
951 NULLDRV_LOG_FUNC;
952
953 return VK_SUCCESS;
954}
955
Ian Elliott338dedb2015-08-21 15:09:33 -0600956VkResult VKAPI vkGetSurfacePresentModesKHR(
Ian Elliott3333bb42015-08-10 13:56:08 -0600957 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600958 const VkSurfaceDescriptionKHR* pSurfaceDescription,
Ian Elliott3333bb42015-08-10 13:56:08 -0600959 uint32_t* pCount,
Ian Elliott338dedb2015-08-21 15:09:33 -0600960 VkPresentModeKHR* pPresentModes)
Tony Barbour7910de72015-07-13 16:37:21 -0600961{
962 NULLDRV_LOG_FUNC;
963
964 return VK_SUCCESS;
965}
966
Ian Elliott338dedb2015-08-21 15:09:33 -0600967ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSurfaceSupportKHR(
Tony Barbour7910de72015-07-13 16:37:21 -0600968 VkPhysicalDevice physicalDevice,
969 uint32_t queueFamilyIndex,
Ian Elliott338dedb2015-08-21 15:09:33 -0600970 const VkSurfaceDescriptionKHR* pSurfaceDescription,
Tony Barbour7910de72015-07-13 16:37:21 -0600971 VkBool32* pSupported)
972{
973 NULLDRV_LOG_FUNC;
974
975 return VK_SUCCESS;
976}
977
Ian Elliott338dedb2015-08-21 15:09:33 -0600978ICD_EXPORT VkResult VKAPI vkQueuePresentKHR(
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600979 VkQueue queue_,
Ian Elliott338dedb2015-08-21 15:09:33 -0600980 VkPresentInfoKHR* pPresentInfo)
Ian Elliott64a68e12015-04-16 11:57:46 -0600981{
982 NULLDRV_LOG_FUNC;
983
984 return VK_SUCCESS;
985}
986
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600987ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600988 VkCmdBuffer cmdBuffer,
989 VkBuffer srcBuffer,
990 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700991 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600992 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700993{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700994 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700995}
996
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600997ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600998 VkCmdBuffer cmdBuffer,
999 VkImage srcImage,
1000 VkImageLayout srcImageLayout,
1001 VkImage destImage,
1002 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001003 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001004 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001005{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001006 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001007}
1008
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001009ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001010 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001011 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001012 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001013 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001014 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001015 uint32_t regionCount,
1016 const VkImageBlit* pRegions,
1017 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -06001018{
1019 NULLDRV_LOG_FUNC;
1020}
1021
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001022ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001023 VkCmdBuffer cmdBuffer,
1024 VkBuffer srcBuffer,
1025 VkImage destImage,
1026 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001027 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001028 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001029{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001030 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001031}
1032
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001033ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001034 VkCmdBuffer cmdBuffer,
1035 VkImage srcImage,
1036 VkImageLayout srcImageLayout,
1037 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001038 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001039 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001040{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001041 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001042}
1043
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001044ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001045 VkCmdBuffer cmdBuffer,
1046 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001047 VkDeviceSize destOffset,
1048 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001049 const uint32_t* pData)
1050{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001051 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001052}
1053
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001054ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001055 VkCmdBuffer cmdBuffer,
1056 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001057 VkDeviceSize destOffset,
1058 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001059 uint32_t data)
1060{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001061 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001062}
1063
Ian Elliotte924ab22015-07-08 13:24:30 -06001064ICD_EXPORT void VKAPI vkCmdClearDepthStencilImage(
1065 VkCmdBuffer cmdBuffer,
1066 VkImage image,
1067 VkImageLayout imageLayout,
1068 float depth,
1069 uint32_t stencil,
1070 uint32_t rangeCount,
1071 const VkImageSubresourceRange* pRanges)
1072{
1073 NULLDRV_LOG_FUNC;
1074}
1075
1076ICD_EXPORT void VKAPI vkCmdClearColorAttachment(
1077 VkCmdBuffer cmdBuffer,
1078 uint32_t colorAttachment,
1079 VkImageLayout imageLayout,
1080 const VkClearColorValue *pColor,
1081 uint32_t rectCount,
1082 const VkRect3D *pRects)
1083{
1084 NULLDRV_LOG_FUNC;
1085}
1086
1087ICD_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(
1088 VkCmdBuffer cmdBuffer,
1089 VkImageAspectFlags imageAspectMask,
1090 VkImageLayout imageLayout,
1091 float depth,
1092 uint32_t stencil,
1093 uint32_t rectCount,
1094 const VkRect3D *pRects)
1095{
1096 NULLDRV_LOG_FUNC;
1097}
1098
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001099ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001100 VkCmdBuffer cmdBuffer,
1101 VkImage image,
1102 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +12001103 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001104 uint32_t rangeCount,
1105 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001106{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001107 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001108}
1109
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001110ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001111 VkCmdBuffer cmdBuffer,
1112 VkImage image,
1113 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001114 float depth,
1115 uint32_t stencil,
1116 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001117 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001118{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001119 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001120}
1121
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001122ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001123 VkCmdBuffer cmdBuffer,
1124 VkImage srcImage,
1125 VkImageLayout srcImageLayout,
1126 VkImage destImage,
1127 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001128 uint32_t regionCount,
1129 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001130{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001131 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001132}
1133
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001134ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001135 VkCmdBuffer cmdBuffer,
1136 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001137 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001138 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001139{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001140 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001141}
1142
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001143ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001144 VkCmdBuffer cmdBuffer,
1145 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001146 uint32_t slot)
1147{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001148 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001149}
1150
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001151ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001152 VkCmdBuffer cmdBuffer,
1153 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001154 uint32_t startQuery,
1155 uint32_t queryCount)
1156{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001157 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001158}
1159
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001160ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001161 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001162 VkEvent event_,
1163 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001164{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001165 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001166}
1167
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001168ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001169 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001170 VkEvent event_,
1171 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001172{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001173 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001174}
1175
Ian Elliott63f1edb2015-04-16 18:10:19 -06001176ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1177 VkCmdBuffer cmdBuffer,
1178 VkQueryPool queryPool,
1179 uint32_t startQuery,
1180 uint32_t queryCount,
1181 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001182 VkDeviceSize destOffset,
1183 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001184 VkFlags flags)
1185{
1186 NULLDRV_LOG_FUNC;
1187}
1188
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001189ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001190 VkCmdBuffer cmdBuffer,
1191 VkTimestampType timestampType,
1192 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001193 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001194{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001195 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001196}
1197
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001198ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001199 VkCmdBuffer cmdBuffer,
Tony Barbourde4124d2015-07-03 10:33:54 -06001200 VkPipelineBindPoint pipelineBindPoint,
1201 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001202{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001203 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001204}
1205
Tony Barbourde4124d2015-07-03 10:33:54 -06001206ICD_EXPORT void VKAPI vkCmdBindDynamicViewportState(
1207 VkCmdBuffer cmdBuffer,
1208 VkDynamicViewportState state)
1209{
1210 NULLDRV_LOG_FUNC;
1211}
1212
Cody Northrope4bc6942015-08-26 10:01:32 -06001213ICD_EXPORT void VKAPI vkCmdBindDynamicLineWidthState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001214 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001215 VkDynamicLineWidthState state)
Cody Northropf5bd2252015-08-17 11:10:49 -06001216{
1217 NULLDRV_LOG_FUNC;
1218}
1219
Cody Northrope4bc6942015-08-26 10:01:32 -06001220ICD_EXPORT void VKAPI vkCmdBindDynamicDepthBiasState(
Cody Northropf5bd2252015-08-17 11:10:49 -06001221 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001222 VkDynamicDepthBiasState state)
Tony Barbourde4124d2015-07-03 10:33:54 -06001223{
1224 NULLDRV_LOG_FUNC;
1225}
1226
Cody Northrope4bc6942015-08-26 10:01:32 -06001227ICD_EXPORT void VKAPI vkCmdBindDynamicBlendState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001228 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001229 VkDynamicBlendState state)
Tony Barbourde4124d2015-07-03 10:33:54 -06001230{
1231 NULLDRV_LOG_FUNC;
1232}
1233
Cody Northrope4bc6942015-08-26 10:01:32 -06001234ICD_EXPORT void VKAPI vkCmdBindDynamicDepthBoundsState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001235 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001236 VkDynamicDepthBoundsState state)
Cody Northrop2605cb02015-08-18 15:21:16 -06001237{
1238 NULLDRV_LOG_FUNC;
1239}
1240
1241ICD_EXPORT void VKAPI vkCmdBindDynamicStencilState(
1242 VkCmdBuffer cmdBuffer,
1243 VkDynamicStencilState state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001244{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001245 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001246}
1247
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001248ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001249 VkCmdBuffer cmdBuffer,
1250 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001251 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001252 uint32_t firstSet,
1253 uint32_t setCount,
1254 const VkDescriptorSet* pDescriptorSets,
1255 uint32_t dynamicOffsetCount,
1256 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001257{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001258 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001259}
1260
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001261ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1262 VkCmdBuffer cmdBuffer,
1263 uint32_t startBinding,
1264 uint32_t bindingCount,
1265 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001266 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001267{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001268 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001269}
1270
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001271ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001272 VkCmdBuffer cmdBuffer,
1273 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001274 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001275 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001276{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001277 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001278}
1279
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001280ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001281 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001282 uint32_t firstVertex,
1283 uint32_t vertexCount,
1284 uint32_t firstInstance,
1285 uint32_t instanceCount)
1286{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001287 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001288}
1289
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001290ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001291 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001292 uint32_t firstIndex,
1293 uint32_t indexCount,
1294 int32_t vertexOffset,
1295 uint32_t firstInstance,
1296 uint32_t instanceCount)
1297{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001298 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001299}
1300
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001301ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001302 VkCmdBuffer cmdBuffer,
1303 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001304 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001305 uint32_t count,
1306 uint32_t stride)
1307{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001308 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001309}
1310
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001311ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001312 VkCmdBuffer cmdBuffer,
1313 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001314 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001315 uint32_t count,
1316 uint32_t stride)
1317{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001318 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001319}
1320
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001321ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001322 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001323 uint32_t x,
1324 uint32_t y,
1325 uint32_t z)
1326{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001327 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001328}
1329
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001330ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001331 VkCmdBuffer cmdBuffer,
1332 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001333 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001334{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001335 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001336}
1337
Tony Barbour8205d902015-04-16 15:59:00 -06001338void VKAPI vkCmdWaitEvents(
1339 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001340 uint32_t eventCount,
1341 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001342 VkPipelineStageFlags sourceStageMask,
1343 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001344 uint32_t memBarrierCount,
Courtney Goeltzenleuchterd9ba3422015-07-12 12:58:58 -06001345 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001346{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001347 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001348}
1349
Tony Barbour8205d902015-04-16 15:59:00 -06001350void VKAPI vkCmdPipelineBarrier(
1351 VkCmdBuffer cmdBuffer,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001352 VkPipelineStageFlags srcStageMask,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001353 VkPipelineStageFlags destStageMask,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001354 VkBool32 byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001355 uint32_t memBarrierCount,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001356 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001357{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001358 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001359}
1360
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001361ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001362 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001363 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001364 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001365{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001366 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001367 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1368 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1369}
1370
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001371ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1372 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001373{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001374 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001375 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001376}
1377
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001378ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1379 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001380 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001381 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001382 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001383{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001384 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001385 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001386 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001387 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001388}
1389
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001390ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1391 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001392{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001393 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001394 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001395}
1396
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001397ICD_EXPORT VkResult VKAPI vkCreateEvent(
1398 VkDevice device,
1399 const VkEventCreateInfo* pCreateInfo,
1400 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001401{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001402 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001403 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001404}
1405
Tony Barbourde4124d2015-07-03 10:33:54 -06001406ICD_EXPORT VkResult VKAPI vkDestroyEvent(
1407 VkDevice device,
1408 VkEvent event)
1409{
1410 NULLDRV_LOG_FUNC;
1411 return VK_SUCCESS;
1412}
1413
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001414ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001415 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001416 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001417{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001418 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001419 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001420}
1421
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001422ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001423 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001424 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001425{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001426 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001427 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001428}
1429
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001430ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001431 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001432 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001433{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001434 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001435 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001436}
1437
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001438ICD_EXPORT VkResult VKAPI vkCreateFence(
1439 VkDevice device,
1440 const VkFenceCreateInfo* pCreateInfo,
1441 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001442{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001443 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001444 struct nulldrv_dev *dev = nulldrv_dev(device);
1445
1446 return nulldrv_fence_create(dev, pCreateInfo,
1447 (struct nulldrv_fence **) pFence);
1448}
1449
Tony Barbourde4124d2015-07-03 10:33:54 -06001450ICD_EXPORT VkResult VKAPI vkDestroyFence(
1451 VkDevice device,
1452 VkFence fence)
1453{
1454 NULLDRV_LOG_FUNC;
1455 return VK_SUCCESS;
1456}
1457
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001458ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001459 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001460 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001461{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001462 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001463 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001464}
1465
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001466ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001467 VkDevice device,
1468 uint32_t fenceCount,
1469 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001470{
1471 NULLDRV_LOG_FUNC;
1472 return VK_SUCCESS;
1473}
1474
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001475ICD_EXPORT VkResult VKAPI vkWaitForFences(
1476 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001477 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001478 const VkFence* pFences,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001479 VkBool32 waitAll,
David Pinedo0257fbf2015-02-02 18:02:40 -07001480 uint64_t timeout)
1481{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001482 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001483 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001484}
1485
Tony Barbour426b9052015-06-24 16:06:58 -06001486ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1487 VkPhysicalDevice gpu_,
1488 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001489{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001490 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001491 VkResult ret = VK_SUCCESS;
1492
Tony Barbour426b9052015-06-24 16:06:58 -06001493 pProperties->apiVersion = VK_API_VERSION;
1494 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1495 pProperties->vendorId = 0;
1496 pProperties->deviceId = 0;
1497 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1498 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001499
1500 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001501}
1502
Chris Forbesd7576302015-06-21 22:55:02 +12001503ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1504 VkPhysicalDevice physicalDevice,
1505 VkPhysicalDeviceFeatures* pFeatures)
1506{
1507 NULLDRV_LOG_FUNC;
1508 VkResult ret = VK_SUCCESS;
1509
1510 /* TODO: fill out features */
1511 memset(pFeatures, 0, sizeof(*pFeatures));
1512
1513 return ret;
1514}
1515
Courtney Goeltzenleuchter4da96aa2015-07-12 12:52:09 -06001516ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatProperties(
Chris Forbesd7576302015-06-21 22:55:02 +12001517 VkPhysicalDevice physicalDevice,
1518 VkFormat format,
1519 VkFormatProperties* pFormatInfo)
1520{
1521 NULLDRV_LOG_FUNC;
1522 VkResult ret = VK_SUCCESS;
1523
1524 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1525 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
Mark Lobodzinski4b36dd42015-09-03 15:21:52 -06001526 pFormatInfo->bufferFeatures = 0;
Chris Forbesd7576302015-06-21 22:55:02 +12001527
1528 return ret;
1529}
1530
1531ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1532 VkPhysicalDevice physicalDevice,
1533 VkPhysicalDeviceLimits* pLimits)
1534{
1535 NULLDRV_LOG_FUNC;
1536 VkResult ret = VK_SUCCESS;
1537
1538 /* TODO: fill out limits */
1539 memset(pLimits, 0, sizeof(*pLimits));
1540
1541 return ret;
1542}
1543
Cody Northropef72e2a2015-08-03 17:04:53 -06001544ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueFamilyProperties(
Tony Barbour426b9052015-06-24 16:06:58 -06001545 VkPhysicalDevice gpu_,
Cody Northropef72e2a2015-08-03 17:04:53 -06001546 uint32_t* pCount,
1547 VkQueueFamilyProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001548 {
Cody Northropef72e2a2015-08-03 17:04:53 -06001549 if (pProperties == NULL) {
1550 *pCount = 1;
1551 return VK_SUCCESS;
1552 }
Tony Barbour426b9052015-06-24 16:06:58 -06001553 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1554 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001555 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001556
Tony Barbour426b9052015-06-24 16:06:58 -06001557 return VK_SUCCESS;
1558}
1559
Ian Elliotte924ab22015-07-08 13:24:30 -06001560ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(
1561 VkPhysicalDevice gpu_,
1562 VkPhysicalDeviceMemoryProperties* pProperties)
1563{
1564 // TODO: Fill in with real data
1565 return VK_SUCCESS;
1566}
1567
1568ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLayerProperties(
1569 VkPhysicalDevice physicalDevice,
1570 uint32_t* pCount,
1571 VkLayerProperties* pProperties)
1572{
1573 // TODO: Fill in with real data
1574 return VK_SUCCESS;
1575}
1576
Tony Barbour426b9052015-06-24 16:06:58 -06001577ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001578 const char* pLayerName,
1579 uint32_t* pCount,
1580 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001581{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001582 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001583
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001584 if (pCount == NULL) {
1585 return VK_ERROR_INVALID_POINTER;
1586 }
Tony Barbour426b9052015-06-24 16:06:58 -06001587
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001588 if (pProperties == NULL) {
1589 *pCount = NULLDRV_EXT_COUNT;
1590 return VK_SUCCESS;
1591 }
Tony Barbour426b9052015-06-24 16:06:58 -06001592
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001593 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1594 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1595 *pCount = copy_size;
1596 if (copy_size < NULLDRV_EXT_COUNT) {
1597 return VK_INCOMPLETE;
1598 }
Tony Barbour426b9052015-06-24 16:06:58 -06001599 return VK_SUCCESS;
1600}
Ian Elliotte924ab22015-07-08 13:24:30 -06001601ICD_EXPORT VkResult VKAPI vkGetGlobalLayerProperties(
1602 uint32_t* pCount,
1603 VkLayerProperties* pProperties)
1604{
1605 // TODO: Fill in with real data
1606 return VK_SUCCESS;
1607}
Tony Barbour426b9052015-06-24 16:06:58 -06001608
1609VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001610 VkPhysicalDevice physicalDevice,
1611 const char* pLayerName,
1612 uint32_t* pCount,
1613 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001614{
Tony Barbour426b9052015-06-24 16:06:58 -06001615
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001616 if (pCount == NULL) {
1617 return VK_ERROR_INVALID_POINTER;
1618 }
1619
Tony Barbour426b9052015-06-24 16:06:58 -06001620 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001621
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001622 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001623}
1624
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001625ICD_EXPORT VkResult VKAPI vkCreateImage(
1626 VkDevice device,
1627 const VkImageCreateInfo* pCreateInfo,
1628 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001629{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001630 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001631 struct nulldrv_dev *dev = nulldrv_dev(device);
1632
1633 return nulldrv_img_create(dev, pCreateInfo, false,
1634 (struct nulldrv_img **) pImage);
1635}
1636
Tony Barbourde4124d2015-07-03 10:33:54 -06001637ICD_EXPORT VkResult VKAPI vkDestroyImage(
1638 VkDevice device,
1639 VkImage image)
1640{
1641 NULLDRV_LOG_FUNC;
1642 return VK_SUCCESS;
1643}
1644
Tony Barbour426b9052015-06-24 16:06:58 -06001645ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001646 VkDevice device,
1647 VkImage image,
1648 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001649 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001650{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001651 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001652
Tony Barbour426b9052015-06-24 16:06:58 -06001653 pLayout->offset = 0;
1654 pLayout->size = 1;
1655 pLayout->rowPitch = 4;
1656 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001657
Tony Barbour426b9052015-06-24 16:06:58 -06001658 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001659}
1660
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001661ICD_EXPORT VkResult VKAPI vkAllocMemory(
1662 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001663 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001664 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001665{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001666 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001667 struct nulldrv_dev *dev = nulldrv_dev(device);
1668
1669 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1670}
1671
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001672ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001673 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001674 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001675{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001676 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001677 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001678}
1679
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001680ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001681 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001682 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001683 VkDeviceSize offset,
1684 VkDeviceSize size,
1685 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001686 void** ppData)
1687{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001688 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001689 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1690 void *ptr = nulldrv_mem_map(mem, flags);
1691
1692 *ppData = ptr;
1693
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001694 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001695}
1696
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001697ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001698 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001699 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001700{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001701 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001702 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001703}
1704
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001705ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001706 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001707 uint32_t memRangeCount,
1708 const VkMappedMemoryRange* pMemRanges)
1709{
1710 NULLDRV_LOG_FUNC;
1711 return VK_SUCCESS;
1712}
1713
1714ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1715 VkDevice device,
1716 uint32_t memRangeCount,
1717 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001718{
1719 NULLDRV_LOG_FUNC;
1720 return VK_SUCCESS;
1721}
1722
Courtney Goeltzenleuchterd040c5c2015-07-09 21:57:28 -06001723ICD_EXPORT VkResult VKAPI vkGetDeviceMemoryCommitment(
1724 VkDevice device,
1725 VkDeviceMemory memory,
1726 VkDeviceSize* pCommittedMemoryInBytes)
1727{
1728 return VK_SUCCESS;
1729}
1730
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001731ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001732 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001733 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001734{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001735 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001736 struct nulldrv_instance *inst;
1737
1738 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001739 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001740 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001741 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001742
Tony Barbour426b9052015-06-24 16:06:58 -06001743 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001744
Mike Stroyan230e6252015-04-17 12:36:38 -06001745 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001746
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001747 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001748}
1749
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001750ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1751 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001752{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001753 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001754 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001755}
1756
Tony Barbour8205d902015-04-16 15:59:00 -06001757ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001758 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001759 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001760 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001761{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001762 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001763 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001764 struct nulldrv_gpu *gpu;
1765 *pGpuCount = 1;
1766 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001767 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001768 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001769 return ret;
1770}
1771
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001772ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001773 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001774 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001775 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001776 char* const* pOutLayers,
1777 void* pReserved)
1778{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001779 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001780 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001781}
1782
Tony Barbourde4124d2015-07-03 10:33:54 -06001783ICD_EXPORT VkResult VKAPI vkGetBufferMemoryRequirements(
1784 VkDevice device,
1785 VkBuffer buffer,
1786 VkMemoryRequirements* pMemoryRequirements)
1787{
1788 NULLDRV_LOG_FUNC;
1789 struct nulldrv_base *base = nulldrv_base((void*)buffer.handle);
1790
1791 return base->get_memory_requirements(base, pMemoryRequirements);
1792}
1793
1794ICD_EXPORT VkResult VKAPI vkGetImageMemoryRequirements(
1795 VkDevice device,
1796 VkImage image,
1797 VkMemoryRequirements* pMemoryRequirements)
1798{
1799 NULLDRV_LOG_FUNC;
1800 struct nulldrv_base *base = nulldrv_base((void*)image.handle);
1801
1802 return base->get_memory_requirements(base, pMemoryRequirements);
1803}
1804
1805ICD_EXPORT VkResult VKAPI vkBindBufferMemory(
1806 VkDevice device,
1807 VkBuffer buffer,
1808 VkDeviceMemory mem_,
1809 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001810{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001811 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001812 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001813}
1814
Tony Barbourde4124d2015-07-03 10:33:54 -06001815ICD_EXPORT VkResult VKAPI vkBindImageMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001816 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06001817 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001818 VkDeviceMemory mem_,
1819 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001820{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001821 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001822 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001823}
1824
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001825ICD_EXPORT VkResult VKAPI vkGetImageSparseMemoryRequirements(
1826 VkDevice device,
1827 VkImage image,
1828 uint32_t* pNumRequirements,
1829 VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
1830{
1831 NULLDRV_LOG_FUNC;
1832 return VK_SUCCESS;
1833}
1834
1835ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(
1836 VkPhysicalDevice physicalDevice,
1837 VkFormat format,
1838 VkImageType type,
1839 uint32_t samples,
1840 VkImageUsageFlags usage,
1841 VkImageTiling tiling,
1842 uint32_t* pNumProperties,
1843 VkSparseImageFormatProperties* pProperties)
1844{
1845 NULLDRV_LOG_FUNC;
1846 return VK_SUCCESS;
1847}
1848
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001849ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001850 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001851 VkBuffer buffer,
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001852 uint32_t numBindings,
1853 const VkSparseMemoryBindInfo* pBindInfo)
1854{
1855 NULLDRV_LOG_FUNC;
1856 return VK_SUCCESS;
1857}
1858
1859ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageOpaqueMemory(
1860 VkQueue queue,
1861 VkImage image,
1862 uint32_t numBindings,
1863 const VkSparseMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001864{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001865 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001866 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001867}
1868
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001869ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001870 VkQueue queue,
1871 VkImage image,
1872 uint32_t numBindings,
1873 const VkSparseImageMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001874{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001875 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001876 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001877}
Jon Ashburn0e249962015-07-10 09:41:15 -07001878ICD_EXPORT VkResult VKAPI vkCreatePipelineCache(
1879 VkDevice device,
1880 const VkPipelineCacheCreateInfo* pCreateInfo,
1881 VkPipelineCache* pPipelineCache)
1882{
David Pinedo0257fbf2015-02-02 18:02:40 -07001883
Jon Ashburn0e249962015-07-10 09:41:15 -07001884 NULLDRV_LOG_FUNC;
1885 return VK_SUCCESS;
1886}
1887
Tony Barbourde4124d2015-07-03 10:33:54 -06001888ICD_EXPORT VkResult VKAPI vkDestroyPipeline(
1889 VkDevice device,
1890 VkPipeline pipeline)
1891{
1892 NULLDRV_LOG_FUNC;
1893 return VK_SUCCESS;
1894}
1895
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06001896VkResult VKAPI vkDestroyPipelineCache(
1897 VkDevice device,
1898 VkPipelineCache pipelineCache)
Jon Ashburn0e249962015-07-10 09:41:15 -07001899{
1900 NULLDRV_LOG_FUNC;
1901 return VK_SUCCESS;
1902}
1903
1904ICD_EXPORT size_t VKAPI vkGetPipelineCacheSize(
1905 VkDevice device,
1906 VkPipelineCache pipelineCache)
1907{
1908 NULLDRV_LOG_FUNC;
1909 return VK_ERROR_UNAVAILABLE;
1910}
1911
1912ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
1913 VkDevice device,
1914 VkPipelineCache pipelineCache,
1915 void* pData)
1916{
1917 NULLDRV_LOG_FUNC;
1918 return VK_ERROR_UNAVAILABLE;
1919}
1920
1921ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
1922 VkDevice device,
1923 VkPipelineCache destCache,
1924 uint32_t srcCacheCount,
1925 const VkPipelineCache* pSrcCaches)
1926{
1927 NULLDRV_LOG_FUNC;
1928 return VK_ERROR_UNAVAILABLE;
1929}
1930ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001931 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001932 VkPipelineCache pipelineCache,
1933 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001934 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1935 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001936{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001937 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001938 struct nulldrv_dev *dev = nulldrv_dev(device);
1939
1940 return graphics_pipeline_create(dev, pCreateInfo,
1941 (struct nulldrv_pipeline **) pPipeline);
1942}
1943
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001944
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001945
Jon Ashburn0e249962015-07-10 09:41:15 -07001946ICD_EXPORT VkResult VKAPI vkCreateComputePipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001947 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001948 VkPipelineCache pipelineCache,
1949 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001950 const VkComputePipelineCreateInfo* pCreateInfo,
1951 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001952{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001953 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001954 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001955}
1956
David Pinedo0257fbf2015-02-02 18:02:40 -07001957
David Pinedo0257fbf2015-02-02 18:02:40 -07001958
Jon Ashburn0e249962015-07-10 09:41:15 -07001959
David Pinedo0257fbf2015-02-02 18:02:40 -07001960
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001961ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1962 VkDevice device,
1963 const VkQueryPoolCreateInfo* pCreateInfo,
1964 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001965{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001966 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001967 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001968}
1969
Tony Barbourde4124d2015-07-03 10:33:54 -06001970ICD_EXPORT VkResult VKAPI vkDestroyQueryPool(
1971 VkDevice device,
1972 VkQueryPool queryPoool)
1973{
1974 NULLDRV_LOG_FUNC;
1975 return VK_SUCCESS;
1976}
1977
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001978ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001979 VkDevice device,
1980 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001981 uint32_t startQuery,
1982 uint32_t queryCount,
1983 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001984 void* pData,
1985 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001986{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001987 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001988 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001989}
1990
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001991ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1992 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001993{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001994 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001995 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001996}
1997
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001998ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1999 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07002000 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002001 const VkCmdBuffer* pCmdBuffers,
2002 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07002003{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002004 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002005 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002006}
2007
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002008ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
2009 VkDevice device,
2010 const VkSemaphoreCreateInfo* pCreateInfo,
2011 VkSemaphore* pSemaphore)
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
Tony Barbourde4124d2015-07-03 10:33:54 -06002017ICD_EXPORT VkResult VKAPI vkDestroySemaphore(
2018 VkDevice device,
2019 VkSemaphore semaphore)
2020{
2021 NULLDRV_LOG_FUNC;
2022 return VK_SUCCESS;
2023}
2024
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002025ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
2026 VkQueue queue,
2027 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002028{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002029 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002030 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002031}
2032
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002033ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
2034 VkQueue queue,
2035 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002036{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002037 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002038 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002039}
2040
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002041ICD_EXPORT VkResult VKAPI vkCreateSampler(
2042 VkDevice device,
2043 const VkSamplerCreateInfo* pCreateInfo,
2044 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07002045{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002046 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002047 struct nulldrv_dev *dev = nulldrv_dev(device);
2048
2049 return nulldrv_sampler_create(dev, pCreateInfo,
2050 (struct nulldrv_sampler **) pSampler);
2051}
2052
Tony Barbourde4124d2015-07-03 10:33:54 -06002053ICD_EXPORT VkResult VKAPI vkDestroySampler(
2054 VkDevice device,
2055 VkSampler sampler)
2056{
2057 NULLDRV_LOG_FUNC;
2058 return VK_SUCCESS;
2059}
2060
Ian Elliotte924ab22015-07-08 13:24:30 -06002061ICD_EXPORT VkResult VKAPI vkCreateShaderModule(
2062 VkDevice device,
2063 const VkShaderModuleCreateInfo* pCreateInfo,
2064 VkShaderModule* pShaderModule)
2065{
2066 // TODO: Fill in with real data
Tony Barbourde4124d2015-07-03 10:33:54 -06002067 NULLDRV_LOG_FUNC;
2068 return VK_SUCCESS;
2069}
2070
2071ICD_EXPORT VkResult VKAPI vkDestroyShaderModule(
2072 VkDevice device,
2073 VkShaderModule shaderModule)
2074{
2075 // TODO: Fill in with real data
2076 NULLDRV_LOG_FUNC;
Ian Elliotte924ab22015-07-08 13:24:30 -06002077 return VK_SUCCESS;
2078}
2079
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002080ICD_EXPORT VkResult VKAPI vkCreateShader(
2081 VkDevice device,
2082 const VkShaderCreateInfo* pCreateInfo,
2083 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002084{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002085 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002086 struct nulldrv_dev *dev = nulldrv_dev(device);
2087
2088 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2089}
2090
Tony Barbourde4124d2015-07-03 10:33:54 -06002091ICD_EXPORT VkResult VKAPI vkDestroyShader(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002092 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002093 VkShader shader)
2094{
2095 NULLDRV_LOG_FUNC;
2096 return VK_SUCCESS;
2097}
2098
2099ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2100 VkDevice device,
2101 const VkDynamicViewportStateCreateInfo* pCreateInfo,
2102 VkDynamicViewportState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002103{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002104 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002105 struct nulldrv_dev *dev = nulldrv_dev(device);
2106
2107 return nulldrv_viewport_state_create(dev, pCreateInfo,
2108 (struct nulldrv_dynamic_vp **) pState);
2109}
2110
Tony Barbourde4124d2015-07-03 10:33:54 -06002111ICD_EXPORT VkResult VKAPI vkDestroyDynamicViewportState(
2112 VkDevice device,
2113 VkDynamicViewportState dynamicViewportState)
2114{
2115 NULLDRV_LOG_FUNC;
2116 return VK_SUCCESS;
2117}
2118
Cody Northrope4bc6942015-08-26 10:01:32 -06002119ICD_EXPORT VkResult VKAPI vkCreateDynamicLineWidthState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002120 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002121 const VkDynamicLineWidthStateCreateInfo* pCreateInfo,
2122 VkDynamicLineWidthState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002123{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002124 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002125 struct nulldrv_dev *dev = nulldrv_dev(device);
2126
Cody Northrope4bc6942015-08-26 10:01:32 -06002127 return nulldrv_line_width_state_create(dev, pCreateInfo,
Cody Northropf5bd2252015-08-17 11:10:49 -06002128 (struct nulldrv_dynamic_rs_line **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002129}
2130
Cody Northrope4bc6942015-08-26 10:01:32 -06002131ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthBiasState(
Cody Northropf5bd2252015-08-17 11:10:49 -06002132 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002133 const VkDynamicDepthBiasStateCreateInfo* pCreateInfo,
2134 VkDynamicDepthBiasState* pState)
Cody Northropf5bd2252015-08-17 11:10:49 -06002135{
2136 NULLDRV_LOG_FUNC;
2137 struct nulldrv_dev *dev = nulldrv_dev(device);
2138
Cody Northrope4bc6942015-08-26 10:01:32 -06002139 return nulldrv_depth_bias_state_create(dev, pCreateInfo,
Cody Northropf5bd2252015-08-17 11:10:49 -06002140 (struct nulldrv_dynamic_rs_depth_bias **) pState);
2141}
2142
Jon Ashburnfb1ac372015-08-27 14:02:23 -07002143ICD_EXPORT VkResult VKAPI vkDestroyDynamicLineWidthState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002144 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002145 VkDynamicLineWidthState dynamicLineWidthState)
Cody Northropf5bd2252015-08-17 11:10:49 -06002146{
2147 NULLDRV_LOG_FUNC;
2148 return VK_SUCCESS;
2149}
2150
Cody Northrope4bc6942015-08-26 10:01:32 -06002151ICD_EXPORT VkResult VKAPI vkDestroyDynamicDepthBiasState(
Cody Northropf5bd2252015-08-17 11:10:49 -06002152 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002153 VkDynamicDepthBiasState dynamicDepthBiasState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002154{
2155 NULLDRV_LOG_FUNC;
2156 return VK_SUCCESS;
2157}
2158
Cody Northrope4bc6942015-08-26 10:01:32 -06002159ICD_EXPORT VkResult VKAPI vkCreateDynamicBlendState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002160 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002161 const VkDynamicBlendStateCreateInfo* pCreateInfo,
2162 VkDynamicBlendState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002163{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002164 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002165 struct nulldrv_dev *dev = nulldrv_dev(device);
2166
2167 return nulldrv_blend_state_create(dev, pCreateInfo,
2168 (struct nulldrv_dynamic_cb **) pState);
2169}
2170
Cody Northrope4bc6942015-08-26 10:01:32 -06002171ICD_EXPORT VkResult VKAPI vkDestroyDynamicBlendState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002172 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002173 VkDynamicBlendState dynamicBlendState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002174{
2175 NULLDRV_LOG_FUNC;
2176 return VK_SUCCESS;
2177}
2178
Cody Northrope4bc6942015-08-26 10:01:32 -06002179ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthBoundsState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002180 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002181 const VkDynamicDepthBoundsStateCreateInfo* pCreateInfo,
2182 VkDynamicDepthBoundsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002183{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002184 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002185 struct nulldrv_dev *dev = nulldrv_dev(device);
2186
Cody Northrope4bc6942015-08-26 10:01:32 -06002187 return nulldrv_depth_bounds_state_create(dev, pCreateInfo,
Cody Northrop2605cb02015-08-18 15:21:16 -06002188 (struct nulldrv_dynamic_depth **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002189}
2190
Cody Northrope4bc6942015-08-26 10:01:32 -06002191ICD_EXPORT VkResult VKAPI vkDestroyDynamicDepthBoundsState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002192 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002193 VkDynamicDepthBoundsState dynamicDepthBoundsState)
Cody Northrop2605cb02015-08-18 15:21:16 -06002194{
2195 NULLDRV_LOG_FUNC;
2196 return VK_SUCCESS;
2197}
2198
2199ICD_EXPORT VkResult VKAPI vkCreateDynamicStencilState(
2200 VkDevice device,
2201 const VkDynamicStencilStateCreateInfo* pCreateInfoFront,
2202 const VkDynamicStencilStateCreateInfo* pCreateInfoBack,
2203 VkDynamicStencilState* pState)
2204{
2205 NULLDRV_LOG_FUNC;
2206 struct nulldrv_dev *dev = nulldrv_dev(device);
2207
2208 return nulldrv_stencil_state_create(dev, pCreateInfoFront, pCreateInfoBack,
2209 (struct nulldrv_dynamic_stencil **) pState);
2210}
2211
2212ICD_EXPORT VkResult VKAPI vkDestroyDynamicStencilState(
2213 VkDevice device,
2214 VkDynamicStencilState dynamicStencilState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002215{
2216 NULLDRV_LOG_FUNC;
2217 return VK_SUCCESS;
2218}
2219
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002220ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2221 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002222 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002223 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002224{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002225 NULLDRV_LOG_FUNC;
2226 struct nulldrv_dev *dev = nulldrv_dev(device);
2227
2228 return nulldrv_buf_view_create(dev, pCreateInfo,
2229 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002230}
2231
Tony Barbourde4124d2015-07-03 10:33:54 -06002232ICD_EXPORT VkResult VKAPI vkDestroyBufferView(
2233 VkDevice device,
2234 VkBufferView bufferView)
2235{
2236 NULLDRV_LOG_FUNC;
2237 return VK_SUCCESS;
2238}
2239
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002240ICD_EXPORT VkResult VKAPI vkCreateImageView(
2241 VkDevice device,
2242 const VkImageViewCreateInfo* pCreateInfo,
2243 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002244{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002245 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002246 struct nulldrv_dev *dev = nulldrv_dev(device);
2247
2248 return nulldrv_img_view_create(dev, pCreateInfo,
2249 (struct nulldrv_img_view **) pView);
2250}
2251
Tony Barbourde4124d2015-07-03 10:33:54 -06002252ICD_EXPORT VkResult VKAPI vkDestroyImageView(
2253 VkDevice device,
2254 VkImageView imageView)
2255{
2256 NULLDRV_LOG_FUNC;
2257 return VK_SUCCESS;
2258}
2259
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002260ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2261 VkDevice device,
2262 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2263 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002264{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002265 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002266 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002267
Chia-I Wu7732cb22015-03-26 15:27:55 +08002268 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002269 (struct nulldrv_desc_layout **) pSetLayout);
2270}
2271
Tony Barbourde4124d2015-07-03 10:33:54 -06002272ICD_EXPORT VkResult VKAPI vkDestroyDescriptorSetLayout(
2273 VkDevice device,
2274 VkDescriptorSetLayout descriptorSetLayout)
2275{
2276 NULLDRV_LOG_FUNC;
2277 return VK_SUCCESS;
2278}
2279
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002280ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2281 VkDevice device,
2282 const VkPipelineLayoutCreateInfo* pCreateInfo,
2283 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002284{
2285 NULLDRV_LOG_FUNC;
2286 struct nulldrv_dev *dev = nulldrv_dev(device);
2287
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002288 return nulldrv_pipeline_layout_create(dev,
2289 pCreateInfo,
2290 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002291}
2292
Tony Barbourde4124d2015-07-03 10:33:54 -06002293ICD_EXPORT VkResult VKAPI vkDestroyPipelineLayout(
2294 VkDevice device,
2295 VkPipelineLayout pipelineLayout)
2296{
2297 NULLDRV_LOG_FUNC;
2298 return VK_SUCCESS;
2299}
2300
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002301ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2302 VkDevice device,
2303 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002304 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002305 const VkDescriptorPoolCreateInfo* pCreateInfo,
2306 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002307{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002308 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002309 struct nulldrv_dev *dev = nulldrv_dev(device);
2310
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002311 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2312 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002313}
2314
Tony Barbourde4124d2015-07-03 10:33:54 -06002315ICD_EXPORT VkResult VKAPI vkDestroyDescriptorPool(
2316 VkDevice device,
2317 VkDescriptorPool descriptorPool)
2318{
2319 NULLDRV_LOG_FUNC;
2320 return VK_SUCCESS;
2321}
2322
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002323ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002324 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002325 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002326{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002327 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002328 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002329}
2330
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002331ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002332 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002333 VkDescriptorPool descriptorPool,
2334 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002335 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002336 const VkDescriptorSetLayout* pSetLayouts,
Cody Northropc8aa4a52015-08-03 12:47:29 -06002337 VkDescriptorSet* pDescriptorSets)
David Pinedo0257fbf2015-02-02 18:02:40 -07002338{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002339 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002340 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2341 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002342 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002343 uint32_t i;
2344
2345 for (i = 0; i < count; i++) {
2346 const struct nulldrv_desc_layout *layout =
Tony Barbour8db65372015-07-10 18:32:33 -06002347 nulldrv_desc_layout(pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002348
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002349 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002350 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002351 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002352 break;
2353 }
2354
David Pinedo0257fbf2015-02-02 18:02:40 -07002355 return ret;
2356}
2357
Tony Barbourb857d312015-07-10 10:50:45 -06002358ICD_EXPORT VkResult VKAPI vkFreeDescriptorSets(
2359 VkDevice device,
2360 VkDescriptorPool descriptorPool,
2361 uint32_t count,
2362 const VkDescriptorSet* pDescriptorSets)
2363{
2364 NULLDRV_LOG_FUNC;
2365 return VK_SUCCESS;
2366}
2367
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002368ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2369 VkDevice device,
2370 uint32_t writeCount,
2371 const VkWriteDescriptorSet* pDescriptorWrites,
2372 uint32_t copyCount,
2373 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002374{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002375 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002376 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002377}
2378
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002379ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2380 VkDevice device,
2381 const VkFramebufferCreateInfo* info,
2382 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002383{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002384 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002385 struct nulldrv_dev *dev = nulldrv_dev(device);
2386
2387 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2388}
2389
Tony Barbourde4124d2015-07-03 10:33:54 -06002390ICD_EXPORT VkResult VKAPI vkDestroyFramebuffer(
2391 VkDevice device,
2392 VkFramebuffer framebuffer)
2393{
2394 NULLDRV_LOG_FUNC;
2395 return VK_SUCCESS;
2396}
David Pinedo0257fbf2015-02-02 18:02:40 -07002397
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002398ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2399 VkDevice device,
2400 const VkRenderPassCreateInfo* info,
2401 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002402{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002403 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002404 struct nulldrv_dev *dev = nulldrv_dev(device);
2405
2406 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2407}
2408
Tony Barbourde4124d2015-07-03 10:33:54 -06002409ICD_EXPORT VkResult VKAPI vkDestroyRenderPass(
2410 VkDevice device,
2411 VkRenderPass renderPass)
2412{
2413 NULLDRV_LOG_FUNC;
2414 return VK_SUCCESS;
2415}
2416
Courtney Goeltzenleuchtera375b622015-07-27 14:04:01 -06002417ICD_EXPORT void VKAPI vkCmdPushConstants(
2418 VkCmdBuffer cmdBuffer,
2419 VkPipelineLayout layout,
2420 VkShaderStageFlags stageFlags,
2421 uint32_t start,
2422 uint32_t length,
2423 const void* values)
2424{
2425 /* TODO: Implement */
2426}
2427
Courtney Goeltzenleuchter07fe0662015-07-27 13:47:08 -06002428ICD_EXPORT VkResult VKAPI vkGetRenderAreaGranularity(
2429 VkDevice device,
2430 VkRenderPass renderPass,
2431 VkExtent2D* pGranularity)
2432{
2433 pGranularity->height = 1;
2434 pGranularity->width = 1;
2435
2436 return VK_SUCCESS;
2437}
2438
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002439ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Chia-I Wuc278df82015-07-07 11:50:03 +08002440 VkCmdBuffer cmdBuffer,
2441 const VkRenderPassBeginInfo* pRenderPassBegin,
2442 VkRenderPassContents contents)
2443{
2444 NULLDRV_LOG_FUNC;
2445}
2446
2447ICD_EXPORT void VKAPI vkCmdNextSubpass(
2448 VkCmdBuffer cmdBuffer,
2449 VkRenderPassContents contents)
David Pinedo0257fbf2015-02-02 18:02:40 -07002450{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002451 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002452}
2453
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002454ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002455 VkCmdBuffer cmdBuffer)
2456{
2457 NULLDRV_LOG_FUNC;
2458}
2459
2460ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2461 VkCmdBuffer cmdBuffer,
2462 uint32_t cmdBuffersCount,
2463 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002464{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002465 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002466}
Ian Elliottf93069f2015-02-19 14:26:19 -07002467
2468ICD_EXPORT void* xcbCreateWindow(
2469 uint16_t width,
2470 uint16_t height)
2471{
2472 static uint32_t window; // Kludge to the max
2473 NULLDRV_LOG_FUNC;
2474 return &window;
2475}
2476
2477// May not be needed, if we stub out stuf in tri.c
2478ICD_EXPORT void xcbDestroyWindow()
2479{
2480 NULLDRV_LOG_FUNC;
2481}
2482
2483ICD_EXPORT int xcbGetMessage(void *msg)
2484{
2485 NULLDRV_LOG_FUNC;
2486 return 0;
2487}
2488
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002489ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002490{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002491 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002492}
David Pinedo07494fd2015-07-24 10:54:41 -06002493
2494ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceImageFormatProperties(
2495 VkPhysicalDevice physicalDevice,
2496 VkFormat format,
2497 VkImageType type,
2498 VkImageTiling tiling,
2499 VkImageUsageFlags usage,
2500 VkImageFormatProperties* pImageFormatProperties)
2501{
2502 return VK_ERROR_UNAVAILABLE;
2503}