blob: 37a93249e16904b8f5b88b93e430c8c3114b363e [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 Elliott53bd3dc2015-07-06 14:29:31 -060043 [NULLDRV_EXT_WSI_SWAPCHAIN] = VK_WSI_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 Elliott53bd3dc2015-07-06 14:29:31 -060047 .extName = VK_WSI_SWAPCHAIN_EXTENSION_NAME,
48 .specVersion = VK_WSI_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,
Chia-I Wuc278df82015-07-07 11:50:03 +0800238 const VkAttachmentViewCreateInfo *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 Northropf5bd2252015-08-17 11:10:49 -0600521static VkResult nulldrv_raster_line_state_create(struct nulldrv_dev *dev,
522 const VkDynamicRasterLineStateCreateInfo *info,
523 struct nulldrv_dynamic_rs_line **state_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700524{
Cody Northropf5bd2252015-08-17 11:10:49 -0600525 struct nulldrv_dynamic_rs_line *state;
David Pinedo0257fbf2015-02-02 18:02:40 -0700526
Cody Northropf5bd2252015-08-17 11:10:49 -0600527 state = (struct nulldrv_dynamic_rs_line *) nulldrv_base_create(dev,
528 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RASTER_LINE_STATE);
529 if (!state)
530 return VK_ERROR_OUT_OF_HOST_MEMORY;
531
532 *state_ret = state;
533
534 return VK_SUCCESS;
535}
536
537static VkResult nulldrv_raster_depth_bias_state_create(struct nulldrv_dev *dev,
538 const VkDynamicRasterDepthBiasStateCreateInfo *info,
539 struct nulldrv_dynamic_rs_depth_bias **state_ret)
540{
541 struct nulldrv_dynamic_rs_depth_bias *state;
542
543 state = (struct nulldrv_dynamic_rs_depth_bias *) nulldrv_base_create(dev,
544 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RASTER_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,
Tony Barbourde4124d2015-07-03 10:33:54 -0600554 const VkDynamicColorBlendStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700555 struct nulldrv_dynamic_cb **state_ret)
556{
557 struct nulldrv_dynamic_cb *state;
558
559 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600560 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_COLOR_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
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600569static VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600570 const VkDynamicDepthStencilStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700571 struct nulldrv_dynamic_ds **state_ret)
572{
573 struct nulldrv_dynamic_ds *state;
574
575 state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600576 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_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
585
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600586static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
587 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700588 struct nulldrv_cmd **cmd_ret)
589{
David Pinedo0257fbf2015-02-02 18:02:40 -0700590 struct nulldrv_cmd *cmd;
591
David Pinedo0257fbf2015-02-02 18:02:40 -0700592 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600593 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700594 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600595 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700596
597 *cmd_ret = cmd;
598
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600599 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700600}
601
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600602static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
603 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700604 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600605 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800606 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700607{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800608 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700609
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800610 pool = (struct nulldrv_desc_pool *)
611 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600612 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800613 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600614 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700615
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800616 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700617
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800618 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700619
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600620 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700621}
622
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600623static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800624 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600625 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700626 const struct nulldrv_desc_layout *layout,
627 struct nulldrv_desc_set **set_ret)
628{
629 struct nulldrv_desc_set *set;
630
631 set = (struct nulldrv_desc_set *)
632 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600633 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700634 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600635 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700636
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800637 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700638 set->layout = layout;
639 *set_ret = set;
640
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600641 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700642}
643
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600644static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700645{
Tony Barbourde4124d2015-07-03 10:33:54 -0600646 return *(struct nulldrv_desc_pool **) &pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700647}
648
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600649static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
650 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700651 struct nulldrv_framebuffer ** fb_ret)
652{
653
654 struct nulldrv_framebuffer *fb;
655 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600656 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700657 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600658 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700659
660 *fb_ret = fb;
661
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600662 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700663
664}
665
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600666static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
667 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700668 struct nulldrv_render_pass** rp_ret)
669{
670 struct nulldrv_render_pass *rp;
671 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600672 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700673 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600674 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700675
676 *rp_ret = rp;
677
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600678 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700679}
680
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600681static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700682{
Tony Barbourde4124d2015-07-03 10:33:54 -0600683 return *(struct nulldrv_buf **) &buf;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700684}
685
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600686static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600687 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700688 struct nulldrv_buf_view **view_ret)
689{
690 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
691 struct nulldrv_buf_view *view;
692
693 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600694 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700695 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600696 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700697
698 view->buf = buf;
699
700 *view_ret = view;
701
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600702 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700703}
704
David Pinedo0257fbf2015-02-02 18:02:40 -0700705
706//*********************************************
707// Driver entry points
708//*********************************************
709
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600710ICD_EXPORT VkResult VKAPI vkCreateBuffer(
711 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600712 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600713 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700714{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700715 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700716 struct nulldrv_dev *dev = nulldrv_dev(device);
717
718 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
719}
720
Tony Barbourde4124d2015-07-03 10:33:54 -0600721ICD_EXPORT VkResult VKAPI vkDestroyBuffer(
722 VkDevice device,
723 VkBuffer buffer)
724{
725 NULLDRV_LOG_FUNC;
726 return VK_SUCCESS;
727}
728
Cody Northropf02f9f82015-07-09 18:08:05 -0600729ICD_EXPORT VkResult VKAPI vkCreateCommandPool(
730 VkDevice device,
731 const VkCmdPoolCreateInfo* pCreateInfo,
732 VkCmdPool* pCmdPool)
733{
734 NULLDRV_LOG_FUNC;
735 return VK_SUCCESS;
736}
737
738ICD_EXPORT VkResult VKAPI vkDestroyCommandPool(
739 VkDevice device,
740 VkCmdPool cmdPool)
741{
742 NULLDRV_LOG_FUNC;
743 return VK_SUCCESS;
744}
745
746ICD_EXPORT VkResult VKAPI vkResetCommandPool(
747 VkDevice device,
748 VkCmdPool cmdPool,
749 VkCmdPoolResetFlags flags)
750{
751 NULLDRV_LOG_FUNC;
752 return VK_SUCCESS;
753}
754
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600755ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
756 VkDevice device,
757 const VkCmdBufferCreateInfo* pCreateInfo,
758 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700759{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700760 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700761 struct nulldrv_dev *dev = nulldrv_dev(device);
762
763 return nulldrv_cmd_create(dev, pCreateInfo,
764 (struct nulldrv_cmd **) pCmdBuffer);
765}
766
Tony Barbourde4124d2015-07-03 10:33:54 -0600767ICD_EXPORT VkResult VKAPI vkDestroyCommandBuffer(
768 VkDevice device,
769 VkCmdBuffer cmdBuffer)
770{
771 NULLDRV_LOG_FUNC;
772 return VK_SUCCESS;
773}
774
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600775ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
776 VkCmdBuffer cmdBuffer,
777 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700778{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700779 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600780 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700781}
782
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600783ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
784 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700785{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700786 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600787 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700788}
789
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600790ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
Cody Northropf02f9f82015-07-09 18:08:05 -0600791 VkCmdBuffer cmdBuffer,
792 VkCmdBufferResetFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700793{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700794 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600795 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700796}
797
Ian Elliott64a68e12015-04-16 11:57:46 -0600798static const VkFormat nulldrv_presentable_formats[] = {
799 VK_FORMAT_B8G8R8A8_UNORM,
800};
801
Jon Ashburnba4a1952015-06-16 12:44:51 -0600802#if 0
Ian Elliott64a68e12015-04-16 11:57:46 -0600803ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
804 VkDisplayWSI display,
805 VkDisplayInfoTypeWSI infoType,
806 size_t* pDataSize,
807 void* pData)
808{
809 VkResult ret = VK_SUCCESS;
810
811 NULLDRV_LOG_FUNC;
812
813 if (!pDataSize)
814 return VK_ERROR_INVALID_POINTER;
815
816 switch (infoType) {
817 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
818 {
819 VkDisplayFormatPropertiesWSI *dst = pData;
820 size_t size_ret;
821 uint32_t i;
822
823 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
824
825 if (dst && *pDataSize < size_ret)
826 return VK_ERROR_INVALID_VALUE;
827
828 *pDataSize = size_ret;
829 if (!dst)
830 return VK_SUCCESS;
831
832 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
833 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
834 }
835 break;
836 default:
837 ret = VK_ERROR_INVALID_VALUE;
838 break;
839 }
840
841 return ret;
842}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600843#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600844
845ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
846 VkDevice device,
847 const VkSwapChainCreateInfoWSI* pCreateInfo,
848 VkSwapChainWSI* pSwapChain)
849{
850 NULLDRV_LOG_FUNC;
851 struct nulldrv_dev *dev = nulldrv_dev(device);
852 struct nulldrv_swap_chain *sc;
853
854 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600855 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600856 if (!sc) {
857 return VK_ERROR_OUT_OF_HOST_MEMORY;
858 }
859 sc->dev = dev;
860
Tony Barbour7910de72015-07-13 16:37:21 -0600861 *(VkSwapChainWSI **)pSwapChain = *(VkSwapChainWSI **)&sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600862
863 return VK_SUCCESS;
864}
865
866ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600867 VkDevice device,
Ian Elliott64a68e12015-04-16 11:57:46 -0600868 VkSwapChainWSI swapChain)
869{
870 NULLDRV_LOG_FUNC;
Tony Barbour7910de72015-07-13 16:37:21 -0600871 struct nulldrv_swap_chain *sc = *(struct nulldrv_swap_chain **) &swapChain;
Ian Elliott64a68e12015-04-16 11:57:46 -0600872
873 free(sc);
874
875 return VK_SUCCESS;
876}
877
Ian Elliott3333bb42015-08-10 13:56:08 -0600878ICD_EXPORT VkResult VKAPI vkGetSwapChainImagesWSI(
879 VkDevice device,
880 VkSwapChainWSI swapChain,
881 uint32_t* pCount,
882 VkImage* pSwapChainImages)
Ian Elliott64a68e12015-04-16 11:57:46 -0600883{
884 NULLDRV_LOG_FUNC;
Tony Barbour7910de72015-07-13 16:37:21 -0600885 struct nulldrv_swap_chain *sc = *(struct nulldrv_swap_chain **) &swapChain;
Ian Elliott64a68e12015-04-16 11:57:46 -0600886 struct nulldrv_dev *dev = sc->dev;
887 VkResult ret = VK_SUCCESS;
888
Ian Elliott3333bb42015-08-10 13:56:08 -0600889 *pCount = 2;
890 if (pSwapChainImages) {
891 uint32_t i;
892 for (i = 0; i < 2; i++) {
Ian Elliott64a68e12015-04-16 11:57:46 -0600893 struct nulldrv_img *img;
Ian Elliott64a68e12015-04-16 11:57:46 -0600894
895 img = (struct nulldrv_img *) nulldrv_base_create(dev,
896 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600897 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600898 if (!img)
899 return VK_ERROR_OUT_OF_HOST_MEMORY;
Ian Elliott3333bb42015-08-10 13:56:08 -0600900 pSwapChainImages[i].handle = (uint64_t) &img;
Ian Elliott64a68e12015-04-16 11:57:46 -0600901 }
Ian Elliott64a68e12015-04-16 11:57:46 -0600902 }
903
904 return ret;
905}
906
Tony Barbour7910de72015-07-13 16:37:21 -0600907ICD_EXPORT VkResult VKAPI vkAcquireNextImageWSI(
908 VkDevice device,
909 VkSwapChainWSI swapChain,
910 uint64_t timeout,
911 VkSemaphore semaphore,
912 uint32_t* pImageIndex)
913{
914 NULLDRV_LOG_FUNC;
915
916 return VK_SUCCESS;
917}
918
Ian Elliott3333bb42015-08-10 13:56:08 -0600919VkResult VKAPI vkGetSurfacePropertiesWSI(
Tony Barbour7910de72015-07-13 16:37:21 -0600920 VkDevice device,
921 const VkSurfaceDescriptionWSI* pSurfaceDescription,
Ian Elliott3333bb42015-08-10 13:56:08 -0600922 VkSurfacePropertiesWSI* pSurfaceProperties)
923{
924 NULLDRV_LOG_FUNC;
925
926 return VK_SUCCESS;
927}
928
929VkResult VKAPI vkGetSurfaceFormatsWSI(
930 VkDevice device,
931 const VkSurfaceDescriptionWSI* pSurfaceDescription,
932 uint32_t* pCount,
933 VkSurfaceFormatWSI* pSurfaceFormats)
934{
935 NULLDRV_LOG_FUNC;
936
937 return VK_SUCCESS;
938}
939
940VkResult VKAPI vkGetSurfacePresentModesWSI(
941 VkDevice device,
942 const VkSurfaceDescriptionWSI* pSurfaceDescription,
943 uint32_t* pCount,
944 VkPresentModeWSI* pPresentModes)
Tony Barbour7910de72015-07-13 16:37:21 -0600945{
946 NULLDRV_LOG_FUNC;
947
948 return VK_SUCCESS;
949}
950
951ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSurfaceSupportWSI(
952 VkPhysicalDevice physicalDevice,
953 uint32_t queueFamilyIndex,
954 const VkSurfaceDescriptionWSI* pSurfaceDescription,
955 VkBool32* pSupported)
956{
957 NULLDRV_LOG_FUNC;
958
959 return VK_SUCCESS;
960}
961
Ian Elliott64a68e12015-04-16 11:57:46 -0600962ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600963 VkQueue queue_,
964 VkPresentInfoWSI* pPresentInfo)
Ian Elliott64a68e12015-04-16 11:57:46 -0600965{
966 NULLDRV_LOG_FUNC;
967
968 return VK_SUCCESS;
969}
970
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600971ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600972 VkCmdBuffer cmdBuffer,
973 VkBuffer srcBuffer,
974 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700975 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600976 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700977{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700978 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700979}
980
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600981ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600982 VkCmdBuffer cmdBuffer,
983 VkImage srcImage,
984 VkImageLayout srcImageLayout,
985 VkImage destImage,
986 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700987 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600988 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700989{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700990 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700991}
992
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600993ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600994 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500995 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600996 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500997 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600998 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500999 uint32_t regionCount,
1000 const VkImageBlit* pRegions,
1001 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -06001002{
1003 NULLDRV_LOG_FUNC;
1004}
1005
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001006ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001007 VkCmdBuffer cmdBuffer,
1008 VkBuffer srcBuffer,
1009 VkImage destImage,
1010 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001011 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001012 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001013{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001014 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001015}
1016
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001017ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001018 VkCmdBuffer cmdBuffer,
1019 VkImage srcImage,
1020 VkImageLayout srcImageLayout,
1021 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001022 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001023 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001024{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001025 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001026}
1027
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001028ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001029 VkCmdBuffer cmdBuffer,
1030 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001031 VkDeviceSize destOffset,
1032 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001033 const uint32_t* pData)
1034{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001035 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001036}
1037
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001038ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001039 VkCmdBuffer cmdBuffer,
1040 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001041 VkDeviceSize destOffset,
1042 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001043 uint32_t data)
1044{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001045 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001046}
1047
Ian Elliotte924ab22015-07-08 13:24:30 -06001048ICD_EXPORT void VKAPI vkCmdClearDepthStencilImage(
1049 VkCmdBuffer cmdBuffer,
1050 VkImage image,
1051 VkImageLayout imageLayout,
1052 float depth,
1053 uint32_t stencil,
1054 uint32_t rangeCount,
1055 const VkImageSubresourceRange* pRanges)
1056{
1057 NULLDRV_LOG_FUNC;
1058}
1059
1060ICD_EXPORT void VKAPI vkCmdClearColorAttachment(
1061 VkCmdBuffer cmdBuffer,
1062 uint32_t colorAttachment,
1063 VkImageLayout imageLayout,
1064 const VkClearColorValue *pColor,
1065 uint32_t rectCount,
1066 const VkRect3D *pRects)
1067{
1068 NULLDRV_LOG_FUNC;
1069}
1070
1071ICD_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(
1072 VkCmdBuffer cmdBuffer,
1073 VkImageAspectFlags imageAspectMask,
1074 VkImageLayout imageLayout,
1075 float depth,
1076 uint32_t stencil,
1077 uint32_t rectCount,
1078 const VkRect3D *pRects)
1079{
1080 NULLDRV_LOG_FUNC;
1081}
1082
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001083ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001084 VkCmdBuffer cmdBuffer,
1085 VkImage image,
1086 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +12001087 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001088 uint32_t rangeCount,
1089 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001090{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001091 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001092}
1093
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001094ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001095 VkCmdBuffer cmdBuffer,
1096 VkImage image,
1097 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001098 float depth,
1099 uint32_t stencil,
1100 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001101 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001102{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001103 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001104}
1105
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001106ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001107 VkCmdBuffer cmdBuffer,
1108 VkImage srcImage,
1109 VkImageLayout srcImageLayout,
1110 VkImage destImage,
1111 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001112 uint32_t regionCount,
1113 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001114{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001115 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001116}
1117
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001118ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001119 VkCmdBuffer cmdBuffer,
1120 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001121 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001122 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001123{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001124 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001125}
1126
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001127ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001128 VkCmdBuffer cmdBuffer,
1129 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001130 uint32_t slot)
1131{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001132 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001133}
1134
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001135ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001136 VkCmdBuffer cmdBuffer,
1137 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001138 uint32_t startQuery,
1139 uint32_t queryCount)
1140{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001141 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001142}
1143
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001144ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001145 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001146 VkEvent event_,
1147 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001148{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001149 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001150}
1151
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001152ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001153 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001154 VkEvent event_,
1155 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001156{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001157 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001158}
1159
Ian Elliott63f1edb2015-04-16 18:10:19 -06001160ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1161 VkCmdBuffer cmdBuffer,
1162 VkQueryPool queryPool,
1163 uint32_t startQuery,
1164 uint32_t queryCount,
1165 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001166 VkDeviceSize destOffset,
1167 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001168 VkFlags flags)
1169{
1170 NULLDRV_LOG_FUNC;
1171}
1172
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001173ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001174 VkCmdBuffer cmdBuffer,
1175 VkTimestampType timestampType,
1176 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001177 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001178{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001179 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001180}
1181
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001182ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001183 VkCmdBuffer cmdBuffer,
Tony Barbourde4124d2015-07-03 10:33:54 -06001184 VkPipelineBindPoint pipelineBindPoint,
1185 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001186{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001187 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001188}
1189
Tony Barbourde4124d2015-07-03 10:33:54 -06001190ICD_EXPORT void VKAPI vkCmdBindDynamicViewportState(
1191 VkCmdBuffer cmdBuffer,
1192 VkDynamicViewportState state)
1193{
1194 NULLDRV_LOG_FUNC;
1195}
1196
Cody Northropf5bd2252015-08-17 11:10:49 -06001197ICD_EXPORT void VKAPI vkCmdBindDynamicRasterLineState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001198 VkCmdBuffer cmdBuffer,
Cody Northropf5bd2252015-08-17 11:10:49 -06001199 VkDynamicRasterLineState state)
1200{
1201 NULLDRV_LOG_FUNC;
1202}
1203
1204ICD_EXPORT void VKAPI vkCmdBindDynamicRasterDepthBiasState(
1205 VkCmdBuffer cmdBuffer,
1206 VkDynamicRasterDepthBiasState state)
Tony Barbourde4124d2015-07-03 10:33:54 -06001207{
1208 NULLDRV_LOG_FUNC;
1209}
1210
1211ICD_EXPORT void VKAPI vkCmdBindDynamicColorBlendState(
1212 VkCmdBuffer cmdBuffer,
1213 VkDynamicColorBlendState state)
1214{
1215 NULLDRV_LOG_FUNC;
1216}
1217
1218ICD_EXPORT void VKAPI vkCmdBindDynamicDepthStencilState(
1219 VkCmdBuffer cmdBuffer,
1220 VkDynamicDepthStencilState state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001221{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001222 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001223}
1224
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001225ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001226 VkCmdBuffer cmdBuffer,
1227 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001228 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001229 uint32_t firstSet,
1230 uint32_t setCount,
1231 const VkDescriptorSet* pDescriptorSets,
1232 uint32_t dynamicOffsetCount,
1233 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001234{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001235 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001236}
1237
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001238ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1239 VkCmdBuffer cmdBuffer,
1240 uint32_t startBinding,
1241 uint32_t bindingCount,
1242 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001243 const VkDeviceSize* pOffsets)
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 vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001249 VkCmdBuffer cmdBuffer,
1250 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001251 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001252 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001253{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001254 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001255}
1256
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001257ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001258 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001259 uint32_t firstVertex,
1260 uint32_t vertexCount,
1261 uint32_t firstInstance,
1262 uint32_t instanceCount)
1263{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001264 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001265}
1266
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001267ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001268 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001269 uint32_t firstIndex,
1270 uint32_t indexCount,
1271 int32_t vertexOffset,
1272 uint32_t firstInstance,
1273 uint32_t instanceCount)
1274{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001275 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001276}
1277
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001278ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001279 VkCmdBuffer cmdBuffer,
1280 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001281 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001282 uint32_t count,
1283 uint32_t stride)
1284{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001285 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001286}
1287
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001288ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001289 VkCmdBuffer cmdBuffer,
1290 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001291 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001292 uint32_t count,
1293 uint32_t stride)
1294{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001295 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001296}
1297
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001298ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001299 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001300 uint32_t x,
1301 uint32_t y,
1302 uint32_t z)
1303{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001304 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001305}
1306
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001307ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001308 VkCmdBuffer cmdBuffer,
1309 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001310 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001311{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001312 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001313}
1314
Tony Barbour8205d902015-04-16 15:59:00 -06001315void VKAPI vkCmdWaitEvents(
1316 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001317 uint32_t eventCount,
1318 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001319 VkPipelineStageFlags sourceStageMask,
1320 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001321 uint32_t memBarrierCount,
Courtney Goeltzenleuchterd9ba3422015-07-12 12:58:58 -06001322 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001323{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001324 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001325}
1326
Tony Barbour8205d902015-04-16 15:59:00 -06001327void VKAPI vkCmdPipelineBarrier(
1328 VkCmdBuffer cmdBuffer,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001329 VkPipelineStageFlags srcStageMask,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001330 VkPipelineStageFlags destStageMask,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001331 VkBool32 byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001332 uint32_t memBarrierCount,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001333 const void* const* ppMemBarriers)
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
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001338ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001339 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001340 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001341 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001342{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001343 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001344 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1345 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1346}
1347
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001348ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1349 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001350{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001351 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001352 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001353}
1354
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001355ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1356 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001357 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001358 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001359 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001360{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001361 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001362 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001363 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001364 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001365}
1366
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001367ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1368 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001369{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001370 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001371 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001372}
1373
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001374ICD_EXPORT VkResult VKAPI vkCreateEvent(
1375 VkDevice device,
1376 const VkEventCreateInfo* pCreateInfo,
1377 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001378{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001379 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001380 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001381}
1382
Tony Barbourde4124d2015-07-03 10:33:54 -06001383ICD_EXPORT VkResult VKAPI vkDestroyEvent(
1384 VkDevice device,
1385 VkEvent event)
1386{
1387 NULLDRV_LOG_FUNC;
1388 return VK_SUCCESS;
1389}
1390
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001391ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001392 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001393 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001394{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001395 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001396 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001397}
1398
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001399ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001400 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001401 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001402{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001403 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001404 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001405}
1406
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001407ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001408 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001409 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001410{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001411 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001412 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001413}
1414
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001415ICD_EXPORT VkResult VKAPI vkCreateFence(
1416 VkDevice device,
1417 const VkFenceCreateInfo* pCreateInfo,
1418 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001419{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001420 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001421 struct nulldrv_dev *dev = nulldrv_dev(device);
1422
1423 return nulldrv_fence_create(dev, pCreateInfo,
1424 (struct nulldrv_fence **) pFence);
1425}
1426
Tony Barbourde4124d2015-07-03 10:33:54 -06001427ICD_EXPORT VkResult VKAPI vkDestroyFence(
1428 VkDevice device,
1429 VkFence fence)
1430{
1431 NULLDRV_LOG_FUNC;
1432 return VK_SUCCESS;
1433}
1434
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001435ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001436 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001437 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001438{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001439 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001440 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001441}
1442
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001443ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001444 VkDevice device,
1445 uint32_t fenceCount,
1446 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001447{
1448 NULLDRV_LOG_FUNC;
1449 return VK_SUCCESS;
1450}
1451
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001452ICD_EXPORT VkResult VKAPI vkWaitForFences(
1453 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001454 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001455 const VkFence* pFences,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001456 VkBool32 waitAll,
David Pinedo0257fbf2015-02-02 18:02:40 -07001457 uint64_t timeout)
1458{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001459 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001460 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001461}
1462
Tony Barbour426b9052015-06-24 16:06:58 -06001463ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1464 VkPhysicalDevice gpu_,
1465 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001466{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001467 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001468 VkResult ret = VK_SUCCESS;
1469
Tony Barbour426b9052015-06-24 16:06:58 -06001470 pProperties->apiVersion = VK_API_VERSION;
1471 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1472 pProperties->vendorId = 0;
1473 pProperties->deviceId = 0;
1474 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1475 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001476
1477 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001478}
1479
Chris Forbesd7576302015-06-21 22:55:02 +12001480ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1481 VkPhysicalDevice physicalDevice,
1482 VkPhysicalDeviceFeatures* pFeatures)
1483{
1484 NULLDRV_LOG_FUNC;
1485 VkResult ret = VK_SUCCESS;
1486
1487 /* TODO: fill out features */
1488 memset(pFeatures, 0, sizeof(*pFeatures));
1489
1490 return ret;
1491}
1492
Courtney Goeltzenleuchter4da96aa2015-07-12 12:52:09 -06001493ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatProperties(
Chris Forbesd7576302015-06-21 22:55:02 +12001494 VkPhysicalDevice physicalDevice,
1495 VkFormat format,
1496 VkFormatProperties* pFormatInfo)
1497{
1498 NULLDRV_LOG_FUNC;
1499 VkResult ret = VK_SUCCESS;
1500
1501 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1502 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1503
1504 return ret;
1505}
1506
1507ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1508 VkPhysicalDevice physicalDevice,
1509 VkPhysicalDeviceLimits* pLimits)
1510{
1511 NULLDRV_LOG_FUNC;
1512 VkResult ret = VK_SUCCESS;
1513
1514 /* TODO: fill out limits */
1515 memset(pLimits, 0, sizeof(*pLimits));
1516
1517 return ret;
1518}
1519
Cody Northropef72e2a2015-08-03 17:04:53 -06001520ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueFamilyProperties(
Tony Barbour426b9052015-06-24 16:06:58 -06001521 VkPhysicalDevice gpu_,
Cody Northropef72e2a2015-08-03 17:04:53 -06001522 uint32_t* pCount,
1523 VkQueueFamilyProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001524 {
Cody Northropef72e2a2015-08-03 17:04:53 -06001525 if (pProperties == NULL) {
1526 *pCount = 1;
1527 return VK_SUCCESS;
1528 }
Tony Barbour426b9052015-06-24 16:06:58 -06001529 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1530 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001531 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001532
Tony Barbour426b9052015-06-24 16:06:58 -06001533 return VK_SUCCESS;
1534}
1535
Ian Elliotte924ab22015-07-08 13:24:30 -06001536ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(
1537 VkPhysicalDevice gpu_,
1538 VkPhysicalDeviceMemoryProperties* pProperties)
1539{
1540 // TODO: Fill in with real data
1541 return VK_SUCCESS;
1542}
1543
1544ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLayerProperties(
1545 VkPhysicalDevice physicalDevice,
1546 uint32_t* pCount,
1547 VkLayerProperties* pProperties)
1548{
1549 // TODO: Fill in with real data
1550 return VK_SUCCESS;
1551}
1552
Tony Barbour426b9052015-06-24 16:06:58 -06001553ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001554 const char* pLayerName,
1555 uint32_t* pCount,
1556 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001557{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001558 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001559
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001560 if (pCount == NULL) {
1561 return VK_ERROR_INVALID_POINTER;
1562 }
Tony Barbour426b9052015-06-24 16:06:58 -06001563
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001564 if (pProperties == NULL) {
1565 *pCount = NULLDRV_EXT_COUNT;
1566 return VK_SUCCESS;
1567 }
Tony Barbour426b9052015-06-24 16:06:58 -06001568
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001569 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1570 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1571 *pCount = copy_size;
1572 if (copy_size < NULLDRV_EXT_COUNT) {
1573 return VK_INCOMPLETE;
1574 }
Tony Barbour426b9052015-06-24 16:06:58 -06001575 return VK_SUCCESS;
1576}
Ian Elliotte924ab22015-07-08 13:24:30 -06001577ICD_EXPORT VkResult VKAPI vkGetGlobalLayerProperties(
1578 uint32_t* pCount,
1579 VkLayerProperties* pProperties)
1580{
1581 // TODO: Fill in with real data
1582 return VK_SUCCESS;
1583}
Tony Barbour426b9052015-06-24 16:06:58 -06001584
1585VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001586 VkPhysicalDevice physicalDevice,
1587 const char* pLayerName,
1588 uint32_t* pCount,
1589 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001590{
Tony Barbour426b9052015-06-24 16:06:58 -06001591
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001592 if (pCount == NULL) {
1593 return VK_ERROR_INVALID_POINTER;
1594 }
1595
Tony Barbour426b9052015-06-24 16:06:58 -06001596 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001597
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001598 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001599}
1600
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001601ICD_EXPORT VkResult VKAPI vkCreateImage(
1602 VkDevice device,
1603 const VkImageCreateInfo* pCreateInfo,
1604 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001605{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001606 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001607 struct nulldrv_dev *dev = nulldrv_dev(device);
1608
1609 return nulldrv_img_create(dev, pCreateInfo, false,
1610 (struct nulldrv_img **) pImage);
1611}
1612
Tony Barbourde4124d2015-07-03 10:33:54 -06001613ICD_EXPORT VkResult VKAPI vkDestroyImage(
1614 VkDevice device,
1615 VkImage image)
1616{
1617 NULLDRV_LOG_FUNC;
1618 return VK_SUCCESS;
1619}
1620
Tony Barbour426b9052015-06-24 16:06:58 -06001621ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001622 VkDevice device,
1623 VkImage image,
1624 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001625 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001626{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001627 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001628
Tony Barbour426b9052015-06-24 16:06:58 -06001629 pLayout->offset = 0;
1630 pLayout->size = 1;
1631 pLayout->rowPitch = 4;
1632 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001633
Tony Barbour426b9052015-06-24 16:06:58 -06001634 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001635}
1636
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001637ICD_EXPORT VkResult VKAPI vkAllocMemory(
1638 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001639 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001640 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001641{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001642 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001643 struct nulldrv_dev *dev = nulldrv_dev(device);
1644
1645 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1646}
1647
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001648ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001649 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001650 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001651{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001652 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001653 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001654}
1655
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001656ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001657 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001658 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001659 VkDeviceSize offset,
1660 VkDeviceSize size,
1661 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001662 void** ppData)
1663{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001664 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001665 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1666 void *ptr = nulldrv_mem_map(mem, flags);
1667
1668 *ppData = ptr;
1669
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001670 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001671}
1672
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001673ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001674 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001675 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001676{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001677 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001678 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001679}
1680
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001681ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001682 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001683 uint32_t memRangeCount,
1684 const VkMappedMemoryRange* pMemRanges)
1685{
1686 NULLDRV_LOG_FUNC;
1687 return VK_SUCCESS;
1688}
1689
1690ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1691 VkDevice device,
1692 uint32_t memRangeCount,
1693 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001694{
1695 NULLDRV_LOG_FUNC;
1696 return VK_SUCCESS;
1697}
1698
Courtney Goeltzenleuchterd040c5c2015-07-09 21:57:28 -06001699ICD_EXPORT VkResult VKAPI vkGetDeviceMemoryCommitment(
1700 VkDevice device,
1701 VkDeviceMemory memory,
1702 VkDeviceSize* pCommittedMemoryInBytes)
1703{
1704 return VK_SUCCESS;
1705}
1706
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001707ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001708 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001709 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001710{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001711 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001712 struct nulldrv_instance *inst;
1713
1714 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001715 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001716 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001717 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001718
Tony Barbour426b9052015-06-24 16:06:58 -06001719 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001720
Mike Stroyan230e6252015-04-17 12:36:38 -06001721 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001722
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001723 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001724}
1725
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001726ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1727 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001728{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001729 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001730 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001731}
1732
Tony Barbour8205d902015-04-16 15:59:00 -06001733ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001734 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001735 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001736 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001737{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001738 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001739 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001740 struct nulldrv_gpu *gpu;
1741 *pGpuCount = 1;
1742 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001743 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001744 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001745 return ret;
1746}
1747
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001748ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001749 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001750 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001751 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001752 char* const* pOutLayers,
1753 void* pReserved)
1754{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001755 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001756 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001757}
1758
Tony Barbourde4124d2015-07-03 10:33:54 -06001759ICD_EXPORT VkResult VKAPI vkGetBufferMemoryRequirements(
1760 VkDevice device,
1761 VkBuffer buffer,
1762 VkMemoryRequirements* pMemoryRequirements)
1763{
1764 NULLDRV_LOG_FUNC;
1765 struct nulldrv_base *base = nulldrv_base((void*)buffer.handle);
1766
1767 return base->get_memory_requirements(base, pMemoryRequirements);
1768}
1769
1770ICD_EXPORT VkResult VKAPI vkGetImageMemoryRequirements(
1771 VkDevice device,
1772 VkImage image,
1773 VkMemoryRequirements* pMemoryRequirements)
1774{
1775 NULLDRV_LOG_FUNC;
1776 struct nulldrv_base *base = nulldrv_base((void*)image.handle);
1777
1778 return base->get_memory_requirements(base, pMemoryRequirements);
1779}
1780
1781ICD_EXPORT VkResult VKAPI vkBindBufferMemory(
1782 VkDevice device,
1783 VkBuffer buffer,
1784 VkDeviceMemory mem_,
1785 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001786{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001787 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001788 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001789}
1790
Tony Barbourde4124d2015-07-03 10:33:54 -06001791ICD_EXPORT VkResult VKAPI vkBindImageMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001792 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06001793 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001794 VkDeviceMemory mem_,
1795 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001796{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001797 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001798 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001799}
1800
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001801ICD_EXPORT VkResult VKAPI vkGetImageSparseMemoryRequirements(
1802 VkDevice device,
1803 VkImage image,
1804 uint32_t* pNumRequirements,
1805 VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
1806{
1807 NULLDRV_LOG_FUNC;
1808 return VK_SUCCESS;
1809}
1810
1811ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(
1812 VkPhysicalDevice physicalDevice,
1813 VkFormat format,
1814 VkImageType type,
1815 uint32_t samples,
1816 VkImageUsageFlags usage,
1817 VkImageTiling tiling,
1818 uint32_t* pNumProperties,
1819 VkSparseImageFormatProperties* pProperties)
1820{
1821 NULLDRV_LOG_FUNC;
1822 return VK_SUCCESS;
1823}
1824
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001825ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001826 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001827 VkBuffer buffer,
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001828 uint32_t numBindings,
1829 const VkSparseMemoryBindInfo* pBindInfo)
1830{
1831 NULLDRV_LOG_FUNC;
1832 return VK_SUCCESS;
1833}
1834
1835ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageOpaqueMemory(
1836 VkQueue queue,
1837 VkImage image,
1838 uint32_t numBindings,
1839 const VkSparseMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001840{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001841 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001842 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001843}
1844
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001845ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001846 VkQueue queue,
1847 VkImage image,
1848 uint32_t numBindings,
1849 const VkSparseImageMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001850{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001851 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001852 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001853}
Jon Ashburn0e249962015-07-10 09:41:15 -07001854ICD_EXPORT VkResult VKAPI vkCreatePipelineCache(
1855 VkDevice device,
1856 const VkPipelineCacheCreateInfo* pCreateInfo,
1857 VkPipelineCache* pPipelineCache)
1858{
David Pinedo0257fbf2015-02-02 18:02:40 -07001859
Jon Ashburn0e249962015-07-10 09:41:15 -07001860 NULLDRV_LOG_FUNC;
1861 return VK_SUCCESS;
1862}
1863
Tony Barbourde4124d2015-07-03 10:33:54 -06001864ICD_EXPORT VkResult VKAPI vkDestroyPipeline(
1865 VkDevice device,
1866 VkPipeline pipeline)
1867{
1868 NULLDRV_LOG_FUNC;
1869 return VK_SUCCESS;
1870}
1871
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06001872VkResult VKAPI vkDestroyPipelineCache(
1873 VkDevice device,
1874 VkPipelineCache pipelineCache)
Jon Ashburn0e249962015-07-10 09:41:15 -07001875{
1876 NULLDRV_LOG_FUNC;
1877 return VK_SUCCESS;
1878}
1879
1880ICD_EXPORT size_t VKAPI vkGetPipelineCacheSize(
1881 VkDevice device,
1882 VkPipelineCache pipelineCache)
1883{
1884 NULLDRV_LOG_FUNC;
1885 return VK_ERROR_UNAVAILABLE;
1886}
1887
1888ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
1889 VkDevice device,
1890 VkPipelineCache pipelineCache,
1891 void* pData)
1892{
1893 NULLDRV_LOG_FUNC;
1894 return VK_ERROR_UNAVAILABLE;
1895}
1896
1897ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
1898 VkDevice device,
1899 VkPipelineCache destCache,
1900 uint32_t srcCacheCount,
1901 const VkPipelineCache* pSrcCaches)
1902{
1903 NULLDRV_LOG_FUNC;
1904 return VK_ERROR_UNAVAILABLE;
1905}
1906ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001907 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001908 VkPipelineCache pipelineCache,
1909 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001910 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1911 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001912{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001913 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001914 struct nulldrv_dev *dev = nulldrv_dev(device);
1915
1916 return graphics_pipeline_create(dev, pCreateInfo,
1917 (struct nulldrv_pipeline **) pPipeline);
1918}
1919
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001920
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001921
Jon Ashburn0e249962015-07-10 09:41:15 -07001922ICD_EXPORT VkResult VKAPI vkCreateComputePipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001923 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001924 VkPipelineCache pipelineCache,
1925 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001926 const VkComputePipelineCreateInfo* pCreateInfo,
1927 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001928{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001929 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001930 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001931}
1932
David Pinedo0257fbf2015-02-02 18:02:40 -07001933
David Pinedo0257fbf2015-02-02 18:02:40 -07001934
Jon Ashburn0e249962015-07-10 09:41:15 -07001935
David Pinedo0257fbf2015-02-02 18:02:40 -07001936
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001937ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1938 VkDevice device,
1939 const VkQueryPoolCreateInfo* pCreateInfo,
1940 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001941{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001942 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001943 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001944}
1945
Tony Barbourde4124d2015-07-03 10:33:54 -06001946ICD_EXPORT VkResult VKAPI vkDestroyQueryPool(
1947 VkDevice device,
1948 VkQueryPool queryPoool)
1949{
1950 NULLDRV_LOG_FUNC;
1951 return VK_SUCCESS;
1952}
1953
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001954ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001955 VkDevice device,
1956 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001957 uint32_t startQuery,
1958 uint32_t queryCount,
1959 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001960 void* pData,
1961 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001962{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001963 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001964 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001965}
1966
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001967ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1968 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001969{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001970 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001971 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001972}
1973
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001974ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1975 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001976 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001977 const VkCmdBuffer* pCmdBuffers,
1978 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001979{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001980 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001981 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001982}
1983
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001984ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1985 VkDevice device,
1986 const VkSemaphoreCreateInfo* pCreateInfo,
1987 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001988{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001989 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001990 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001991}
1992
Tony Barbourde4124d2015-07-03 10:33:54 -06001993ICD_EXPORT VkResult VKAPI vkDestroySemaphore(
1994 VkDevice device,
1995 VkSemaphore semaphore)
1996{
1997 NULLDRV_LOG_FUNC;
1998 return VK_SUCCESS;
1999}
2000
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002001ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
2002 VkQueue queue,
2003 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002004{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002005 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002006 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002007}
2008
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002009ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
2010 VkQueue queue,
2011 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002012{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002013 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002014 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002015}
2016
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002017ICD_EXPORT VkResult VKAPI vkCreateSampler(
2018 VkDevice device,
2019 const VkSamplerCreateInfo* pCreateInfo,
2020 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07002021{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002022 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002023 struct nulldrv_dev *dev = nulldrv_dev(device);
2024
2025 return nulldrv_sampler_create(dev, pCreateInfo,
2026 (struct nulldrv_sampler **) pSampler);
2027}
2028
Tony Barbourde4124d2015-07-03 10:33:54 -06002029ICD_EXPORT VkResult VKAPI vkDestroySampler(
2030 VkDevice device,
2031 VkSampler sampler)
2032{
2033 NULLDRV_LOG_FUNC;
2034 return VK_SUCCESS;
2035}
2036
Ian Elliotte924ab22015-07-08 13:24:30 -06002037ICD_EXPORT VkResult VKAPI vkCreateShaderModule(
2038 VkDevice device,
2039 const VkShaderModuleCreateInfo* pCreateInfo,
2040 VkShaderModule* pShaderModule)
2041{
2042 // TODO: Fill in with real data
Tony Barbourde4124d2015-07-03 10:33:54 -06002043 NULLDRV_LOG_FUNC;
2044 return VK_SUCCESS;
2045}
2046
2047ICD_EXPORT VkResult VKAPI vkDestroyShaderModule(
2048 VkDevice device,
2049 VkShaderModule shaderModule)
2050{
2051 // TODO: Fill in with real data
2052 NULLDRV_LOG_FUNC;
Ian Elliotte924ab22015-07-08 13:24:30 -06002053 return VK_SUCCESS;
2054}
2055
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002056ICD_EXPORT VkResult VKAPI vkCreateShader(
2057 VkDevice device,
2058 const VkShaderCreateInfo* pCreateInfo,
2059 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002060{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002061 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002062 struct nulldrv_dev *dev = nulldrv_dev(device);
2063
2064 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2065}
2066
Tony Barbourde4124d2015-07-03 10:33:54 -06002067ICD_EXPORT VkResult VKAPI vkDestroyShader(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002068 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002069 VkShader shader)
2070{
2071 NULLDRV_LOG_FUNC;
2072 return VK_SUCCESS;
2073}
2074
2075ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2076 VkDevice device,
2077 const VkDynamicViewportStateCreateInfo* pCreateInfo,
2078 VkDynamicViewportState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002079{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002080 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002081 struct nulldrv_dev *dev = nulldrv_dev(device);
2082
2083 return nulldrv_viewport_state_create(dev, pCreateInfo,
2084 (struct nulldrv_dynamic_vp **) pState);
2085}
2086
Tony Barbourde4124d2015-07-03 10:33:54 -06002087ICD_EXPORT VkResult VKAPI vkDestroyDynamicViewportState(
2088 VkDevice device,
2089 VkDynamicViewportState dynamicViewportState)
2090{
2091 NULLDRV_LOG_FUNC;
2092 return VK_SUCCESS;
2093}
2094
Cody Northropf5bd2252015-08-17 11:10:49 -06002095ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterLineState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002096 VkDevice device,
Cody Northropf5bd2252015-08-17 11:10:49 -06002097 const VkDynamicRasterLineStateCreateInfo* pCreateInfo,
2098 VkDynamicRasterLineState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002099{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002100 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002101 struct nulldrv_dev *dev = nulldrv_dev(device);
2102
Cody Northropf5bd2252015-08-17 11:10:49 -06002103 return nulldrv_raster_line_state_create(dev, pCreateInfo,
2104 (struct nulldrv_dynamic_rs_line **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002105}
2106
Cody Northropf5bd2252015-08-17 11:10:49 -06002107ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterDepthBiasState(
2108 VkDevice device,
2109 const VkDynamicRasterDepthBiasStateCreateInfo* pCreateInfo,
2110 VkDynamicRasterDepthBiasState* pState)
2111{
2112 NULLDRV_LOG_FUNC;
2113 struct nulldrv_dev *dev = nulldrv_dev(device);
2114
2115 return nulldrv_raster_depth_bias_state_create(dev, pCreateInfo,
2116 (struct nulldrv_dynamic_rs_depth_bias **) pState);
2117}
2118
2119ICD_EXPORT VkResult VKAPI vkDestroyDynamicRasterLinesState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002120 VkDevice device,
Cody Northropf5bd2252015-08-17 11:10:49 -06002121 VkDynamicRasterLineState dynamicRasterLineState)
2122{
2123 NULLDRV_LOG_FUNC;
2124 return VK_SUCCESS;
2125}
2126
2127ICD_EXPORT VkResult VKAPI vkDestroyDynamicRasterDepthBiasState(
2128 VkDevice device,
2129 VkDynamicRasterDepthBiasState dynamicRasterDepthBiasState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002130{
2131 NULLDRV_LOG_FUNC;
2132 return VK_SUCCESS;
2133}
2134
2135ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
2136 VkDevice device,
2137 const VkDynamicColorBlendStateCreateInfo* pCreateInfo,
2138 VkDynamicColorBlendState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002139{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002140 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002141 struct nulldrv_dev *dev = nulldrv_dev(device);
2142
2143 return nulldrv_blend_state_create(dev, pCreateInfo,
2144 (struct nulldrv_dynamic_cb **) pState);
2145}
2146
Tony Barbourde4124d2015-07-03 10:33:54 -06002147ICD_EXPORT VkResult VKAPI vkDestroyDynamicColorBlendState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002148 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002149 VkDynamicColorBlendState dynamicColorBlendState)
2150{
2151 NULLDRV_LOG_FUNC;
2152 return VK_SUCCESS;
2153}
2154
2155ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
2156 VkDevice device,
2157 const VkDynamicDepthStencilStateCreateInfo* pCreateInfo,
2158 VkDynamicDepthStencilState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002159{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002160 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002161 struct nulldrv_dev *dev = nulldrv_dev(device);
2162
2163 return nulldrv_ds_state_create(dev, pCreateInfo,
2164 (struct nulldrv_dynamic_ds **) pState);
2165}
2166
Tony Barbourde4124d2015-07-03 10:33:54 -06002167ICD_EXPORT VkResult VKAPI vkDestroyDynamicDepthStencilState(
2168 VkDevice device,
2169 VkDynamicDepthStencilState dynamicDepthStencilState)
2170{
2171 NULLDRV_LOG_FUNC;
2172 return VK_SUCCESS;
2173}
2174
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002175ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2176 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002177 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002178 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002179{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002180 NULLDRV_LOG_FUNC;
2181 struct nulldrv_dev *dev = nulldrv_dev(device);
2182
2183 return nulldrv_buf_view_create(dev, pCreateInfo,
2184 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002185}
2186
Tony Barbourde4124d2015-07-03 10:33:54 -06002187ICD_EXPORT VkResult VKAPI vkDestroyBufferView(
2188 VkDevice device,
2189 VkBufferView bufferView)
2190{
2191 NULLDRV_LOG_FUNC;
2192 return VK_SUCCESS;
2193}
2194
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002195ICD_EXPORT VkResult VKAPI vkCreateImageView(
2196 VkDevice device,
2197 const VkImageViewCreateInfo* pCreateInfo,
2198 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002199{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002200 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002201 struct nulldrv_dev *dev = nulldrv_dev(device);
2202
2203 return nulldrv_img_view_create(dev, pCreateInfo,
2204 (struct nulldrv_img_view **) pView);
2205}
2206
Tony Barbourde4124d2015-07-03 10:33:54 -06002207ICD_EXPORT VkResult VKAPI vkDestroyImageView(
2208 VkDevice device,
2209 VkImageView imageView)
2210{
2211 NULLDRV_LOG_FUNC;
2212 return VK_SUCCESS;
2213}
2214
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002215ICD_EXPORT VkResult VKAPI vkCreateAttachmentView(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002216 VkDevice device,
Chia-I Wuc278df82015-07-07 11:50:03 +08002217 const VkAttachmentViewCreateInfo* pCreateInfo,
2218 VkAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002219{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002220 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002221 struct nulldrv_dev *dev = nulldrv_dev(device);
2222
2223 return nulldrv_rt_view_create(dev, pCreateInfo,
2224 (struct nulldrv_rt_view **) pView);
2225}
2226
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002227ICD_EXPORT VkResult VKAPI vkDestroyAttachmentView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002228 VkDevice device,
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002229 VkAttachmentView attachmentView)
Tony Barbourde4124d2015-07-03 10:33:54 -06002230{
2231 NULLDRV_LOG_FUNC;
2232 return VK_SUCCESS;
2233}
2234
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002235ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2236 VkDevice device,
2237 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2238 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002239{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002240 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002241 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002242
Chia-I Wu7732cb22015-03-26 15:27:55 +08002243 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002244 (struct nulldrv_desc_layout **) pSetLayout);
2245}
2246
Tony Barbourde4124d2015-07-03 10:33:54 -06002247ICD_EXPORT VkResult VKAPI vkDestroyDescriptorSetLayout(
2248 VkDevice device,
2249 VkDescriptorSetLayout descriptorSetLayout)
2250{
2251 NULLDRV_LOG_FUNC;
2252 return VK_SUCCESS;
2253}
2254
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002255ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2256 VkDevice device,
2257 const VkPipelineLayoutCreateInfo* pCreateInfo,
2258 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002259{
2260 NULLDRV_LOG_FUNC;
2261 struct nulldrv_dev *dev = nulldrv_dev(device);
2262
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002263 return nulldrv_pipeline_layout_create(dev,
2264 pCreateInfo,
2265 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002266}
2267
Tony Barbourde4124d2015-07-03 10:33:54 -06002268ICD_EXPORT VkResult VKAPI vkDestroyPipelineLayout(
2269 VkDevice device,
2270 VkPipelineLayout pipelineLayout)
2271{
2272 NULLDRV_LOG_FUNC;
2273 return VK_SUCCESS;
2274}
2275
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002276ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2277 VkDevice device,
2278 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002279 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002280 const VkDescriptorPoolCreateInfo* pCreateInfo,
2281 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002282{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002283 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002284 struct nulldrv_dev *dev = nulldrv_dev(device);
2285
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002286 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2287 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002288}
2289
Tony Barbourde4124d2015-07-03 10:33:54 -06002290ICD_EXPORT VkResult VKAPI vkDestroyDescriptorPool(
2291 VkDevice device,
2292 VkDescriptorPool descriptorPool)
2293{
2294 NULLDRV_LOG_FUNC;
2295 return VK_SUCCESS;
2296}
2297
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002298ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002299 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002300 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002301{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002302 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002303 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002304}
2305
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002306ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002307 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002308 VkDescriptorPool descriptorPool,
2309 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002310 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002311 const VkDescriptorSetLayout* pSetLayouts,
Cody Northropc8aa4a52015-08-03 12:47:29 -06002312 VkDescriptorSet* pDescriptorSets)
David Pinedo0257fbf2015-02-02 18:02:40 -07002313{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002314 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002315 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2316 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002317 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002318 uint32_t i;
2319
2320 for (i = 0; i < count; i++) {
2321 const struct nulldrv_desc_layout *layout =
Tony Barbour8db65372015-07-10 18:32:33 -06002322 nulldrv_desc_layout(pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002323
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002324 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002325 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002326 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002327 break;
2328 }
2329
David Pinedo0257fbf2015-02-02 18:02:40 -07002330 return ret;
2331}
2332
Tony Barbourb857d312015-07-10 10:50:45 -06002333ICD_EXPORT VkResult VKAPI vkFreeDescriptorSets(
2334 VkDevice device,
2335 VkDescriptorPool descriptorPool,
2336 uint32_t count,
2337 const VkDescriptorSet* pDescriptorSets)
2338{
2339 NULLDRV_LOG_FUNC;
2340 return VK_SUCCESS;
2341}
2342
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002343ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2344 VkDevice device,
2345 uint32_t writeCount,
2346 const VkWriteDescriptorSet* pDescriptorWrites,
2347 uint32_t copyCount,
2348 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002349{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002350 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002351 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002352}
2353
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002354ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2355 VkDevice device,
2356 const VkFramebufferCreateInfo* info,
2357 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002358{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002359 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002360 struct nulldrv_dev *dev = nulldrv_dev(device);
2361
2362 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2363}
2364
Tony Barbourde4124d2015-07-03 10:33:54 -06002365ICD_EXPORT VkResult VKAPI vkDestroyFramebuffer(
2366 VkDevice device,
2367 VkFramebuffer framebuffer)
2368{
2369 NULLDRV_LOG_FUNC;
2370 return VK_SUCCESS;
2371}
David Pinedo0257fbf2015-02-02 18:02:40 -07002372
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002373ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2374 VkDevice device,
2375 const VkRenderPassCreateInfo* info,
2376 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002377{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002378 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002379 struct nulldrv_dev *dev = nulldrv_dev(device);
2380
2381 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2382}
2383
Tony Barbourde4124d2015-07-03 10:33:54 -06002384ICD_EXPORT VkResult VKAPI vkDestroyRenderPass(
2385 VkDevice device,
2386 VkRenderPass renderPass)
2387{
2388 NULLDRV_LOG_FUNC;
2389 return VK_SUCCESS;
2390}
2391
Courtney Goeltzenleuchtera375b622015-07-27 14:04:01 -06002392ICD_EXPORT void VKAPI vkCmdPushConstants(
2393 VkCmdBuffer cmdBuffer,
2394 VkPipelineLayout layout,
2395 VkShaderStageFlags stageFlags,
2396 uint32_t start,
2397 uint32_t length,
2398 const void* values)
2399{
2400 /* TODO: Implement */
2401}
2402
Courtney Goeltzenleuchter07fe0662015-07-27 13:47:08 -06002403ICD_EXPORT VkResult VKAPI vkGetRenderAreaGranularity(
2404 VkDevice device,
2405 VkRenderPass renderPass,
2406 VkExtent2D* pGranularity)
2407{
2408 pGranularity->height = 1;
2409 pGranularity->width = 1;
2410
2411 return VK_SUCCESS;
2412}
2413
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002414ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Chia-I Wuc278df82015-07-07 11:50:03 +08002415 VkCmdBuffer cmdBuffer,
2416 const VkRenderPassBeginInfo* pRenderPassBegin,
2417 VkRenderPassContents contents)
2418{
2419 NULLDRV_LOG_FUNC;
2420}
2421
2422ICD_EXPORT void VKAPI vkCmdNextSubpass(
2423 VkCmdBuffer cmdBuffer,
2424 VkRenderPassContents contents)
David Pinedo0257fbf2015-02-02 18:02:40 -07002425{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002426 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002427}
2428
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002429ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002430 VkCmdBuffer cmdBuffer)
2431{
2432 NULLDRV_LOG_FUNC;
2433}
2434
2435ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2436 VkCmdBuffer cmdBuffer,
2437 uint32_t cmdBuffersCount,
2438 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002439{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002440 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002441}
Ian Elliottf93069f2015-02-19 14:26:19 -07002442
2443ICD_EXPORT void* xcbCreateWindow(
2444 uint16_t width,
2445 uint16_t height)
2446{
2447 static uint32_t window; // Kludge to the max
2448 NULLDRV_LOG_FUNC;
2449 return &window;
2450}
2451
2452// May not be needed, if we stub out stuf in tri.c
2453ICD_EXPORT void xcbDestroyWindow()
2454{
2455 NULLDRV_LOG_FUNC;
2456}
2457
2458ICD_EXPORT int xcbGetMessage(void *msg)
2459{
2460 NULLDRV_LOG_FUNC;
2461 return 0;
2462}
2463
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002464ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002465{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002466 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002467}
David Pinedo07494fd2015-07-24 10:54:41 -06002468
2469ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceImageFormatProperties(
2470 VkPhysicalDevice physicalDevice,
2471 VkFormat format,
2472 VkImageType type,
2473 VkImageTiling tiling,
2474 VkImageUsageFlags usage,
2475 VkImageFormatProperties* pImageFormatProperties)
2476{
2477 return VK_ERROR_UNAVAILABLE;
2478}