blob: 0e42c8a1a3f7907ff5b0550c5c746881e64108a4 [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] = {
Jon Ashburncedc15f2015-05-21 18:13:33 -060043 [NULLDRV_EXT_WSI_LUNARG] = VK_WSI_LUNARG_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 {
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -060047 .extName = VK_WSI_LUNARG_EXTENSION_NAME,
Courtney Goeltzenleuchter73a21d32015-07-12 13:20:05 -060048 .specVersion = ,VK_WSI_LUNARG_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
141 if (q->queueCount == 1 && !dev->queues[q->queueNodeIndex]) {
142 ret = nulldrv_queue_create(dev, q->queueNodeIndex,
143 &dev->queues[q->queueNodeIndex]);
144 }
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
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600467static struct nulldrv_desc_layout *nulldrv_desc_layout(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
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600521static VkResult nulldrv_raster_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600522 const VkDynamicRasterStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700523 struct nulldrv_dynamic_rs **state_ret)
524{
525 struct nulldrv_dynamic_rs *state;
526
527 state = (struct nulldrv_dynamic_rs *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600528 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RASTER_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700529 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600530 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700531
532 *state_ret = state;
533
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600534 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700535}
536
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600537static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600538 const VkDynamicColorBlendStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700539 struct nulldrv_dynamic_cb **state_ret)
540{
541 struct nulldrv_dynamic_cb *state;
542
543 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600544 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_COLOR_BLEND_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_ds_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600554 const VkDynamicDepthStencilStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700555 struct nulldrv_dynamic_ds **state_ret)
556{
557 struct nulldrv_dynamic_ds *state;
558
559 state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600560 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_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
569
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600570static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
571 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700572 struct nulldrv_cmd **cmd_ret)
573{
David Pinedo0257fbf2015-02-02 18:02:40 -0700574 struct nulldrv_cmd *cmd;
575
David Pinedo0257fbf2015-02-02 18:02:40 -0700576 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600577 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700578 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600579 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700580
581 *cmd_ret = cmd;
582
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600583 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700584}
585
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600586static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
587 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700588 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600589 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800590 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700591{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800592 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700593
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800594 pool = (struct nulldrv_desc_pool *)
595 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600596 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800597 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600598 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700599
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800600 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700601
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800602 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700603
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600604 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700605}
606
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600607static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800608 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600609 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700610 const struct nulldrv_desc_layout *layout,
611 struct nulldrv_desc_set **set_ret)
612{
613 struct nulldrv_desc_set *set;
614
615 set = (struct nulldrv_desc_set *)
616 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600617 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700618 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600619 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700620
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800621 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700622 set->layout = layout;
623 *set_ret = set;
624
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600625 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700626}
627
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600628static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700629{
Tony Barbourde4124d2015-07-03 10:33:54 -0600630 return *(struct nulldrv_desc_pool **) &pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700631}
632
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600633static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
634 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700635 struct nulldrv_framebuffer ** fb_ret)
636{
637
638 struct nulldrv_framebuffer *fb;
639 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600640 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700641 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600642 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700643
644 *fb_ret = fb;
645
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600646 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700647
648}
649
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600650static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
651 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700652 struct nulldrv_render_pass** rp_ret)
653{
654 struct nulldrv_render_pass *rp;
655 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600656 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700657 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600658 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700659
660 *rp_ret = rp;
661
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600662 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700663}
664
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600665static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700666{
Tony Barbourde4124d2015-07-03 10:33:54 -0600667 return *(struct nulldrv_buf **) &buf;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700668}
669
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600670static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600671 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700672 struct nulldrv_buf_view **view_ret)
673{
674 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
675 struct nulldrv_buf_view *view;
676
677 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600678 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700679 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600680 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700681
682 view->buf = buf;
683
684 *view_ret = view;
685
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600686 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700687}
688
David Pinedo0257fbf2015-02-02 18:02:40 -0700689
690//*********************************************
691// Driver entry points
692//*********************************************
693
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600694ICD_EXPORT VkResult VKAPI vkCreateBuffer(
695 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600696 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600697 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700698{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700699 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700700 struct nulldrv_dev *dev = nulldrv_dev(device);
701
702 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
703}
704
Tony Barbourde4124d2015-07-03 10:33:54 -0600705ICD_EXPORT VkResult VKAPI vkDestroyBuffer(
706 VkDevice device,
707 VkBuffer buffer)
708{
709 NULLDRV_LOG_FUNC;
710 return VK_SUCCESS;
711}
712
Cody Northropf02f9f82015-07-09 18:08:05 -0600713ICD_EXPORT VkResult VKAPI vkCreateCommandPool(
714 VkDevice device,
715 const VkCmdPoolCreateInfo* pCreateInfo,
716 VkCmdPool* pCmdPool)
717{
718 NULLDRV_LOG_FUNC;
719 return VK_SUCCESS;
720}
721
722ICD_EXPORT VkResult VKAPI vkDestroyCommandPool(
723 VkDevice device,
724 VkCmdPool cmdPool)
725{
726 NULLDRV_LOG_FUNC;
727 return VK_SUCCESS;
728}
729
730ICD_EXPORT VkResult VKAPI vkResetCommandPool(
731 VkDevice device,
732 VkCmdPool cmdPool,
733 VkCmdPoolResetFlags flags)
734{
735 NULLDRV_LOG_FUNC;
736 return VK_SUCCESS;
737}
738
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600739ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
740 VkDevice device,
741 const VkCmdBufferCreateInfo* pCreateInfo,
742 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700743{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700744 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700745 struct nulldrv_dev *dev = nulldrv_dev(device);
746
747 return nulldrv_cmd_create(dev, pCreateInfo,
748 (struct nulldrv_cmd **) pCmdBuffer);
749}
750
Tony Barbourde4124d2015-07-03 10:33:54 -0600751ICD_EXPORT VkResult VKAPI vkDestroyCommandBuffer(
752 VkDevice device,
753 VkCmdBuffer cmdBuffer)
754{
755 NULLDRV_LOG_FUNC;
756 return VK_SUCCESS;
757}
758
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600759ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
760 VkCmdBuffer cmdBuffer,
761 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700762{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700763 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600764 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700765}
766
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600767ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
768 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700769{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700770 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600771 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700772}
773
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600774ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
Cody Northropf02f9f82015-07-09 18:08:05 -0600775 VkCmdBuffer cmdBuffer,
776 VkCmdBufferResetFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700777{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700778 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600779 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700780}
781
Ian Elliott64a68e12015-04-16 11:57:46 -0600782static const VkFormat nulldrv_presentable_formats[] = {
783 VK_FORMAT_B8G8R8A8_UNORM,
784};
785
Jon Ashburnba4a1952015-06-16 12:44:51 -0600786#if 0
Ian Elliott64a68e12015-04-16 11:57:46 -0600787ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
788 VkDisplayWSI display,
789 VkDisplayInfoTypeWSI infoType,
790 size_t* pDataSize,
791 void* pData)
792{
793 VkResult ret = VK_SUCCESS;
794
795 NULLDRV_LOG_FUNC;
796
797 if (!pDataSize)
798 return VK_ERROR_INVALID_POINTER;
799
800 switch (infoType) {
801 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
802 {
803 VkDisplayFormatPropertiesWSI *dst = pData;
804 size_t size_ret;
805 uint32_t i;
806
807 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
808
809 if (dst && *pDataSize < size_ret)
810 return VK_ERROR_INVALID_VALUE;
811
812 *pDataSize = size_ret;
813 if (!dst)
814 return VK_SUCCESS;
815
816 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
817 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
818 }
819 break;
820 default:
821 ret = VK_ERROR_INVALID_VALUE;
822 break;
823 }
824
825 return ret;
826}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600827#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600828
829ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
830 VkDevice device,
831 const VkSwapChainCreateInfoWSI* pCreateInfo,
832 VkSwapChainWSI* pSwapChain)
833{
834 NULLDRV_LOG_FUNC;
835 struct nulldrv_dev *dev = nulldrv_dev(device);
836 struct nulldrv_swap_chain *sc;
837
838 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600839 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600840 if (!sc) {
841 return VK_ERROR_OUT_OF_HOST_MEMORY;
842 }
843 sc->dev = dev;
844
Tony Barbour11e76ac2015-04-20 16:28:46 -0600845 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600846
847 return VK_SUCCESS;
848}
849
850ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
851 VkSwapChainWSI swapChain)
852{
853 NULLDRV_LOG_FUNC;
854 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
855
856 free(sc);
857
858 return VK_SUCCESS;
859}
860
861ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
862 VkSwapChainWSI swapChain,
863 VkSwapChainInfoTypeWSI infoType,
864 size_t* pDataSize,
865 void* pData)
866{
867 NULLDRV_LOG_FUNC;
868 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
869 struct nulldrv_dev *dev = sc->dev;
870 VkResult ret = VK_SUCCESS;
871
872 if (!pDataSize)
873 return VK_ERROR_INVALID_POINTER;
874
875 switch (infoType) {
876 case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
877 {
878 VkSwapChainImageInfoWSI *images;
879 const size_t size = sizeof(*images) * 2;
880 uint32_t i;
881
882 if (pData && *pDataSize < size)
883 return VK_ERROR_INVALID_VALUE;
884
885 *pDataSize = size;
886 if (!pData)
887 return VK_SUCCESS;
888
889 images = (VkSwapChainImageInfoWSI *) pData;
890 for (i = 0; i < 2; i++) {
891 struct nulldrv_img *img;
892 struct nulldrv_mem *mem;
893
894 img = (struct nulldrv_img *) nulldrv_base_create(dev,
895 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600896 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600897 if (!img)
898 return VK_ERROR_OUT_OF_HOST_MEMORY;
899
900 mem = (struct nulldrv_mem *) nulldrv_base_create(dev,
901 sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600902 VK_OBJECT_TYPE_DEVICE_MEMORY);
Ian Elliott64a68e12015-04-16 11:57:46 -0600903 if (!mem)
904 return VK_ERROR_OUT_OF_HOST_MEMORY;
905
Tony Barbourde4124d2015-07-03 10:33:54 -0600906 images[i].image.handle = (uint64_t) img;
907 images[i].memory.handle = (uint64_t) mem;
Ian Elliott64a68e12015-04-16 11:57:46 -0600908 }
909 }
910 break;
911 default:
912 ret = VK_ERROR_INVALID_VALUE;
913 break;
914 }
915
916 return ret;
917}
918
919ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
920 VkQueue queue_,
921 const VkPresentInfoWSI* pPresentInfo)
922{
923 NULLDRV_LOG_FUNC;
924
925 return VK_SUCCESS;
926}
927
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600928ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600929 VkCmdBuffer cmdBuffer,
930 VkBuffer srcBuffer,
931 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700932 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600933 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700934{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700935 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700936}
937
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600938ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600939 VkCmdBuffer cmdBuffer,
940 VkImage srcImage,
941 VkImageLayout srcImageLayout,
942 VkImage destImage,
943 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700944 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600945 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700946{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700947 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700948}
949
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600950ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600951 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500952 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600953 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500954 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600955 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500956 uint32_t regionCount,
957 const VkImageBlit* pRegions,
958 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600959{
960 NULLDRV_LOG_FUNC;
961}
962
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600963ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600964 VkCmdBuffer cmdBuffer,
965 VkBuffer srcBuffer,
966 VkImage destImage,
967 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700968 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600969 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700970{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700971 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700972}
973
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600974ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600975 VkCmdBuffer cmdBuffer,
976 VkImage srcImage,
977 VkImageLayout srcImageLayout,
978 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700979 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600980 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700981{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700982 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700983}
984
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600985ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600986 VkCmdBuffer cmdBuffer,
987 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600988 VkDeviceSize destOffset,
989 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700990 const uint32_t* pData)
991{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700992 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700993}
994
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600995ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600996 VkCmdBuffer cmdBuffer,
997 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600998 VkDeviceSize destOffset,
999 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001000 uint32_t data)
1001{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001002 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001003}
1004
Ian Elliotte924ab22015-07-08 13:24:30 -06001005ICD_EXPORT void VKAPI vkCmdClearDepthStencilImage(
1006 VkCmdBuffer cmdBuffer,
1007 VkImage image,
1008 VkImageLayout imageLayout,
1009 float depth,
1010 uint32_t stencil,
1011 uint32_t rangeCount,
1012 const VkImageSubresourceRange* pRanges)
1013{
1014 NULLDRV_LOG_FUNC;
1015}
1016
1017ICD_EXPORT void VKAPI vkCmdClearColorAttachment(
1018 VkCmdBuffer cmdBuffer,
1019 uint32_t colorAttachment,
1020 VkImageLayout imageLayout,
1021 const VkClearColorValue *pColor,
1022 uint32_t rectCount,
1023 const VkRect3D *pRects)
1024{
1025 NULLDRV_LOG_FUNC;
1026}
1027
1028ICD_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(
1029 VkCmdBuffer cmdBuffer,
1030 VkImageAspectFlags imageAspectMask,
1031 VkImageLayout imageLayout,
1032 float depth,
1033 uint32_t stencil,
1034 uint32_t rectCount,
1035 const VkRect3D *pRects)
1036{
1037 NULLDRV_LOG_FUNC;
1038}
1039
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001040ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001041 VkCmdBuffer cmdBuffer,
1042 VkImage image,
1043 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +12001044 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001045 uint32_t rangeCount,
1046 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001047{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001048 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001049}
1050
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001051ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001052 VkCmdBuffer cmdBuffer,
1053 VkImage image,
1054 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001055 float depth,
1056 uint32_t stencil,
1057 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001058 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001059{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001060 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001061}
1062
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001063ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001064 VkCmdBuffer cmdBuffer,
1065 VkImage srcImage,
1066 VkImageLayout srcImageLayout,
1067 VkImage destImage,
1068 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001069 uint32_t regionCount,
1070 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001071{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001072 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001073}
1074
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001075ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001076 VkCmdBuffer cmdBuffer,
1077 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001078 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001079 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001080{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001081 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001082}
1083
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001084ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001085 VkCmdBuffer cmdBuffer,
1086 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001087 uint32_t slot)
1088{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001089 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001090}
1091
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001092ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001093 VkCmdBuffer cmdBuffer,
1094 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001095 uint32_t startQuery,
1096 uint32_t queryCount)
1097{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001098 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001099}
1100
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001101ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001102 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001103 VkEvent event_,
1104 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001105{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001106 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001107}
1108
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001109ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001110 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001111 VkEvent event_,
1112 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001113{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001114 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001115}
1116
Ian Elliott63f1edb2015-04-16 18:10:19 -06001117ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1118 VkCmdBuffer cmdBuffer,
1119 VkQueryPool queryPool,
1120 uint32_t startQuery,
1121 uint32_t queryCount,
1122 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001123 VkDeviceSize destOffset,
1124 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001125 VkFlags flags)
1126{
1127 NULLDRV_LOG_FUNC;
1128}
1129
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001130ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001131 VkCmdBuffer cmdBuffer,
1132 VkTimestampType timestampType,
1133 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001134 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001135{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001136 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001137}
1138
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001139ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001140 VkCmdBuffer cmdBuffer,
Tony Barbourde4124d2015-07-03 10:33:54 -06001141 VkPipelineBindPoint pipelineBindPoint,
1142 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001143{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001144 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001145}
1146
Tony Barbourde4124d2015-07-03 10:33:54 -06001147ICD_EXPORT void VKAPI vkCmdBindDynamicViewportState(
1148 VkCmdBuffer cmdBuffer,
1149 VkDynamicViewportState state)
1150{
1151 NULLDRV_LOG_FUNC;
1152}
1153
1154ICD_EXPORT void VKAPI vkCmdBindDynamicRasterState(
1155 VkCmdBuffer cmdBuffer,
1156 VkDynamicRasterState state)
1157{
1158 NULLDRV_LOG_FUNC;
1159}
1160
1161ICD_EXPORT void VKAPI vkCmdBindDynamicColorBlendState(
1162 VkCmdBuffer cmdBuffer,
1163 VkDynamicColorBlendState state)
1164{
1165 NULLDRV_LOG_FUNC;
1166}
1167
1168ICD_EXPORT void VKAPI vkCmdBindDynamicDepthStencilState(
1169 VkCmdBuffer cmdBuffer,
1170 VkDynamicDepthStencilState state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001171{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001172 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001173}
1174
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001175ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001176 VkCmdBuffer cmdBuffer,
1177 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001178 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001179 uint32_t firstSet,
1180 uint32_t setCount,
1181 const VkDescriptorSet* pDescriptorSets,
1182 uint32_t dynamicOffsetCount,
1183 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001184{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001185 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001186}
1187
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001188ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1189 VkCmdBuffer cmdBuffer,
1190 uint32_t startBinding,
1191 uint32_t bindingCount,
1192 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001193 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001194{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001195 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001196}
1197
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001198ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001199 VkCmdBuffer cmdBuffer,
1200 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001201 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001202 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001203{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001204 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001205}
1206
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001207ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001208 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001209 uint32_t firstVertex,
1210 uint32_t vertexCount,
1211 uint32_t firstInstance,
1212 uint32_t instanceCount)
1213{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001214 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001215}
1216
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001217ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001218 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001219 uint32_t firstIndex,
1220 uint32_t indexCount,
1221 int32_t vertexOffset,
1222 uint32_t firstInstance,
1223 uint32_t instanceCount)
1224{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001225 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001226}
1227
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001228ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001229 VkCmdBuffer cmdBuffer,
1230 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001231 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001232 uint32_t count,
1233 uint32_t stride)
1234{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001235 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001236}
1237
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001238ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001239 VkCmdBuffer cmdBuffer,
1240 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001241 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001242 uint32_t count,
1243 uint32_t stride)
1244{
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 vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001249 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001250 uint32_t x,
1251 uint32_t y,
1252 uint32_t z)
1253{
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 vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001258 VkCmdBuffer cmdBuffer,
1259 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001260 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001261{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001262 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001263}
1264
Tony Barbour8205d902015-04-16 15:59:00 -06001265void VKAPI vkCmdWaitEvents(
1266 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001267 uint32_t eventCount,
1268 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001269 VkPipelineStageFlags sourceStageMask,
1270 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001271 uint32_t memBarrierCount,
Courtney Goeltzenleuchterd9ba3422015-07-12 12:58:58 -06001272 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001273{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001274 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001275}
1276
Tony Barbour8205d902015-04-16 15:59:00 -06001277void VKAPI vkCmdPipelineBarrier(
1278 VkCmdBuffer cmdBuffer,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001279 VkPipelineStageFlags srcStageMask,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001280 VkPipelineStageFlags destStageMask,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001281 VkBool32 byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001282 uint32_t memBarrierCount,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001283 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001284{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001285 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001286}
1287
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001288ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001289 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001290 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001291 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001292{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001293 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001294 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1295 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1296}
1297
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001298ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1299 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001300{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001301 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001302 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001303}
1304
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001305ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1306 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001307 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001308 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001309 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001310{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001311 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001312 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001313 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001314 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001315}
1316
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001317ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1318 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001319{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001320 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001321 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001322}
1323
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001324ICD_EXPORT VkResult VKAPI vkCreateEvent(
1325 VkDevice device,
1326 const VkEventCreateInfo* pCreateInfo,
1327 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001328{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001329 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001330 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001331}
1332
Tony Barbourde4124d2015-07-03 10:33:54 -06001333ICD_EXPORT VkResult VKAPI vkDestroyEvent(
1334 VkDevice device,
1335 VkEvent event)
1336{
1337 NULLDRV_LOG_FUNC;
1338 return VK_SUCCESS;
1339}
1340
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001341ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001342 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001343 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001344{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001345 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001346 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001347}
1348
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001349ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001350 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001351 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001352{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001353 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001354 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001355}
1356
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001357ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001358 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001359 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001360{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001361 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001362 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001363}
1364
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001365ICD_EXPORT VkResult VKAPI vkCreateFence(
1366 VkDevice device,
1367 const VkFenceCreateInfo* pCreateInfo,
1368 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001369{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001370 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001371 struct nulldrv_dev *dev = nulldrv_dev(device);
1372
1373 return nulldrv_fence_create(dev, pCreateInfo,
1374 (struct nulldrv_fence **) pFence);
1375}
1376
Tony Barbourde4124d2015-07-03 10:33:54 -06001377ICD_EXPORT VkResult VKAPI vkDestroyFence(
1378 VkDevice device,
1379 VkFence fence)
1380{
1381 NULLDRV_LOG_FUNC;
1382 return VK_SUCCESS;
1383}
1384
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001385ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001386 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001387 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001388{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001389 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001390 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001391}
1392
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001393ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001394 VkDevice device,
1395 uint32_t fenceCount,
1396 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001397{
1398 NULLDRV_LOG_FUNC;
1399 return VK_SUCCESS;
1400}
1401
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001402ICD_EXPORT VkResult VKAPI vkWaitForFences(
1403 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001404 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001405 const VkFence* pFences,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001406 VkBool32 waitAll,
David Pinedo0257fbf2015-02-02 18:02:40 -07001407 uint64_t timeout)
1408{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001409 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001410 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001411}
1412
Tony Barbour426b9052015-06-24 16:06:58 -06001413ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1414 VkPhysicalDevice gpu_,
1415 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001416{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001417 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001418 VkResult ret = VK_SUCCESS;
1419
Tony Barbour426b9052015-06-24 16:06:58 -06001420 pProperties->apiVersion = VK_API_VERSION;
1421 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1422 pProperties->vendorId = 0;
1423 pProperties->deviceId = 0;
1424 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1425 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001426
1427 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001428}
1429
Chris Forbesd7576302015-06-21 22:55:02 +12001430ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1431 VkPhysicalDevice physicalDevice,
1432 VkPhysicalDeviceFeatures* pFeatures)
1433{
1434 NULLDRV_LOG_FUNC;
1435 VkResult ret = VK_SUCCESS;
1436
1437 /* TODO: fill out features */
1438 memset(pFeatures, 0, sizeof(*pFeatures));
1439
1440 return ret;
1441}
1442
Courtney Goeltzenleuchter4da96aa2015-07-12 12:52:09 -06001443ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatProperties(
Chris Forbesd7576302015-06-21 22:55:02 +12001444 VkPhysicalDevice physicalDevice,
1445 VkFormat format,
1446 VkFormatProperties* pFormatInfo)
1447{
1448 NULLDRV_LOG_FUNC;
1449 VkResult ret = VK_SUCCESS;
1450
1451 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1452 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1453
1454 return ret;
1455}
1456
1457ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1458 VkPhysicalDevice physicalDevice,
1459 VkPhysicalDeviceLimits* pLimits)
1460{
1461 NULLDRV_LOG_FUNC;
1462 VkResult ret = VK_SUCCESS;
1463
1464 /* TODO: fill out limits */
1465 memset(pLimits, 0, sizeof(*pLimits));
1466
1467 return ret;
1468}
1469
Tony Barbour426b9052015-06-24 16:06:58 -06001470ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueCount(
1471 VkPhysicalDevice gpu_,
1472 uint32_t* pCount)
David Pinedo0257fbf2015-02-02 18:02:40 -07001473{
Tony Barbour426b9052015-06-24 16:06:58 -06001474 *pCount = 1;
1475 return VK_SUCCESS;
1476}
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001477
Tony Barbour426b9052015-06-24 16:06:58 -06001478ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueProperties(
1479 VkPhysicalDevice gpu_,
1480 uint32_t count,
1481 VkPhysicalDeviceQueueProperties* pProperties)
1482 {
1483 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1484 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001485 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001486
Tony Barbour426b9052015-06-24 16:06:58 -06001487 return VK_SUCCESS;
1488}
1489
Ian Elliotte924ab22015-07-08 13:24:30 -06001490ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(
1491 VkPhysicalDevice gpu_,
1492 VkPhysicalDeviceMemoryProperties* pProperties)
1493{
1494 // TODO: Fill in with real data
1495 return VK_SUCCESS;
1496}
1497
1498ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLayerProperties(
1499 VkPhysicalDevice physicalDevice,
1500 uint32_t* pCount,
1501 VkLayerProperties* pProperties)
1502{
1503 // TODO: Fill in with real data
1504 return VK_SUCCESS;
1505}
1506
Tony Barbour426b9052015-06-24 16:06:58 -06001507ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001508 const char* pLayerName,
1509 uint32_t* pCount,
1510 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001511{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001512 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001513
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001514 if (pCount == NULL) {
1515 return VK_ERROR_INVALID_POINTER;
1516 }
Tony Barbour426b9052015-06-24 16:06:58 -06001517
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001518 if (pProperties == NULL) {
1519 *pCount = NULLDRV_EXT_COUNT;
1520 return VK_SUCCESS;
1521 }
Tony Barbour426b9052015-06-24 16:06:58 -06001522
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001523 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1524 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1525 *pCount = copy_size;
1526 if (copy_size < NULLDRV_EXT_COUNT) {
1527 return VK_INCOMPLETE;
1528 }
Tony Barbour426b9052015-06-24 16:06:58 -06001529 return VK_SUCCESS;
1530}
Ian Elliotte924ab22015-07-08 13:24:30 -06001531ICD_EXPORT VkResult VKAPI vkGetGlobalLayerProperties(
1532 uint32_t* pCount,
1533 VkLayerProperties* pProperties)
1534{
1535 // TODO: Fill in with real data
1536 return VK_SUCCESS;
1537}
Tony Barbour426b9052015-06-24 16:06:58 -06001538
1539VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001540 VkPhysicalDevice physicalDevice,
1541 const char* pLayerName,
1542 uint32_t* pCount,
1543 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001544{
Tony Barbour426b9052015-06-24 16:06:58 -06001545
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001546 if (pCount == NULL) {
1547 return VK_ERROR_INVALID_POINTER;
1548 }
1549
Tony Barbour426b9052015-06-24 16:06:58 -06001550 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001551
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001552 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001553}
1554
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001555ICD_EXPORT VkResult VKAPI vkCreateImage(
1556 VkDevice device,
1557 const VkImageCreateInfo* pCreateInfo,
1558 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001559{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001560 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001561 struct nulldrv_dev *dev = nulldrv_dev(device);
1562
1563 return nulldrv_img_create(dev, pCreateInfo, false,
1564 (struct nulldrv_img **) pImage);
1565}
1566
Tony Barbourde4124d2015-07-03 10:33:54 -06001567ICD_EXPORT VkResult VKAPI vkDestroyImage(
1568 VkDevice device,
1569 VkImage image)
1570{
1571 NULLDRV_LOG_FUNC;
1572 return VK_SUCCESS;
1573}
1574
Tony Barbour426b9052015-06-24 16:06:58 -06001575ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001576 VkDevice device,
1577 VkImage image,
1578 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001579 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001580{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001581 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001582
Tony Barbour426b9052015-06-24 16:06:58 -06001583 pLayout->offset = 0;
1584 pLayout->size = 1;
1585 pLayout->rowPitch = 4;
1586 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001587
Tony Barbour426b9052015-06-24 16:06:58 -06001588 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001589}
1590
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001591ICD_EXPORT VkResult VKAPI vkAllocMemory(
1592 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001593 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001594 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001595{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001596 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001597 struct nulldrv_dev *dev = nulldrv_dev(device);
1598
1599 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1600}
1601
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001602ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001603 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001604 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001605{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001606 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001607 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001608}
1609
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001610ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001611 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001612 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001613 VkDeviceSize offset,
1614 VkDeviceSize size,
1615 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001616 void** ppData)
1617{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001618 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001619 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1620 void *ptr = nulldrv_mem_map(mem, flags);
1621
1622 *ppData = ptr;
1623
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001624 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001625}
1626
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001627ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001628 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001629 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001630{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001631 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001632 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001633}
1634
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001635ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001636 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001637 uint32_t memRangeCount,
1638 const VkMappedMemoryRange* pMemRanges)
1639{
1640 NULLDRV_LOG_FUNC;
1641 return VK_SUCCESS;
1642}
1643
1644ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1645 VkDevice device,
1646 uint32_t memRangeCount,
1647 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001648{
1649 NULLDRV_LOG_FUNC;
1650 return VK_SUCCESS;
1651}
1652
Courtney Goeltzenleuchterd040c5c2015-07-09 21:57:28 -06001653ICD_EXPORT VkResult VKAPI vkGetDeviceMemoryCommitment(
1654 VkDevice device,
1655 VkDeviceMemory memory,
1656 VkDeviceSize* pCommittedMemoryInBytes)
1657{
1658 return VK_SUCCESS;
1659}
1660
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001661ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001662 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001663 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001664{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001665 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001666 struct nulldrv_instance *inst;
1667
1668 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001669 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001670 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001671 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001672
Tony Barbour426b9052015-06-24 16:06:58 -06001673 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001674
Mike Stroyan230e6252015-04-17 12:36:38 -06001675 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001676
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001677 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001678}
1679
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001680ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1681 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001682{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001683 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001684 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001685}
1686
Tony Barbour8205d902015-04-16 15:59:00 -06001687ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001688 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001689 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001690 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001691{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001692 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001693 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001694 struct nulldrv_gpu *gpu;
1695 *pGpuCount = 1;
1696 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001697 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001698 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001699 return ret;
1700}
1701
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001702ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001703 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001704 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001705 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001706 char* const* pOutLayers,
1707 void* pReserved)
1708{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001709 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001710 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001711}
1712
Tony Barbourde4124d2015-07-03 10:33:54 -06001713ICD_EXPORT VkResult VKAPI vkGetBufferMemoryRequirements(
1714 VkDevice device,
1715 VkBuffer buffer,
1716 VkMemoryRequirements* pMemoryRequirements)
1717{
1718 NULLDRV_LOG_FUNC;
1719 struct nulldrv_base *base = nulldrv_base((void*)buffer.handle);
1720
1721 return base->get_memory_requirements(base, pMemoryRequirements);
1722}
1723
1724ICD_EXPORT VkResult VKAPI vkGetImageMemoryRequirements(
1725 VkDevice device,
1726 VkImage image,
1727 VkMemoryRequirements* pMemoryRequirements)
1728{
1729 NULLDRV_LOG_FUNC;
1730 struct nulldrv_base *base = nulldrv_base((void*)image.handle);
1731
1732 return base->get_memory_requirements(base, pMemoryRequirements);
1733}
1734
1735ICD_EXPORT VkResult VKAPI vkBindBufferMemory(
1736 VkDevice device,
1737 VkBuffer buffer,
1738 VkDeviceMemory mem_,
1739 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001740{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001741 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001742 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001743}
1744
Tony Barbourde4124d2015-07-03 10:33:54 -06001745ICD_EXPORT VkResult VKAPI vkBindImageMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001746 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06001747 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001748 VkDeviceMemory mem_,
1749 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001750{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001751 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001752 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001753}
1754
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001755ICD_EXPORT VkResult VKAPI vkGetImageSparseMemoryRequirements(
1756 VkDevice device,
1757 VkImage image,
1758 uint32_t* pNumRequirements,
1759 VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
1760{
1761 NULLDRV_LOG_FUNC;
1762 return VK_SUCCESS;
1763}
1764
1765ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(
1766 VkPhysicalDevice physicalDevice,
1767 VkFormat format,
1768 VkImageType type,
1769 uint32_t samples,
1770 VkImageUsageFlags usage,
1771 VkImageTiling tiling,
1772 uint32_t* pNumProperties,
1773 VkSparseImageFormatProperties* pProperties)
1774{
1775 NULLDRV_LOG_FUNC;
1776 return VK_SUCCESS;
1777}
1778
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001779ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001780 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001781 VkBuffer buffer,
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001782 uint32_t numBindings,
1783 const VkSparseMemoryBindInfo* pBindInfo)
1784{
1785 NULLDRV_LOG_FUNC;
1786 return VK_SUCCESS;
1787}
1788
1789ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageOpaqueMemory(
1790 VkQueue queue,
1791 VkImage image,
1792 uint32_t numBindings,
1793 const VkSparseMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001794{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001795 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001796 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001797}
1798
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001799ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001800 VkQueue queue,
1801 VkImage image,
1802 uint32_t numBindings,
1803 const VkSparseImageMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001804{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001805 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001806 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001807}
Jon Ashburn0e249962015-07-10 09:41:15 -07001808ICD_EXPORT VkResult VKAPI vkCreatePipelineCache(
1809 VkDevice device,
1810 const VkPipelineCacheCreateInfo* pCreateInfo,
1811 VkPipelineCache* pPipelineCache)
1812{
David Pinedo0257fbf2015-02-02 18:02:40 -07001813
Jon Ashburn0e249962015-07-10 09:41:15 -07001814 NULLDRV_LOG_FUNC;
1815 return VK_SUCCESS;
1816}
1817
Tony Barbourde4124d2015-07-03 10:33:54 -06001818ICD_EXPORT VkResult VKAPI vkDestroyPipeline(
1819 VkDevice device,
1820 VkPipeline pipeline)
1821{
1822 NULLDRV_LOG_FUNC;
1823 return VK_SUCCESS;
1824}
1825
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06001826VkResult VKAPI vkDestroyPipelineCache(
1827 VkDevice device,
1828 VkPipelineCache pipelineCache)
Jon Ashburn0e249962015-07-10 09:41:15 -07001829{
1830 NULLDRV_LOG_FUNC;
1831 return VK_SUCCESS;
1832}
1833
1834ICD_EXPORT size_t VKAPI vkGetPipelineCacheSize(
1835 VkDevice device,
1836 VkPipelineCache pipelineCache)
1837{
1838 NULLDRV_LOG_FUNC;
1839 return VK_ERROR_UNAVAILABLE;
1840}
1841
1842ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
1843 VkDevice device,
1844 VkPipelineCache pipelineCache,
1845 void* pData)
1846{
1847 NULLDRV_LOG_FUNC;
1848 return VK_ERROR_UNAVAILABLE;
1849}
1850
1851ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
1852 VkDevice device,
1853 VkPipelineCache destCache,
1854 uint32_t srcCacheCount,
1855 const VkPipelineCache* pSrcCaches)
1856{
1857 NULLDRV_LOG_FUNC;
1858 return VK_ERROR_UNAVAILABLE;
1859}
1860ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001861 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001862 VkPipelineCache pipelineCache,
1863 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001864 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1865 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001866{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001867 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001868 struct nulldrv_dev *dev = nulldrv_dev(device);
1869
1870 return graphics_pipeline_create(dev, pCreateInfo,
1871 (struct nulldrv_pipeline **) pPipeline);
1872}
1873
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001874
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001875
Jon Ashburn0e249962015-07-10 09:41:15 -07001876ICD_EXPORT VkResult VKAPI vkCreateComputePipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001877 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001878 VkPipelineCache pipelineCache,
1879 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001880 const VkComputePipelineCreateInfo* pCreateInfo,
1881 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001882{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001883 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001884 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001885}
1886
David Pinedo0257fbf2015-02-02 18:02:40 -07001887
David Pinedo0257fbf2015-02-02 18:02:40 -07001888
Jon Ashburn0e249962015-07-10 09:41:15 -07001889
David Pinedo0257fbf2015-02-02 18:02:40 -07001890
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001891ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1892 VkDevice device,
1893 const VkQueryPoolCreateInfo* pCreateInfo,
1894 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001895{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001896 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001897 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001898}
1899
Tony Barbourde4124d2015-07-03 10:33:54 -06001900ICD_EXPORT VkResult VKAPI vkDestroyQueryPool(
1901 VkDevice device,
1902 VkQueryPool queryPoool)
1903{
1904 NULLDRV_LOG_FUNC;
1905 return VK_SUCCESS;
1906}
1907
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001908ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001909 VkDevice device,
1910 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001911 uint32_t startQuery,
1912 uint32_t queryCount,
1913 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001914 void* pData,
1915 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001916{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001917 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001918 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001919}
1920
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001921ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1922 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001923{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001924 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001925 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001926}
1927
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001928ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1929 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001930 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001931 const VkCmdBuffer* pCmdBuffers,
1932 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001933{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001934 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001935 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001936}
1937
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001938ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1939 VkDevice device,
1940 const VkSemaphoreCreateInfo* pCreateInfo,
1941 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001942{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001943 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001944 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001945}
1946
Tony Barbourde4124d2015-07-03 10:33:54 -06001947ICD_EXPORT VkResult VKAPI vkDestroySemaphore(
1948 VkDevice device,
1949 VkSemaphore semaphore)
1950{
1951 NULLDRV_LOG_FUNC;
1952 return VK_SUCCESS;
1953}
1954
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001955ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1956 VkQueue queue,
1957 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001958{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001959 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001960 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001961}
1962
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001963ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1964 VkQueue queue,
1965 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001966{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001967 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001968 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001969}
1970
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001971ICD_EXPORT VkResult VKAPI vkCreateSampler(
1972 VkDevice device,
1973 const VkSamplerCreateInfo* pCreateInfo,
1974 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07001975{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001976 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001977 struct nulldrv_dev *dev = nulldrv_dev(device);
1978
1979 return nulldrv_sampler_create(dev, pCreateInfo,
1980 (struct nulldrv_sampler **) pSampler);
1981}
1982
Tony Barbourde4124d2015-07-03 10:33:54 -06001983ICD_EXPORT VkResult VKAPI vkDestroySampler(
1984 VkDevice device,
1985 VkSampler sampler)
1986{
1987 NULLDRV_LOG_FUNC;
1988 return VK_SUCCESS;
1989}
1990
Ian Elliotte924ab22015-07-08 13:24:30 -06001991ICD_EXPORT VkResult VKAPI vkCreateShaderModule(
1992 VkDevice device,
1993 const VkShaderModuleCreateInfo* pCreateInfo,
1994 VkShaderModule* pShaderModule)
1995{
1996 // TODO: Fill in with real data
Tony Barbourde4124d2015-07-03 10:33:54 -06001997 NULLDRV_LOG_FUNC;
1998 return VK_SUCCESS;
1999}
2000
2001ICD_EXPORT VkResult VKAPI vkDestroyShaderModule(
2002 VkDevice device,
2003 VkShaderModule shaderModule)
2004{
2005 // TODO: Fill in with real data
2006 NULLDRV_LOG_FUNC;
Ian Elliotte924ab22015-07-08 13:24:30 -06002007 return VK_SUCCESS;
2008}
2009
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002010ICD_EXPORT VkResult VKAPI vkCreateShader(
2011 VkDevice device,
2012 const VkShaderCreateInfo* pCreateInfo,
2013 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002014{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002015 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002016 struct nulldrv_dev *dev = nulldrv_dev(device);
2017
2018 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2019}
2020
Tony Barbourde4124d2015-07-03 10:33:54 -06002021ICD_EXPORT VkResult VKAPI vkDestroyShader(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002022 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002023 VkShader shader)
2024{
2025 NULLDRV_LOG_FUNC;
2026 return VK_SUCCESS;
2027}
2028
2029ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2030 VkDevice device,
2031 const VkDynamicViewportStateCreateInfo* pCreateInfo,
2032 VkDynamicViewportState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002033{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002034 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002035 struct nulldrv_dev *dev = nulldrv_dev(device);
2036
2037 return nulldrv_viewport_state_create(dev, pCreateInfo,
2038 (struct nulldrv_dynamic_vp **) pState);
2039}
2040
Tony Barbourde4124d2015-07-03 10:33:54 -06002041ICD_EXPORT VkResult VKAPI vkDestroyDynamicViewportState(
2042 VkDevice device,
2043 VkDynamicViewportState dynamicViewportState)
2044{
2045 NULLDRV_LOG_FUNC;
2046 return VK_SUCCESS;
2047}
2048
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002049ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
2050 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002051 const VkDynamicRasterStateCreateInfo* pCreateInfo,
2052 VkDynamicRasterState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002053{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002054 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002055 struct nulldrv_dev *dev = nulldrv_dev(device);
2056
2057 return nulldrv_raster_state_create(dev, pCreateInfo,
2058 (struct nulldrv_dynamic_rs **) pState);
2059}
2060
Tony Barbourde4124d2015-07-03 10:33:54 -06002061ICD_EXPORT VkResult VKAPI vkDestroyDynamicRasterState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002062 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002063 VkDynamicRasterState dynamicRasterState)
2064{
2065 NULLDRV_LOG_FUNC;
2066 return VK_SUCCESS;
2067}
2068
2069ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
2070 VkDevice device,
2071 const VkDynamicColorBlendStateCreateInfo* pCreateInfo,
2072 VkDynamicColorBlendState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002073{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002074 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002075 struct nulldrv_dev *dev = nulldrv_dev(device);
2076
2077 return nulldrv_blend_state_create(dev, pCreateInfo,
2078 (struct nulldrv_dynamic_cb **) pState);
2079}
2080
Tony Barbourde4124d2015-07-03 10:33:54 -06002081ICD_EXPORT VkResult VKAPI vkDestroyDynamicColorBlendState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002082 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002083 VkDynamicColorBlendState dynamicColorBlendState)
2084{
2085 NULLDRV_LOG_FUNC;
2086 return VK_SUCCESS;
2087}
2088
2089ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
2090 VkDevice device,
2091 const VkDynamicDepthStencilStateCreateInfo* pCreateInfo,
2092 VkDynamicDepthStencilState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002093{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002094 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002095 struct nulldrv_dev *dev = nulldrv_dev(device);
2096
2097 return nulldrv_ds_state_create(dev, pCreateInfo,
2098 (struct nulldrv_dynamic_ds **) pState);
2099}
2100
Tony Barbourde4124d2015-07-03 10:33:54 -06002101ICD_EXPORT VkResult VKAPI vkDestroyDynamicDepthStencilState(
2102 VkDevice device,
2103 VkDynamicDepthStencilState dynamicDepthStencilState)
2104{
2105 NULLDRV_LOG_FUNC;
2106 return VK_SUCCESS;
2107}
2108
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002109ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2110 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002111 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002112 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002113{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002114 NULLDRV_LOG_FUNC;
2115 struct nulldrv_dev *dev = nulldrv_dev(device);
2116
2117 return nulldrv_buf_view_create(dev, pCreateInfo,
2118 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002119}
2120
Tony Barbourde4124d2015-07-03 10:33:54 -06002121ICD_EXPORT VkResult VKAPI vkDestroyBufferView(
2122 VkDevice device,
2123 VkBufferView bufferView)
2124{
2125 NULLDRV_LOG_FUNC;
2126 return VK_SUCCESS;
2127}
2128
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002129ICD_EXPORT VkResult VKAPI vkCreateImageView(
2130 VkDevice device,
2131 const VkImageViewCreateInfo* pCreateInfo,
2132 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002133{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002134 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002135 struct nulldrv_dev *dev = nulldrv_dev(device);
2136
2137 return nulldrv_img_view_create(dev, pCreateInfo,
2138 (struct nulldrv_img_view **) pView);
2139}
2140
Tony Barbourde4124d2015-07-03 10:33:54 -06002141ICD_EXPORT VkResult VKAPI vkDestroyImageView(
2142 VkDevice device,
2143 VkImageView imageView)
2144{
2145 NULLDRV_LOG_FUNC;
2146 return VK_SUCCESS;
2147}
2148
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002149ICD_EXPORT VkResult VKAPI vkCreateAttachmentView(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002150 VkDevice device,
Chia-I Wuc278df82015-07-07 11:50:03 +08002151 const VkAttachmentViewCreateInfo* pCreateInfo,
2152 VkAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002153{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002154 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002155 struct nulldrv_dev *dev = nulldrv_dev(device);
2156
2157 return nulldrv_rt_view_create(dev, pCreateInfo,
2158 (struct nulldrv_rt_view **) pView);
2159}
2160
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002161ICD_EXPORT VkResult VKAPI vkDestroyAttachmentView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002162 VkDevice device,
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002163 VkAttachmentView attachmentView)
Tony Barbourde4124d2015-07-03 10:33:54 -06002164{
2165 NULLDRV_LOG_FUNC;
2166 return VK_SUCCESS;
2167}
2168
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002169ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2170 VkDevice device,
2171 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2172 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002173{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002174 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002175 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002176
Chia-I Wu7732cb22015-03-26 15:27:55 +08002177 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002178 (struct nulldrv_desc_layout **) pSetLayout);
2179}
2180
Tony Barbourde4124d2015-07-03 10:33:54 -06002181ICD_EXPORT VkResult VKAPI vkDestroyDescriptorSetLayout(
2182 VkDevice device,
2183 VkDescriptorSetLayout descriptorSetLayout)
2184{
2185 NULLDRV_LOG_FUNC;
2186 return VK_SUCCESS;
2187}
2188
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002189ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2190 VkDevice device,
2191 const VkPipelineLayoutCreateInfo* pCreateInfo,
2192 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002193{
2194 NULLDRV_LOG_FUNC;
2195 struct nulldrv_dev *dev = nulldrv_dev(device);
2196
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002197 return nulldrv_pipeline_layout_create(dev,
2198 pCreateInfo,
2199 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002200}
2201
Tony Barbourde4124d2015-07-03 10:33:54 -06002202ICD_EXPORT VkResult VKAPI vkDestroyPipelineLayout(
2203 VkDevice device,
2204 VkPipelineLayout pipelineLayout)
2205{
2206 NULLDRV_LOG_FUNC;
2207 return VK_SUCCESS;
2208}
2209
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002210ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2211 VkDevice device,
2212 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002213 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002214 const VkDescriptorPoolCreateInfo* pCreateInfo,
2215 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002216{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002217 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002218 struct nulldrv_dev *dev = nulldrv_dev(device);
2219
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002220 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2221 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002222}
2223
Tony Barbourde4124d2015-07-03 10:33:54 -06002224ICD_EXPORT VkResult VKAPI vkDestroyDescriptorPool(
2225 VkDevice device,
2226 VkDescriptorPool descriptorPool)
2227{
2228 NULLDRV_LOG_FUNC;
2229 return VK_SUCCESS;
2230}
2231
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002232ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002233 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002234 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002235{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002236 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002237 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002238}
2239
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002240ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002241 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002242 VkDescriptorPool descriptorPool,
2243 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002244 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002245 const VkDescriptorSetLayout* pSetLayouts,
2246 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07002247 uint32_t* pCount)
2248{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002249 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002250 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2251 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002252 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002253 uint32_t i;
2254
2255 for (i = 0; i < count; i++) {
2256 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002257 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002258
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002259 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002260 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002261 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002262 break;
2263 }
2264
2265 if (pCount)
2266 *pCount = i;
2267
2268 return ret;
2269}
2270
Tony Barbourb857d312015-07-10 10:50:45 -06002271ICD_EXPORT VkResult VKAPI vkFreeDescriptorSets(
2272 VkDevice device,
2273 VkDescriptorPool descriptorPool,
2274 uint32_t count,
2275 const VkDescriptorSet* pDescriptorSets)
2276{
2277 NULLDRV_LOG_FUNC;
2278 return VK_SUCCESS;
2279}
2280
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002281ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2282 VkDevice device,
2283 uint32_t writeCount,
2284 const VkWriteDescriptorSet* pDescriptorWrites,
2285 uint32_t copyCount,
2286 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002287{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002288 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002289 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002290}
2291
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002292ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2293 VkDevice device,
2294 const VkFramebufferCreateInfo* info,
2295 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002296{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002297 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002298 struct nulldrv_dev *dev = nulldrv_dev(device);
2299
2300 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2301}
2302
Tony Barbourde4124d2015-07-03 10:33:54 -06002303ICD_EXPORT VkResult VKAPI vkDestroyFramebuffer(
2304 VkDevice device,
2305 VkFramebuffer framebuffer)
2306{
2307 NULLDRV_LOG_FUNC;
2308 return VK_SUCCESS;
2309}
David Pinedo0257fbf2015-02-02 18:02:40 -07002310
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002311ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2312 VkDevice device,
2313 const VkRenderPassCreateInfo* info,
2314 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002315{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002316 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002317 struct nulldrv_dev *dev = nulldrv_dev(device);
2318
2319 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2320}
2321
Tony Barbourde4124d2015-07-03 10:33:54 -06002322ICD_EXPORT VkResult VKAPI vkDestroyRenderPass(
2323 VkDevice device,
2324 VkRenderPass renderPass)
2325{
2326 NULLDRV_LOG_FUNC;
2327 return VK_SUCCESS;
2328}
2329
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002330ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Chia-I Wuc278df82015-07-07 11:50:03 +08002331 VkCmdBuffer cmdBuffer,
2332 const VkRenderPassBeginInfo* pRenderPassBegin,
2333 VkRenderPassContents contents)
2334{
2335 NULLDRV_LOG_FUNC;
2336}
2337
2338ICD_EXPORT void VKAPI vkCmdNextSubpass(
2339 VkCmdBuffer cmdBuffer,
2340 VkRenderPassContents contents)
David Pinedo0257fbf2015-02-02 18:02:40 -07002341{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002342 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002343}
2344
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002345ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002346 VkCmdBuffer cmdBuffer)
2347{
2348 NULLDRV_LOG_FUNC;
2349}
2350
2351ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2352 VkCmdBuffer cmdBuffer,
2353 uint32_t cmdBuffersCount,
2354 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002355{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002356 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002357}
Ian Elliottf93069f2015-02-19 14:26:19 -07002358
2359ICD_EXPORT void* xcbCreateWindow(
2360 uint16_t width,
2361 uint16_t height)
2362{
2363 static uint32_t window; // Kludge to the max
2364 NULLDRV_LOG_FUNC;
2365 return &window;
2366}
2367
2368// May not be needed, if we stub out stuf in tri.c
2369ICD_EXPORT void xcbDestroyWindow()
2370{
2371 NULLDRV_LOG_FUNC;
2372}
2373
2374ICD_EXPORT int xcbGetMessage(void *msg)
2375{
2376 NULLDRV_LOG_FUNC;
2377 return 0;
2378}
2379
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002380ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002381{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002382 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002383}