blob: 1a5a158a78b1c83b7e2cb4e7b6da197c46f8af4e [file] [log] [blame]
David Pinedo0257fbf2015-02-02 18:02:40 -07001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan null driver
David Pinedo0257fbf2015-02-02 18:02:40 -07003 *
4 * Copyright (C) 2015 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 */
25
26#include "nulldrv.h"
David Pinedo8e9cb3b2015-02-10 15:02:08 -070027#include <stdio.h>
David Pinedo0257fbf2015-02-02 18:02:40 -070028
David Pinedo8e9cb3b2015-02-10 15:02:08 -070029#if 0
30#define NULLDRV_LOG_FUNC \
31 do { \
32 fflush(stdout); \
33 fflush(stderr); \
34 printf("null driver: %s\n", __FUNCTION__); \
35 fflush(stdout); \
36 } while (0)
37#else
38 #define NULLDRV_LOG_FUNC do { } while (0)
39#endif
40
41// The null driver supports all WSI extenstions ... for now ...
David Pinedo0257fbf2015-02-02 18:02:40 -070042static const char * const nulldrv_gpu_exts[NULLDRV_EXT_COUNT] = {
Ian Elliott53bd3dc2015-07-06 14:29:31 -060043 [NULLDRV_EXT_WSI_SWAPCHAIN] = VK_WSI_SWAPCHAIN_EXTENSION_NAME,
David Pinedo0257fbf2015-02-02 18:02:40 -070044};
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060045static const VkExtensionProperties intel_gpu_exts[NULLDRV_EXT_COUNT] = {
46 {
Ian Elliott53bd3dc2015-07-06 14:29:31 -060047 .extName = VK_WSI_SWAPCHAIN_EXTENSION_NAME,
48 .specVersion = VK_WSI_SWAPCHAIN_REVISION,
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060049 }
50};
David Pinedo0257fbf2015-02-02 18:02:40 -070051
Tony Barbourde4124d2015-07-03 10:33:54 -060052static struct nulldrv_base *nulldrv_base(void* base)
David Pinedo0257fbf2015-02-02 18:02:40 -070053{
54 return (struct nulldrv_base *) base;
55}
56
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060057static struct nulldrv_base *nulldrv_base_create(
58 struct nulldrv_dev *dev,
59 size_t obj_size,
Tony Barbourde4124d2015-07-03 10:33:54 -060060 VkDbgObjectType type)
David Pinedo0257fbf2015-02-02 18:02:40 -070061{
62 struct nulldrv_base *base;
63
64 if (!obj_size)
65 obj_size = sizeof(*base);
66
67 assert(obj_size >= sizeof(*base));
68
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060069 base = (struct nulldrv_base*)malloc(obj_size);
David Pinedo0257fbf2015-02-02 18:02:40 -070070 if (!base)
71 return NULL;
72
73 memset(base, 0, obj_size);
74
75 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbourde4124d2015-07-03 10:33:54 -060076 set_loader_magic_value(base);
David Pinedo0257fbf2015-02-02 18:02:40 -070077
78 if (dev == NULL) {
79 /*
80 * dev is NULL when we are creating the base device object
81 * Set dev now so that debug setup happens correctly
82 */
83 dev = (struct nulldrv_dev *) base;
84 }
85
86
Tony Barbour426b9052015-06-24 16:06:58 -060087 base->get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -070088
89 return base;
90}
91
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060092static VkResult nulldrv_gpu_add(int devid, const char *primary_node,
David Pinedo0257fbf2015-02-02 18:02:40 -070093 const char *render_node, struct nulldrv_gpu **gpu_ret)
94{
95 struct nulldrv_gpu *gpu;
96
Chia-I Wu493a1752015-02-22 14:40:25 +080097 gpu = malloc(sizeof(*gpu));
David Pinedo0257fbf2015-02-02 18:02:40 -070098 if (!gpu)
Tony Barbour8205d902015-04-16 15:59:00 -060099 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700100 memset(gpu, 0, sizeof(*gpu));
Mark Lobodzinski97dcd042015-04-16 08:52:00 -0500101
David Pinedo0257fbf2015-02-02 18:02:40 -0700102 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbourde4124d2015-07-03 10:33:54 -0600103 set_loader_magic_value(gpu);
David Pinedo0257fbf2015-02-02 18:02:40 -0700104
105 *gpu_ret = gpu;
106
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600107 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700108}
109
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600110static VkResult nulldrv_queue_create(struct nulldrv_dev *dev,
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700111 uint32_t node_index,
David Pinedo0257fbf2015-02-02 18:02:40 -0700112 struct nulldrv_queue **queue_ret)
113{
114 struct nulldrv_queue *queue;
115
116 queue = (struct nulldrv_queue *) nulldrv_base_create(dev, sizeof(*queue),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600117 VK_OBJECT_TYPE_QUEUE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700118 if (!queue)
Tony Barbour8205d902015-04-16 15:59:00 -0600119 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700120
121 queue->dev = dev;
122
123 *queue_ret = queue;
124
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600125 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700126}
127
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600128static VkResult dev_create_queues(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600129 const VkDeviceQueueCreateInfo *queues,
David Pinedo0257fbf2015-02-02 18:02:40 -0700130 uint32_t count)
131{
132 uint32_t i;
133
134 if (!count)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600135 return VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700136
137 for (i = 0; i < count; i++) {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600138 const VkDeviceQueueCreateInfo *q = &queues[i];
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600139 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700140
Tony Barbour29b12062015-07-13 13:37:24 -0600141 if (q->queueCount == 1 && !dev->queues[q->queueFamilyIndex]) {
142 ret = nulldrv_queue_create(dev, q->queueFamilyIndex,
143 &dev->queues[q->queueFamilyIndex]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700144 }
145 else {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600146 ret = VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700147 }
148
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600149 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700150 return ret;
151 }
152 }
153
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600154 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700155}
156
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600157static enum nulldrv_ext_type nulldrv_gpu_lookup_extension(
158 const struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600159 const char* extName)
David Pinedo0257fbf2015-02-02 18:02:40 -0700160{
161 enum nulldrv_ext_type type;
162
163 for (type = 0; type < ARRAY_SIZE(nulldrv_gpu_exts); type++) {
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600164 if (strcmp(nulldrv_gpu_exts[type], extName) == 0)
David Pinedo0257fbf2015-02-02 18:02:40 -0700165 break;
166 }
167
168 assert(type < NULLDRV_EXT_COUNT || type == NULLDRV_EXT_INVALID);
169
170 return type;
171}
172
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600173static VkResult nulldrv_desc_ooxx_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800174 struct nulldrv_desc_ooxx **ooxx_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700175{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800176 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700177
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800178 ooxx = malloc(sizeof(*ooxx));
179 if (!ooxx)
Tony Barbour8205d902015-04-16 15:59:00 -0600180 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700181
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800182 memset(ooxx, 0, sizeof(*ooxx));
David Pinedo0257fbf2015-02-02 18:02:40 -0700183
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800184 ooxx->surface_desc_size = 0;
185 ooxx->sampler_desc_size = 0;
David Pinedo0257fbf2015-02-02 18:02:40 -0700186
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800187 *ooxx_ret = ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700188
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600189 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700190}
191
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600192static VkResult nulldrv_dev_create(struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600193 const VkDeviceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700194 struct nulldrv_dev **dev_ret)
195{
196 struct nulldrv_dev *dev;
197 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600198 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -0700199
200 dev = (struct nulldrv_dev *) nulldrv_base_create(NULL, sizeof(*dev),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600201 VK_OBJECT_TYPE_DEVICE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700202 if (!dev)
Tony Barbour8205d902015-04-16 15:59:00 -0600203 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700204
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600205 for (i = 0; i < info->extensionCount; i++) {
206 const enum nulldrv_ext_type ext = nulldrv_gpu_lookup_extension(
207 gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600208 info->ppEnabledExtensionNames[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700209
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600210 if (ext == NULLDRV_EXT_INVALID)
211 return VK_ERROR_INVALID_EXTENSION;
David Pinedo0257fbf2015-02-02 18:02:40 -0700212
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600213 dev->exts[ext] = true;
214 }
David Pinedo0257fbf2015-02-02 18:02:40 -0700215
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800216 ret = nulldrv_desc_ooxx_create(dev, &dev->desc_ooxx);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600217 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700218 return ret;
219 }
220
221 ret = dev_create_queues(dev, info->pRequestedQueues,
222 info->queueRecordCount);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600223 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700224 return ret;
225 }
226
227 *dev_ret = dev;
228
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600229 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700230}
231
Tony Barbour8205d902015-04-16 15:59:00 -0600232static struct nulldrv_gpu *nulldrv_gpu(VkPhysicalDevice gpu)
David Pinedo0257fbf2015-02-02 18:02:40 -0700233{
234 return (struct nulldrv_gpu *) gpu;
235}
236
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600237static VkResult nulldrv_rt_view_create(struct nulldrv_dev *dev,
Chia-I Wuc278df82015-07-07 11:50:03 +0800238 const VkAttachmentViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700239 struct nulldrv_rt_view **view_ret)
240{
241 struct nulldrv_rt_view *view;
242
243 view = (struct nulldrv_rt_view *) nulldrv_base_create(dev, sizeof(*view),
Chia-I Wuc278df82015-07-07 11:50:03 +0800244 VK_OBJECT_TYPE_ATTACHMENT_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700245 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600246 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700247
248 *view_ret = view;
249
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600250 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700251}
252
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600253static VkResult nulldrv_fence_create(struct nulldrv_dev *dev,
254 const VkFenceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700255 struct nulldrv_fence **fence_ret)
256{
257 struct nulldrv_fence *fence;
258
259 fence = (struct nulldrv_fence *) nulldrv_base_create(dev, sizeof(*fence),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600260 VK_OBJECT_TYPE_FENCE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700261 if (!fence)
Tony Barbour8205d902015-04-16 15:59:00 -0600262 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700263
264 *fence_ret = fence;
265
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600266 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700267}
268
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600269static struct nulldrv_dev *nulldrv_dev(VkDevice dev)
David Pinedo0257fbf2015-02-02 18:02:40 -0700270{
271 return (struct nulldrv_dev *) dev;
272}
273
274static struct nulldrv_img *nulldrv_img_from_base(struct nulldrv_base *base)
275{
276 return (struct nulldrv_img *) base;
277}
278
279
Tony Barbour426b9052015-06-24 16:06:58 -0600280static VkResult img_get_memory_requirements(struct nulldrv_base *base,
281 VkMemoryRequirements *pRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700282{
283 struct nulldrv_img *img = nulldrv_img_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600284 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700285
Tony Barbour426b9052015-06-24 16:06:58 -0600286 pRequirements->size = img->total_size;
287 pRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700288
289 return ret;
290}
291
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600292static VkResult nulldrv_img_create(struct nulldrv_dev *dev,
293 const VkImageCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700294 bool scanout,
295 struct nulldrv_img **img_ret)
296{
297 struct nulldrv_img *img;
298
299 img = (struct nulldrv_img *) nulldrv_base_create(dev, sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600300 VK_OBJECT_TYPE_IMAGE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700301 if (!img)
Tony Barbour8205d902015-04-16 15:59:00 -0600302 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700303
304 img->type = info->imageType;
305 img->depth = info->extent.depth;
306 img->mip_levels = info->mipLevels;
307 img->array_size = info->arraySize;
308 img->usage = info->usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700309 img->samples = info->samples;
310
Tony Barbour426b9052015-06-24 16:06:58 -0600311 img->obj.base.get_memory_requirements = img_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700312
313 *img_ret = img;
314
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600315 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700316}
317
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600318static struct nulldrv_img *nulldrv_img(VkImage image)
David Pinedo0257fbf2015-02-02 18:02:40 -0700319{
Tony Barbourde4124d2015-07-03 10:33:54 -0600320 return *(struct nulldrv_img **) &image;
David Pinedo0257fbf2015-02-02 18:02:40 -0700321}
322
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600323static VkResult nulldrv_mem_alloc(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600324 const VkMemoryAllocInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700325 struct nulldrv_mem **mem_ret)
326{
327 struct nulldrv_mem *mem;
328
329 mem = (struct nulldrv_mem *) nulldrv_base_create(dev, sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600330 VK_OBJECT_TYPE_DEVICE_MEMORY);
David Pinedo0257fbf2015-02-02 18:02:40 -0700331 if (!mem)
Tony Barbour8205d902015-04-16 15:59:00 -0600332 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700333
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700334 mem->bo = malloc(info->allocationSize);
David Pinedo0257fbf2015-02-02 18:02:40 -0700335 if (!mem->bo) {
Tony Barbour8205d902015-04-16 15:59:00 -0600336 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700337 }
338
339 mem->size = info->allocationSize;
340
341 *mem_ret = mem;
342
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600343 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700344}
345
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600346static VkResult nulldrv_sampler_create(struct nulldrv_dev *dev,
347 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700348 struct nulldrv_sampler **sampler_ret)
349{
350 struct nulldrv_sampler *sampler;
351
352 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600353 sizeof(*sampler), VK_OBJECT_TYPE_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700354 if (!sampler)
Tony Barbour8205d902015-04-16 15:59:00 -0600355 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700356
357 *sampler_ret = sampler;
358
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600359 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700360}
361
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600362static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
363 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700364 struct nulldrv_img_view **view_ret)
365{
366 struct nulldrv_img *img = nulldrv_img(info->image);
367 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700368
369 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600370 VK_OBJECT_TYPE_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700371 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600372 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700373
374 view->img = img;
David Pinedo0257fbf2015-02-02 18:02:40 -0700375
David Pinedo0257fbf2015-02-02 18:02:40 -0700376 view->cmd_len = 8;
377
378 *view_ret = view;
379
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600380 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700381}
382
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600383static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700384{
385 return mem->bo;
386}
387
Tony Barbour8205d902015-04-16 15:59:00 -0600388static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700389{
Tony Barbourde4124d2015-07-03 10:33:54 -0600390 return *(struct nulldrv_mem **) &mem;
David Pinedo0257fbf2015-02-02 18:02:40 -0700391}
392
393static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
394{
395 return (struct nulldrv_buf *) base;
396}
397
Tony Barbour426b9052015-06-24 16:06:58 -0600398static VkResult buf_get_memory_requirements(struct nulldrv_base *base,
399 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700400{
401 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
David Pinedo0257fbf2015-02-02 18:02:40 -0700402
Tony Barbour426b9052015-06-24 16:06:58 -0600403 if (pMemoryRequirements == NULL)
404 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700405
Tony Barbour426b9052015-06-24 16:06:58 -0600406 pMemoryRequirements->size = buf->size;
407 pMemoryRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700408
Tony Barbour426b9052015-06-24 16:06:58 -0600409 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700410}
411
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600412static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600413 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700414 struct nulldrv_buf **buf_ret)
415{
416 struct nulldrv_buf *buf;
417
418 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600419 VK_OBJECT_TYPE_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700420 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600421 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700422
423 buf->size = info->size;
424 buf->usage = info->usage;
425
Tony Barbour426b9052015-06-24 16:06:58 -0600426 buf->obj.base.get_memory_requirements = buf_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700427
428 *buf_ret = buf;
429
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600430 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700431}
432
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600433static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
434 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700435 struct nulldrv_desc_layout **layout_ret)
436{
437 struct nulldrv_desc_layout *layout;
438
439 layout = (struct nulldrv_desc_layout *)
440 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600441 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700442 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600443 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700444
445 *layout_ret = layout;
446
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600447 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700448}
449
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500450static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
451 const VkPipelineLayoutCreateInfo* pCreateInfo,
452 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800453{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500454 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800455
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500456 pipeline_layout = (struct nulldrv_pipeline_layout *)
457 nulldrv_base_create(dev, sizeof(*pipeline_layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600458 VK_OBJECT_TYPE_PIPELINE_LAYOUT);
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500459 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600460 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800461
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500462 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800463
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600464 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800465}
466
Tony Barbour8db65372015-07-10 18:32:33 -0600467static struct nulldrv_desc_layout *nulldrv_desc_layout(const VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700468{
Tony Barbourde4124d2015-07-03 10:33:54 -0600469 return *(struct nulldrv_desc_layout **) &layout;
David Pinedo0257fbf2015-02-02 18:02:40 -0700470}
471
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600472static VkResult shader_create(struct nulldrv_dev *dev,
473 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700474 struct nulldrv_shader **sh_ret)
475{
David Pinedo0257fbf2015-02-02 18:02:40 -0700476 struct nulldrv_shader *sh;
477
478 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600479 VK_OBJECT_TYPE_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700480 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600481 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700482
483 *sh_ret = sh;
484
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600485 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700486}
487
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600488static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
489 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700490 struct nulldrv_pipeline **pipeline_ret)
491{
492 struct nulldrv_pipeline *pipeline;
493
494 pipeline = (struct nulldrv_pipeline *)
495 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600496 VK_OBJECT_TYPE_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700497 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600498 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700499
500 *pipeline_ret = pipeline;
501
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600502 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700503}
504
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600505static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600506 const VkDynamicViewportStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700507 struct nulldrv_dynamic_vp **state_ret)
508{
509 struct nulldrv_dynamic_vp *state;
510
511 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600512 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_VIEWPORT_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700513 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600514 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700515
516 *state_ret = state;
517
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600518 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700519}
520
Cody Northropf5bd2252015-08-17 11:10:49 -0600521static VkResult nulldrv_raster_line_state_create(struct nulldrv_dev *dev,
522 const VkDynamicRasterLineStateCreateInfo *info,
523 struct nulldrv_dynamic_rs_line **state_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700524{
Cody Northropf5bd2252015-08-17 11:10:49 -0600525 struct nulldrv_dynamic_rs_line *state;
David Pinedo0257fbf2015-02-02 18:02:40 -0700526
Cody Northropf5bd2252015-08-17 11:10:49 -0600527 state = (struct nulldrv_dynamic_rs_line *) nulldrv_base_create(dev,
528 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RASTER_LINE_STATE);
529 if (!state)
530 return VK_ERROR_OUT_OF_HOST_MEMORY;
531
532 *state_ret = state;
533
534 return VK_SUCCESS;
535}
536
537static VkResult nulldrv_raster_depth_bias_state_create(struct nulldrv_dev *dev,
538 const VkDynamicRasterDepthBiasStateCreateInfo *info,
539 struct nulldrv_dynamic_rs_depth_bias **state_ret)
540{
541 struct nulldrv_dynamic_rs_depth_bias *state;
542
543 state = (struct nulldrv_dynamic_rs_depth_bias *) nulldrv_base_create(dev,
544 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RASTER_DEPTH_BIAS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700545 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600546 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700547
548 *state_ret = state;
549
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600550 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700551}
552
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600553static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600554 const VkDynamicColorBlendStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700555 struct nulldrv_dynamic_cb **state_ret)
556{
557 struct nulldrv_dynamic_cb *state;
558
559 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600560 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_COLOR_BLEND_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700561 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600562 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700563
564 *state_ret = state;
565
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600566 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700567}
568
Cody Northrop2605cb02015-08-18 15:21:16 -0600569static VkResult nulldrv_depth_state_create(struct nulldrv_dev *dev,
570 const VkDynamicDepthStateCreateInfo *info,
571 struct nulldrv_dynamic_depth **state_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700572{
Cody Northrop2605cb02015-08-18 15:21:16 -0600573 struct nulldrv_dynamic_depth *state;
David Pinedo0257fbf2015-02-02 18:02:40 -0700574
Cody Northrop2605cb02015-08-18 15:21:16 -0600575 state = (struct nulldrv_dynamic_depth *) nulldrv_base_create(dev,
576 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DEPTH_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700577 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600578 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700579
580 *state_ret = state;
581
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600582 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700583}
584
Cody Northrop2605cb02015-08-18 15:21:16 -0600585static VkResult nulldrv_stencil_state_create(struct nulldrv_dev *dev,
586 const VkDynamicStencilStateCreateInfo *infoFront,
587 const VkDynamicStencilStateCreateInfo *infoBack,
588 struct nulldrv_dynamic_stencil **state_ret)
589{
590 struct nulldrv_dynamic_stencil *state;
591
592 state = (struct nulldrv_dynamic_stencil *) nulldrv_base_create(dev,
593 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE);
594 if (!state)
595 return VK_ERROR_OUT_OF_HOST_MEMORY;
596
597 *state_ret = state;
598
599 return VK_SUCCESS;
600}
David Pinedo0257fbf2015-02-02 18:02:40 -0700601
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600602static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
603 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700604 struct nulldrv_cmd **cmd_ret)
605{
David Pinedo0257fbf2015-02-02 18:02:40 -0700606 struct nulldrv_cmd *cmd;
607
David Pinedo0257fbf2015-02-02 18:02:40 -0700608 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600609 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700610 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600611 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700612
613 *cmd_ret = cmd;
614
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600615 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700616}
617
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600618static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
619 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700620 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600621 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800622 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700623{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800624 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700625
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800626 pool = (struct nulldrv_desc_pool *)
627 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600628 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800629 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600630 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700631
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800632 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700633
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800634 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700635
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600636 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700637}
638
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600639static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800640 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600641 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700642 const struct nulldrv_desc_layout *layout,
643 struct nulldrv_desc_set **set_ret)
644{
645 struct nulldrv_desc_set *set;
646
647 set = (struct nulldrv_desc_set *)
648 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600649 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700650 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600651 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700652
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800653 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700654 set->layout = layout;
655 *set_ret = set;
656
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600657 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700658}
659
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600660static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700661{
Tony Barbourde4124d2015-07-03 10:33:54 -0600662 return *(struct nulldrv_desc_pool **) &pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700663}
664
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600665static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
666 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700667 struct nulldrv_framebuffer ** fb_ret)
668{
669
670 struct nulldrv_framebuffer *fb;
671 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600672 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700673 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600674 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700675
676 *fb_ret = fb;
677
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600678 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700679
680}
681
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600682static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
683 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700684 struct nulldrv_render_pass** rp_ret)
685{
686 struct nulldrv_render_pass *rp;
687 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600688 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700689 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600690 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700691
692 *rp_ret = rp;
693
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600694 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700695}
696
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600697static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700698{
Tony Barbourde4124d2015-07-03 10:33:54 -0600699 return *(struct nulldrv_buf **) &buf;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700700}
701
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600702static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600703 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700704 struct nulldrv_buf_view **view_ret)
705{
706 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
707 struct nulldrv_buf_view *view;
708
709 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600710 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700711 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600712 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700713
714 view->buf = buf;
715
716 *view_ret = view;
717
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600718 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700719}
720
David Pinedo0257fbf2015-02-02 18:02:40 -0700721
722//*********************************************
723// Driver entry points
724//*********************************************
725
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600726ICD_EXPORT VkResult VKAPI vkCreateBuffer(
727 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600728 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600729 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700730{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700731 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700732 struct nulldrv_dev *dev = nulldrv_dev(device);
733
734 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
735}
736
Tony Barbourde4124d2015-07-03 10:33:54 -0600737ICD_EXPORT VkResult VKAPI vkDestroyBuffer(
738 VkDevice device,
739 VkBuffer buffer)
740{
741 NULLDRV_LOG_FUNC;
742 return VK_SUCCESS;
743}
744
Cody Northropf02f9f82015-07-09 18:08:05 -0600745ICD_EXPORT VkResult VKAPI vkCreateCommandPool(
746 VkDevice device,
747 const VkCmdPoolCreateInfo* pCreateInfo,
748 VkCmdPool* pCmdPool)
749{
750 NULLDRV_LOG_FUNC;
751 return VK_SUCCESS;
752}
753
754ICD_EXPORT VkResult VKAPI vkDestroyCommandPool(
755 VkDevice device,
756 VkCmdPool cmdPool)
757{
758 NULLDRV_LOG_FUNC;
759 return VK_SUCCESS;
760}
761
762ICD_EXPORT VkResult VKAPI vkResetCommandPool(
763 VkDevice device,
764 VkCmdPool cmdPool,
765 VkCmdPoolResetFlags flags)
766{
767 NULLDRV_LOG_FUNC;
768 return VK_SUCCESS;
769}
770
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600771ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
772 VkDevice device,
773 const VkCmdBufferCreateInfo* pCreateInfo,
774 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700775{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700776 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700777 struct nulldrv_dev *dev = nulldrv_dev(device);
778
779 return nulldrv_cmd_create(dev, pCreateInfo,
780 (struct nulldrv_cmd **) pCmdBuffer);
781}
782
Tony Barbourde4124d2015-07-03 10:33:54 -0600783ICD_EXPORT VkResult VKAPI vkDestroyCommandBuffer(
784 VkDevice device,
785 VkCmdBuffer cmdBuffer)
786{
787 NULLDRV_LOG_FUNC;
788 return VK_SUCCESS;
789}
790
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600791ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
792 VkCmdBuffer cmdBuffer,
793 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700794{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700795 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600796 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700797}
798
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600799ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
800 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700801{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700802 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600803 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700804}
805
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600806ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
Cody Northropf02f9f82015-07-09 18:08:05 -0600807 VkCmdBuffer cmdBuffer,
808 VkCmdBufferResetFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700809{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700810 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600811 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700812}
813
Ian Elliott64a68e12015-04-16 11:57:46 -0600814static const VkFormat nulldrv_presentable_formats[] = {
815 VK_FORMAT_B8G8R8A8_UNORM,
816};
817
Jon Ashburnba4a1952015-06-16 12:44:51 -0600818#if 0
Ian Elliott64a68e12015-04-16 11:57:46 -0600819ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
820 VkDisplayWSI display,
821 VkDisplayInfoTypeWSI infoType,
822 size_t* pDataSize,
823 void* pData)
824{
825 VkResult ret = VK_SUCCESS;
826
827 NULLDRV_LOG_FUNC;
828
829 if (!pDataSize)
830 return VK_ERROR_INVALID_POINTER;
831
832 switch (infoType) {
833 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
834 {
835 VkDisplayFormatPropertiesWSI *dst = pData;
836 size_t size_ret;
837 uint32_t i;
838
839 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
840
841 if (dst && *pDataSize < size_ret)
842 return VK_ERROR_INVALID_VALUE;
843
844 *pDataSize = size_ret;
845 if (!dst)
846 return VK_SUCCESS;
847
848 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
849 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
850 }
851 break;
852 default:
853 ret = VK_ERROR_INVALID_VALUE;
854 break;
855 }
856
857 return ret;
858}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600859#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600860
861ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
862 VkDevice device,
863 const VkSwapChainCreateInfoWSI* pCreateInfo,
864 VkSwapChainWSI* pSwapChain)
865{
866 NULLDRV_LOG_FUNC;
867 struct nulldrv_dev *dev = nulldrv_dev(device);
868 struct nulldrv_swap_chain *sc;
869
870 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600871 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600872 if (!sc) {
873 return VK_ERROR_OUT_OF_HOST_MEMORY;
874 }
875 sc->dev = dev;
876
Tony Barbour7910de72015-07-13 16:37:21 -0600877 *(VkSwapChainWSI **)pSwapChain = *(VkSwapChainWSI **)&sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600878
879 return VK_SUCCESS;
880}
881
882ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600883 VkDevice device,
Ian Elliott64a68e12015-04-16 11:57:46 -0600884 VkSwapChainWSI swapChain)
885{
886 NULLDRV_LOG_FUNC;
Tony Barbour7910de72015-07-13 16:37:21 -0600887 struct nulldrv_swap_chain *sc = *(struct nulldrv_swap_chain **) &swapChain;
Ian Elliott64a68e12015-04-16 11:57:46 -0600888
889 free(sc);
890
891 return VK_SUCCESS;
892}
893
Ian Elliott3333bb42015-08-10 13:56:08 -0600894ICD_EXPORT VkResult VKAPI vkGetSwapChainImagesWSI(
895 VkDevice device,
896 VkSwapChainWSI swapChain,
897 uint32_t* pCount,
898 VkImage* pSwapChainImages)
Ian Elliott64a68e12015-04-16 11:57:46 -0600899{
900 NULLDRV_LOG_FUNC;
Tony Barbour7910de72015-07-13 16:37:21 -0600901 struct nulldrv_swap_chain *sc = *(struct nulldrv_swap_chain **) &swapChain;
Ian Elliott64a68e12015-04-16 11:57:46 -0600902 struct nulldrv_dev *dev = sc->dev;
903 VkResult ret = VK_SUCCESS;
904
Ian Elliott3333bb42015-08-10 13:56:08 -0600905 *pCount = 2;
906 if (pSwapChainImages) {
907 uint32_t i;
908 for (i = 0; i < 2; i++) {
Ian Elliott64a68e12015-04-16 11:57:46 -0600909 struct nulldrv_img *img;
Ian Elliott64a68e12015-04-16 11:57:46 -0600910
911 img = (struct nulldrv_img *) nulldrv_base_create(dev,
912 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600913 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600914 if (!img)
915 return VK_ERROR_OUT_OF_HOST_MEMORY;
Ian Elliott3333bb42015-08-10 13:56:08 -0600916 pSwapChainImages[i].handle = (uint64_t) &img;
Ian Elliott64a68e12015-04-16 11:57:46 -0600917 }
Ian Elliott64a68e12015-04-16 11:57:46 -0600918 }
919
920 return ret;
921}
922
Tony Barbour7910de72015-07-13 16:37:21 -0600923ICD_EXPORT VkResult VKAPI vkAcquireNextImageWSI(
924 VkDevice device,
925 VkSwapChainWSI swapChain,
926 uint64_t timeout,
927 VkSemaphore semaphore,
928 uint32_t* pImageIndex)
929{
930 NULLDRV_LOG_FUNC;
931
932 return VK_SUCCESS;
933}
934
Ian Elliott3333bb42015-08-10 13:56:08 -0600935VkResult VKAPI vkGetSurfacePropertiesWSI(
Tony Barbour7910de72015-07-13 16:37:21 -0600936 VkDevice device,
937 const VkSurfaceDescriptionWSI* pSurfaceDescription,
Ian Elliott3333bb42015-08-10 13:56:08 -0600938 VkSurfacePropertiesWSI* pSurfaceProperties)
939{
940 NULLDRV_LOG_FUNC;
941
942 return VK_SUCCESS;
943}
944
945VkResult VKAPI vkGetSurfaceFormatsWSI(
946 VkDevice device,
947 const VkSurfaceDescriptionWSI* pSurfaceDescription,
948 uint32_t* pCount,
949 VkSurfaceFormatWSI* pSurfaceFormats)
950{
951 NULLDRV_LOG_FUNC;
952
953 return VK_SUCCESS;
954}
955
956VkResult VKAPI vkGetSurfacePresentModesWSI(
957 VkDevice device,
958 const VkSurfaceDescriptionWSI* pSurfaceDescription,
959 uint32_t* pCount,
960 VkPresentModeWSI* pPresentModes)
Tony Barbour7910de72015-07-13 16:37:21 -0600961{
962 NULLDRV_LOG_FUNC;
963
964 return VK_SUCCESS;
965}
966
967ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSurfaceSupportWSI(
968 VkPhysicalDevice physicalDevice,
969 uint32_t queueFamilyIndex,
970 const VkSurfaceDescriptionWSI* pSurfaceDescription,
971 VkBool32* pSupported)
972{
973 NULLDRV_LOG_FUNC;
974
975 return VK_SUCCESS;
976}
977
Ian Elliott64a68e12015-04-16 11:57:46 -0600978ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600979 VkQueue queue_,
980 VkPresentInfoWSI* pPresentInfo)
Ian Elliott64a68e12015-04-16 11:57:46 -0600981{
982 NULLDRV_LOG_FUNC;
983
984 return VK_SUCCESS;
985}
986
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600987ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600988 VkCmdBuffer cmdBuffer,
989 VkBuffer srcBuffer,
990 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700991 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600992 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700993{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700994 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700995}
996
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600997ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600998 VkCmdBuffer cmdBuffer,
999 VkImage srcImage,
1000 VkImageLayout srcImageLayout,
1001 VkImage destImage,
1002 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001003 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001004 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001005{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001006 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001007}
1008
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001009ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001010 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001011 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001012 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001013 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001014 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -05001015 uint32_t regionCount,
1016 const VkImageBlit* pRegions,
1017 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -06001018{
1019 NULLDRV_LOG_FUNC;
1020}
1021
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001022ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001023 VkCmdBuffer cmdBuffer,
1024 VkBuffer srcBuffer,
1025 VkImage destImage,
1026 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001027 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001028 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001029{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001030 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001031}
1032
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001033ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001034 VkCmdBuffer cmdBuffer,
1035 VkImage srcImage,
1036 VkImageLayout srcImageLayout,
1037 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001038 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001039 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001040{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001041 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001042}
1043
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001044ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001045 VkCmdBuffer cmdBuffer,
1046 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001047 VkDeviceSize destOffset,
1048 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001049 const uint32_t* pData)
1050{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001051 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001052}
1053
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001054ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001055 VkCmdBuffer cmdBuffer,
1056 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001057 VkDeviceSize destOffset,
1058 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001059 uint32_t data)
1060{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001061 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001062}
1063
Ian Elliotte924ab22015-07-08 13:24:30 -06001064ICD_EXPORT void VKAPI vkCmdClearDepthStencilImage(
1065 VkCmdBuffer cmdBuffer,
1066 VkImage image,
1067 VkImageLayout imageLayout,
1068 float depth,
1069 uint32_t stencil,
1070 uint32_t rangeCount,
1071 const VkImageSubresourceRange* pRanges)
1072{
1073 NULLDRV_LOG_FUNC;
1074}
1075
1076ICD_EXPORT void VKAPI vkCmdClearColorAttachment(
1077 VkCmdBuffer cmdBuffer,
1078 uint32_t colorAttachment,
1079 VkImageLayout imageLayout,
1080 const VkClearColorValue *pColor,
1081 uint32_t rectCount,
1082 const VkRect3D *pRects)
1083{
1084 NULLDRV_LOG_FUNC;
1085}
1086
1087ICD_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(
1088 VkCmdBuffer cmdBuffer,
1089 VkImageAspectFlags imageAspectMask,
1090 VkImageLayout imageLayout,
1091 float depth,
1092 uint32_t stencil,
1093 uint32_t rectCount,
1094 const VkRect3D *pRects)
1095{
1096 NULLDRV_LOG_FUNC;
1097}
1098
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001099ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001100 VkCmdBuffer cmdBuffer,
1101 VkImage image,
1102 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +12001103 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001104 uint32_t rangeCount,
1105 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001106{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001107 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001108}
1109
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001110ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001111 VkCmdBuffer cmdBuffer,
1112 VkImage image,
1113 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001114 float depth,
1115 uint32_t stencil,
1116 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001117 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001118{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001119 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001120}
1121
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001122ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001123 VkCmdBuffer cmdBuffer,
1124 VkImage srcImage,
1125 VkImageLayout srcImageLayout,
1126 VkImage destImage,
1127 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001128 uint32_t regionCount,
1129 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001130{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001131 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001132}
1133
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001134ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001135 VkCmdBuffer cmdBuffer,
1136 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001137 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001138 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001139{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001140 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001141}
1142
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001143ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001144 VkCmdBuffer cmdBuffer,
1145 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001146 uint32_t slot)
1147{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001148 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001149}
1150
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001151ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001152 VkCmdBuffer cmdBuffer,
1153 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001154 uint32_t startQuery,
1155 uint32_t queryCount)
1156{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001157 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001158}
1159
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001160ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001161 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001162 VkEvent event_,
1163 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001164{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001165 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001166}
1167
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001168ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001169 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001170 VkEvent event_,
1171 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001172{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001173 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001174}
1175
Ian Elliott63f1edb2015-04-16 18:10:19 -06001176ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1177 VkCmdBuffer cmdBuffer,
1178 VkQueryPool queryPool,
1179 uint32_t startQuery,
1180 uint32_t queryCount,
1181 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001182 VkDeviceSize destOffset,
1183 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001184 VkFlags flags)
1185{
1186 NULLDRV_LOG_FUNC;
1187}
1188
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001189ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001190 VkCmdBuffer cmdBuffer,
1191 VkTimestampType timestampType,
1192 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001193 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001194{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001195 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001196}
1197
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001198ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001199 VkCmdBuffer cmdBuffer,
Tony Barbourde4124d2015-07-03 10:33:54 -06001200 VkPipelineBindPoint pipelineBindPoint,
1201 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001202{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001203 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001204}
1205
Tony Barbourde4124d2015-07-03 10:33:54 -06001206ICD_EXPORT void VKAPI vkCmdBindDynamicViewportState(
1207 VkCmdBuffer cmdBuffer,
1208 VkDynamicViewportState state)
1209{
1210 NULLDRV_LOG_FUNC;
1211}
1212
Cody Northropf5bd2252015-08-17 11:10:49 -06001213ICD_EXPORT void VKAPI vkCmdBindDynamicRasterLineState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001214 VkCmdBuffer cmdBuffer,
Cody Northropf5bd2252015-08-17 11:10:49 -06001215 VkDynamicRasterLineState state)
1216{
1217 NULLDRV_LOG_FUNC;
1218}
1219
1220ICD_EXPORT void VKAPI vkCmdBindDynamicRasterDepthBiasState(
1221 VkCmdBuffer cmdBuffer,
1222 VkDynamicRasterDepthBiasState state)
Tony Barbourde4124d2015-07-03 10:33:54 -06001223{
1224 NULLDRV_LOG_FUNC;
1225}
1226
1227ICD_EXPORT void VKAPI vkCmdBindDynamicColorBlendState(
1228 VkCmdBuffer cmdBuffer,
1229 VkDynamicColorBlendState state)
1230{
1231 NULLDRV_LOG_FUNC;
1232}
1233
Cody Northrop2605cb02015-08-18 15:21:16 -06001234ICD_EXPORT void VKAPI vkCmdBindDynamicDepthState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001235 VkCmdBuffer cmdBuffer,
Cody Northrop2605cb02015-08-18 15:21:16 -06001236 VkDynamicDepthState state)
1237{
1238 NULLDRV_LOG_FUNC;
1239}
1240
1241ICD_EXPORT void VKAPI vkCmdBindDynamicStencilState(
1242 VkCmdBuffer cmdBuffer,
1243 VkDynamicStencilState state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001244{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001245 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001246}
1247
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001248ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001249 VkCmdBuffer cmdBuffer,
1250 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001251 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001252 uint32_t firstSet,
1253 uint32_t setCount,
1254 const VkDescriptorSet* pDescriptorSets,
1255 uint32_t dynamicOffsetCount,
1256 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001257{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001258 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001259}
1260
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001261ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1262 VkCmdBuffer cmdBuffer,
1263 uint32_t startBinding,
1264 uint32_t bindingCount,
1265 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001266 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001267{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001268 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001269}
1270
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001271ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001272 VkCmdBuffer cmdBuffer,
1273 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001274 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001275 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001276{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001277 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001278}
1279
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001280ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001281 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001282 uint32_t firstVertex,
1283 uint32_t vertexCount,
1284 uint32_t firstInstance,
1285 uint32_t instanceCount)
1286{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001287 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001288}
1289
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001290ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001291 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001292 uint32_t firstIndex,
1293 uint32_t indexCount,
1294 int32_t vertexOffset,
1295 uint32_t firstInstance,
1296 uint32_t instanceCount)
1297{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001298 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001299}
1300
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001301ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001302 VkCmdBuffer cmdBuffer,
1303 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001304 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001305 uint32_t count,
1306 uint32_t stride)
1307{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001308 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001309}
1310
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001311ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001312 VkCmdBuffer cmdBuffer,
1313 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001314 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001315 uint32_t count,
1316 uint32_t stride)
1317{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001318 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001319}
1320
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001321ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001322 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001323 uint32_t x,
1324 uint32_t y,
1325 uint32_t z)
1326{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001327 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001328}
1329
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001330ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001331 VkCmdBuffer cmdBuffer,
1332 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001333 VkDeviceSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001334{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001335 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001336}
1337
Tony Barbour8205d902015-04-16 15:59:00 -06001338void VKAPI vkCmdWaitEvents(
1339 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001340 uint32_t eventCount,
1341 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001342 VkPipelineStageFlags sourceStageMask,
1343 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001344 uint32_t memBarrierCount,
Courtney Goeltzenleuchterd9ba3422015-07-12 12:58:58 -06001345 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001346{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001347 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001348}
1349
Tony Barbour8205d902015-04-16 15:59:00 -06001350void VKAPI vkCmdPipelineBarrier(
1351 VkCmdBuffer cmdBuffer,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001352 VkPipelineStageFlags srcStageMask,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001353 VkPipelineStageFlags destStageMask,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001354 VkBool32 byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001355 uint32_t memBarrierCount,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001356 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001357{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001358 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001359}
1360
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001361ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001362 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001363 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001364 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001365{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001366 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001367 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1368 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1369}
1370
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001371ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1372 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001373{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001374 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001375 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001376}
1377
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001378ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1379 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001380 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001381 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001382 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001383{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001384 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001385 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001386 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001387 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001388}
1389
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001390ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1391 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001392{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001393 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001394 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001395}
1396
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001397ICD_EXPORT VkResult VKAPI vkCreateEvent(
1398 VkDevice device,
1399 const VkEventCreateInfo* pCreateInfo,
1400 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001401{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001402 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001403 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001404}
1405
Tony Barbourde4124d2015-07-03 10:33:54 -06001406ICD_EXPORT VkResult VKAPI vkDestroyEvent(
1407 VkDevice device,
1408 VkEvent event)
1409{
1410 NULLDRV_LOG_FUNC;
1411 return VK_SUCCESS;
1412}
1413
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001414ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001415 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001416 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001417{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001418 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001419 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001420}
1421
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001422ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001423 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001424 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001425{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001426 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001427 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001428}
1429
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001430ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001431 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001432 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001433{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001434 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001435 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001436}
1437
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001438ICD_EXPORT VkResult VKAPI vkCreateFence(
1439 VkDevice device,
1440 const VkFenceCreateInfo* pCreateInfo,
1441 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001442{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001443 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001444 struct nulldrv_dev *dev = nulldrv_dev(device);
1445
1446 return nulldrv_fence_create(dev, pCreateInfo,
1447 (struct nulldrv_fence **) pFence);
1448}
1449
Tony Barbourde4124d2015-07-03 10:33:54 -06001450ICD_EXPORT VkResult VKAPI vkDestroyFence(
1451 VkDevice device,
1452 VkFence fence)
1453{
1454 NULLDRV_LOG_FUNC;
1455 return VK_SUCCESS;
1456}
1457
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001458ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001459 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001460 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001461{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001462 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001463 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001464}
1465
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001466ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001467 VkDevice device,
1468 uint32_t fenceCount,
1469 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001470{
1471 NULLDRV_LOG_FUNC;
1472 return VK_SUCCESS;
1473}
1474
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001475ICD_EXPORT VkResult VKAPI vkWaitForFences(
1476 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001477 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001478 const VkFence* pFences,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001479 VkBool32 waitAll,
David Pinedo0257fbf2015-02-02 18:02:40 -07001480 uint64_t timeout)
1481{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001482 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001483 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001484}
1485
Tony Barbour426b9052015-06-24 16:06:58 -06001486ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1487 VkPhysicalDevice gpu_,
1488 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001489{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001490 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001491 VkResult ret = VK_SUCCESS;
1492
Tony Barbour426b9052015-06-24 16:06:58 -06001493 pProperties->apiVersion = VK_API_VERSION;
1494 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1495 pProperties->vendorId = 0;
1496 pProperties->deviceId = 0;
1497 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1498 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001499
1500 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001501}
1502
Chris Forbesd7576302015-06-21 22:55:02 +12001503ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1504 VkPhysicalDevice physicalDevice,
1505 VkPhysicalDeviceFeatures* pFeatures)
1506{
1507 NULLDRV_LOG_FUNC;
1508 VkResult ret = VK_SUCCESS;
1509
1510 /* TODO: fill out features */
1511 memset(pFeatures, 0, sizeof(*pFeatures));
1512
1513 return ret;
1514}
1515
Courtney Goeltzenleuchter4da96aa2015-07-12 12:52:09 -06001516ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatProperties(
Chris Forbesd7576302015-06-21 22:55:02 +12001517 VkPhysicalDevice physicalDevice,
1518 VkFormat format,
1519 VkFormatProperties* pFormatInfo)
1520{
1521 NULLDRV_LOG_FUNC;
1522 VkResult ret = VK_SUCCESS;
1523
1524 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1525 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1526
1527 return ret;
1528}
1529
1530ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1531 VkPhysicalDevice physicalDevice,
1532 VkPhysicalDeviceLimits* pLimits)
1533{
1534 NULLDRV_LOG_FUNC;
1535 VkResult ret = VK_SUCCESS;
1536
1537 /* TODO: fill out limits */
1538 memset(pLimits, 0, sizeof(*pLimits));
1539
1540 return ret;
1541}
1542
Cody Northropef72e2a2015-08-03 17:04:53 -06001543ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueFamilyProperties(
Tony Barbour426b9052015-06-24 16:06:58 -06001544 VkPhysicalDevice gpu_,
Cody Northropef72e2a2015-08-03 17:04:53 -06001545 uint32_t* pCount,
1546 VkQueueFamilyProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001547 {
Cody Northropef72e2a2015-08-03 17:04:53 -06001548 if (pProperties == NULL) {
1549 *pCount = 1;
1550 return VK_SUCCESS;
1551 }
Tony Barbour426b9052015-06-24 16:06:58 -06001552 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1553 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001554 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001555
Tony Barbour426b9052015-06-24 16:06:58 -06001556 return VK_SUCCESS;
1557}
1558
Ian Elliotte924ab22015-07-08 13:24:30 -06001559ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(
1560 VkPhysicalDevice gpu_,
1561 VkPhysicalDeviceMemoryProperties* pProperties)
1562{
1563 // TODO: Fill in with real data
1564 return VK_SUCCESS;
1565}
1566
1567ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLayerProperties(
1568 VkPhysicalDevice physicalDevice,
1569 uint32_t* pCount,
1570 VkLayerProperties* pProperties)
1571{
1572 // TODO: Fill in with real data
1573 return VK_SUCCESS;
1574}
1575
Tony Barbour426b9052015-06-24 16:06:58 -06001576ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001577 const char* pLayerName,
1578 uint32_t* pCount,
1579 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001580{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001581 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001582
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001583 if (pCount == NULL) {
1584 return VK_ERROR_INVALID_POINTER;
1585 }
Tony Barbour426b9052015-06-24 16:06:58 -06001586
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001587 if (pProperties == NULL) {
1588 *pCount = NULLDRV_EXT_COUNT;
1589 return VK_SUCCESS;
1590 }
Tony Barbour426b9052015-06-24 16:06:58 -06001591
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001592 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1593 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1594 *pCount = copy_size;
1595 if (copy_size < NULLDRV_EXT_COUNT) {
1596 return VK_INCOMPLETE;
1597 }
Tony Barbour426b9052015-06-24 16:06:58 -06001598 return VK_SUCCESS;
1599}
Ian Elliotte924ab22015-07-08 13:24:30 -06001600ICD_EXPORT VkResult VKAPI vkGetGlobalLayerProperties(
1601 uint32_t* pCount,
1602 VkLayerProperties* pProperties)
1603{
1604 // TODO: Fill in with real data
1605 return VK_SUCCESS;
1606}
Tony Barbour426b9052015-06-24 16:06:58 -06001607
1608VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001609 VkPhysicalDevice physicalDevice,
1610 const char* pLayerName,
1611 uint32_t* pCount,
1612 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001613{
Tony Barbour426b9052015-06-24 16:06:58 -06001614
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001615 if (pCount == NULL) {
1616 return VK_ERROR_INVALID_POINTER;
1617 }
1618
Tony Barbour426b9052015-06-24 16:06:58 -06001619 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001620
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001621 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001622}
1623
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001624ICD_EXPORT VkResult VKAPI vkCreateImage(
1625 VkDevice device,
1626 const VkImageCreateInfo* pCreateInfo,
1627 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001628{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001629 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001630 struct nulldrv_dev *dev = nulldrv_dev(device);
1631
1632 return nulldrv_img_create(dev, pCreateInfo, false,
1633 (struct nulldrv_img **) pImage);
1634}
1635
Tony Barbourde4124d2015-07-03 10:33:54 -06001636ICD_EXPORT VkResult VKAPI vkDestroyImage(
1637 VkDevice device,
1638 VkImage image)
1639{
1640 NULLDRV_LOG_FUNC;
1641 return VK_SUCCESS;
1642}
1643
Tony Barbour426b9052015-06-24 16:06:58 -06001644ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001645 VkDevice device,
1646 VkImage image,
1647 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001648 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001649{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001650 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001651
Tony Barbour426b9052015-06-24 16:06:58 -06001652 pLayout->offset = 0;
1653 pLayout->size = 1;
1654 pLayout->rowPitch = 4;
1655 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001656
Tony Barbour426b9052015-06-24 16:06:58 -06001657 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001658}
1659
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001660ICD_EXPORT VkResult VKAPI vkAllocMemory(
1661 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001662 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001663 VkDeviceMemory* pMem)
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_dev *dev = nulldrv_dev(device);
1667
1668 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1669}
1670
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001671ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001672 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001673 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001674{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001675 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001676 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001677}
1678
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001679ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001680 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001681 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001682 VkDeviceSize offset,
1683 VkDeviceSize size,
1684 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001685 void** ppData)
1686{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001687 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001688 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1689 void *ptr = nulldrv_mem_map(mem, flags);
1690
1691 *ppData = ptr;
1692
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001693 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001694}
1695
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001696ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001697 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001698 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001699{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001700 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001701 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001702}
1703
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001704ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001705 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001706 uint32_t memRangeCount,
1707 const VkMappedMemoryRange* pMemRanges)
1708{
1709 NULLDRV_LOG_FUNC;
1710 return VK_SUCCESS;
1711}
1712
1713ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1714 VkDevice device,
1715 uint32_t memRangeCount,
1716 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001717{
1718 NULLDRV_LOG_FUNC;
1719 return VK_SUCCESS;
1720}
1721
Courtney Goeltzenleuchterd040c5c2015-07-09 21:57:28 -06001722ICD_EXPORT VkResult VKAPI vkGetDeviceMemoryCommitment(
1723 VkDevice device,
1724 VkDeviceMemory memory,
1725 VkDeviceSize* pCommittedMemoryInBytes)
1726{
1727 return VK_SUCCESS;
1728}
1729
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001730ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001731 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001732 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001733{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001734 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001735 struct nulldrv_instance *inst;
1736
1737 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001738 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001739 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001740 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001741
Tony Barbour426b9052015-06-24 16:06:58 -06001742 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001743
Mike Stroyan230e6252015-04-17 12:36:38 -06001744 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001745
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001746 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001747}
1748
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001749ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1750 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001751{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001752 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001753 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001754}
1755
Tony Barbour8205d902015-04-16 15:59:00 -06001756ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001757 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001758 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001759 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001760{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001761 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001762 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001763 struct nulldrv_gpu *gpu;
1764 *pGpuCount = 1;
1765 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001766 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001767 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001768 return ret;
1769}
1770
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001771ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001772 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001773 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001774 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001775 char* const* pOutLayers,
1776 void* pReserved)
1777{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001778 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001779 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001780}
1781
Tony Barbourde4124d2015-07-03 10:33:54 -06001782ICD_EXPORT VkResult VKAPI vkGetBufferMemoryRequirements(
1783 VkDevice device,
1784 VkBuffer buffer,
1785 VkMemoryRequirements* pMemoryRequirements)
1786{
1787 NULLDRV_LOG_FUNC;
1788 struct nulldrv_base *base = nulldrv_base((void*)buffer.handle);
1789
1790 return base->get_memory_requirements(base, pMemoryRequirements);
1791}
1792
1793ICD_EXPORT VkResult VKAPI vkGetImageMemoryRequirements(
1794 VkDevice device,
1795 VkImage image,
1796 VkMemoryRequirements* pMemoryRequirements)
1797{
1798 NULLDRV_LOG_FUNC;
1799 struct nulldrv_base *base = nulldrv_base((void*)image.handle);
1800
1801 return base->get_memory_requirements(base, pMemoryRequirements);
1802}
1803
1804ICD_EXPORT VkResult VKAPI vkBindBufferMemory(
1805 VkDevice device,
1806 VkBuffer buffer,
1807 VkDeviceMemory mem_,
1808 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001809{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001810 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001811 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001812}
1813
Tony Barbourde4124d2015-07-03 10:33:54 -06001814ICD_EXPORT VkResult VKAPI vkBindImageMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001815 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06001816 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001817 VkDeviceMemory mem_,
1818 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001819{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001820 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001821 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001822}
1823
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001824ICD_EXPORT VkResult VKAPI vkGetImageSparseMemoryRequirements(
1825 VkDevice device,
1826 VkImage image,
1827 uint32_t* pNumRequirements,
1828 VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
1829{
1830 NULLDRV_LOG_FUNC;
1831 return VK_SUCCESS;
1832}
1833
1834ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(
1835 VkPhysicalDevice physicalDevice,
1836 VkFormat format,
1837 VkImageType type,
1838 uint32_t samples,
1839 VkImageUsageFlags usage,
1840 VkImageTiling tiling,
1841 uint32_t* pNumProperties,
1842 VkSparseImageFormatProperties* pProperties)
1843{
1844 NULLDRV_LOG_FUNC;
1845 return VK_SUCCESS;
1846}
1847
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001848ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001849 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001850 VkBuffer buffer,
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001851 uint32_t numBindings,
1852 const VkSparseMemoryBindInfo* pBindInfo)
1853{
1854 NULLDRV_LOG_FUNC;
1855 return VK_SUCCESS;
1856}
1857
1858ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageOpaqueMemory(
1859 VkQueue queue,
1860 VkImage image,
1861 uint32_t numBindings,
1862 const VkSparseMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001863{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001864 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001865 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001866}
1867
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001868ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001869 VkQueue queue,
1870 VkImage image,
1871 uint32_t numBindings,
1872 const VkSparseImageMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001873{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001874 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001875 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001876}
Jon Ashburn0e249962015-07-10 09:41:15 -07001877ICD_EXPORT VkResult VKAPI vkCreatePipelineCache(
1878 VkDevice device,
1879 const VkPipelineCacheCreateInfo* pCreateInfo,
1880 VkPipelineCache* pPipelineCache)
1881{
David Pinedo0257fbf2015-02-02 18:02:40 -07001882
Jon Ashburn0e249962015-07-10 09:41:15 -07001883 NULLDRV_LOG_FUNC;
1884 return VK_SUCCESS;
1885}
1886
Tony Barbourde4124d2015-07-03 10:33:54 -06001887ICD_EXPORT VkResult VKAPI vkDestroyPipeline(
1888 VkDevice device,
1889 VkPipeline pipeline)
1890{
1891 NULLDRV_LOG_FUNC;
1892 return VK_SUCCESS;
1893}
1894
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06001895VkResult VKAPI vkDestroyPipelineCache(
1896 VkDevice device,
1897 VkPipelineCache pipelineCache)
Jon Ashburn0e249962015-07-10 09:41:15 -07001898{
1899 NULLDRV_LOG_FUNC;
1900 return VK_SUCCESS;
1901}
1902
1903ICD_EXPORT size_t VKAPI vkGetPipelineCacheSize(
1904 VkDevice device,
1905 VkPipelineCache pipelineCache)
1906{
1907 NULLDRV_LOG_FUNC;
1908 return VK_ERROR_UNAVAILABLE;
1909}
1910
1911ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
1912 VkDevice device,
1913 VkPipelineCache pipelineCache,
1914 void* pData)
1915{
1916 NULLDRV_LOG_FUNC;
1917 return VK_ERROR_UNAVAILABLE;
1918}
1919
1920ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
1921 VkDevice device,
1922 VkPipelineCache destCache,
1923 uint32_t srcCacheCount,
1924 const VkPipelineCache* pSrcCaches)
1925{
1926 NULLDRV_LOG_FUNC;
1927 return VK_ERROR_UNAVAILABLE;
1928}
1929ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001930 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001931 VkPipelineCache pipelineCache,
1932 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001933 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1934 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001935{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001936 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001937 struct nulldrv_dev *dev = nulldrv_dev(device);
1938
1939 return graphics_pipeline_create(dev, pCreateInfo,
1940 (struct nulldrv_pipeline **) pPipeline);
1941}
1942
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001943
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001944
Jon Ashburn0e249962015-07-10 09:41:15 -07001945ICD_EXPORT VkResult VKAPI vkCreateComputePipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001946 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001947 VkPipelineCache pipelineCache,
1948 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001949 const VkComputePipelineCreateInfo* pCreateInfo,
1950 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001951{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001952 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001953 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001954}
1955
David Pinedo0257fbf2015-02-02 18:02:40 -07001956
David Pinedo0257fbf2015-02-02 18:02:40 -07001957
Jon Ashburn0e249962015-07-10 09:41:15 -07001958
David Pinedo0257fbf2015-02-02 18:02:40 -07001959
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001960ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1961 VkDevice device,
1962 const VkQueryPoolCreateInfo* pCreateInfo,
1963 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001964{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001965 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001966 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001967}
1968
Tony Barbourde4124d2015-07-03 10:33:54 -06001969ICD_EXPORT VkResult VKAPI vkDestroyQueryPool(
1970 VkDevice device,
1971 VkQueryPool queryPoool)
1972{
1973 NULLDRV_LOG_FUNC;
1974 return VK_SUCCESS;
1975}
1976
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001977ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001978 VkDevice device,
1979 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001980 uint32_t startQuery,
1981 uint32_t queryCount,
1982 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001983 void* pData,
1984 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001985{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001986 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001987 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001988}
1989
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001990ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1991 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001992{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001993 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001994 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001995}
1996
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001997ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1998 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001999 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002000 const VkCmdBuffer* pCmdBuffers,
2001 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07002002{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002003 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002004 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002005}
2006
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002007ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
2008 VkDevice device,
2009 const VkSemaphoreCreateInfo* pCreateInfo,
2010 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002011{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002012 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002013 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002014}
2015
Tony Barbourde4124d2015-07-03 10:33:54 -06002016ICD_EXPORT VkResult VKAPI vkDestroySemaphore(
2017 VkDevice device,
2018 VkSemaphore semaphore)
2019{
2020 NULLDRV_LOG_FUNC;
2021 return VK_SUCCESS;
2022}
2023
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002024ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
2025 VkQueue queue,
2026 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002027{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002028 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002029 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002030}
2031
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002032ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
2033 VkQueue queue,
2034 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07002035{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002036 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002037 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002038}
2039
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002040ICD_EXPORT VkResult VKAPI vkCreateSampler(
2041 VkDevice device,
2042 const VkSamplerCreateInfo* pCreateInfo,
2043 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07002044{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002045 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002046 struct nulldrv_dev *dev = nulldrv_dev(device);
2047
2048 return nulldrv_sampler_create(dev, pCreateInfo,
2049 (struct nulldrv_sampler **) pSampler);
2050}
2051
Tony Barbourde4124d2015-07-03 10:33:54 -06002052ICD_EXPORT VkResult VKAPI vkDestroySampler(
2053 VkDevice device,
2054 VkSampler sampler)
2055{
2056 NULLDRV_LOG_FUNC;
2057 return VK_SUCCESS;
2058}
2059
Ian Elliotte924ab22015-07-08 13:24:30 -06002060ICD_EXPORT VkResult VKAPI vkCreateShaderModule(
2061 VkDevice device,
2062 const VkShaderModuleCreateInfo* pCreateInfo,
2063 VkShaderModule* pShaderModule)
2064{
2065 // TODO: Fill in with real data
Tony Barbourde4124d2015-07-03 10:33:54 -06002066 NULLDRV_LOG_FUNC;
2067 return VK_SUCCESS;
2068}
2069
2070ICD_EXPORT VkResult VKAPI vkDestroyShaderModule(
2071 VkDevice device,
2072 VkShaderModule shaderModule)
2073{
2074 // TODO: Fill in with real data
2075 NULLDRV_LOG_FUNC;
Ian Elliotte924ab22015-07-08 13:24:30 -06002076 return VK_SUCCESS;
2077}
2078
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002079ICD_EXPORT VkResult VKAPI vkCreateShader(
2080 VkDevice device,
2081 const VkShaderCreateInfo* pCreateInfo,
2082 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002083{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002084 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002085 struct nulldrv_dev *dev = nulldrv_dev(device);
2086
2087 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2088}
2089
Tony Barbourde4124d2015-07-03 10:33:54 -06002090ICD_EXPORT VkResult VKAPI vkDestroyShader(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002091 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002092 VkShader shader)
2093{
2094 NULLDRV_LOG_FUNC;
2095 return VK_SUCCESS;
2096}
2097
2098ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2099 VkDevice device,
2100 const VkDynamicViewportStateCreateInfo* pCreateInfo,
2101 VkDynamicViewportState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002102{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002103 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002104 struct nulldrv_dev *dev = nulldrv_dev(device);
2105
2106 return nulldrv_viewport_state_create(dev, pCreateInfo,
2107 (struct nulldrv_dynamic_vp **) pState);
2108}
2109
Tony Barbourde4124d2015-07-03 10:33:54 -06002110ICD_EXPORT VkResult VKAPI vkDestroyDynamicViewportState(
2111 VkDevice device,
2112 VkDynamicViewportState dynamicViewportState)
2113{
2114 NULLDRV_LOG_FUNC;
2115 return VK_SUCCESS;
2116}
2117
Cody Northropf5bd2252015-08-17 11:10:49 -06002118ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterLineState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002119 VkDevice device,
Cody Northropf5bd2252015-08-17 11:10:49 -06002120 const VkDynamicRasterLineStateCreateInfo* pCreateInfo,
2121 VkDynamicRasterLineState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002122{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002123 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002124 struct nulldrv_dev *dev = nulldrv_dev(device);
2125
Cody Northropf5bd2252015-08-17 11:10:49 -06002126 return nulldrv_raster_line_state_create(dev, pCreateInfo,
2127 (struct nulldrv_dynamic_rs_line **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002128}
2129
Cody Northropf5bd2252015-08-17 11:10:49 -06002130ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterDepthBiasState(
2131 VkDevice device,
2132 const VkDynamicRasterDepthBiasStateCreateInfo* pCreateInfo,
2133 VkDynamicRasterDepthBiasState* pState)
2134{
2135 NULLDRV_LOG_FUNC;
2136 struct nulldrv_dev *dev = nulldrv_dev(device);
2137
2138 return nulldrv_raster_depth_bias_state_create(dev, pCreateInfo,
2139 (struct nulldrv_dynamic_rs_depth_bias **) pState);
2140}
2141
2142ICD_EXPORT VkResult VKAPI vkDestroyDynamicRasterLinesState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002143 VkDevice device,
Cody Northropf5bd2252015-08-17 11:10:49 -06002144 VkDynamicRasterLineState dynamicRasterLineState)
2145{
2146 NULLDRV_LOG_FUNC;
2147 return VK_SUCCESS;
2148}
2149
2150ICD_EXPORT VkResult VKAPI vkDestroyDynamicRasterDepthBiasState(
2151 VkDevice device,
2152 VkDynamicRasterDepthBiasState dynamicRasterDepthBiasState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002153{
2154 NULLDRV_LOG_FUNC;
2155 return VK_SUCCESS;
2156}
2157
2158ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
2159 VkDevice device,
2160 const VkDynamicColorBlendStateCreateInfo* pCreateInfo,
2161 VkDynamicColorBlendState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002162{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002163 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002164 struct nulldrv_dev *dev = nulldrv_dev(device);
2165
2166 return nulldrv_blend_state_create(dev, pCreateInfo,
2167 (struct nulldrv_dynamic_cb **) pState);
2168}
2169
Tony Barbourde4124d2015-07-03 10:33:54 -06002170ICD_EXPORT VkResult VKAPI vkDestroyDynamicColorBlendState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002171 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002172 VkDynamicColorBlendState dynamicColorBlendState)
2173{
2174 NULLDRV_LOG_FUNC;
2175 return VK_SUCCESS;
2176}
2177
Cody Northrop2605cb02015-08-18 15:21:16 -06002178ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002179 VkDevice device,
Cody Northrop2605cb02015-08-18 15:21:16 -06002180 const VkDynamicDepthStateCreateInfo* pCreateInfo,
2181 VkDynamicDepthState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002182{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002183 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002184 struct nulldrv_dev *dev = nulldrv_dev(device);
2185
Cody Northrop2605cb02015-08-18 15:21:16 -06002186 return nulldrv_depth_state_create(dev, pCreateInfo,
2187 (struct nulldrv_dynamic_depth **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002188}
2189
Cody Northrop2605cb02015-08-18 15:21:16 -06002190ICD_EXPORT VkResult VKAPI vkDestroyDynamicDepthState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002191 VkDevice device,
Cody Northrop2605cb02015-08-18 15:21:16 -06002192 VkDynamicDepthState dynamicDepthState)
2193{
2194 NULLDRV_LOG_FUNC;
2195 return VK_SUCCESS;
2196}
2197
2198ICD_EXPORT VkResult VKAPI vkCreateDynamicStencilState(
2199 VkDevice device,
2200 const VkDynamicStencilStateCreateInfo* pCreateInfoFront,
2201 const VkDynamicStencilStateCreateInfo* pCreateInfoBack,
2202 VkDynamicStencilState* pState)
2203{
2204 NULLDRV_LOG_FUNC;
2205 struct nulldrv_dev *dev = nulldrv_dev(device);
2206
2207 return nulldrv_stencil_state_create(dev, pCreateInfoFront, pCreateInfoBack,
2208 (struct nulldrv_dynamic_stencil **) pState);
2209}
2210
2211ICD_EXPORT VkResult VKAPI vkDestroyDynamicStencilState(
2212 VkDevice device,
2213 VkDynamicStencilState dynamicStencilState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002214{
2215 NULLDRV_LOG_FUNC;
2216 return VK_SUCCESS;
2217}
2218
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002219ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2220 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002221 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002222 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002223{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002224 NULLDRV_LOG_FUNC;
2225 struct nulldrv_dev *dev = nulldrv_dev(device);
2226
2227 return nulldrv_buf_view_create(dev, pCreateInfo,
2228 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002229}
2230
Tony Barbourde4124d2015-07-03 10:33:54 -06002231ICD_EXPORT VkResult VKAPI vkDestroyBufferView(
2232 VkDevice device,
2233 VkBufferView bufferView)
2234{
2235 NULLDRV_LOG_FUNC;
2236 return VK_SUCCESS;
2237}
2238
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002239ICD_EXPORT VkResult VKAPI vkCreateImageView(
2240 VkDevice device,
2241 const VkImageViewCreateInfo* pCreateInfo,
2242 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002243{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002244 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002245 struct nulldrv_dev *dev = nulldrv_dev(device);
2246
2247 return nulldrv_img_view_create(dev, pCreateInfo,
2248 (struct nulldrv_img_view **) pView);
2249}
2250
Tony Barbourde4124d2015-07-03 10:33:54 -06002251ICD_EXPORT VkResult VKAPI vkDestroyImageView(
2252 VkDevice device,
2253 VkImageView imageView)
2254{
2255 NULLDRV_LOG_FUNC;
2256 return VK_SUCCESS;
2257}
2258
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002259ICD_EXPORT VkResult VKAPI vkCreateAttachmentView(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002260 VkDevice device,
Chia-I Wuc278df82015-07-07 11:50:03 +08002261 const VkAttachmentViewCreateInfo* pCreateInfo,
2262 VkAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002263{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002264 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002265 struct nulldrv_dev *dev = nulldrv_dev(device);
2266
2267 return nulldrv_rt_view_create(dev, pCreateInfo,
2268 (struct nulldrv_rt_view **) pView);
2269}
2270
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002271ICD_EXPORT VkResult VKAPI vkDestroyAttachmentView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002272 VkDevice device,
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002273 VkAttachmentView attachmentView)
Tony Barbourde4124d2015-07-03 10:33:54 -06002274{
2275 NULLDRV_LOG_FUNC;
2276 return VK_SUCCESS;
2277}
2278
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002279ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2280 VkDevice device,
2281 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2282 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002283{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002284 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002285 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002286
Chia-I Wu7732cb22015-03-26 15:27:55 +08002287 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002288 (struct nulldrv_desc_layout **) pSetLayout);
2289}
2290
Tony Barbourde4124d2015-07-03 10:33:54 -06002291ICD_EXPORT VkResult VKAPI vkDestroyDescriptorSetLayout(
2292 VkDevice device,
2293 VkDescriptorSetLayout descriptorSetLayout)
2294{
2295 NULLDRV_LOG_FUNC;
2296 return VK_SUCCESS;
2297}
2298
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002299ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2300 VkDevice device,
2301 const VkPipelineLayoutCreateInfo* pCreateInfo,
2302 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002303{
2304 NULLDRV_LOG_FUNC;
2305 struct nulldrv_dev *dev = nulldrv_dev(device);
2306
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002307 return nulldrv_pipeline_layout_create(dev,
2308 pCreateInfo,
2309 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002310}
2311
Tony Barbourde4124d2015-07-03 10:33:54 -06002312ICD_EXPORT VkResult VKAPI vkDestroyPipelineLayout(
2313 VkDevice device,
2314 VkPipelineLayout pipelineLayout)
2315{
2316 NULLDRV_LOG_FUNC;
2317 return VK_SUCCESS;
2318}
2319
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002320ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2321 VkDevice device,
2322 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002323 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002324 const VkDescriptorPoolCreateInfo* pCreateInfo,
2325 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002326{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002327 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002328 struct nulldrv_dev *dev = nulldrv_dev(device);
2329
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002330 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2331 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002332}
2333
Tony Barbourde4124d2015-07-03 10:33:54 -06002334ICD_EXPORT VkResult VKAPI vkDestroyDescriptorPool(
2335 VkDevice device,
2336 VkDescriptorPool descriptorPool)
2337{
2338 NULLDRV_LOG_FUNC;
2339 return VK_SUCCESS;
2340}
2341
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002342ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002343 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002344 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002345{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002346 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002347 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002348}
2349
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002350ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002351 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002352 VkDescriptorPool descriptorPool,
2353 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002354 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002355 const VkDescriptorSetLayout* pSetLayouts,
Cody Northropc8aa4a52015-08-03 12:47:29 -06002356 VkDescriptorSet* pDescriptorSets)
David Pinedo0257fbf2015-02-02 18:02:40 -07002357{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002358 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002359 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2360 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002361 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002362 uint32_t i;
2363
2364 for (i = 0; i < count; i++) {
2365 const struct nulldrv_desc_layout *layout =
Tony Barbour8db65372015-07-10 18:32:33 -06002366 nulldrv_desc_layout(pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002367
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002368 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002369 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002370 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002371 break;
2372 }
2373
David Pinedo0257fbf2015-02-02 18:02:40 -07002374 return ret;
2375}
2376
Tony Barbourb857d312015-07-10 10:50:45 -06002377ICD_EXPORT VkResult VKAPI vkFreeDescriptorSets(
2378 VkDevice device,
2379 VkDescriptorPool descriptorPool,
2380 uint32_t count,
2381 const VkDescriptorSet* pDescriptorSets)
2382{
2383 NULLDRV_LOG_FUNC;
2384 return VK_SUCCESS;
2385}
2386
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002387ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2388 VkDevice device,
2389 uint32_t writeCount,
2390 const VkWriteDescriptorSet* pDescriptorWrites,
2391 uint32_t copyCount,
2392 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002393{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002394 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002395 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002396}
2397
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002398ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2399 VkDevice device,
2400 const VkFramebufferCreateInfo* info,
2401 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002402{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002403 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002404 struct nulldrv_dev *dev = nulldrv_dev(device);
2405
2406 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2407}
2408
Tony Barbourde4124d2015-07-03 10:33:54 -06002409ICD_EXPORT VkResult VKAPI vkDestroyFramebuffer(
2410 VkDevice device,
2411 VkFramebuffer framebuffer)
2412{
2413 NULLDRV_LOG_FUNC;
2414 return VK_SUCCESS;
2415}
David Pinedo0257fbf2015-02-02 18:02:40 -07002416
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002417ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2418 VkDevice device,
2419 const VkRenderPassCreateInfo* info,
2420 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002421{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002422 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002423 struct nulldrv_dev *dev = nulldrv_dev(device);
2424
2425 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2426}
2427
Tony Barbourde4124d2015-07-03 10:33:54 -06002428ICD_EXPORT VkResult VKAPI vkDestroyRenderPass(
2429 VkDevice device,
2430 VkRenderPass renderPass)
2431{
2432 NULLDRV_LOG_FUNC;
2433 return VK_SUCCESS;
2434}
2435
Courtney Goeltzenleuchtera375b622015-07-27 14:04:01 -06002436ICD_EXPORT void VKAPI vkCmdPushConstants(
2437 VkCmdBuffer cmdBuffer,
2438 VkPipelineLayout layout,
2439 VkShaderStageFlags stageFlags,
2440 uint32_t start,
2441 uint32_t length,
2442 const void* values)
2443{
2444 /* TODO: Implement */
2445}
2446
Courtney Goeltzenleuchter07fe0662015-07-27 13:47:08 -06002447ICD_EXPORT VkResult VKAPI vkGetRenderAreaGranularity(
2448 VkDevice device,
2449 VkRenderPass renderPass,
2450 VkExtent2D* pGranularity)
2451{
2452 pGranularity->height = 1;
2453 pGranularity->width = 1;
2454
2455 return VK_SUCCESS;
2456}
2457
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002458ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Chia-I Wuc278df82015-07-07 11:50:03 +08002459 VkCmdBuffer cmdBuffer,
2460 const VkRenderPassBeginInfo* pRenderPassBegin,
2461 VkRenderPassContents contents)
2462{
2463 NULLDRV_LOG_FUNC;
2464}
2465
2466ICD_EXPORT void VKAPI vkCmdNextSubpass(
2467 VkCmdBuffer cmdBuffer,
2468 VkRenderPassContents contents)
David Pinedo0257fbf2015-02-02 18:02:40 -07002469{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002470 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002471}
2472
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002473ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002474 VkCmdBuffer cmdBuffer)
2475{
2476 NULLDRV_LOG_FUNC;
2477}
2478
2479ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2480 VkCmdBuffer cmdBuffer,
2481 uint32_t cmdBuffersCount,
2482 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002483{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002484 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002485}
Ian Elliottf93069f2015-02-19 14:26:19 -07002486
2487ICD_EXPORT void* xcbCreateWindow(
2488 uint16_t width,
2489 uint16_t height)
2490{
2491 static uint32_t window; // Kludge to the max
2492 NULLDRV_LOG_FUNC;
2493 return &window;
2494}
2495
2496// May not be needed, if we stub out stuf in tri.c
2497ICD_EXPORT void xcbDestroyWindow()
2498{
2499 NULLDRV_LOG_FUNC;
2500}
2501
2502ICD_EXPORT int xcbGetMessage(void *msg)
2503{
2504 NULLDRV_LOG_FUNC;
2505 return 0;
2506}
2507
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002508ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002509{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002510 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002511}
David Pinedo07494fd2015-07-24 10:54:41 -06002512
2513ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceImageFormatProperties(
2514 VkPhysicalDevice physicalDevice,
2515 VkFormat format,
2516 VkImageType type,
2517 VkImageTiling tiling,
2518 VkImageUsageFlags usage,
2519 VkImageFormatProperties* pImageFormatProperties)
2520{
2521 return VK_ERROR_UNAVAILABLE;
2522}