blob: 9cdf961abbadb77cc2c3d15a8a0581bf684d111f [file] [log] [blame]
David Pinedo0257fbf2015-02-02 18:02:40 -07001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan null driver
David Pinedo0257fbf2015-02-02 18:02:40 -07003 *
4 * Copyright (C) 2015 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 */
25
26#include "nulldrv.h"
David Pinedo8e9cb3b2015-02-10 15:02:08 -070027#include <stdio.h>
David Pinedo0257fbf2015-02-02 18:02:40 -070028
David Pinedo8e9cb3b2015-02-10 15:02:08 -070029#if 0
30#define NULLDRV_LOG_FUNC \
31 do { \
32 fflush(stdout); \
33 fflush(stderr); \
34 printf("null driver: %s\n", __FUNCTION__); \
35 fflush(stdout); \
36 } while (0)
37#else
38 #define NULLDRV_LOG_FUNC do { } while (0)
39#endif
40
41// The null driver supports all WSI extenstions ... for now ...
David Pinedo0257fbf2015-02-02 18:02:40 -070042static const char * const nulldrv_gpu_exts[NULLDRV_EXT_COUNT] = {
Ian Elliott338dedb2015-08-21 15:09:33 -060043 [NULLDRV_EXT_KHR_SWAPCHAIN] = VK_EXT_KHR_SWAPCHAIN_EXTENSION_NAME,
David Pinedo0257fbf2015-02-02 18:02:40 -070044};
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060045static const VkExtensionProperties intel_gpu_exts[NULLDRV_EXT_COUNT] = {
46 {
Ian Elliott338dedb2015-08-21 15:09:33 -060047 .extName = VK_EXT_KHR_SWAPCHAIN_EXTENSION_NAME,
David Pinedob0833bd2015-09-04 15:33:22 -060048 .specVersion = VK_EXT_KHR_SWAPCHAIN_REVISION,
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060049 }
50};
David Pinedo0257fbf2015-02-02 18:02:40 -070051
Tony Barbourde4124d2015-07-03 10:33:54 -060052static struct nulldrv_base *nulldrv_base(void* base)
David Pinedo0257fbf2015-02-02 18:02:40 -070053{
54 return (struct nulldrv_base *) base;
55}
56
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060057static struct nulldrv_base *nulldrv_base_create(
58 struct nulldrv_dev *dev,
59 size_t obj_size,
Tony Barbourde4124d2015-07-03 10:33:54 -060060 VkDbgObjectType type)
David Pinedo0257fbf2015-02-02 18:02:40 -070061{
62 struct nulldrv_base *base;
63
64 if (!obj_size)
65 obj_size = sizeof(*base);
66
67 assert(obj_size >= sizeof(*base));
68
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060069 base = (struct nulldrv_base*)malloc(obj_size);
David Pinedo0257fbf2015-02-02 18:02:40 -070070 if (!base)
71 return NULL;
72
73 memset(base, 0, obj_size);
74
75 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbourde4124d2015-07-03 10:33:54 -060076 set_loader_magic_value(base);
David Pinedo0257fbf2015-02-02 18:02:40 -070077
78 if (dev == NULL) {
79 /*
80 * dev is NULL when we are creating the base device object
81 * Set dev now so that debug setup happens correctly
82 */
83 dev = (struct nulldrv_dev *) base;
84 }
85
86
Tony Barbour426b9052015-06-24 16:06:58 -060087 base->get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -070088
89 return base;
90}
91
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060092static VkResult nulldrv_gpu_add(int devid, const char *primary_node,
David Pinedo0257fbf2015-02-02 18:02:40 -070093 const char *render_node, struct nulldrv_gpu **gpu_ret)
94{
95 struct nulldrv_gpu *gpu;
96
Chia-I Wu493a1752015-02-22 14:40:25 +080097 gpu = malloc(sizeof(*gpu));
David Pinedo0257fbf2015-02-02 18:02:40 -070098 if (!gpu)
Tony Barbour8205d902015-04-16 15:59:00 -060099 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700100 memset(gpu, 0, sizeof(*gpu));
Mark Lobodzinski97dcd042015-04-16 08:52:00 -0500101
David Pinedo0257fbf2015-02-02 18:02:40 -0700102 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbourde4124d2015-07-03 10:33:54 -0600103 set_loader_magic_value(gpu);
David Pinedo0257fbf2015-02-02 18:02:40 -0700104
105 *gpu_ret = gpu;
106
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600107 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700108}
109
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600110static VkResult nulldrv_queue_create(struct nulldrv_dev *dev,
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700111 uint32_t node_index,
David Pinedo0257fbf2015-02-02 18:02:40 -0700112 struct nulldrv_queue **queue_ret)
113{
114 struct nulldrv_queue *queue;
115
116 queue = (struct nulldrv_queue *) nulldrv_base_create(dev, sizeof(*queue),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600117 VK_OBJECT_TYPE_QUEUE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700118 if (!queue)
Tony Barbour8205d902015-04-16 15:59:00 -0600119 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700120
121 queue->dev = dev;
122
123 *queue_ret = queue;
124
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600125 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700126}
127
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600128static VkResult dev_create_queues(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterea975642015-09-16 16:23:55 -0600129 const VkDeviceQueueCreateInfo *queues,
130 uint32_t count)
David Pinedo0257fbf2015-02-02 18:02:40 -0700131{
132 uint32_t i;
133
David Pinedo0257fbf2015-02-02 18:02:40 -0700134 for (i = 0; i < count; i++) {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600135 const VkDeviceQueueCreateInfo *q = &queues[i];
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600136 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700137
Tony Barbour29b12062015-07-13 13:37:24 -0600138 if (q->queueCount == 1 && !dev->queues[q->queueFamilyIndex]) {
139 ret = nulldrv_queue_create(dev, q->queueFamilyIndex,
140 &dev->queues[q->queueFamilyIndex]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700141 }
David Pinedo0257fbf2015-02-02 18:02:40 -0700142
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600143 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700144 return ret;
145 }
146 }
147
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600148 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700149}
150
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600151static enum nulldrv_ext_type nulldrv_gpu_lookup_extension(
152 const struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600153 const char* extName)
David Pinedo0257fbf2015-02-02 18:02:40 -0700154{
155 enum nulldrv_ext_type type;
156
157 for (type = 0; type < ARRAY_SIZE(nulldrv_gpu_exts); type++) {
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600158 if (strcmp(nulldrv_gpu_exts[type], extName) == 0)
David Pinedo0257fbf2015-02-02 18:02:40 -0700159 break;
160 }
161
162 assert(type < NULLDRV_EXT_COUNT || type == NULLDRV_EXT_INVALID);
163
164 return type;
165}
166
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600167static VkResult nulldrv_desc_ooxx_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800168 struct nulldrv_desc_ooxx **ooxx_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700169{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800170 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700171
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800172 ooxx = malloc(sizeof(*ooxx));
173 if (!ooxx)
Tony Barbour8205d902015-04-16 15:59:00 -0600174 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700175
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800176 memset(ooxx, 0, sizeof(*ooxx));
David Pinedo0257fbf2015-02-02 18:02:40 -0700177
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800178 ooxx->surface_desc_size = 0;
179 ooxx->sampler_desc_size = 0;
David Pinedo0257fbf2015-02-02 18:02:40 -0700180
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800181 *ooxx_ret = ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700182
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600183 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700184}
185
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600186static VkResult nulldrv_dev_create(struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600187 const VkDeviceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700188 struct nulldrv_dev **dev_ret)
189{
190 struct nulldrv_dev *dev;
191 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600192 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -0700193
194 dev = (struct nulldrv_dev *) nulldrv_base_create(NULL, sizeof(*dev),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600195 VK_OBJECT_TYPE_DEVICE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700196 if (!dev)
Tony Barbour8205d902015-04-16 15:59:00 -0600197 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700198
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600199 for (i = 0; i < info->extensionCount; i++) {
200 const enum nulldrv_ext_type ext = nulldrv_gpu_lookup_extension(
201 gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600202 info->ppEnabledExtensionNames[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700203
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600204 if (ext == NULLDRV_EXT_INVALID)
Courtney Goeltzenleuchterac544f32015-09-14 18:01:17 -0600205 return VK_ERROR_EXTENSION_NOT_PRESENT;
David Pinedo0257fbf2015-02-02 18:02:40 -0700206
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600207 dev->exts[ext] = true;
208 }
David Pinedo0257fbf2015-02-02 18:02:40 -0700209
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800210 ret = nulldrv_desc_ooxx_create(dev, &dev->desc_ooxx);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600211 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700212 return ret;
213 }
214
215 ret = dev_create_queues(dev, info->pRequestedQueues,
216 info->queueRecordCount);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600217 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700218 return ret;
219 }
220
221 *dev_ret = dev;
222
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600223 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700224}
225
Tony Barbour8205d902015-04-16 15:59:00 -0600226static struct nulldrv_gpu *nulldrv_gpu(VkPhysicalDevice gpu)
David Pinedo0257fbf2015-02-02 18:02:40 -0700227{
228 return (struct nulldrv_gpu *) gpu;
229}
230
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600231static VkResult nulldrv_fence_create(struct nulldrv_dev *dev,
232 const VkFenceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700233 struct nulldrv_fence **fence_ret)
234{
235 struct nulldrv_fence *fence;
236
237 fence = (struct nulldrv_fence *) nulldrv_base_create(dev, sizeof(*fence),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600238 VK_OBJECT_TYPE_FENCE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700239 if (!fence)
Tony Barbour8205d902015-04-16 15:59:00 -0600240 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700241
242 *fence_ret = fence;
243
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600244 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700245}
246
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600247static struct nulldrv_dev *nulldrv_dev(VkDevice dev)
David Pinedo0257fbf2015-02-02 18:02:40 -0700248{
249 return (struct nulldrv_dev *) dev;
250}
251
252static struct nulldrv_img *nulldrv_img_from_base(struct nulldrv_base *base)
253{
254 return (struct nulldrv_img *) base;
255}
256
257
Tony Barbour426b9052015-06-24 16:06:58 -0600258static VkResult img_get_memory_requirements(struct nulldrv_base *base,
259 VkMemoryRequirements *pRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700260{
261 struct nulldrv_img *img = nulldrv_img_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600262 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700263
Tony Barbour426b9052015-06-24 16:06:58 -0600264 pRequirements->size = img->total_size;
265 pRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700266
267 return ret;
268}
269
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600270static VkResult nulldrv_img_create(struct nulldrv_dev *dev,
271 const VkImageCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700272 bool scanout,
273 struct nulldrv_img **img_ret)
274{
275 struct nulldrv_img *img;
276
277 img = (struct nulldrv_img *) nulldrv_base_create(dev, sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600278 VK_OBJECT_TYPE_IMAGE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700279 if (!img)
Tony Barbour8205d902015-04-16 15:59:00 -0600280 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700281
282 img->type = info->imageType;
283 img->depth = info->extent.depth;
284 img->mip_levels = info->mipLevels;
285 img->array_size = info->arraySize;
286 img->usage = info->usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700287 img->samples = info->samples;
288
Tony Barbour426b9052015-06-24 16:06:58 -0600289 img->obj.base.get_memory_requirements = img_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700290
291 *img_ret = img;
292
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600293 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700294}
295
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600296static struct nulldrv_img *nulldrv_img(VkImage image)
David Pinedo0257fbf2015-02-02 18:02:40 -0700297{
Tony Barbourde4124d2015-07-03 10:33:54 -0600298 return *(struct nulldrv_img **) &image;
David Pinedo0257fbf2015-02-02 18:02:40 -0700299}
300
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600301static VkResult nulldrv_mem_alloc(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600302 const VkMemoryAllocInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700303 struct nulldrv_mem **mem_ret)
304{
305 struct nulldrv_mem *mem;
306
307 mem = (struct nulldrv_mem *) nulldrv_base_create(dev, sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600308 VK_OBJECT_TYPE_DEVICE_MEMORY);
David Pinedo0257fbf2015-02-02 18:02:40 -0700309 if (!mem)
Tony Barbour8205d902015-04-16 15:59:00 -0600310 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700311
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700312 mem->bo = malloc(info->allocationSize);
David Pinedo0257fbf2015-02-02 18:02:40 -0700313 if (!mem->bo) {
Tony Barbour8205d902015-04-16 15:59:00 -0600314 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700315 }
316
317 mem->size = info->allocationSize;
318
319 *mem_ret = mem;
320
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600321 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700322}
323
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600324static VkResult nulldrv_sampler_create(struct nulldrv_dev *dev,
325 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700326 struct nulldrv_sampler **sampler_ret)
327{
328 struct nulldrv_sampler *sampler;
329
330 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600331 sizeof(*sampler), VK_OBJECT_TYPE_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700332 if (!sampler)
Tony Barbour8205d902015-04-16 15:59:00 -0600333 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700334
335 *sampler_ret = sampler;
336
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600337 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700338}
339
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600340static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
341 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700342 struct nulldrv_img_view **view_ret)
343{
344 struct nulldrv_img *img = nulldrv_img(info->image);
345 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700346
347 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600348 VK_OBJECT_TYPE_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700349 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600350 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700351
352 view->img = img;
David Pinedo0257fbf2015-02-02 18:02:40 -0700353
David Pinedo0257fbf2015-02-02 18:02:40 -0700354 view->cmd_len = 8;
355
356 *view_ret = view;
357
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600358 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700359}
360
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600361static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700362{
363 return mem->bo;
364}
365
Tony Barbour8205d902015-04-16 15:59:00 -0600366static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700367{
Tony Barbourde4124d2015-07-03 10:33:54 -0600368 return *(struct nulldrv_mem **) &mem;
David Pinedo0257fbf2015-02-02 18:02:40 -0700369}
370
371static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
372{
373 return (struct nulldrv_buf *) base;
374}
375
Tony Barbour426b9052015-06-24 16:06:58 -0600376static VkResult buf_get_memory_requirements(struct nulldrv_base *base,
377 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700378{
379 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
David Pinedo0257fbf2015-02-02 18:02:40 -0700380
Tony Barbour426b9052015-06-24 16:06:58 -0600381 if (pMemoryRequirements == NULL)
382 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700383
Tony Barbour426b9052015-06-24 16:06:58 -0600384 pMemoryRequirements->size = buf->size;
385 pMemoryRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700386
Tony Barbour426b9052015-06-24 16:06:58 -0600387 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700388}
389
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600390static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600391 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700392 struct nulldrv_buf **buf_ret)
393{
394 struct nulldrv_buf *buf;
395
396 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600397 VK_OBJECT_TYPE_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700398 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600399 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700400
401 buf->size = info->size;
402 buf->usage = info->usage;
403
Tony Barbour426b9052015-06-24 16:06:58 -0600404 buf->obj.base.get_memory_requirements = buf_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700405
406 *buf_ret = buf;
407
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600408 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700409}
410
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600411static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
412 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700413 struct nulldrv_desc_layout **layout_ret)
414{
415 struct nulldrv_desc_layout *layout;
416
417 layout = (struct nulldrv_desc_layout *)
418 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600419 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700420 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600421 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700422
423 *layout_ret = layout;
424
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600425 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700426}
427
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500428static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
429 const VkPipelineLayoutCreateInfo* pCreateInfo,
430 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800431{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500432 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800433
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500434 pipeline_layout = (struct nulldrv_pipeline_layout *)
435 nulldrv_base_create(dev, sizeof(*pipeline_layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600436 VK_OBJECT_TYPE_PIPELINE_LAYOUT);
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500437 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600438 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800439
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500440 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800441
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600442 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800443}
444
Tony Barbour8db65372015-07-10 18:32:33 -0600445static struct nulldrv_desc_layout *nulldrv_desc_layout(const VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700446{
Tony Barbourde4124d2015-07-03 10:33:54 -0600447 return *(struct nulldrv_desc_layout **) &layout;
David Pinedo0257fbf2015-02-02 18:02:40 -0700448}
449
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600450static VkResult shader_create(struct nulldrv_dev *dev,
451 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700452 struct nulldrv_shader **sh_ret)
453{
David Pinedo0257fbf2015-02-02 18:02:40 -0700454 struct nulldrv_shader *sh;
455
456 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600457 VK_OBJECT_TYPE_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700458 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600459 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700460
461 *sh_ret = sh;
462
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600463 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700464}
465
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600466static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
467 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700468 struct nulldrv_pipeline **pipeline_ret)
469{
470 struct nulldrv_pipeline *pipeline;
471
472 pipeline = (struct nulldrv_pipeline *)
473 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600474 VK_OBJECT_TYPE_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700475 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600476 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700477
478 *pipeline_ret = pipeline;
479
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600480 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700481}
482
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600483static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600484 const VkDynamicViewportStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700485 struct nulldrv_dynamic_vp **state_ret)
486{
487 struct nulldrv_dynamic_vp *state;
488
489 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600490 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_VIEWPORT_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700491 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600492 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700493
494 *state_ret = state;
495
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600496 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700497}
498
Cody Northrope4bc6942015-08-26 10:01:32 -0600499static VkResult nulldrv_line_width_state_create(struct nulldrv_dev *dev,
500 const VkDynamicLineWidthStateCreateInfo *info,
501 struct nulldrv_dynamic_line_width **state_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700502{
Cody Northrope4bc6942015-08-26 10:01:32 -0600503 struct nulldrv_dynamic_line_width *state;
David Pinedo0257fbf2015-02-02 18:02:40 -0700504
Cody Northrope4bc6942015-08-26 10:01:32 -0600505 state = (struct nulldrv_dynamic_line_width *) nulldrv_base_create(dev,
506 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_LINE_WIDTH_STATE);
Cody Northropf5bd2252015-08-17 11:10:49 -0600507 if (!state)
508 return VK_ERROR_OUT_OF_HOST_MEMORY;
509
510 *state_ret = state;
511
512 return VK_SUCCESS;
513}
514
Cody Northrope4bc6942015-08-26 10:01:32 -0600515static VkResult nulldrv_depth_bias_state_create(struct nulldrv_dev *dev,
516 const VkDynamicDepthBiasStateCreateInfo *info,
517 struct nulldrv_dynamic_depth_bias **state_ret)
Cody Northropf5bd2252015-08-17 11:10:49 -0600518{
Cody Northrope4bc6942015-08-26 10:01:32 -0600519 struct nulldrv_dynamic_depth_bias *state;
Cody Northropf5bd2252015-08-17 11:10:49 -0600520
Cody Northrope4bc6942015-08-26 10:01:32 -0600521 state = (struct nulldrv_dynamic_depth_bias *) nulldrv_base_create(dev,
522 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DEPTH_BIAS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700523 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600524 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700525
526 *state_ret = state;
527
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600528 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700529}
530
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600531static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
Cody Northrope4bc6942015-08-26 10:01:32 -0600532 const VkDynamicBlendStateCreateInfo *info,
533 struct nulldrv_dynamic_blend **state_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700534{
Cody Northrope4bc6942015-08-26 10:01:32 -0600535 struct nulldrv_dynamic_blend *state;
David Pinedo0257fbf2015-02-02 18:02:40 -0700536
Cody Northrope4bc6942015-08-26 10:01:32 -0600537 state = (struct nulldrv_dynamic_blend *) nulldrv_base_create(dev,
538 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_BLEND_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700539 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600540 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700541
542 *state_ret = state;
543
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600544 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700545}
546
Cody Northrope4bc6942015-08-26 10:01:32 -0600547static VkResult nulldrv_depth_bounds_state_create(struct nulldrv_dev *dev,
548 const VkDynamicDepthBoundsStateCreateInfo *info,
549 struct nulldrv_dynamic_depth_bounds **state_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700550{
Cody Northrope4bc6942015-08-26 10:01:32 -0600551 struct nulldrv_dynamic_depth_bounds *state;
David Pinedo0257fbf2015-02-02 18:02:40 -0700552
Cody Northrope4bc6942015-08-26 10:01:32 -0600553 state = (struct nulldrv_dynamic_depth_bounds *) nulldrv_base_create(dev,
554 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DEPTH_BOUNDS_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700555 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600556 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700557
558 *state_ret = state;
559
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600560 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700561}
562
Cody Northrop2605cb02015-08-18 15:21:16 -0600563static VkResult nulldrv_stencil_state_create(struct nulldrv_dev *dev,
564 const VkDynamicStencilStateCreateInfo *infoFront,
565 const VkDynamicStencilStateCreateInfo *infoBack,
566 struct nulldrv_dynamic_stencil **state_ret)
567{
568 struct nulldrv_dynamic_stencil *state;
569
570 state = (struct nulldrv_dynamic_stencil *) nulldrv_base_create(dev,
571 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE);
572 if (!state)
573 return VK_ERROR_OUT_OF_HOST_MEMORY;
574
575 *state_ret = state;
576
577 return VK_SUCCESS;
578}
David Pinedo0257fbf2015-02-02 18:02:40 -0700579
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600580static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
581 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700582 struct nulldrv_cmd **cmd_ret)
583{
David Pinedo0257fbf2015-02-02 18:02:40 -0700584 struct nulldrv_cmd *cmd;
585
David Pinedo0257fbf2015-02-02 18:02:40 -0700586 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600587 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700588 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600589 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700590
591 *cmd_ret = cmd;
592
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600593 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700594}
595
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600596static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600597 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800598 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700599{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800600 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700601
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800602 pool = (struct nulldrv_desc_pool *)
603 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600604 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800605 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600606 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700607
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800608 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700609
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800610 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700611
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600612 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700613}
614
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600615static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800616 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600617 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700618 const struct nulldrv_desc_layout *layout,
619 struct nulldrv_desc_set **set_ret)
620{
621 struct nulldrv_desc_set *set;
622
623 set = (struct nulldrv_desc_set *)
624 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600625 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700626 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600627 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700628
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800629 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700630 set->layout = layout;
631 *set_ret = set;
632
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600633 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700634}
635
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600636static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700637{
Tony Barbourde4124d2015-07-03 10:33:54 -0600638 return *(struct nulldrv_desc_pool **) &pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700639}
640
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600641static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
642 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700643 struct nulldrv_framebuffer ** fb_ret)
644{
645
646 struct nulldrv_framebuffer *fb;
647 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600648 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700649 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600650 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700651
652 *fb_ret = fb;
653
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600654 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700655
656}
657
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600658static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
659 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700660 struct nulldrv_render_pass** rp_ret)
661{
662 struct nulldrv_render_pass *rp;
663 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600664 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700665 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600666 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700667
668 *rp_ret = rp;
669
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600670 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700671}
672
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600673static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700674{
Tony Barbourde4124d2015-07-03 10:33:54 -0600675 return *(struct nulldrv_buf **) &buf;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700676}
677
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600678static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600679 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700680 struct nulldrv_buf_view **view_ret)
681{
682 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
683 struct nulldrv_buf_view *view;
684
685 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600686 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700687 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600688 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700689
690 view->buf = buf;
691
692 *view_ret = view;
693
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600694 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700695}
696
David Pinedo0257fbf2015-02-02 18:02:40 -0700697
698//*********************************************
699// Driver entry points
700//*********************************************
701
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600702ICD_EXPORT VkResult VKAPI vkCreateBuffer(
703 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600704 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600705 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700706{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700707 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700708 struct nulldrv_dev *dev = nulldrv_dev(device);
709
710 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
711}
712
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600713ICD_EXPORT void VKAPI vkDestroyBuffer(
Tony Barbourde4124d2015-07-03 10:33:54 -0600714 VkDevice device,
715 VkBuffer buffer)
716{
717 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -0600718}
719
Cody Northropf02f9f82015-07-09 18:08:05 -0600720ICD_EXPORT VkResult VKAPI vkCreateCommandPool(
721 VkDevice device,
722 const VkCmdPoolCreateInfo* pCreateInfo,
723 VkCmdPool* pCmdPool)
724{
725 NULLDRV_LOG_FUNC;
726 return VK_SUCCESS;
727}
728
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600729ICD_EXPORT void VKAPI vkDestroyCommandPool(
Cody Northropf02f9f82015-07-09 18:08:05 -0600730 VkDevice device,
731 VkCmdPool cmdPool)
732{
733 NULLDRV_LOG_FUNC;
Cody Northropf02f9f82015-07-09 18:08:05 -0600734}
735
736ICD_EXPORT VkResult VKAPI vkResetCommandPool(
737 VkDevice device,
738 VkCmdPool cmdPool,
739 VkCmdPoolResetFlags flags)
740{
741 NULLDRV_LOG_FUNC;
742 return VK_SUCCESS;
743}
744
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600745ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
746 VkDevice device,
747 const VkCmdBufferCreateInfo* pCreateInfo,
748 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700749{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700750 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700751 struct nulldrv_dev *dev = nulldrv_dev(device);
752
753 return nulldrv_cmd_create(dev, pCreateInfo,
754 (struct nulldrv_cmd **) pCmdBuffer);
755}
756
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600757ICD_EXPORT void VKAPI vkDestroyCommandBuffer(
Tony Barbourde4124d2015-07-03 10:33:54 -0600758 VkDevice device,
759 VkCmdBuffer cmdBuffer)
760{
761 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -0600762}
763
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600764ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
765 VkCmdBuffer cmdBuffer,
766 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700767{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700768 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600769 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700770}
771
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600772ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
773 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700774{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700775 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600776 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700777}
778
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600779ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
Cody Northropf02f9f82015-07-09 18:08:05 -0600780 VkCmdBuffer cmdBuffer,
781 VkCmdBufferResetFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700782{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700783 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600784 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700785}
786
Ian Elliott64a68e12015-04-16 11:57:46 -0600787static const VkFormat nulldrv_presentable_formats[] = {
788 VK_FORMAT_B8G8R8A8_UNORM,
789};
790
Jon Ashburnba4a1952015-06-16 12:44:51 -0600791#if 0
Ian Elliott338dedb2015-08-21 15:09:33 -0600792ICD_EXPORT VkResult VKAPI vkGetDisplayInfoKHR(
793 VkDisplayKHR display,
794 VkDisplayInfoTypeKHR infoType,
Ian Elliott64a68e12015-04-16 11:57:46 -0600795 size_t* pDataSize,
796 void* pData)
797{
798 VkResult ret = VK_SUCCESS;
799
800 NULLDRV_LOG_FUNC;
801
802 if (!pDataSize)
803 return VK_ERROR_INVALID_POINTER;
804
805 switch (infoType) {
Ian Elliott338dedb2015-08-21 15:09:33 -0600806 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_KHR:
Ian Elliott64a68e12015-04-16 11:57:46 -0600807 {
Ian Elliott338dedb2015-08-21 15:09:33 -0600808 VkDisplayFormatPropertiesKHR *dst = pData;
Ian Elliott64a68e12015-04-16 11:57:46 -0600809 size_t size_ret;
810 uint32_t i;
811
812 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
813
814 if (dst && *pDataSize < size_ret)
815 return VK_ERROR_INVALID_VALUE;
816
817 *pDataSize = size_ret;
818 if (!dst)
819 return VK_SUCCESS;
820
821 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
Ian Elliott338dedb2015-08-21 15:09:33 -0600822 dst[i].swapchainFormat = nulldrv_presentable_formats[i];
Ian Elliott64a68e12015-04-16 11:57:46 -0600823 }
824 break;
825 default:
826 ret = VK_ERROR_INVALID_VALUE;
827 break;
828 }
829
830 return ret;
831}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600832#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600833
Ian Elliott338dedb2015-08-21 15:09:33 -0600834ICD_EXPORT VkResult VKAPI vkCreateSwapchainKHR(
Ian Elliott64a68e12015-04-16 11:57:46 -0600835 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600836 const VkSwapchainCreateInfoKHR* pCreateInfo,
837 VkSwapchainKHR* pSwapchain)
Ian Elliott64a68e12015-04-16 11:57:46 -0600838{
839 NULLDRV_LOG_FUNC;
840 struct nulldrv_dev *dev = nulldrv_dev(device);
841 struct nulldrv_swap_chain *sc;
842
843 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Ian Elliott338dedb2015-08-21 15:09:33 -0600844 VK_OBJECT_TYPE_SWAPCHAIN_KHR);
Ian Elliott64a68e12015-04-16 11:57:46 -0600845 if (!sc) {
846 return VK_ERROR_OUT_OF_HOST_MEMORY;
847 }
848 sc->dev = dev;
849
Ian Elliott338dedb2015-08-21 15:09:33 -0600850 *(VkSwapchainKHR **)pSwapchain = *(VkSwapchainKHR **)&sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600851
852 return VK_SUCCESS;
853}
854
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -0600855ICD_EXPORT VkResult VKAPI vkDestroySwapchainKHR(
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600856 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600857 VkSwapchainKHR swapchain)
Ian Elliott64a68e12015-04-16 11:57:46 -0600858{
859 NULLDRV_LOG_FUNC;
Ian Elliott338dedb2015-08-21 15:09:33 -0600860 struct nulldrv_swap_chain *sc = *(struct nulldrv_swap_chain **) &swapchain;
Ian Elliott64a68e12015-04-16 11:57:46 -0600861
862 free(sc);
863
864 return VK_SUCCESS;
865}
866
Ian Elliott338dedb2015-08-21 15:09:33 -0600867ICD_EXPORT VkResult VKAPI vkGetSwapchainImagesKHR(
Ian Elliott3333bb42015-08-10 13:56:08 -0600868 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600869 VkSwapchainKHR swapchain,
Ian Elliott3333bb42015-08-10 13:56:08 -0600870 uint32_t* pCount,
Ian Elliott338dedb2015-08-21 15:09:33 -0600871 VkImage* pSwapchainImages)
Ian Elliott64a68e12015-04-16 11:57:46 -0600872{
873 NULLDRV_LOG_FUNC;
Ian Elliott338dedb2015-08-21 15:09:33 -0600874 struct nulldrv_swap_chain *sc = *(struct nulldrv_swap_chain **) &swapchain;
Ian Elliott64a68e12015-04-16 11:57:46 -0600875 struct nulldrv_dev *dev = sc->dev;
876 VkResult ret = VK_SUCCESS;
877
Ian Elliott3333bb42015-08-10 13:56:08 -0600878 *pCount = 2;
Ian Elliott338dedb2015-08-21 15:09:33 -0600879 if (pSwapchainImages) {
Ian Elliott3333bb42015-08-10 13:56:08 -0600880 uint32_t i;
881 for (i = 0; i < 2; i++) {
Ian Elliott64a68e12015-04-16 11:57:46 -0600882 struct nulldrv_img *img;
Ian Elliott64a68e12015-04-16 11:57:46 -0600883
884 img = (struct nulldrv_img *) nulldrv_base_create(dev,
885 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600886 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600887 if (!img)
888 return VK_ERROR_OUT_OF_HOST_MEMORY;
Ian Elliott338dedb2015-08-21 15:09:33 -0600889 pSwapchainImages[i].handle = (uint64_t) &img;
Ian Elliott64a68e12015-04-16 11:57:46 -0600890 }
Ian Elliott64a68e12015-04-16 11:57:46 -0600891 }
892
893 return ret;
894}
895
Ian Elliott338dedb2015-08-21 15:09:33 -0600896ICD_EXPORT VkResult VKAPI vkAcquireNextImageKHR(
Tony Barbour7910de72015-07-13 16:37:21 -0600897 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600898 VkSwapchainKHR swapchain,
Tony Barbour7910de72015-07-13 16:37:21 -0600899 uint64_t timeout,
900 VkSemaphore semaphore,
901 uint32_t* pImageIndex)
902{
903 NULLDRV_LOG_FUNC;
904
905 return VK_SUCCESS;
906}
907
Ian Elliott338dedb2015-08-21 15:09:33 -0600908VkResult VKAPI vkGetSurfacePropertiesKHR(
Tony Barbour7910de72015-07-13 16:37:21 -0600909 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600910 const VkSurfaceDescriptionKHR* pSurfaceDescription,
911 VkSurfacePropertiesKHR* pSurfaceProperties)
Ian Elliott3333bb42015-08-10 13:56:08 -0600912{
913 NULLDRV_LOG_FUNC;
914
915 return VK_SUCCESS;
916}
917
Ian Elliott338dedb2015-08-21 15:09:33 -0600918VkResult VKAPI vkGetSurfaceFormatsKHR(
Ian Elliott3333bb42015-08-10 13:56:08 -0600919 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600920 const VkSurfaceDescriptionKHR* pSurfaceDescription,
Ian Elliott3333bb42015-08-10 13:56:08 -0600921 uint32_t* pCount,
Ian Elliott338dedb2015-08-21 15:09:33 -0600922 VkSurfaceFormatKHR* pSurfaceFormats)
Ian Elliott3333bb42015-08-10 13:56:08 -0600923{
924 NULLDRV_LOG_FUNC;
925
926 return VK_SUCCESS;
927}
928
Ian Elliott338dedb2015-08-21 15:09:33 -0600929VkResult VKAPI vkGetSurfacePresentModesKHR(
Ian Elliott3333bb42015-08-10 13:56:08 -0600930 VkDevice device,
Ian Elliott338dedb2015-08-21 15:09:33 -0600931 const VkSurfaceDescriptionKHR* pSurfaceDescription,
Ian Elliott3333bb42015-08-10 13:56:08 -0600932 uint32_t* pCount,
Ian Elliott338dedb2015-08-21 15:09:33 -0600933 VkPresentModeKHR* pPresentModes)
Tony Barbour7910de72015-07-13 16:37:21 -0600934{
935 NULLDRV_LOG_FUNC;
936
937 return VK_SUCCESS;
938}
939
Ian Elliott338dedb2015-08-21 15:09:33 -0600940ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSurfaceSupportKHR(
Tony Barbour7910de72015-07-13 16:37:21 -0600941 VkPhysicalDevice physicalDevice,
942 uint32_t queueFamilyIndex,
Ian Elliott338dedb2015-08-21 15:09:33 -0600943 const VkSurfaceDescriptionKHR* pSurfaceDescription,
Tony Barbour7910de72015-07-13 16:37:21 -0600944 VkBool32* pSupported)
945{
946 NULLDRV_LOG_FUNC;
947
948 return VK_SUCCESS;
949}
950
Ian Elliott338dedb2015-08-21 15:09:33 -0600951ICD_EXPORT VkResult VKAPI vkQueuePresentKHR(
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600952 VkQueue queue_,
Ian Elliott338dedb2015-08-21 15:09:33 -0600953 VkPresentInfoKHR* pPresentInfo)
Ian Elliott64a68e12015-04-16 11:57:46 -0600954{
955 NULLDRV_LOG_FUNC;
956
957 return VK_SUCCESS;
958}
959
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600960ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600961 VkCmdBuffer cmdBuffer,
962 VkBuffer srcBuffer,
963 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700964 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600965 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700966{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700967 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700968}
969
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600970ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600971 VkCmdBuffer cmdBuffer,
972 VkImage srcImage,
973 VkImageLayout srcImageLayout,
974 VkImage destImage,
975 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700976 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600977 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700978{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700979 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700980}
981
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600982ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600983 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500984 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600985 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500986 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600987 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500988 uint32_t regionCount,
989 const VkImageBlit* pRegions,
990 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600991{
992 NULLDRV_LOG_FUNC;
993}
994
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600995ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600996 VkCmdBuffer cmdBuffer,
997 VkBuffer srcBuffer,
998 VkImage destImage,
999 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001000 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001001 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001002{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001003 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001004}
1005
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001006ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001007 VkCmdBuffer cmdBuffer,
1008 VkImage srcImage,
1009 VkImageLayout srcImageLayout,
1010 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001011 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001012 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001013{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001014 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001015}
1016
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001017ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001018 VkCmdBuffer cmdBuffer,
1019 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001020 VkDeviceSize destOffset,
1021 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001022 const uint32_t* pData)
1023{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001024 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001025}
1026
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001027ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001028 VkCmdBuffer cmdBuffer,
1029 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001030 VkDeviceSize destOffset,
1031 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001032 uint32_t data)
1033{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001034 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001035}
1036
Ian Elliotte924ab22015-07-08 13:24:30 -06001037ICD_EXPORT void VKAPI vkCmdClearDepthStencilImage(
Courtney Goeltzenleuchter315ad992015-09-15 18:03:22 -06001038 VkCmdBuffer cmdBuffer,
1039 VkImage image,
1040 VkImageLayout imageLayout,
1041 const VkClearDepthStencilValue* pDepthStencil,
Ian Elliotte924ab22015-07-08 13:24:30 -06001042 uint32_t rangeCount,
Courtney Goeltzenleuchter315ad992015-09-15 18:03:22 -06001043 const VkImageSubresourceRange* pRanges)
Ian Elliotte924ab22015-07-08 13:24:30 -06001044{
1045 NULLDRV_LOG_FUNC;
1046}
1047
1048ICD_EXPORT void VKAPI vkCmdClearColorAttachment(
1049 VkCmdBuffer cmdBuffer,
1050 uint32_t colorAttachment,
1051 VkImageLayout imageLayout,
1052 const VkClearColorValue *pColor,
1053 uint32_t rectCount,
1054 const VkRect3D *pRects)
1055{
1056 NULLDRV_LOG_FUNC;
1057}
1058
1059ICD_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(
1060 VkCmdBuffer cmdBuffer,
1061 VkImageAspectFlags imageAspectMask,
1062 VkImageLayout imageLayout,
Courtney Goeltzenleuchter315ad992015-09-15 18:03:22 -06001063 const VkClearDepthStencilValue* pDepthStencil,
Ian Elliotte924ab22015-07-08 13:24:30 -06001064 uint32_t rectCount,
1065 const VkRect3D *pRects)
1066{
1067 NULLDRV_LOG_FUNC;
1068}
1069
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001070ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001071 VkCmdBuffer cmdBuffer,
1072 VkImage image,
1073 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +12001074 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001075 uint32_t rangeCount,
1076 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001077{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001078 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001079}
1080
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001081ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001082 VkCmdBuffer cmdBuffer,
1083 VkImage image,
1084 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001085 float depth,
1086 uint32_t stencil,
1087 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001088 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001089{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001090 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001091}
1092
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001093ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001094 VkCmdBuffer cmdBuffer,
1095 VkImage srcImage,
1096 VkImageLayout srcImageLayout,
1097 VkImage destImage,
1098 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001099 uint32_t regionCount,
1100 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001101{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001102 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001103}
1104
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001105ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001106 VkCmdBuffer cmdBuffer,
1107 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001108 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001109 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001110{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001111 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001112}
1113
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001114ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001115 VkCmdBuffer cmdBuffer,
1116 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001117 uint32_t slot)
1118{
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 vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001123 VkCmdBuffer cmdBuffer,
1124 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001125 uint32_t startQuery,
1126 uint32_t queryCount)
1127{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001128 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001129}
1130
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001131ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001132 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001133 VkEvent event_,
1134 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001135{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001136 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001137}
1138
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001139ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001140 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001141 VkEvent event_,
1142 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001143{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001144 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001145}
1146
Ian Elliott63f1edb2015-04-16 18:10:19 -06001147ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1148 VkCmdBuffer cmdBuffer,
1149 VkQueryPool queryPool,
1150 uint32_t startQuery,
1151 uint32_t queryCount,
1152 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001153 VkDeviceSize destOffset,
1154 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001155 VkFlags flags)
1156{
1157 NULLDRV_LOG_FUNC;
1158}
1159
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001160ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001161 VkCmdBuffer cmdBuffer,
1162 VkTimestampType timestampType,
1163 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001164 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001165{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001166 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001167}
1168
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001169ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001170 VkCmdBuffer cmdBuffer,
Tony Barbourde4124d2015-07-03 10:33:54 -06001171 VkPipelineBindPoint pipelineBindPoint,
1172 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001173{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001174 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001175}
1176
Tony Barbourde4124d2015-07-03 10:33:54 -06001177ICD_EXPORT void VKAPI vkCmdBindDynamicViewportState(
1178 VkCmdBuffer cmdBuffer,
1179 VkDynamicViewportState state)
1180{
1181 NULLDRV_LOG_FUNC;
1182}
1183
Cody Northrope4bc6942015-08-26 10:01:32 -06001184ICD_EXPORT void VKAPI vkCmdBindDynamicLineWidthState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001185 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001186 VkDynamicLineWidthState state)
Cody Northropf5bd2252015-08-17 11:10:49 -06001187{
1188 NULLDRV_LOG_FUNC;
1189}
1190
Cody Northrope4bc6942015-08-26 10:01:32 -06001191ICD_EXPORT void VKAPI vkCmdBindDynamicDepthBiasState(
Cody Northropf5bd2252015-08-17 11:10:49 -06001192 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001193 VkDynamicDepthBiasState state)
Tony Barbourde4124d2015-07-03 10:33:54 -06001194{
1195 NULLDRV_LOG_FUNC;
1196}
1197
Cody Northrope4bc6942015-08-26 10:01:32 -06001198ICD_EXPORT void VKAPI vkCmdBindDynamicBlendState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001199 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001200 VkDynamicBlendState state)
Tony Barbourde4124d2015-07-03 10:33:54 -06001201{
1202 NULLDRV_LOG_FUNC;
1203}
1204
Cody Northrope4bc6942015-08-26 10:01:32 -06001205ICD_EXPORT void VKAPI vkCmdBindDynamicDepthBoundsState(
Tony Barbourde4124d2015-07-03 10:33:54 -06001206 VkCmdBuffer cmdBuffer,
Cody Northrope4bc6942015-08-26 10:01:32 -06001207 VkDynamicDepthBoundsState state)
Cody Northrop2605cb02015-08-18 15:21:16 -06001208{
1209 NULLDRV_LOG_FUNC;
1210}
1211
1212ICD_EXPORT void VKAPI vkCmdBindDynamicStencilState(
1213 VkCmdBuffer cmdBuffer,
1214 VkDynamicStencilState state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001215{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001216 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001217}
1218
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001219ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001220 VkCmdBuffer cmdBuffer,
1221 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001222 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001223 uint32_t firstSet,
1224 uint32_t setCount,
1225 const VkDescriptorSet* pDescriptorSets,
1226 uint32_t dynamicOffsetCount,
1227 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001228{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001229 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001230}
1231
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001232ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1233 VkCmdBuffer cmdBuffer,
1234 uint32_t startBinding,
1235 uint32_t bindingCount,
1236 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001237 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001238{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001239 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001240}
1241
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001242ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001243 VkCmdBuffer cmdBuffer,
1244 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001245 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001246 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001247{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001248 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001249}
1250
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001251ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001252 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001253 uint32_t firstVertex,
1254 uint32_t vertexCount,
1255 uint32_t firstInstance,
1256 uint32_t instanceCount)
1257{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001258 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001259}
1260
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001261ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001262 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001263 uint32_t firstIndex,
1264 uint32_t indexCount,
1265 int32_t vertexOffset,
1266 uint32_t firstInstance,
1267 uint32_t instanceCount)
1268{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001269 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001270}
1271
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001272ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001273 VkCmdBuffer cmdBuffer,
1274 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001275 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001276 uint32_t count,
1277 uint32_t stride)
1278{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001279 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001280}
1281
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001282ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001283 VkCmdBuffer cmdBuffer,
1284 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001285 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001286 uint32_t count,
1287 uint32_t stride)
1288{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001289 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001290}
1291
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001292ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001293 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001294 uint32_t x,
1295 uint32_t y,
1296 uint32_t z)
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 vkCmdDispatchIndirect(
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{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001306 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001307}
1308
Tony Barbour8205d902015-04-16 15:59:00 -06001309void VKAPI vkCmdWaitEvents(
1310 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001311 uint32_t eventCount,
1312 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001313 VkPipelineStageFlags sourceStageMask,
1314 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001315 uint32_t memBarrierCount,
Courtney Goeltzenleuchterd9ba3422015-07-12 12:58:58 -06001316 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001317{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001318 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001319}
1320
Tony Barbour8205d902015-04-16 15:59:00 -06001321void VKAPI vkCmdPipelineBarrier(
1322 VkCmdBuffer cmdBuffer,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001323 VkPipelineStageFlags srcStageMask,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001324 VkPipelineStageFlags destStageMask,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001325 VkBool32 byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001326 uint32_t memBarrierCount,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001327 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001328{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001329 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001330}
1331
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001332ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001333 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001334 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001335 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001336{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001337 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001338 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1339 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1340}
1341
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001342ICD_EXPORT void VKAPI vkDestroyDevice(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001343 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001344{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001345 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001346}
1347
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001348ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1349 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001350 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001351 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001352 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001353{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001354 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001355 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001356 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001357 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001358}
1359
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001360ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1361 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001362{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001363 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001364 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001365}
1366
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001367ICD_EXPORT VkResult VKAPI vkCreateEvent(
1368 VkDevice device,
1369 const VkEventCreateInfo* pCreateInfo,
1370 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001371{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001372 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001373 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001374}
1375
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001376ICD_EXPORT void VKAPI vkDestroyEvent(
Tony Barbourde4124d2015-07-03 10:33:54 -06001377 VkDevice device,
1378 VkEvent event)
1379{
1380 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06001381}
1382
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001383ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001384 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001385 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001386{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001387 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001388 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001389}
1390
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001391ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001392 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001393 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001394{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001395 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001396 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001397}
1398
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001399ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001400 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001401 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001402{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001403 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001404 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001405}
1406
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001407ICD_EXPORT VkResult VKAPI vkCreateFence(
1408 VkDevice device,
1409 const VkFenceCreateInfo* pCreateInfo,
1410 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001411{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001412 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001413 struct nulldrv_dev *dev = nulldrv_dev(device);
1414
1415 return nulldrv_fence_create(dev, pCreateInfo,
1416 (struct nulldrv_fence **) pFence);
1417}
1418
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001419ICD_EXPORT void VKAPI vkDestroyFence(
Tony Barbourde4124d2015-07-03 10:33:54 -06001420 VkDevice device,
1421 VkFence fence)
1422{
1423 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06001424}
1425
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001426ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001427 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001428 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001429{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001430 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001431 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001432}
1433
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001434ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001435 VkDevice device,
1436 uint32_t fenceCount,
1437 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001438{
1439 NULLDRV_LOG_FUNC;
1440 return VK_SUCCESS;
1441}
1442
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001443ICD_EXPORT VkResult VKAPI vkWaitForFences(
1444 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001445 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001446 const VkFence* pFences,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001447 VkBool32 waitAll,
David Pinedo0257fbf2015-02-02 18:02:40 -07001448 uint64_t timeout)
1449{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001450 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001451 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001452}
1453
Tony Barbour426b9052015-06-24 16:06:58 -06001454ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1455 VkPhysicalDevice gpu_,
1456 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001457{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001458 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001459 VkResult ret = VK_SUCCESS;
1460
Tony Barbour426b9052015-06-24 16:06:58 -06001461 pProperties->apiVersion = VK_API_VERSION;
1462 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1463 pProperties->vendorId = 0;
1464 pProperties->deviceId = 0;
1465 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1466 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001467
Mark Lobodzinski7dae6862015-09-07 12:56:17 -06001468 /* TODO: fill out limits */
1469 memset(&pProperties->limits, 0, sizeof(VkPhysicalDeviceLimits));
1470 memset(&pProperties->sparseProperties, 0, sizeof(VkPhysicalDeviceSparseProperties));
Ian Elliott64a68e12015-04-16 11:57:46 -06001471 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001472}
1473
Chris Forbesd7576302015-06-21 22:55:02 +12001474ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1475 VkPhysicalDevice physicalDevice,
1476 VkPhysicalDeviceFeatures* pFeatures)
1477{
1478 NULLDRV_LOG_FUNC;
1479 VkResult ret = VK_SUCCESS;
1480
1481 /* TODO: fill out features */
1482 memset(pFeatures, 0, sizeof(*pFeatures));
1483
1484 return ret;
1485}
1486
Courtney Goeltzenleuchter4da96aa2015-07-12 12:52:09 -06001487ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatProperties(
Chris Forbesd7576302015-06-21 22:55:02 +12001488 VkPhysicalDevice physicalDevice,
1489 VkFormat format,
1490 VkFormatProperties* pFormatInfo)
1491{
1492 NULLDRV_LOG_FUNC;
1493 VkResult ret = VK_SUCCESS;
1494
1495 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1496 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
Mark Lobodzinski4b36dd42015-09-03 15:21:52 -06001497 pFormatInfo->bufferFeatures = 0;
Chris Forbesd7576302015-06-21 22:55:02 +12001498
1499 return ret;
1500}
1501
Cody Northropef72e2a2015-08-03 17:04:53 -06001502ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueFamilyProperties(
Tony Barbour426b9052015-06-24 16:06:58 -06001503 VkPhysicalDevice gpu_,
Cody Northropef72e2a2015-08-03 17:04:53 -06001504 uint32_t* pCount,
1505 VkQueueFamilyProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001506 {
Cody Northropef72e2a2015-08-03 17:04:53 -06001507 if (pProperties == NULL) {
1508 *pCount = 1;
1509 return VK_SUCCESS;
1510 }
Tony Barbour426b9052015-06-24 16:06:58 -06001511 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1512 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001513 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001514
Tony Barbour426b9052015-06-24 16:06:58 -06001515 return VK_SUCCESS;
1516}
1517
Ian Elliotte924ab22015-07-08 13:24:30 -06001518ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(
1519 VkPhysicalDevice gpu_,
1520 VkPhysicalDeviceMemoryProperties* pProperties)
1521{
1522 // TODO: Fill in with real data
1523 return VK_SUCCESS;
1524}
1525
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001526ICD_EXPORT VkResult VKAPI vkEnumerateDeviceLayerProperties(
Ian Elliotte924ab22015-07-08 13:24:30 -06001527 VkPhysicalDevice physicalDevice,
1528 uint32_t* pCount,
1529 VkLayerProperties* pProperties)
1530{
1531 // TODO: Fill in with real data
1532 return VK_SUCCESS;
1533}
1534
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001535ICD_EXPORT VkResult VKAPI vkEnumerateInstanceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001536 const char* pLayerName,
1537 uint32_t* pCount,
1538 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001539{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001540 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001541
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001542 if (pProperties == NULL) {
1543 *pCount = NULLDRV_EXT_COUNT;
1544 return VK_SUCCESS;
1545 }
Tony Barbour426b9052015-06-24 16:06:58 -06001546
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001547 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1548 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1549 *pCount = copy_size;
1550 if (copy_size < NULLDRV_EXT_COUNT) {
1551 return VK_INCOMPLETE;
1552 }
Tony Barbour426b9052015-06-24 16:06:58 -06001553 return VK_SUCCESS;
1554}
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001555ICD_EXPORT VkResult VKAPI vkEnumerateInstanceLayerProperties(
Ian Elliotte924ab22015-07-08 13:24:30 -06001556 uint32_t* pCount,
1557 VkLayerProperties* pProperties)
1558{
1559 // TODO: Fill in with real data
1560 return VK_SUCCESS;
1561}
Tony Barbour426b9052015-06-24 16:06:58 -06001562
Courtney Goeltzenleuchter74c4ce92015-09-14 17:22:16 -06001563VkResult VKAPI vkEnumerateDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001564 VkPhysicalDevice physicalDevice,
1565 const char* pLayerName,
1566 uint32_t* pCount,
1567 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001568{
Tony Barbour426b9052015-06-24 16:06:58 -06001569
Tony Barbour426b9052015-06-24 16:06:58 -06001570 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001571
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001572 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001573}
1574
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001575ICD_EXPORT VkResult VKAPI vkCreateImage(
1576 VkDevice device,
1577 const VkImageCreateInfo* pCreateInfo,
1578 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001579{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001580 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001581 struct nulldrv_dev *dev = nulldrv_dev(device);
1582
1583 return nulldrv_img_create(dev, pCreateInfo, false,
1584 (struct nulldrv_img **) pImage);
1585}
1586
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001587ICD_EXPORT void VKAPI vkDestroyImage(
Tony Barbourde4124d2015-07-03 10:33:54 -06001588 VkDevice device,
1589 VkImage image)
1590{
1591 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06001592}
1593
Tony Barbour426b9052015-06-24 16:06:58 -06001594ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001595 VkDevice device,
1596 VkImage image,
1597 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001598 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001599{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001600 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001601
Tony Barbour426b9052015-06-24 16:06:58 -06001602 pLayout->offset = 0;
1603 pLayout->size = 1;
1604 pLayout->rowPitch = 4;
1605 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001606
Tony Barbour426b9052015-06-24 16:06:58 -06001607 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001608}
1609
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001610ICD_EXPORT VkResult VKAPI vkAllocMemory(
1611 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001612 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001613 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001614{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001615 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001616 struct nulldrv_dev *dev = nulldrv_dev(device);
1617
1618 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1619}
1620
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001621ICD_EXPORT void VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001622 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001623 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001624{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001625 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001626}
1627
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001628ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001629 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001630 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001631 VkDeviceSize offset,
1632 VkDeviceSize size,
1633 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001634 void** ppData)
1635{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001636 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001637 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1638 void *ptr = nulldrv_mem_map(mem, flags);
1639
1640 *ppData = ptr;
1641
Courtney Goeltzenleuchterac544f32015-09-14 18:01:17 -06001642 return (ptr) ? VK_SUCCESS : VK_ERROR_MEMORY_MAP_FAILED;
David Pinedo0257fbf2015-02-02 18:02:40 -07001643}
1644
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001645ICD_EXPORT void VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001646 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001647 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001648{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001649 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001650}
1651
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001652ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001653 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001654 uint32_t memRangeCount,
1655 const VkMappedMemoryRange* pMemRanges)
1656{
1657 NULLDRV_LOG_FUNC;
1658 return VK_SUCCESS;
1659}
1660
1661ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1662 VkDevice device,
1663 uint32_t memRangeCount,
1664 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001665{
1666 NULLDRV_LOG_FUNC;
1667 return VK_SUCCESS;
1668}
1669
Courtney Goeltzenleuchterd040c5c2015-07-09 21:57:28 -06001670ICD_EXPORT VkResult VKAPI vkGetDeviceMemoryCommitment(
1671 VkDevice device,
1672 VkDeviceMemory memory,
1673 VkDeviceSize* pCommittedMemoryInBytes)
1674{
1675 return VK_SUCCESS;
1676}
1677
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001678ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001679 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001680 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001681{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001682 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001683 struct nulldrv_instance *inst;
1684
1685 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001686 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001687 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001688 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001689
Tony Barbour426b9052015-06-24 16:06:58 -06001690 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001691
Mike Stroyan230e6252015-04-17 12:36:38 -06001692 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001693
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001694 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001695}
1696
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001697ICD_EXPORT void VKAPI vkDestroyInstance(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001698 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001699{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001700 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001701}
1702
Tony Barbour8205d902015-04-16 15:59:00 -06001703ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001704 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001705 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001706 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001707{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001708 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001709 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001710 struct nulldrv_gpu *gpu;
1711 *pGpuCount = 1;
1712 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001713 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001714 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001715 return ret;
1716}
1717
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001718ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001719 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001720 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001721 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001722 char* const* pOutLayers,
1723 void* pReserved)
1724{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001725 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001726 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001727}
1728
Tony Barbourde4124d2015-07-03 10:33:54 -06001729ICD_EXPORT VkResult VKAPI vkGetBufferMemoryRequirements(
1730 VkDevice device,
1731 VkBuffer buffer,
1732 VkMemoryRequirements* pMemoryRequirements)
1733{
1734 NULLDRV_LOG_FUNC;
1735 struct nulldrv_base *base = nulldrv_base((void*)buffer.handle);
1736
1737 return base->get_memory_requirements(base, pMemoryRequirements);
1738}
1739
1740ICD_EXPORT VkResult VKAPI vkGetImageMemoryRequirements(
1741 VkDevice device,
1742 VkImage image,
1743 VkMemoryRequirements* pMemoryRequirements)
1744{
1745 NULLDRV_LOG_FUNC;
1746 struct nulldrv_base *base = nulldrv_base((void*)image.handle);
1747
1748 return base->get_memory_requirements(base, pMemoryRequirements);
1749}
1750
1751ICD_EXPORT VkResult VKAPI vkBindBufferMemory(
1752 VkDevice device,
1753 VkBuffer buffer,
1754 VkDeviceMemory mem_,
1755 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001756{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001757 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001758 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001759}
1760
Tony Barbourde4124d2015-07-03 10:33:54 -06001761ICD_EXPORT VkResult VKAPI vkBindImageMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001762 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06001763 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001764 VkDeviceMemory mem_,
1765 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001766{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001767 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001768 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001769}
1770
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001771ICD_EXPORT VkResult VKAPI vkGetImageSparseMemoryRequirements(
1772 VkDevice device,
1773 VkImage image,
1774 uint32_t* pNumRequirements,
1775 VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
1776{
1777 NULLDRV_LOG_FUNC;
1778 return VK_SUCCESS;
1779}
1780
1781ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(
1782 VkPhysicalDevice physicalDevice,
1783 VkFormat format,
1784 VkImageType type,
1785 uint32_t samples,
1786 VkImageUsageFlags usage,
1787 VkImageTiling tiling,
1788 uint32_t* pNumProperties,
1789 VkSparseImageFormatProperties* pProperties)
1790{
1791 NULLDRV_LOG_FUNC;
1792 return VK_SUCCESS;
1793}
1794
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001795ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001796 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001797 VkBuffer buffer,
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001798 uint32_t numBindings,
1799 const VkSparseMemoryBindInfo* pBindInfo)
1800{
1801 NULLDRV_LOG_FUNC;
1802 return VK_SUCCESS;
1803}
1804
1805ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageOpaqueMemory(
1806 VkQueue queue,
1807 VkImage image,
1808 uint32_t numBindings,
1809 const VkSparseMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001810{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001811 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001812 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001813}
1814
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001815ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001816 VkQueue queue,
1817 VkImage image,
1818 uint32_t numBindings,
1819 const VkSparseImageMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001820{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001821 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001822 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001823}
Jon Ashburn0e249962015-07-10 09:41:15 -07001824ICD_EXPORT VkResult VKAPI vkCreatePipelineCache(
1825 VkDevice device,
1826 const VkPipelineCacheCreateInfo* pCreateInfo,
1827 VkPipelineCache* pPipelineCache)
1828{
David Pinedo0257fbf2015-02-02 18:02:40 -07001829
Jon Ashburn0e249962015-07-10 09:41:15 -07001830 NULLDRV_LOG_FUNC;
1831 return VK_SUCCESS;
1832}
1833
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001834ICD_EXPORT void VKAPI vkDestroyPipeline(
Tony Barbourde4124d2015-07-03 10:33:54 -06001835 VkDevice device,
1836 VkPipeline pipeline)
1837{
1838 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06001839}
1840
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001841void VKAPI vkDestroyPipelineCache(
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06001842 VkDevice device,
1843 VkPipelineCache pipelineCache)
Jon Ashburn0e249962015-07-10 09:41:15 -07001844{
1845 NULLDRV_LOG_FUNC;
Jon Ashburn0e249962015-07-10 09:41:15 -07001846}
1847
1848ICD_EXPORT size_t VKAPI vkGetPipelineCacheSize(
1849 VkDevice device,
1850 VkPipelineCache pipelineCache)
1851{
1852 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06001853 return 0;
Jon Ashburn0e249962015-07-10 09:41:15 -07001854}
1855
1856ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
1857 VkDevice device,
1858 VkPipelineCache pipelineCache,
1859 void* pData)
1860{
1861 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06001862 return VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn0e249962015-07-10 09:41:15 -07001863}
1864
1865ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
1866 VkDevice device,
1867 VkPipelineCache destCache,
1868 uint32_t srcCacheCount,
1869 const VkPipelineCache* pSrcCaches)
1870{
1871 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06001872 return VK_ERROR_INITIALIZATION_FAILED;
Jon Ashburn0e249962015-07-10 09:41:15 -07001873}
1874ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001875 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001876 VkPipelineCache pipelineCache,
1877 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001878 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1879 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001880{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001881 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001882 struct nulldrv_dev *dev = nulldrv_dev(device);
1883
1884 return graphics_pipeline_create(dev, pCreateInfo,
1885 (struct nulldrv_pipeline **) pPipeline);
1886}
1887
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001888
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001889
Jon Ashburn0e249962015-07-10 09:41:15 -07001890ICD_EXPORT VkResult VKAPI vkCreateComputePipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001891 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001892 VkPipelineCache pipelineCache,
1893 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001894 const VkComputePipelineCreateInfo* pCreateInfo,
1895 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001896{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001897 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001898 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001899}
1900
David Pinedo0257fbf2015-02-02 18:02:40 -07001901
David Pinedo0257fbf2015-02-02 18:02:40 -07001902
Jon Ashburn0e249962015-07-10 09:41:15 -07001903
David Pinedo0257fbf2015-02-02 18:02:40 -07001904
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001905ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1906 VkDevice device,
1907 const VkQueryPoolCreateInfo* pCreateInfo,
1908 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001909{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001910 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001911 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001912}
1913
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001914ICD_EXPORT void VKAPI vkDestroyQueryPool(
Tony Barbourde4124d2015-07-03 10:33:54 -06001915 VkDevice device,
1916 VkQueryPool queryPoool)
1917{
1918 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06001919}
1920
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001921ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001922 VkDevice device,
1923 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001924 uint32_t startQuery,
1925 uint32_t queryCount,
1926 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001927 void* pData,
1928 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001929{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001930 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001931 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001932}
1933
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001934ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1935 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001936{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001937 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001938 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001939}
1940
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001941ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1942 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001943 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001944 const VkCmdBuffer* pCmdBuffers,
1945 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001946{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001947 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001948 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001949}
1950
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001951ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1952 VkDevice device,
1953 const VkSemaphoreCreateInfo* pCreateInfo,
1954 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001955{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001956 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001957 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001958}
1959
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001960ICD_EXPORT void VKAPI vkDestroySemaphore(
Tony Barbourde4124d2015-07-03 10:33:54 -06001961 VkDevice device,
1962 VkSemaphore semaphore)
1963{
1964 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06001965}
1966
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001967ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1968 VkQueue queue,
1969 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001970{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001971 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001972 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001973}
1974
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001975ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1976 VkQueue queue,
1977 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001978{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001979 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001980 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001981}
1982
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001983ICD_EXPORT VkResult VKAPI vkCreateSampler(
1984 VkDevice device,
1985 const VkSamplerCreateInfo* pCreateInfo,
1986 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07001987{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001988 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001989 struct nulldrv_dev *dev = nulldrv_dev(device);
1990
1991 return nulldrv_sampler_create(dev, pCreateInfo,
1992 (struct nulldrv_sampler **) pSampler);
1993}
1994
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06001995ICD_EXPORT void VKAPI vkDestroySampler(
Tony Barbourde4124d2015-07-03 10:33:54 -06001996 VkDevice device,
1997 VkSampler sampler)
1998{
1999 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06002000}
2001
Ian Elliotte924ab22015-07-08 13:24:30 -06002002ICD_EXPORT VkResult VKAPI vkCreateShaderModule(
2003 VkDevice device,
2004 const VkShaderModuleCreateInfo* pCreateInfo,
2005 VkShaderModule* pShaderModule)
2006{
2007 // TODO: Fill in with real data
Tony Barbourde4124d2015-07-03 10:33:54 -06002008 NULLDRV_LOG_FUNC;
2009 return VK_SUCCESS;
2010}
2011
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002012ICD_EXPORT void VKAPI vkDestroyShaderModule(
Tony Barbourde4124d2015-07-03 10:33:54 -06002013 VkDevice device,
2014 VkShaderModule shaderModule)
2015{
2016 // TODO: Fill in with real data
2017 NULLDRV_LOG_FUNC;
Ian Elliotte924ab22015-07-08 13:24:30 -06002018}
2019
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002020ICD_EXPORT VkResult VKAPI vkCreateShader(
2021 VkDevice device,
2022 const VkShaderCreateInfo* pCreateInfo,
2023 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002024{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002025 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002026 struct nulldrv_dev *dev = nulldrv_dev(device);
2027
2028 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2029}
2030
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002031ICD_EXPORT void VKAPI vkDestroyShader(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002032 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002033 VkShader shader)
2034{
2035 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06002036}
2037
2038ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2039 VkDevice device,
2040 const VkDynamicViewportStateCreateInfo* pCreateInfo,
2041 VkDynamicViewportState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002042{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002043 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002044 struct nulldrv_dev *dev = nulldrv_dev(device);
2045
2046 return nulldrv_viewport_state_create(dev, pCreateInfo,
2047 (struct nulldrv_dynamic_vp **) pState);
2048}
2049
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002050ICD_EXPORT void VKAPI vkDestroyDynamicViewportState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002051 VkDevice device,
2052 VkDynamicViewportState dynamicViewportState)
2053{
2054 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06002055}
2056
Cody Northrope4bc6942015-08-26 10:01:32 -06002057ICD_EXPORT VkResult VKAPI vkCreateDynamicLineWidthState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002058 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002059 const VkDynamicLineWidthStateCreateInfo* pCreateInfo,
2060 VkDynamicLineWidthState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002061{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002062 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002063 struct nulldrv_dev *dev = nulldrv_dev(device);
2064
Cody Northrope4bc6942015-08-26 10:01:32 -06002065 return nulldrv_line_width_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002066 (struct nulldrv_dynamic_line_width **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002067}
2068
Cody Northrope4bc6942015-08-26 10:01:32 -06002069ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthBiasState(
Cody Northropf5bd2252015-08-17 11:10:49 -06002070 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002071 const VkDynamicDepthBiasStateCreateInfo* pCreateInfo,
2072 VkDynamicDepthBiasState* pState)
Cody Northropf5bd2252015-08-17 11:10:49 -06002073{
2074 NULLDRV_LOG_FUNC;
2075 struct nulldrv_dev *dev = nulldrv_dev(device);
2076
Cody Northrope4bc6942015-08-26 10:01:32 -06002077 return nulldrv_depth_bias_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002078 (struct nulldrv_dynamic_depth_bias **) pState);
Cody Northropf5bd2252015-08-17 11:10:49 -06002079}
2080
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002081ICD_EXPORT void VKAPI vkDestroyDynamicLineWidthState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002082 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002083 VkDynamicLineWidthState dynamicLineWidthState)
Cody Northropf5bd2252015-08-17 11:10:49 -06002084{
2085 NULLDRV_LOG_FUNC;
Cody Northropf5bd2252015-08-17 11:10:49 -06002086}
2087
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002088ICD_EXPORT void VKAPI vkDestroyDynamicDepthBiasState(
Cody Northropf5bd2252015-08-17 11:10:49 -06002089 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002090 VkDynamicDepthBiasState dynamicDepthBiasState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002091{
2092 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06002093}
2094
Cody Northrope4bc6942015-08-26 10:01:32 -06002095ICD_EXPORT VkResult VKAPI vkCreateDynamicBlendState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002096 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002097 const VkDynamicBlendStateCreateInfo* pCreateInfo,
2098 VkDynamicBlendState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002099{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002100 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002101 struct nulldrv_dev *dev = nulldrv_dev(device);
2102
2103 return nulldrv_blend_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002104 (struct nulldrv_dynamic_blend **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002105}
2106
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002107ICD_EXPORT void VKAPI vkDestroyDynamicBlendState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002108 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002109 VkDynamicBlendState dynamicBlendState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002110{
2111 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06002112}
2113
Cody Northrope4bc6942015-08-26 10:01:32 -06002114ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthBoundsState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002115 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002116 const VkDynamicDepthBoundsStateCreateInfo* pCreateInfo,
2117 VkDynamicDepthBoundsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002118{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002119 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002120 struct nulldrv_dev *dev = nulldrv_dev(device);
2121
Cody Northrope4bc6942015-08-26 10:01:32 -06002122 return nulldrv_depth_bounds_state_create(dev, pCreateInfo,
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002123 (struct nulldrv_dynamic_depth_bounds **) pState);
David Pinedo0257fbf2015-02-02 18:02:40 -07002124}
2125
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002126ICD_EXPORT void VKAPI vkDestroyDynamicDepthBoundsState(
Tony Barbourde4124d2015-07-03 10:33:54 -06002127 VkDevice device,
Cody Northrope4bc6942015-08-26 10:01:32 -06002128 VkDynamicDepthBoundsState dynamicDepthBoundsState)
Cody Northrop2605cb02015-08-18 15:21:16 -06002129{
2130 NULLDRV_LOG_FUNC;
Cody Northrop2605cb02015-08-18 15:21:16 -06002131}
2132
2133ICD_EXPORT VkResult VKAPI vkCreateDynamicStencilState(
2134 VkDevice device,
2135 const VkDynamicStencilStateCreateInfo* pCreateInfoFront,
2136 const VkDynamicStencilStateCreateInfo* pCreateInfoBack,
2137 VkDynamicStencilState* pState)
2138{
2139 NULLDRV_LOG_FUNC;
2140 struct nulldrv_dev *dev = nulldrv_dev(device);
2141
2142 return nulldrv_stencil_state_create(dev, pCreateInfoFront, pCreateInfoBack,
2143 (struct nulldrv_dynamic_stencil **) pState);
2144}
2145
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002146ICD_EXPORT void VKAPI vkDestroyDynamicStencilState(
Cody Northrop2605cb02015-08-18 15:21:16 -06002147 VkDevice device,
2148 VkDynamicStencilState dynamicStencilState)
Tony Barbourde4124d2015-07-03 10:33:54 -06002149{
2150 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06002151}
2152
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002153ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2154 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002155 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002156 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002157{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002158 NULLDRV_LOG_FUNC;
2159 struct nulldrv_dev *dev = nulldrv_dev(device);
2160
2161 return nulldrv_buf_view_create(dev, pCreateInfo,
2162 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002163}
2164
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002165ICD_EXPORT void VKAPI vkDestroyBufferView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002166 VkDevice device,
2167 VkBufferView bufferView)
2168{
2169 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06002170}
2171
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002172ICD_EXPORT VkResult VKAPI vkCreateImageView(
2173 VkDevice device,
2174 const VkImageViewCreateInfo* pCreateInfo,
2175 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002176{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002177 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002178 struct nulldrv_dev *dev = nulldrv_dev(device);
2179
2180 return nulldrv_img_view_create(dev, pCreateInfo,
2181 (struct nulldrv_img_view **) pView);
2182}
2183
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002184ICD_EXPORT void VKAPI vkDestroyImageView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002185 VkDevice device,
2186 VkImageView imageView)
2187{
2188 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06002189}
2190
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002191ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2192 VkDevice device,
2193 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2194 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002195{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002196 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002197 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002198
Chia-I Wu7732cb22015-03-26 15:27:55 +08002199 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002200 (struct nulldrv_desc_layout **) pSetLayout);
2201}
2202
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002203ICD_EXPORT void VKAPI vkDestroyDescriptorSetLayout(
Tony Barbourde4124d2015-07-03 10:33:54 -06002204 VkDevice device,
2205 VkDescriptorSetLayout descriptorSetLayout)
2206{
2207 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06002208}
2209
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002210ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2211 VkDevice device,
2212 const VkPipelineLayoutCreateInfo* pCreateInfo,
2213 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002214{
2215 NULLDRV_LOG_FUNC;
2216 struct nulldrv_dev *dev = nulldrv_dev(device);
2217
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002218 return nulldrv_pipeline_layout_create(dev,
2219 pCreateInfo,
2220 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002221}
2222
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002223ICD_EXPORT void VKAPI vkDestroyPipelineLayout(
Tony Barbourde4124d2015-07-03 10:33:54 -06002224 VkDevice device,
2225 VkPipelineLayout pipelineLayout)
2226{
2227 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06002228}
2229
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002230ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
Courtney Goeltzenleuchterd9e966a2015-09-16 16:12:45 -06002231 VkDevice device,
2232 const VkDescriptorPoolCreateInfo* pCreateInfo,
2233 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002234{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002235 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002236 struct nulldrv_dev *dev = nulldrv_dev(device);
2237
Courtney Goeltzenleuchterd9e966a2015-09-16 16:12:45 -06002238 return nulldrv_desc_pool_create(dev, pCreateInfo,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002239 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002240}
2241
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002242ICD_EXPORT void VKAPI vkDestroyDescriptorPool(
Tony Barbourde4124d2015-07-03 10:33:54 -06002243 VkDevice device,
2244 VkDescriptorPool descriptorPool)
2245{
2246 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06002247}
2248
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002249ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002250 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002251 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002252{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002253 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002254 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002255}
2256
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002257ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002258 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002259 VkDescriptorPool descriptorPool,
2260 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002261 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002262 const VkDescriptorSetLayout* pSetLayouts,
Cody Northropc8aa4a52015-08-03 12:47:29 -06002263 VkDescriptorSet* pDescriptorSets)
David Pinedo0257fbf2015-02-02 18:02:40 -07002264{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002265 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002266 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2267 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002268 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002269 uint32_t i;
2270
2271 for (i = 0; i < count; i++) {
2272 const struct nulldrv_desc_layout *layout =
Tony Barbour8db65372015-07-10 18:32:33 -06002273 nulldrv_desc_layout(pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002274
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002275 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002276 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002277 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002278 break;
2279 }
2280
David Pinedo0257fbf2015-02-02 18:02:40 -07002281 return ret;
2282}
2283
Tony Barbourb857d312015-07-10 10:50:45 -06002284ICD_EXPORT VkResult VKAPI vkFreeDescriptorSets(
2285 VkDevice device,
2286 VkDescriptorPool descriptorPool,
2287 uint32_t count,
2288 const VkDescriptorSet* pDescriptorSets)
2289{
2290 NULLDRV_LOG_FUNC;
2291 return VK_SUCCESS;
2292}
2293
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002294ICD_EXPORT void VKAPI vkUpdateDescriptorSets(
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002295 VkDevice device,
2296 uint32_t writeCount,
2297 const VkWriteDescriptorSet* pDescriptorWrites,
2298 uint32_t copyCount,
2299 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002300{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002301 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002302}
2303
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002304ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2305 VkDevice device,
2306 const VkFramebufferCreateInfo* info,
2307 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002308{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002309 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002310 struct nulldrv_dev *dev = nulldrv_dev(device);
2311
2312 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2313}
2314
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002315ICD_EXPORT void VKAPI vkDestroyFramebuffer(
Tony Barbourde4124d2015-07-03 10:33:54 -06002316 VkDevice device,
2317 VkFramebuffer framebuffer)
2318{
2319 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06002320}
David Pinedo0257fbf2015-02-02 18:02:40 -07002321
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002322ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2323 VkDevice device,
2324 const VkRenderPassCreateInfo* info,
2325 VkRenderPass* rp_ret)
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
2330 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2331}
2332
Mark Lobodzinski67b42b72015-09-07 13:59:43 -06002333ICD_EXPORT void VKAPI vkDestroyRenderPass(
Tony Barbourde4124d2015-07-03 10:33:54 -06002334 VkDevice device,
2335 VkRenderPass renderPass)
2336{
2337 NULLDRV_LOG_FUNC;
Tony Barbourde4124d2015-07-03 10:33:54 -06002338}
2339
Courtney Goeltzenleuchtera375b622015-07-27 14:04:01 -06002340ICD_EXPORT void VKAPI vkCmdPushConstants(
2341 VkCmdBuffer cmdBuffer,
2342 VkPipelineLayout layout,
2343 VkShaderStageFlags stageFlags,
2344 uint32_t start,
2345 uint32_t length,
2346 const void* values)
2347{
2348 /* TODO: Implement */
2349}
2350
Courtney Goeltzenleuchter07fe0662015-07-27 13:47:08 -06002351ICD_EXPORT VkResult VKAPI vkGetRenderAreaGranularity(
2352 VkDevice device,
2353 VkRenderPass renderPass,
2354 VkExtent2D* pGranularity)
2355{
2356 pGranularity->height = 1;
2357 pGranularity->width = 1;
2358
2359 return VK_SUCCESS;
2360}
2361
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002362ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Chia-I Wuc278df82015-07-07 11:50:03 +08002363 VkCmdBuffer cmdBuffer,
2364 const VkRenderPassBeginInfo* pRenderPassBegin,
2365 VkRenderPassContents contents)
2366{
2367 NULLDRV_LOG_FUNC;
2368}
2369
2370ICD_EXPORT void VKAPI vkCmdNextSubpass(
2371 VkCmdBuffer cmdBuffer,
2372 VkRenderPassContents contents)
David Pinedo0257fbf2015-02-02 18:02:40 -07002373{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002374 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002375}
2376
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002377ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002378 VkCmdBuffer cmdBuffer)
2379{
2380 NULLDRV_LOG_FUNC;
2381}
2382
2383ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2384 VkCmdBuffer cmdBuffer,
2385 uint32_t cmdBuffersCount,
2386 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002387{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002388 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002389}
Ian Elliottf93069f2015-02-19 14:26:19 -07002390
2391ICD_EXPORT void* xcbCreateWindow(
2392 uint16_t width,
2393 uint16_t height)
2394{
2395 static uint32_t window; // Kludge to the max
2396 NULLDRV_LOG_FUNC;
2397 return &window;
2398}
2399
2400// May not be needed, if we stub out stuf in tri.c
2401ICD_EXPORT void xcbDestroyWindow()
2402{
2403 NULLDRV_LOG_FUNC;
2404}
2405
2406ICD_EXPORT int xcbGetMessage(void *msg)
2407{
2408 NULLDRV_LOG_FUNC;
2409 return 0;
2410}
2411
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002412ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002413{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002414 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002415}
David Pinedo07494fd2015-07-24 10:54:41 -06002416
2417ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceImageFormatProperties(
2418 VkPhysicalDevice physicalDevice,
2419 VkFormat format,
2420 VkImageType type,
2421 VkImageTiling tiling,
2422 VkImageUsageFlags usage,
Courtney Goeltzenleuchter06d94a52015-09-17 11:21:14 -06002423 VkImageCreateFlags flags,
David Pinedo07494fd2015-07-24 10:54:41 -06002424 VkImageFormatProperties* pImageFormatProperties)
2425{
Courtney Goeltzenleuchter08854b22015-09-10 11:23:57 -06002426 return VK_ERROR_INITIALIZATION_FAILED;
David Pinedo07494fd2015-07-24 10:54:41 -06002427}