blob: 1d786008b609e0d070630d3579ceea97f7a875c7 [file] [log] [blame]
David Pinedo0257fbf2015-02-02 18:02:40 -07001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan null driver
David Pinedo0257fbf2015-02-02 18:02:40 -07003 *
4 * Copyright (C) 2015 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 */
25
26#include "nulldrv.h"
David Pinedo8e9cb3b2015-02-10 15:02:08 -070027#include <stdio.h>
David Pinedo0257fbf2015-02-02 18:02:40 -070028
David Pinedo8e9cb3b2015-02-10 15:02:08 -070029#if 0
30#define NULLDRV_LOG_FUNC \
31 do { \
32 fflush(stdout); \
33 fflush(stderr); \
34 printf("null driver: %s\n", __FUNCTION__); \
35 fflush(stdout); \
36 } while (0)
37#else
38 #define NULLDRV_LOG_FUNC do { } while (0)
39#endif
40
41// The null driver supports all WSI extenstions ... for now ...
David Pinedo0257fbf2015-02-02 18:02:40 -070042static const char * const nulldrv_gpu_exts[NULLDRV_EXT_COUNT] = {
Ian Elliott53bd3dc2015-07-06 14:29:31 -060043 [NULLDRV_EXT_WSI_SWAPCHAIN] = VK_WSI_SWAPCHAIN_EXTENSION_NAME,
David Pinedo0257fbf2015-02-02 18:02:40 -070044};
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060045static const VkExtensionProperties intel_gpu_exts[NULLDRV_EXT_COUNT] = {
46 {
Ian Elliott53bd3dc2015-07-06 14:29:31 -060047 .extName = VK_WSI_SWAPCHAIN_EXTENSION_NAME,
48 .specVersion = VK_WSI_SWAPCHAIN_REVISION,
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -060049 }
50};
David Pinedo0257fbf2015-02-02 18:02:40 -070051
Tony Barbourde4124d2015-07-03 10:33:54 -060052static struct nulldrv_base *nulldrv_base(void* base)
David Pinedo0257fbf2015-02-02 18:02:40 -070053{
54 return (struct nulldrv_base *) base;
55}
56
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060057static struct nulldrv_base *nulldrv_base_create(
58 struct nulldrv_dev *dev,
59 size_t obj_size,
Tony Barbourde4124d2015-07-03 10:33:54 -060060 VkDbgObjectType type)
David Pinedo0257fbf2015-02-02 18:02:40 -070061{
62 struct nulldrv_base *base;
63
64 if (!obj_size)
65 obj_size = sizeof(*base);
66
67 assert(obj_size >= sizeof(*base));
68
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060069 base = (struct nulldrv_base*)malloc(obj_size);
David Pinedo0257fbf2015-02-02 18:02:40 -070070 if (!base)
71 return NULL;
72
73 memset(base, 0, obj_size);
74
75 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbourde4124d2015-07-03 10:33:54 -060076 set_loader_magic_value(base);
David Pinedo0257fbf2015-02-02 18:02:40 -070077
78 if (dev == NULL) {
79 /*
80 * dev is NULL when we are creating the base device object
81 * Set dev now so that debug setup happens correctly
82 */
83 dev = (struct nulldrv_dev *) base;
84 }
85
86
Tony Barbour426b9052015-06-24 16:06:58 -060087 base->get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -070088
89 return base;
90}
91
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060092static VkResult nulldrv_gpu_add(int devid, const char *primary_node,
David Pinedo0257fbf2015-02-02 18:02:40 -070093 const char *render_node, struct nulldrv_gpu **gpu_ret)
94{
95 struct nulldrv_gpu *gpu;
96
Chia-I Wu493a1752015-02-22 14:40:25 +080097 gpu = malloc(sizeof(*gpu));
David Pinedo0257fbf2015-02-02 18:02:40 -070098 if (!gpu)
Tony Barbour8205d902015-04-16 15:59:00 -060099 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700100 memset(gpu, 0, sizeof(*gpu));
Mark Lobodzinski97dcd042015-04-16 08:52:00 -0500101
David Pinedo0257fbf2015-02-02 18:02:40 -0700102 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
Tony Barbourde4124d2015-07-03 10:33:54 -0600103 set_loader_magic_value(gpu);
David Pinedo0257fbf2015-02-02 18:02:40 -0700104
105 *gpu_ret = gpu;
106
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600107 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700108}
109
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600110static VkResult nulldrv_queue_create(struct nulldrv_dev *dev,
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700111 uint32_t node_index,
David Pinedo0257fbf2015-02-02 18:02:40 -0700112 struct nulldrv_queue **queue_ret)
113{
114 struct nulldrv_queue *queue;
115
116 queue = (struct nulldrv_queue *) nulldrv_base_create(dev, sizeof(*queue),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600117 VK_OBJECT_TYPE_QUEUE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700118 if (!queue)
Tony Barbour8205d902015-04-16 15:59:00 -0600119 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700120
121 queue->dev = dev;
122
123 *queue_ret = queue;
124
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600125 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700126}
127
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600128static VkResult dev_create_queues(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600129 const VkDeviceQueueCreateInfo *queues,
David Pinedo0257fbf2015-02-02 18:02:40 -0700130 uint32_t count)
131{
132 uint32_t i;
133
134 if (!count)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600135 return VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700136
137 for (i = 0; i < count; i++) {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600138 const VkDeviceQueueCreateInfo *q = &queues[i];
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600139 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700140
Tony Barbour29b12062015-07-13 13:37:24 -0600141 if (q->queueCount == 1 && !dev->queues[q->queueFamilyIndex]) {
142 ret = nulldrv_queue_create(dev, q->queueFamilyIndex,
143 &dev->queues[q->queueFamilyIndex]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700144 }
145 else {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600146 ret = VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700147 }
148
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600149 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700150 return ret;
151 }
152 }
153
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600154 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700155}
156
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600157static enum nulldrv_ext_type nulldrv_gpu_lookup_extension(
158 const struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600159 const char* extName)
David Pinedo0257fbf2015-02-02 18:02:40 -0700160{
161 enum nulldrv_ext_type type;
162
163 for (type = 0; type < ARRAY_SIZE(nulldrv_gpu_exts); type++) {
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600164 if (strcmp(nulldrv_gpu_exts[type], extName) == 0)
David Pinedo0257fbf2015-02-02 18:02:40 -0700165 break;
166 }
167
168 assert(type < NULLDRV_EXT_COUNT || type == NULLDRV_EXT_INVALID);
169
170 return type;
171}
172
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600173static VkResult nulldrv_desc_ooxx_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800174 struct nulldrv_desc_ooxx **ooxx_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700175{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800176 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700177
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800178 ooxx = malloc(sizeof(*ooxx));
179 if (!ooxx)
Tony Barbour8205d902015-04-16 15:59:00 -0600180 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700181
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800182 memset(ooxx, 0, sizeof(*ooxx));
David Pinedo0257fbf2015-02-02 18:02:40 -0700183
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800184 ooxx->surface_desc_size = 0;
185 ooxx->sampler_desc_size = 0;
David Pinedo0257fbf2015-02-02 18:02:40 -0700186
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800187 *ooxx_ret = ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700188
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600189 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700190}
191
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600192static VkResult nulldrv_dev_create(struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600193 const VkDeviceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700194 struct nulldrv_dev **dev_ret)
195{
196 struct nulldrv_dev *dev;
197 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600198 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -0700199
200 dev = (struct nulldrv_dev *) nulldrv_base_create(NULL, sizeof(*dev),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600201 VK_OBJECT_TYPE_DEVICE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700202 if (!dev)
Tony Barbour8205d902015-04-16 15:59:00 -0600203 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700204
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600205 for (i = 0; i < info->extensionCount; i++) {
206 const enum nulldrv_ext_type ext = nulldrv_gpu_lookup_extension(
207 gpu,
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600208 info->ppEnabledExtensionNames[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -0700209
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600210 if (ext == NULLDRV_EXT_INVALID)
211 return VK_ERROR_INVALID_EXTENSION;
David Pinedo0257fbf2015-02-02 18:02:40 -0700212
Courtney Goeltzenleuchtere023ff42015-06-01 15:10:03 -0600213 dev->exts[ext] = true;
214 }
David Pinedo0257fbf2015-02-02 18:02:40 -0700215
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800216 ret = nulldrv_desc_ooxx_create(dev, &dev->desc_ooxx);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600217 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700218 return ret;
219 }
220
221 ret = dev_create_queues(dev, info->pRequestedQueues,
222 info->queueRecordCount);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600223 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700224 return ret;
225 }
226
227 *dev_ret = dev;
228
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600229 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700230}
231
Tony Barbour8205d902015-04-16 15:59:00 -0600232static struct nulldrv_gpu *nulldrv_gpu(VkPhysicalDevice gpu)
David Pinedo0257fbf2015-02-02 18:02:40 -0700233{
234 return (struct nulldrv_gpu *) gpu;
235}
236
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600237static VkResult nulldrv_rt_view_create(struct nulldrv_dev *dev,
Chia-I Wuc278df82015-07-07 11:50:03 +0800238 const VkAttachmentViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700239 struct nulldrv_rt_view **view_ret)
240{
241 struct nulldrv_rt_view *view;
242
243 view = (struct nulldrv_rt_view *) nulldrv_base_create(dev, sizeof(*view),
Chia-I Wuc278df82015-07-07 11:50:03 +0800244 VK_OBJECT_TYPE_ATTACHMENT_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700245 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600246 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700247
248 *view_ret = view;
249
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600250 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700251}
252
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600253static VkResult nulldrv_fence_create(struct nulldrv_dev *dev,
254 const VkFenceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700255 struct nulldrv_fence **fence_ret)
256{
257 struct nulldrv_fence *fence;
258
259 fence = (struct nulldrv_fence *) nulldrv_base_create(dev, sizeof(*fence),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600260 VK_OBJECT_TYPE_FENCE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700261 if (!fence)
Tony Barbour8205d902015-04-16 15:59:00 -0600262 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700263
264 *fence_ret = fence;
265
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600266 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700267}
268
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600269static struct nulldrv_dev *nulldrv_dev(VkDevice dev)
David Pinedo0257fbf2015-02-02 18:02:40 -0700270{
271 return (struct nulldrv_dev *) dev;
272}
273
274static struct nulldrv_img *nulldrv_img_from_base(struct nulldrv_base *base)
275{
276 return (struct nulldrv_img *) base;
277}
278
279
Tony Barbour426b9052015-06-24 16:06:58 -0600280static VkResult img_get_memory_requirements(struct nulldrv_base *base,
281 VkMemoryRequirements *pRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700282{
283 struct nulldrv_img *img = nulldrv_img_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600284 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700285
Tony Barbour426b9052015-06-24 16:06:58 -0600286 pRequirements->size = img->total_size;
287 pRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700288
289 return ret;
290}
291
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600292static VkResult nulldrv_img_create(struct nulldrv_dev *dev,
293 const VkImageCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700294 bool scanout,
295 struct nulldrv_img **img_ret)
296{
297 struct nulldrv_img *img;
298
299 img = (struct nulldrv_img *) nulldrv_base_create(dev, sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600300 VK_OBJECT_TYPE_IMAGE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700301 if (!img)
Tony Barbour8205d902015-04-16 15:59:00 -0600302 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700303
304 img->type = info->imageType;
305 img->depth = info->extent.depth;
306 img->mip_levels = info->mipLevels;
307 img->array_size = info->arraySize;
308 img->usage = info->usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700309 img->samples = info->samples;
310
Tony Barbour426b9052015-06-24 16:06:58 -0600311 img->obj.base.get_memory_requirements = img_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700312
313 *img_ret = img;
314
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600315 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700316}
317
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600318static struct nulldrv_img *nulldrv_img(VkImage image)
David Pinedo0257fbf2015-02-02 18:02:40 -0700319{
Tony Barbourde4124d2015-07-03 10:33:54 -0600320 return *(struct nulldrv_img **) &image;
David Pinedo0257fbf2015-02-02 18:02:40 -0700321}
322
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600323static VkResult nulldrv_mem_alloc(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600324 const VkMemoryAllocInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700325 struct nulldrv_mem **mem_ret)
326{
327 struct nulldrv_mem *mem;
328
329 mem = (struct nulldrv_mem *) nulldrv_base_create(dev, sizeof(*mem),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600330 VK_OBJECT_TYPE_DEVICE_MEMORY);
David Pinedo0257fbf2015-02-02 18:02:40 -0700331 if (!mem)
Tony Barbour8205d902015-04-16 15:59:00 -0600332 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700333
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700334 mem->bo = malloc(info->allocationSize);
David Pinedo0257fbf2015-02-02 18:02:40 -0700335 if (!mem->bo) {
Tony Barbour8205d902015-04-16 15:59:00 -0600336 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700337 }
338
339 mem->size = info->allocationSize;
340
341 *mem_ret = mem;
342
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600343 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700344}
345
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600346static VkResult nulldrv_sampler_create(struct nulldrv_dev *dev,
347 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700348 struct nulldrv_sampler **sampler_ret)
349{
350 struct nulldrv_sampler *sampler;
351
352 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600353 sizeof(*sampler), VK_OBJECT_TYPE_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700354 if (!sampler)
Tony Barbour8205d902015-04-16 15:59:00 -0600355 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700356
357 *sampler_ret = sampler;
358
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600359 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700360}
361
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600362static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
363 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700364 struct nulldrv_img_view **view_ret)
365{
366 struct nulldrv_img *img = nulldrv_img(info->image);
367 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700368
369 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600370 VK_OBJECT_TYPE_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700371 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600372 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700373
374 view->img = img;
David Pinedo0257fbf2015-02-02 18:02:40 -0700375
David Pinedo0257fbf2015-02-02 18:02:40 -0700376 view->cmd_len = 8;
377
378 *view_ret = view;
379
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600380 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700381}
382
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600383static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700384{
385 return mem->bo;
386}
387
Tony Barbour8205d902015-04-16 15:59:00 -0600388static struct nulldrv_mem *nulldrv_mem(VkDeviceMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700389{
Tony Barbourde4124d2015-07-03 10:33:54 -0600390 return *(struct nulldrv_mem **) &mem;
David Pinedo0257fbf2015-02-02 18:02:40 -0700391}
392
393static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
394{
395 return (struct nulldrv_buf *) base;
396}
397
Tony Barbour426b9052015-06-24 16:06:58 -0600398static VkResult buf_get_memory_requirements(struct nulldrv_base *base,
399 VkMemoryRequirements* pMemoryRequirements)
David Pinedo0257fbf2015-02-02 18:02:40 -0700400{
401 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
David Pinedo0257fbf2015-02-02 18:02:40 -0700402
Tony Barbour426b9052015-06-24 16:06:58 -0600403 if (pMemoryRequirements == NULL)
404 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700405
Tony Barbour426b9052015-06-24 16:06:58 -0600406 pMemoryRequirements->size = buf->size;
407 pMemoryRequirements->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700408
Tony Barbour426b9052015-06-24 16:06:58 -0600409 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700410}
411
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600412static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600413 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700414 struct nulldrv_buf **buf_ret)
415{
416 struct nulldrv_buf *buf;
417
418 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600419 VK_OBJECT_TYPE_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700420 if (!buf)
Tony Barbour8205d902015-04-16 15:59:00 -0600421 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700422
423 buf->size = info->size;
424 buf->usage = info->usage;
425
Tony Barbour426b9052015-06-24 16:06:58 -0600426 buf->obj.base.get_memory_requirements = buf_get_memory_requirements;
David Pinedo0257fbf2015-02-02 18:02:40 -0700427
428 *buf_ret = buf;
429
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600430 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700431}
432
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600433static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
434 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700435 struct nulldrv_desc_layout **layout_ret)
436{
437 struct nulldrv_desc_layout *layout;
438
439 layout = (struct nulldrv_desc_layout *)
440 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600441 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700442 if (!layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600443 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700444
445 *layout_ret = layout;
446
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600447 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700448}
449
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500450static VkResult nulldrv_pipeline_layout_create(struct nulldrv_dev *dev,
451 const VkPipelineLayoutCreateInfo* pCreateInfo,
452 struct nulldrv_pipeline_layout **pipeline_layout_ret)
Chia-I Wu7732cb22015-03-26 15:27:55 +0800453{
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500454 struct nulldrv_pipeline_layout *pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800455
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500456 pipeline_layout = (struct nulldrv_pipeline_layout *)
457 nulldrv_base_create(dev, sizeof(*pipeline_layout),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600458 VK_OBJECT_TYPE_PIPELINE_LAYOUT);
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500459 if (!pipeline_layout)
Tony Barbour8205d902015-04-16 15:59:00 -0600460 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800461
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500462 *pipeline_layout_ret = pipeline_layout;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800463
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600464 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800465}
466
Tony Barbour8db65372015-07-10 18:32:33 -0600467static struct nulldrv_desc_layout *nulldrv_desc_layout(const VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700468{
Tony Barbourde4124d2015-07-03 10:33:54 -0600469 return *(struct nulldrv_desc_layout **) &layout;
David Pinedo0257fbf2015-02-02 18:02:40 -0700470}
471
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600472static VkResult shader_create(struct nulldrv_dev *dev,
473 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700474 struct nulldrv_shader **sh_ret)
475{
David Pinedo0257fbf2015-02-02 18:02:40 -0700476 struct nulldrv_shader *sh;
477
478 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600479 VK_OBJECT_TYPE_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700480 if (!sh)
Tony Barbour8205d902015-04-16 15:59:00 -0600481 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700482
483 *sh_ret = sh;
484
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600485 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700486}
487
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600488static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
489 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700490 struct nulldrv_pipeline **pipeline_ret)
491{
492 struct nulldrv_pipeline *pipeline;
493
494 pipeline = (struct nulldrv_pipeline *)
495 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600496 VK_OBJECT_TYPE_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700497 if (!pipeline)
Tony Barbour8205d902015-04-16 15:59:00 -0600498 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700499
500 *pipeline_ret = pipeline;
501
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600502 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700503}
504
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600505static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600506 const VkDynamicViewportStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700507 struct nulldrv_dynamic_vp **state_ret)
508{
509 struct nulldrv_dynamic_vp *state;
510
511 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600512 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_VIEWPORT_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700513 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600514 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700515
516 *state_ret = state;
517
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600518 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700519}
520
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600521static VkResult nulldrv_raster_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600522 const VkDynamicRasterStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700523 struct nulldrv_dynamic_rs **state_ret)
524{
525 struct nulldrv_dynamic_rs *state;
526
527 state = (struct nulldrv_dynamic_rs *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600528 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_RASTER_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700529 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600530 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700531
532 *state_ret = state;
533
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600534 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700535}
536
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600537static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600538 const VkDynamicColorBlendStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700539 struct nulldrv_dynamic_cb **state_ret)
540{
541 struct nulldrv_dynamic_cb *state;
542
543 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600544 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_COLOR_BLEND_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700545 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600546 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700547
548 *state_ret = state;
549
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600550 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700551}
552
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600553static VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600554 const VkDynamicDepthStencilStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700555 struct nulldrv_dynamic_ds **state_ret)
556{
557 struct nulldrv_dynamic_ds *state;
558
559 state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
Tony Barbour2a199c12015-07-09 17:31:46 -0600560 sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700561 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600562 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700563
564 *state_ret = state;
565
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600566 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700567}
568
569
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600570static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
571 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700572 struct nulldrv_cmd **cmd_ret)
573{
David Pinedo0257fbf2015-02-02 18:02:40 -0700574 struct nulldrv_cmd *cmd;
575
David Pinedo0257fbf2015-02-02 18:02:40 -0700576 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600577 VK_OBJECT_TYPE_COMMAND_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700578 if (!cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600579 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700580
581 *cmd_ret = cmd;
582
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600583 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700584}
585
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600586static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
587 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700588 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600589 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800590 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700591{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800592 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700593
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800594 pool = (struct nulldrv_desc_pool *)
595 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600596 VK_OBJECT_TYPE_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800597 if (!pool)
Tony Barbour8205d902015-04-16 15:59:00 -0600598 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700599
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800600 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700601
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800602 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700603
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600604 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700605}
606
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600607static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800608 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600609 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700610 const struct nulldrv_desc_layout *layout,
611 struct nulldrv_desc_set **set_ret)
612{
613 struct nulldrv_desc_set *set;
614
615 set = (struct nulldrv_desc_set *)
616 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600617 VK_OBJECT_TYPE_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700618 if (!set)
Tony Barbour8205d902015-04-16 15:59:00 -0600619 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700620
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800621 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700622 set->layout = layout;
623 *set_ret = set;
624
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600625 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700626}
627
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600628static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700629{
Tony Barbourde4124d2015-07-03 10:33:54 -0600630 return *(struct nulldrv_desc_pool **) &pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700631}
632
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600633static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
634 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700635 struct nulldrv_framebuffer ** fb_ret)
636{
637
638 struct nulldrv_framebuffer *fb;
639 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600640 VK_OBJECT_TYPE_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700641 if (!fb)
Tony Barbour8205d902015-04-16 15:59:00 -0600642 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700643
644 *fb_ret = fb;
645
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600646 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700647
648}
649
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600650static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
651 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700652 struct nulldrv_render_pass** rp_ret)
653{
654 struct nulldrv_render_pass *rp;
655 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600656 VK_OBJECT_TYPE_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700657 if (!rp)
Tony Barbour8205d902015-04-16 15:59:00 -0600658 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700659
660 *rp_ret = rp;
661
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600662 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700663}
664
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600665static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700666{
Tony Barbourde4124d2015-07-03 10:33:54 -0600667 return *(struct nulldrv_buf **) &buf;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700668}
669
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600670static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600671 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700672 struct nulldrv_buf_view **view_ret)
673{
674 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
675 struct nulldrv_buf_view *view;
676
677 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600678 VK_OBJECT_TYPE_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700679 if (!view)
Tony Barbour8205d902015-04-16 15:59:00 -0600680 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700681
682 view->buf = buf;
683
684 *view_ret = view;
685
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600686 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700687}
688
David Pinedo0257fbf2015-02-02 18:02:40 -0700689
690//*********************************************
691// Driver entry points
692//*********************************************
693
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600694ICD_EXPORT VkResult VKAPI vkCreateBuffer(
695 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600696 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600697 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700698{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700699 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700700 struct nulldrv_dev *dev = nulldrv_dev(device);
701
702 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
703}
704
Tony Barbourde4124d2015-07-03 10:33:54 -0600705ICD_EXPORT VkResult VKAPI vkDestroyBuffer(
706 VkDevice device,
707 VkBuffer buffer)
708{
709 NULLDRV_LOG_FUNC;
710 return VK_SUCCESS;
711}
712
Cody Northropf02f9f82015-07-09 18:08:05 -0600713ICD_EXPORT VkResult VKAPI vkCreateCommandPool(
714 VkDevice device,
715 const VkCmdPoolCreateInfo* pCreateInfo,
716 VkCmdPool* pCmdPool)
717{
718 NULLDRV_LOG_FUNC;
719 return VK_SUCCESS;
720}
721
722ICD_EXPORT VkResult VKAPI vkDestroyCommandPool(
723 VkDevice device,
724 VkCmdPool cmdPool)
725{
726 NULLDRV_LOG_FUNC;
727 return VK_SUCCESS;
728}
729
730ICD_EXPORT VkResult VKAPI vkResetCommandPool(
731 VkDevice device,
732 VkCmdPool cmdPool,
733 VkCmdPoolResetFlags flags)
734{
735 NULLDRV_LOG_FUNC;
736 return VK_SUCCESS;
737}
738
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600739ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
740 VkDevice device,
741 const VkCmdBufferCreateInfo* pCreateInfo,
742 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700743{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700744 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700745 struct nulldrv_dev *dev = nulldrv_dev(device);
746
747 return nulldrv_cmd_create(dev, pCreateInfo,
748 (struct nulldrv_cmd **) pCmdBuffer);
749}
750
Tony Barbourde4124d2015-07-03 10:33:54 -0600751ICD_EXPORT VkResult VKAPI vkDestroyCommandBuffer(
752 VkDevice device,
753 VkCmdBuffer cmdBuffer)
754{
755 NULLDRV_LOG_FUNC;
756 return VK_SUCCESS;
757}
758
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600759ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
760 VkCmdBuffer cmdBuffer,
761 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700762{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700763 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600764 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700765}
766
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600767ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
768 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700769{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700770 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600771 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700772}
773
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600774ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
Cody Northropf02f9f82015-07-09 18:08:05 -0600775 VkCmdBuffer cmdBuffer,
776 VkCmdBufferResetFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700777{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700778 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600779 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700780}
781
Ian Elliott64a68e12015-04-16 11:57:46 -0600782static const VkFormat nulldrv_presentable_formats[] = {
783 VK_FORMAT_B8G8R8A8_UNORM,
784};
785
Jon Ashburnba4a1952015-06-16 12:44:51 -0600786#if 0
Ian Elliott64a68e12015-04-16 11:57:46 -0600787ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
788 VkDisplayWSI display,
789 VkDisplayInfoTypeWSI infoType,
790 size_t* pDataSize,
791 void* pData)
792{
793 VkResult ret = VK_SUCCESS;
794
795 NULLDRV_LOG_FUNC;
796
797 if (!pDataSize)
798 return VK_ERROR_INVALID_POINTER;
799
800 switch (infoType) {
801 case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
802 {
803 VkDisplayFormatPropertiesWSI *dst = pData;
804 size_t size_ret;
805 uint32_t i;
806
807 size_ret = sizeof(*dst) * ARRAY_SIZE(nulldrv_presentable_formats);
808
809 if (dst && *pDataSize < size_ret)
810 return VK_ERROR_INVALID_VALUE;
811
812 *pDataSize = size_ret;
813 if (!dst)
814 return VK_SUCCESS;
815
816 for (i = 0; i < ARRAY_SIZE(nulldrv_presentable_formats); i++)
817 dst[i].swapChainFormat = nulldrv_presentable_formats[i];
818 }
819 break;
820 default:
821 ret = VK_ERROR_INVALID_VALUE;
822 break;
823 }
824
825 return ret;
826}
Jon Ashburnba4a1952015-06-16 12:44:51 -0600827#endif
Ian Elliott64a68e12015-04-16 11:57:46 -0600828
829ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
830 VkDevice device,
831 const VkSwapChainCreateInfoWSI* pCreateInfo,
832 VkSwapChainWSI* pSwapChain)
833{
834 NULLDRV_LOG_FUNC;
835 struct nulldrv_dev *dev = nulldrv_dev(device);
836 struct nulldrv_swap_chain *sc;
837
838 sc = (struct nulldrv_swap_chain *) nulldrv_base_create(dev, sizeof(*sc),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600839 VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
Ian Elliott64a68e12015-04-16 11:57:46 -0600840 if (!sc) {
841 return VK_ERROR_OUT_OF_HOST_MEMORY;
842 }
843 sc->dev = dev;
844
Tony Barbour11e76ac2015-04-20 16:28:46 -0600845 *pSwapChain = (VkSwapChainWSI) sc;
Ian Elliott64a68e12015-04-16 11:57:46 -0600846
847 return VK_SUCCESS;
848}
849
850ICD_EXPORT VkResult VKAPI vkDestroySwapChainWSI(
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600851 VkDevice device,
Ian Elliott64a68e12015-04-16 11:57:46 -0600852 VkSwapChainWSI swapChain)
853{
854 NULLDRV_LOG_FUNC;
855 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
856
857 free(sc);
858
859 return VK_SUCCESS;
860}
861
862ICD_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600863 VkDevice device,
Ian Elliott64a68e12015-04-16 11:57:46 -0600864 VkSwapChainWSI swapChain,
865 VkSwapChainInfoTypeWSI infoType,
866 size_t* pDataSize,
867 void* pData)
868{
869 NULLDRV_LOG_FUNC;
870 struct nulldrv_swap_chain *sc = (struct nulldrv_swap_chain *) swapChain;
871 struct nulldrv_dev *dev = sc->dev;
872 VkResult ret = VK_SUCCESS;
873
874 if (!pDataSize)
875 return VK_ERROR_INVALID_POINTER;
876
877 switch (infoType) {
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600878 case VK_SWAP_CHAIN_INFO_TYPE_IMAGES_WSI:
879 *pDataSize = (sizeof(VkSwapChainImagePropertiesWSI) * 2);
880 if (pData) {
881 VkSwapChainImagePropertiesWSI *images =
882 (VkSwapChainImagePropertiesWSI *) pData;
Ian Elliott64a68e12015-04-16 11:57:46 -0600883 uint32_t i;
884
Ian Elliott64a68e12015-04-16 11:57:46 -0600885 for (i = 0; i < 2; i++) {
886 struct nulldrv_img *img;
Ian Elliott64a68e12015-04-16 11:57:46 -0600887
888 img = (struct nulldrv_img *) nulldrv_base_create(dev,
889 sizeof(*img),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600890 VK_OBJECT_TYPE_IMAGE);
Ian Elliott64a68e12015-04-16 11:57:46 -0600891 if (!img)
892 return VK_ERROR_OUT_OF_HOST_MEMORY;
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600893 images[i].image = (VkImage) img;
Ian Elliott64a68e12015-04-16 11:57:46 -0600894 }
895 }
896 break;
897 default:
898 ret = VK_ERROR_INVALID_VALUE;
899 break;
900 }
901
902 return ret;
903}
904
905ICD_EXPORT VkResult VKAPI vkQueuePresentWSI(
Ian Elliott53bd3dc2015-07-06 14:29:31 -0600906 VkQueue queue_,
907 VkPresentInfoWSI* pPresentInfo)
Ian Elliott64a68e12015-04-16 11:57:46 -0600908{
909 NULLDRV_LOG_FUNC;
910
911 return VK_SUCCESS;
912}
913
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600914ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600915 VkCmdBuffer cmdBuffer,
916 VkBuffer srcBuffer,
917 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700918 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600919 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700920{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700921 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700922}
923
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600924ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600925 VkCmdBuffer cmdBuffer,
926 VkImage srcImage,
927 VkImageLayout srcImageLayout,
928 VkImage destImage,
929 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700930 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600931 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700932{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700933 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700934}
935
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600936ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600937 VkCmdBuffer cmdBuffer,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500938 VkImage srcImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600939 VkImageLayout srcImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500940 VkImage destImage,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600941 VkImageLayout destImageLayout,
Mark Lobodzinski20f68592015-05-22 14:43:25 -0500942 uint32_t regionCount,
943 const VkImageBlit* pRegions,
944 VkTexFilter filter)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600945{
946 NULLDRV_LOG_FUNC;
947}
948
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600949ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600950 VkCmdBuffer cmdBuffer,
951 VkBuffer srcBuffer,
952 VkImage destImage,
953 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700954 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600955 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700956{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700957 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700958}
959
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600960ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600961 VkCmdBuffer cmdBuffer,
962 VkImage srcImage,
963 VkImageLayout srcImageLayout,
964 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700965 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600966 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700967{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700968 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700969}
970
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600971ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600972 VkCmdBuffer cmdBuffer,
973 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600974 VkDeviceSize destOffset,
975 VkDeviceSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700976 const uint32_t* pData)
977{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700978 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700979}
980
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600981ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600982 VkCmdBuffer cmdBuffer,
983 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -0600984 VkDeviceSize destOffset,
985 VkDeviceSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700986 uint32_t data)
987{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700988 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700989}
990
Ian Elliotte924ab22015-07-08 13:24:30 -0600991ICD_EXPORT void VKAPI vkCmdClearDepthStencilImage(
992 VkCmdBuffer cmdBuffer,
993 VkImage image,
994 VkImageLayout imageLayout,
995 float depth,
996 uint32_t stencil,
997 uint32_t rangeCount,
998 const VkImageSubresourceRange* pRanges)
999{
1000 NULLDRV_LOG_FUNC;
1001}
1002
1003ICD_EXPORT void VKAPI vkCmdClearColorAttachment(
1004 VkCmdBuffer cmdBuffer,
1005 uint32_t colorAttachment,
1006 VkImageLayout imageLayout,
1007 const VkClearColorValue *pColor,
1008 uint32_t rectCount,
1009 const VkRect3D *pRects)
1010{
1011 NULLDRV_LOG_FUNC;
1012}
1013
1014ICD_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(
1015 VkCmdBuffer cmdBuffer,
1016 VkImageAspectFlags imageAspectMask,
1017 VkImageLayout imageLayout,
1018 float depth,
1019 uint32_t stencil,
1020 uint32_t rectCount,
1021 const VkRect3D *pRects)
1022{
1023 NULLDRV_LOG_FUNC;
1024}
1025
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001026ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001027 VkCmdBuffer cmdBuffer,
1028 VkImage image,
1029 VkImageLayout imageLayout,
Chris Forbese3105972015-06-24 14:34:53 +12001030 const VkClearColorValue *pColor,
Courtney Goeltzenleuchterda4a99e2015-04-23 17:49:22 -06001031 uint32_t rangeCount,
1032 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001033{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001034 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001035}
1036
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001037ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001038 VkCmdBuffer cmdBuffer,
1039 VkImage image,
1040 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -07001041 float depth,
1042 uint32_t stencil,
1043 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001044 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -07001045{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001046 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001047}
1048
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001049ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001050 VkCmdBuffer cmdBuffer,
1051 VkImage srcImage,
1052 VkImageLayout srcImageLayout,
1053 VkImage destImage,
1054 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -06001055 uint32_t regionCount,
1056 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -07001057{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001058 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001059}
1060
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001061ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001062 VkCmdBuffer cmdBuffer,
1063 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001064 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001065 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001066{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001067 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001068}
1069
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001070ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001071 VkCmdBuffer cmdBuffer,
1072 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001073 uint32_t slot)
1074{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001075 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001076}
1077
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001078ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001079 VkCmdBuffer cmdBuffer,
1080 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001081 uint32_t startQuery,
1082 uint32_t queryCount)
1083{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001084 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001085}
1086
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001087ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001088 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001089 VkEvent event_,
1090 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001091{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001092 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001093}
1094
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001095ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001096 VkCmdBuffer cmdBuffer,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001097 VkEvent event_,
1098 VkPipelineStageFlags stageMask)
David Pinedo0257fbf2015-02-02 18:02:40 -07001099{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001100 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001101}
1102
Ian Elliott63f1edb2015-04-16 18:10:19 -06001103ICD_EXPORT void VKAPI vkCmdCopyQueryPoolResults(
1104 VkCmdBuffer cmdBuffer,
1105 VkQueryPool queryPool,
1106 uint32_t startQuery,
1107 uint32_t queryCount,
1108 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001109 VkDeviceSize destOffset,
1110 VkDeviceSize destStride,
Ian Elliott63f1edb2015-04-16 18:10:19 -06001111 VkFlags flags)
1112{
1113 NULLDRV_LOG_FUNC;
1114}
1115
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001116ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001117 VkCmdBuffer cmdBuffer,
1118 VkTimestampType timestampType,
1119 VkBuffer destBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001120 VkDeviceSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001121{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001122 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001123}
1124
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001125ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001126 VkCmdBuffer cmdBuffer,
Tony Barbourde4124d2015-07-03 10:33:54 -06001127 VkPipelineBindPoint pipelineBindPoint,
1128 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001129{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001130 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001131}
1132
Tony Barbourde4124d2015-07-03 10:33:54 -06001133ICD_EXPORT void VKAPI vkCmdBindDynamicViewportState(
1134 VkCmdBuffer cmdBuffer,
1135 VkDynamicViewportState state)
1136{
1137 NULLDRV_LOG_FUNC;
1138}
1139
1140ICD_EXPORT void VKAPI vkCmdBindDynamicRasterState(
1141 VkCmdBuffer cmdBuffer,
1142 VkDynamicRasterState state)
1143{
1144 NULLDRV_LOG_FUNC;
1145}
1146
1147ICD_EXPORT void VKAPI vkCmdBindDynamicColorBlendState(
1148 VkCmdBuffer cmdBuffer,
1149 VkDynamicColorBlendState state)
1150{
1151 NULLDRV_LOG_FUNC;
1152}
1153
1154ICD_EXPORT void VKAPI vkCmdBindDynamicDepthStencilState(
1155 VkCmdBuffer cmdBuffer,
1156 VkDynamicDepthStencilState state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001157{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001158 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001159}
1160
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001161ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001162 VkCmdBuffer cmdBuffer,
1163 VkPipelineBindPoint pipelineBindPoint,
Mark Lobodzinskia65c4632015-06-15 13:21:21 -06001164 VkPipelineLayout layout,
Cody Northrop1a01b1d2015-04-16 13:41:56 -06001165 uint32_t firstSet,
1166 uint32_t setCount,
1167 const VkDescriptorSet* pDescriptorSets,
1168 uint32_t dynamicOffsetCount,
1169 const uint32_t* pDynamicOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001170{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001171 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001172}
1173
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001174ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1175 VkCmdBuffer cmdBuffer,
1176 uint32_t startBinding,
1177 uint32_t bindingCount,
1178 const VkBuffer* pBuffers,
Tony Barbour8205d902015-04-16 15:59:00 -06001179 const VkDeviceSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001180{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001181 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001182}
1183
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001184ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001185 VkCmdBuffer cmdBuffer,
1186 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001187 VkDeviceSize offset,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001188 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001189{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001190 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001191}
1192
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001193ICD_EXPORT void VKAPI vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001194 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001195 uint32_t firstVertex,
1196 uint32_t vertexCount,
1197 uint32_t firstInstance,
1198 uint32_t instanceCount)
1199{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001200 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001201}
1202
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001203ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001204 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001205 uint32_t firstIndex,
1206 uint32_t indexCount,
1207 int32_t vertexOffset,
1208 uint32_t firstInstance,
1209 uint32_t instanceCount)
1210{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001211 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001212}
1213
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001214ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001215 VkCmdBuffer cmdBuffer,
1216 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001217 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001218 uint32_t count,
1219 uint32_t stride)
1220{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001221 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001222}
1223
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001224ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001225 VkCmdBuffer cmdBuffer,
1226 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001227 VkDeviceSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001228 uint32_t count,
1229 uint32_t stride)
1230{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001231 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001232}
1233
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001234ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001235 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001236 uint32_t x,
1237 uint32_t y,
1238 uint32_t z)
1239{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001240 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001241}
1242
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001243ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001244 VkCmdBuffer cmdBuffer,
1245 VkBuffer buffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001246 VkDeviceSize offset)
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
Tony Barbour8205d902015-04-16 15:59:00 -06001251void VKAPI vkCmdWaitEvents(
1252 VkCmdBuffer cmdBuffer,
Tony Barbour8205d902015-04-16 15:59:00 -06001253 uint32_t eventCount,
1254 const VkEvent* pEvents,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001255 VkPipelineStageFlags sourceStageMask,
1256 VkPipelineStageFlags destStageMask,
Tony Barbour8205d902015-04-16 15:59:00 -06001257 uint32_t memBarrierCount,
Courtney Goeltzenleuchterd9ba3422015-07-12 12:58:58 -06001258 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001259{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001260 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001261}
1262
Tony Barbour8205d902015-04-16 15:59:00 -06001263void VKAPI vkCmdPipelineBarrier(
1264 VkCmdBuffer cmdBuffer,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001265 VkPipelineStageFlags srcStageMask,
Tony Barbourc2e987e2015-06-29 16:20:35 -06001266 VkPipelineStageFlags destStageMask,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001267 VkBool32 byRegion,
Tony Barbour8205d902015-04-16 15:59:00 -06001268 uint32_t memBarrierCount,
Courtney Goeltzenleuchter82b348f2015-07-12 13:07:46 -06001269 const void* const* ppMemBarriers)
David Pinedo0257fbf2015-02-02 18:02:40 -07001270{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001271 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001272}
1273
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001274ICD_EXPORT VkResult VKAPI vkCreateDevice(
Tony Barbour8205d902015-04-16 15:59:00 -06001275 VkPhysicalDevice gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001276 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001277 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001278{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001279 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001280 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1281 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1282}
1283
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001284ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1285 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001286{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001287 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001288 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001289}
1290
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001291ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1292 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001293 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001294 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001295 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001296{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001297 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001298 struct nulldrv_dev *dev = nulldrv_dev(device);
Mike Stroyan230e6252015-04-17 12:36:38 -06001299 *pQueue = (VkQueue) dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001300 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001301}
1302
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001303ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1304 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001305{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001306 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001307 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001308}
1309
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001310ICD_EXPORT VkResult VKAPI vkCreateEvent(
1311 VkDevice device,
1312 const VkEventCreateInfo* pCreateInfo,
1313 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001314{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001315 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001316 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001317}
1318
Tony Barbourde4124d2015-07-03 10:33:54 -06001319ICD_EXPORT VkResult VKAPI vkDestroyEvent(
1320 VkDevice device,
1321 VkEvent event)
1322{
1323 NULLDRV_LOG_FUNC;
1324 return VK_SUCCESS;
1325}
1326
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001327ICD_EXPORT VkResult VKAPI vkGetEventStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001328 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001329 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001330{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001331 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001332 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001333}
1334
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001335ICD_EXPORT VkResult VKAPI vkSetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001336 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001337 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001338{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001339 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001340 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001341}
1342
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001343ICD_EXPORT VkResult VKAPI vkResetEvent(
Mike Stroyan230e6252015-04-17 12:36:38 -06001344 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001345 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001346{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001347 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001348 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001349}
1350
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001351ICD_EXPORT VkResult VKAPI vkCreateFence(
1352 VkDevice device,
1353 const VkFenceCreateInfo* pCreateInfo,
1354 VkFence* pFence)
David Pinedo0257fbf2015-02-02 18:02:40 -07001355{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001356 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001357 struct nulldrv_dev *dev = nulldrv_dev(device);
1358
1359 return nulldrv_fence_create(dev, pCreateInfo,
1360 (struct nulldrv_fence **) pFence);
1361}
1362
Tony Barbourde4124d2015-07-03 10:33:54 -06001363ICD_EXPORT VkResult VKAPI vkDestroyFence(
1364 VkDevice device,
1365 VkFence fence)
1366{
1367 NULLDRV_LOG_FUNC;
1368 return VK_SUCCESS;
1369}
1370
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001371ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
Mike Stroyan230e6252015-04-17 12:36:38 -06001372 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001373 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001374{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001375 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001376 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001377}
1378
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001379ICD_EXPORT VkResult VKAPI vkResetFences(
Courtney Goeltzenleuchterf2e33ad2015-06-18 17:28:20 -06001380 VkDevice device,
1381 uint32_t fenceCount,
1382 const VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001383{
1384 NULLDRV_LOG_FUNC;
1385 return VK_SUCCESS;
1386}
1387
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001388ICD_EXPORT VkResult VKAPI vkWaitForFences(
1389 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001390 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001391 const VkFence* pFences,
Courtney Goeltzenleuchter1f41f542015-07-09 11:44:38 -06001392 VkBool32 waitAll,
David Pinedo0257fbf2015-02-02 18:02:40 -07001393 uint64_t timeout)
1394{
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
Tony Barbour426b9052015-06-24 16:06:58 -06001399ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceProperties(
1400 VkPhysicalDevice gpu_,
1401 VkPhysicalDeviceProperties* pProperties)
David Pinedo0257fbf2015-02-02 18:02:40 -07001402{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001403 NULLDRV_LOG_FUNC;
Ian Elliott64a68e12015-04-16 11:57:46 -06001404 VkResult ret = VK_SUCCESS;
1405
Tony Barbour426b9052015-06-24 16:06:58 -06001406 pProperties->apiVersion = VK_API_VERSION;
1407 pProperties->driverVersion = 0; // Appropriate that the nulldrv have 0's
1408 pProperties->vendorId = 0;
1409 pProperties->deviceId = 0;
1410 pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
1411 strncpy(pProperties->deviceName, "nulldrv", strlen("nulldrv"));
Ian Elliott64a68e12015-04-16 11:57:46 -06001412
1413 return ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001414}
1415
Chris Forbesd7576302015-06-21 22:55:02 +12001416ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(
1417 VkPhysicalDevice physicalDevice,
1418 VkPhysicalDeviceFeatures* pFeatures)
1419{
1420 NULLDRV_LOG_FUNC;
1421 VkResult ret = VK_SUCCESS;
1422
1423 /* TODO: fill out features */
1424 memset(pFeatures, 0, sizeof(*pFeatures));
1425
1426 return ret;
1427}
1428
Courtney Goeltzenleuchter4da96aa2015-07-12 12:52:09 -06001429ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceFormatProperties(
Chris Forbesd7576302015-06-21 22:55:02 +12001430 VkPhysicalDevice physicalDevice,
1431 VkFormat format,
1432 VkFormatProperties* pFormatInfo)
1433{
1434 NULLDRV_LOG_FUNC;
1435 VkResult ret = VK_SUCCESS;
1436
1437 pFormatInfo->linearTilingFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
1438 pFormatInfo->optimalTilingFeatures = pFormatInfo->linearTilingFeatures;
1439
1440 return ret;
1441}
1442
1443ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLimits(
1444 VkPhysicalDevice physicalDevice,
1445 VkPhysicalDeviceLimits* pLimits)
1446{
1447 NULLDRV_LOG_FUNC;
1448 VkResult ret = VK_SUCCESS;
1449
1450 /* TODO: fill out limits */
1451 memset(pLimits, 0, sizeof(*pLimits));
1452
1453 return ret;
1454}
1455
Tony Barbour426b9052015-06-24 16:06:58 -06001456ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueCount(
1457 VkPhysicalDevice gpu_,
1458 uint32_t* pCount)
David Pinedo0257fbf2015-02-02 18:02:40 -07001459{
Tony Barbour426b9052015-06-24 16:06:58 -06001460 *pCount = 1;
1461 return VK_SUCCESS;
1462}
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001463
Tony Barbour426b9052015-06-24 16:06:58 -06001464ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceQueueProperties(
1465 VkPhysicalDevice gpu_,
1466 uint32_t count,
1467 VkPhysicalDeviceQueueProperties* pProperties)
1468 {
1469 pProperties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
1470 pProperties->queueCount = 1;
Tony Barbour426b9052015-06-24 16:06:58 -06001471 pProperties->supportsTimestamps = false;
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001472
Tony Barbour426b9052015-06-24 16:06:58 -06001473 return VK_SUCCESS;
1474}
1475
Ian Elliotte924ab22015-07-08 13:24:30 -06001476ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(
1477 VkPhysicalDevice gpu_,
1478 VkPhysicalDeviceMemoryProperties* pProperties)
1479{
1480 // TODO: Fill in with real data
1481 return VK_SUCCESS;
1482}
1483
1484ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceLayerProperties(
1485 VkPhysicalDevice physicalDevice,
1486 uint32_t* pCount,
1487 VkLayerProperties* pProperties)
1488{
1489 // TODO: Fill in with real data
1490 return VK_SUCCESS;
1491}
1492
Tony Barbour426b9052015-06-24 16:06:58 -06001493ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001494 const char* pLayerName,
1495 uint32_t* pCount,
1496 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001497{
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001498 uint32_t copy_size;
Tony Barbour426b9052015-06-24 16:06:58 -06001499
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001500 if (pCount == NULL) {
1501 return VK_ERROR_INVALID_POINTER;
1502 }
Tony Barbour426b9052015-06-24 16:06:58 -06001503
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001504 if (pProperties == NULL) {
1505 *pCount = NULLDRV_EXT_COUNT;
1506 return VK_SUCCESS;
1507 }
Tony Barbour426b9052015-06-24 16:06:58 -06001508
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001509 copy_size = *pCount < NULLDRV_EXT_COUNT ? *pCount : NULLDRV_EXT_COUNT;
1510 memcpy(pProperties, intel_gpu_exts, copy_size * sizeof(VkExtensionProperties));
1511 *pCount = copy_size;
1512 if (copy_size < NULLDRV_EXT_COUNT) {
1513 return VK_INCOMPLETE;
1514 }
Tony Barbour426b9052015-06-24 16:06:58 -06001515 return VK_SUCCESS;
1516}
Ian Elliotte924ab22015-07-08 13:24:30 -06001517ICD_EXPORT VkResult VKAPI vkGetGlobalLayerProperties(
1518 uint32_t* pCount,
1519 VkLayerProperties* pProperties)
1520{
1521 // TODO: Fill in with real data
1522 return VK_SUCCESS;
1523}
Tony Barbour426b9052015-06-24 16:06:58 -06001524
1525VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001526 VkPhysicalDevice physicalDevice,
1527 const char* pLayerName,
1528 uint32_t* pCount,
1529 VkExtensionProperties* pProperties)
Tony Barbour426b9052015-06-24 16:06:58 -06001530{
Tony Barbour426b9052015-06-24 16:06:58 -06001531
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001532 if (pCount == NULL) {
1533 return VK_ERROR_INVALID_POINTER;
1534 }
1535
Tony Barbour426b9052015-06-24 16:06:58 -06001536 *pCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -06001537
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001538 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001539}
1540
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001541ICD_EXPORT VkResult VKAPI vkCreateImage(
1542 VkDevice device,
1543 const VkImageCreateInfo* pCreateInfo,
1544 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001545{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001546 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001547 struct nulldrv_dev *dev = nulldrv_dev(device);
1548
1549 return nulldrv_img_create(dev, pCreateInfo, false,
1550 (struct nulldrv_img **) pImage);
1551}
1552
Tony Barbourde4124d2015-07-03 10:33:54 -06001553ICD_EXPORT VkResult VKAPI vkDestroyImage(
1554 VkDevice device,
1555 VkImage image)
1556{
1557 NULLDRV_LOG_FUNC;
1558 return VK_SUCCESS;
1559}
1560
Tony Barbour426b9052015-06-24 16:06:58 -06001561ICD_EXPORT VkResult VKAPI vkGetImageSubresourceLayout(
Mike Stroyan230e6252015-04-17 12:36:38 -06001562 VkDevice device,
1563 VkImage image,
1564 const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -06001565 VkSubresourceLayout* pLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001566{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001567 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001568
Tony Barbour426b9052015-06-24 16:06:58 -06001569 pLayout->offset = 0;
1570 pLayout->size = 1;
1571 pLayout->rowPitch = 4;
1572 pLayout->depthPitch = 4;
David Pinedo0257fbf2015-02-02 18:02:40 -07001573
Tony Barbour426b9052015-06-24 16:06:58 -06001574 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001575}
1576
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001577ICD_EXPORT VkResult VKAPI vkAllocMemory(
1578 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001579 const VkMemoryAllocInfo* pAllocInfo,
Tony Barbour8205d902015-04-16 15:59:00 -06001580 VkDeviceMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001581{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001582 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001583 struct nulldrv_dev *dev = nulldrv_dev(device);
1584
1585 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1586}
1587
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001588ICD_EXPORT VkResult VKAPI vkFreeMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001589 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001590 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001591{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001592 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001593 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001594}
1595
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001596ICD_EXPORT VkResult VKAPI vkMapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001597 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001598 VkDeviceMemory mem_,
Tony Barbour3e3420a2015-04-16 19:09:28 -06001599 VkDeviceSize offset,
1600 VkDeviceSize size,
1601 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001602 void** ppData)
1603{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001604 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001605 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1606 void *ptr = nulldrv_mem_map(mem, flags);
1607
1608 *ppData = ptr;
1609
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001610 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001611}
1612
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001613ICD_EXPORT VkResult VKAPI vkUnmapMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001614 VkDevice device,
Tony Barbour8205d902015-04-16 15:59:00 -06001615 VkDeviceMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001616{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001617 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001618 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001619}
1620
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001621ICD_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(
Mike Stroyan230e6252015-04-17 12:36:38 -06001622 VkDevice device,
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -06001623 uint32_t memRangeCount,
1624 const VkMappedMemoryRange* pMemRanges)
1625{
1626 NULLDRV_LOG_FUNC;
1627 return VK_SUCCESS;
1628}
1629
1630ICD_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(
1631 VkDevice device,
1632 uint32_t memRangeCount,
1633 const VkMappedMemoryRange* pMemRanges)
Ian Elliott07de9232015-04-17 10:04:00 -06001634{
1635 NULLDRV_LOG_FUNC;
1636 return VK_SUCCESS;
1637}
1638
Courtney Goeltzenleuchterd040c5c2015-07-09 21:57:28 -06001639ICD_EXPORT VkResult VKAPI vkGetDeviceMemoryCommitment(
1640 VkDevice device,
1641 VkDeviceMemory memory,
1642 VkDeviceSize* pCommittedMemoryInBytes)
1643{
1644 return VK_SUCCESS;
1645}
1646
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001647ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001648 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001649 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001650{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001651 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001652 struct nulldrv_instance *inst;
1653
1654 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -06001655 VK_OBJECT_TYPE_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001656 if (!inst)
Tony Barbour8205d902015-04-16 15:59:00 -06001657 return VK_ERROR_OUT_OF_HOST_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001658
Tony Barbour426b9052015-06-24 16:06:58 -06001659 inst->obj.base.get_memory_requirements = NULL;
David Pinedo0257fbf2015-02-02 18:02:40 -07001660
Mike Stroyan230e6252015-04-17 12:36:38 -06001661 *pInstance = (VkInstance) inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001662
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001663 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001664}
1665
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001666ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1667 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001668{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001669 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001670 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001671}
1672
Tony Barbour8205d902015-04-16 15:59:00 -06001673ICD_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001674 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001675 uint32_t* pGpuCount,
Tony Barbour8205d902015-04-16 15:59:00 -06001676 VkPhysicalDevice* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001677{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001678 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001679 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001680 struct nulldrv_gpu *gpu;
1681 *pGpuCount = 1;
1682 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
David Pinedof6768452015-04-21 14:44:02 -06001683 if (ret == VK_SUCCESS && pGpus)
Tony Barbour8205d902015-04-16 15:59:00 -06001684 pGpus[0] = (VkPhysicalDevice) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001685 return ret;
1686}
1687
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001688ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
Tony Barbour8205d902015-04-16 15:59:00 -06001689 VkPhysicalDevice gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001690 size_t maxStringSize,
Courtney Goeltzenleuchterbb1f3602015-04-20 11:04:54 -06001691 size_t* pLayerCount,
David Pinedo0257fbf2015-02-02 18:02:40 -07001692 char* const* pOutLayers,
1693 void* pReserved)
1694{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001695 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001696 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001697}
1698
Tony Barbourde4124d2015-07-03 10:33:54 -06001699ICD_EXPORT VkResult VKAPI vkGetBufferMemoryRequirements(
1700 VkDevice device,
1701 VkBuffer buffer,
1702 VkMemoryRequirements* pMemoryRequirements)
1703{
1704 NULLDRV_LOG_FUNC;
1705 struct nulldrv_base *base = nulldrv_base((void*)buffer.handle);
1706
1707 return base->get_memory_requirements(base, pMemoryRequirements);
1708}
1709
1710ICD_EXPORT VkResult VKAPI vkGetImageMemoryRequirements(
1711 VkDevice device,
1712 VkImage image,
1713 VkMemoryRequirements* pMemoryRequirements)
1714{
1715 NULLDRV_LOG_FUNC;
1716 struct nulldrv_base *base = nulldrv_base((void*)image.handle);
1717
1718 return base->get_memory_requirements(base, pMemoryRequirements);
1719}
1720
1721ICD_EXPORT VkResult VKAPI vkBindBufferMemory(
1722 VkDevice device,
1723 VkBuffer buffer,
1724 VkDeviceMemory mem_,
1725 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001726{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001727 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001728 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001729}
1730
Tony Barbourde4124d2015-07-03 10:33:54 -06001731ICD_EXPORT VkResult VKAPI vkBindImageMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001732 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06001733 VkImage image,
Tony Barbour8205d902015-04-16 15:59:00 -06001734 VkDeviceMemory mem_,
1735 VkDeviceSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001736{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001737 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001738 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001739}
1740
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001741ICD_EXPORT VkResult VKAPI vkGetImageSparseMemoryRequirements(
1742 VkDevice device,
1743 VkImage image,
1744 uint32_t* pNumRequirements,
1745 VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
1746{
1747 NULLDRV_LOG_FUNC;
1748 return VK_SUCCESS;
1749}
1750
1751ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceSparseImageFormatProperties(
1752 VkPhysicalDevice physicalDevice,
1753 VkFormat format,
1754 VkImageType type,
1755 uint32_t samples,
1756 VkImageUsageFlags usage,
1757 VkImageTiling tiling,
1758 uint32_t* pNumProperties,
1759 VkSparseImageFormatProperties* pProperties)
1760{
1761 NULLDRV_LOG_FUNC;
1762 return VK_SUCCESS;
1763}
1764
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001765ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
Mike Stroyan230e6252015-04-17 12:36:38 -06001766 VkQueue queue,
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001767 VkBuffer buffer,
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001768 uint32_t numBindings,
1769 const VkSparseMemoryBindInfo* pBindInfo)
1770{
1771 NULLDRV_LOG_FUNC;
1772 return VK_SUCCESS;
1773}
1774
1775ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageOpaqueMemory(
1776 VkQueue queue,
1777 VkImage image,
1778 uint32_t numBindings,
1779 const VkSparseMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001780{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001781 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001782 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001783}
1784
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -05001785ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
Mark Lobodzinski83d4e6a2015-07-03 15:58:09 -06001786 VkQueue queue,
1787 VkImage image,
1788 uint32_t numBindings,
1789 const VkSparseImageMemoryBindInfo* pBindInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001790{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001791 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001792 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001793}
Jon Ashburn0e249962015-07-10 09:41:15 -07001794ICD_EXPORT VkResult VKAPI vkCreatePipelineCache(
1795 VkDevice device,
1796 const VkPipelineCacheCreateInfo* pCreateInfo,
1797 VkPipelineCache* pPipelineCache)
1798{
David Pinedo0257fbf2015-02-02 18:02:40 -07001799
Jon Ashburn0e249962015-07-10 09:41:15 -07001800 NULLDRV_LOG_FUNC;
1801 return VK_SUCCESS;
1802}
1803
Tony Barbourde4124d2015-07-03 10:33:54 -06001804ICD_EXPORT VkResult VKAPI vkDestroyPipeline(
1805 VkDevice device,
1806 VkPipeline pipeline)
1807{
1808 NULLDRV_LOG_FUNC;
1809 return VK_SUCCESS;
1810}
1811
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06001812VkResult VKAPI vkDestroyPipelineCache(
1813 VkDevice device,
1814 VkPipelineCache pipelineCache)
Jon Ashburn0e249962015-07-10 09:41:15 -07001815{
1816 NULLDRV_LOG_FUNC;
1817 return VK_SUCCESS;
1818}
1819
1820ICD_EXPORT size_t VKAPI vkGetPipelineCacheSize(
1821 VkDevice device,
1822 VkPipelineCache pipelineCache)
1823{
1824 NULLDRV_LOG_FUNC;
1825 return VK_ERROR_UNAVAILABLE;
1826}
1827
1828ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
1829 VkDevice device,
1830 VkPipelineCache pipelineCache,
1831 void* pData)
1832{
1833 NULLDRV_LOG_FUNC;
1834 return VK_ERROR_UNAVAILABLE;
1835}
1836
1837ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
1838 VkDevice device,
1839 VkPipelineCache destCache,
1840 uint32_t srcCacheCount,
1841 const VkPipelineCache* pSrcCaches)
1842{
1843 NULLDRV_LOG_FUNC;
1844 return VK_ERROR_UNAVAILABLE;
1845}
1846ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001847 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001848 VkPipelineCache pipelineCache,
1849 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001850 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1851 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001852{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001853 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001854 struct nulldrv_dev *dev = nulldrv_dev(device);
1855
1856 return graphics_pipeline_create(dev, pCreateInfo,
1857 (struct nulldrv_pipeline **) pPipeline);
1858}
1859
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001860
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001861
Jon Ashburn0e249962015-07-10 09:41:15 -07001862ICD_EXPORT VkResult VKAPI vkCreateComputePipelines(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001863 VkDevice device,
Jon Ashburn0e249962015-07-10 09:41:15 -07001864 VkPipelineCache pipelineCache,
1865 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001866 const VkComputePipelineCreateInfo* pCreateInfo,
1867 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001868{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001869 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001870 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001871}
1872
David Pinedo0257fbf2015-02-02 18:02:40 -07001873
David Pinedo0257fbf2015-02-02 18:02:40 -07001874
Jon Ashburn0e249962015-07-10 09:41:15 -07001875
David Pinedo0257fbf2015-02-02 18:02:40 -07001876
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001877ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1878 VkDevice device,
1879 const VkQueryPoolCreateInfo* pCreateInfo,
1880 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001881{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001882 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001883 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001884}
1885
Tony Barbourde4124d2015-07-03 10:33:54 -06001886ICD_EXPORT VkResult VKAPI vkDestroyQueryPool(
1887 VkDevice device,
1888 VkQueryPool queryPoool)
1889{
1890 NULLDRV_LOG_FUNC;
1891 return VK_SUCCESS;
1892}
1893
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001894ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
Mike Stroyan230e6252015-04-17 12:36:38 -06001895 VkDevice device,
1896 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001897 uint32_t startQuery,
1898 uint32_t queryCount,
1899 size_t* pDataSize,
Tony Barbour8205d902015-04-16 15:59:00 -06001900 void* pData,
1901 VkQueryResultFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -07001902{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001903 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001904 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001905}
1906
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001907ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1908 VkQueue queue_)
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
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001914ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1915 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001916 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001917 const VkCmdBuffer* pCmdBuffers,
1918 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001919{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001920 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001921 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001922}
1923
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001924ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1925 VkDevice device,
1926 const VkSemaphoreCreateInfo* pCreateInfo,
1927 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001928{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001929 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001930 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001931}
1932
Tony Barbourde4124d2015-07-03 10:33:54 -06001933ICD_EXPORT VkResult VKAPI vkDestroySemaphore(
1934 VkDevice device,
1935 VkSemaphore semaphore)
1936{
1937 NULLDRV_LOG_FUNC;
1938 return VK_SUCCESS;
1939}
1940
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001941ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1942 VkQueue queue,
1943 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001944{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001945 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001946 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001947}
1948
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001949ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1950 VkQueue queue,
1951 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001952{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001953 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001954 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001955}
1956
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001957ICD_EXPORT VkResult VKAPI vkCreateSampler(
1958 VkDevice device,
1959 const VkSamplerCreateInfo* pCreateInfo,
1960 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07001961{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001962 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001963 struct nulldrv_dev *dev = nulldrv_dev(device);
1964
1965 return nulldrv_sampler_create(dev, pCreateInfo,
1966 (struct nulldrv_sampler **) pSampler);
1967}
1968
Tony Barbourde4124d2015-07-03 10:33:54 -06001969ICD_EXPORT VkResult VKAPI vkDestroySampler(
1970 VkDevice device,
1971 VkSampler sampler)
1972{
1973 NULLDRV_LOG_FUNC;
1974 return VK_SUCCESS;
1975}
1976
Ian Elliotte924ab22015-07-08 13:24:30 -06001977ICD_EXPORT VkResult VKAPI vkCreateShaderModule(
1978 VkDevice device,
1979 const VkShaderModuleCreateInfo* pCreateInfo,
1980 VkShaderModule* pShaderModule)
1981{
1982 // TODO: Fill in with real data
Tony Barbourde4124d2015-07-03 10:33:54 -06001983 NULLDRV_LOG_FUNC;
1984 return VK_SUCCESS;
1985}
1986
1987ICD_EXPORT VkResult VKAPI vkDestroyShaderModule(
1988 VkDevice device,
1989 VkShaderModule shaderModule)
1990{
1991 // TODO: Fill in with real data
1992 NULLDRV_LOG_FUNC;
Ian Elliotte924ab22015-07-08 13:24:30 -06001993 return VK_SUCCESS;
1994}
1995
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001996ICD_EXPORT VkResult VKAPI vkCreateShader(
1997 VkDevice device,
1998 const VkShaderCreateInfo* pCreateInfo,
1999 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07002000{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002001 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002002 struct nulldrv_dev *dev = nulldrv_dev(device);
2003
2004 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
2005}
2006
Tony Barbourde4124d2015-07-03 10:33:54 -06002007ICD_EXPORT VkResult VKAPI vkDestroyShader(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002008 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002009 VkShader shader)
2010{
2011 NULLDRV_LOG_FUNC;
2012 return VK_SUCCESS;
2013}
2014
2015ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
2016 VkDevice device,
2017 const VkDynamicViewportStateCreateInfo* pCreateInfo,
2018 VkDynamicViewportState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002019{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002020 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002021 struct nulldrv_dev *dev = nulldrv_dev(device);
2022
2023 return nulldrv_viewport_state_create(dev, pCreateInfo,
2024 (struct nulldrv_dynamic_vp **) pState);
2025}
2026
Tony Barbourde4124d2015-07-03 10:33:54 -06002027ICD_EXPORT VkResult VKAPI vkDestroyDynamicViewportState(
2028 VkDevice device,
2029 VkDynamicViewportState dynamicViewportState)
2030{
2031 NULLDRV_LOG_FUNC;
2032 return VK_SUCCESS;
2033}
2034
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002035ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
2036 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002037 const VkDynamicRasterStateCreateInfo* pCreateInfo,
2038 VkDynamicRasterState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002039{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002040 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002041 struct nulldrv_dev *dev = nulldrv_dev(device);
2042
2043 return nulldrv_raster_state_create(dev, pCreateInfo,
2044 (struct nulldrv_dynamic_rs **) pState);
2045}
2046
Tony Barbourde4124d2015-07-03 10:33:54 -06002047ICD_EXPORT VkResult VKAPI vkDestroyDynamicRasterState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002048 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002049 VkDynamicRasterState dynamicRasterState)
2050{
2051 NULLDRV_LOG_FUNC;
2052 return VK_SUCCESS;
2053}
2054
2055ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
2056 VkDevice device,
2057 const VkDynamicColorBlendStateCreateInfo* pCreateInfo,
2058 VkDynamicColorBlendState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002059{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002060 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002061 struct nulldrv_dev *dev = nulldrv_dev(device);
2062
2063 return nulldrv_blend_state_create(dev, pCreateInfo,
2064 (struct nulldrv_dynamic_cb **) pState);
2065}
2066
Tony Barbourde4124d2015-07-03 10:33:54 -06002067ICD_EXPORT VkResult VKAPI vkDestroyDynamicColorBlendState(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002068 VkDevice device,
Tony Barbourde4124d2015-07-03 10:33:54 -06002069 VkDynamicColorBlendState dynamicColorBlendState)
2070{
2071 NULLDRV_LOG_FUNC;
2072 return VK_SUCCESS;
2073}
2074
2075ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
2076 VkDevice device,
2077 const VkDynamicDepthStencilStateCreateInfo* pCreateInfo,
2078 VkDynamicDepthStencilState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07002079{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002080 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002081 struct nulldrv_dev *dev = nulldrv_dev(device);
2082
2083 return nulldrv_ds_state_create(dev, pCreateInfo,
2084 (struct nulldrv_dynamic_ds **) pState);
2085}
2086
Tony Barbourde4124d2015-07-03 10:33:54 -06002087ICD_EXPORT VkResult VKAPI vkDestroyDynamicDepthStencilState(
2088 VkDevice device,
2089 VkDynamicDepthStencilState dynamicDepthStencilState)
2090{
2091 NULLDRV_LOG_FUNC;
2092 return VK_SUCCESS;
2093}
2094
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002095ICD_EXPORT VkResult VKAPI vkCreateBufferView(
2096 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06002097 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002098 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002099{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002100 NULLDRV_LOG_FUNC;
2101 struct nulldrv_dev *dev = nulldrv_dev(device);
2102
2103 return nulldrv_buf_view_create(dev, pCreateInfo,
2104 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07002105}
2106
Tony Barbourde4124d2015-07-03 10:33:54 -06002107ICD_EXPORT VkResult VKAPI vkDestroyBufferView(
2108 VkDevice device,
2109 VkBufferView bufferView)
2110{
2111 NULLDRV_LOG_FUNC;
2112 return VK_SUCCESS;
2113}
2114
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002115ICD_EXPORT VkResult VKAPI vkCreateImageView(
2116 VkDevice device,
2117 const VkImageViewCreateInfo* pCreateInfo,
2118 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002119{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002120 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002121 struct nulldrv_dev *dev = nulldrv_dev(device);
2122
2123 return nulldrv_img_view_create(dev, pCreateInfo,
2124 (struct nulldrv_img_view **) pView);
2125}
2126
Tony Barbourde4124d2015-07-03 10:33:54 -06002127ICD_EXPORT VkResult VKAPI vkDestroyImageView(
2128 VkDevice device,
2129 VkImageView imageView)
2130{
2131 NULLDRV_LOG_FUNC;
2132 return VK_SUCCESS;
2133}
2134
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002135ICD_EXPORT VkResult VKAPI vkCreateAttachmentView(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002136 VkDevice device,
Chia-I Wuc278df82015-07-07 11:50:03 +08002137 const VkAttachmentViewCreateInfo* pCreateInfo,
2138 VkAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07002139{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002140 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002141 struct nulldrv_dev *dev = nulldrv_dev(device);
2142
2143 return nulldrv_rt_view_create(dev, pCreateInfo,
2144 (struct nulldrv_rt_view **) pView);
2145}
2146
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002147ICD_EXPORT VkResult VKAPI vkDestroyAttachmentView(
Tony Barbourde4124d2015-07-03 10:33:54 -06002148 VkDevice device,
Courtney Goeltzenleuchtera4cd8192015-07-10 17:44:33 -06002149 VkAttachmentView attachmentView)
Tony Barbourde4124d2015-07-03 10:33:54 -06002150{
2151 NULLDRV_LOG_FUNC;
2152 return VK_SUCCESS;
2153}
2154
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002155ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
2156 VkDevice device,
2157 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
2158 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07002159{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002160 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002161 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07002162
Chia-I Wu7732cb22015-03-26 15:27:55 +08002163 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07002164 (struct nulldrv_desc_layout **) pSetLayout);
2165}
2166
Tony Barbourde4124d2015-07-03 10:33:54 -06002167ICD_EXPORT VkResult VKAPI vkDestroyDescriptorSetLayout(
2168 VkDevice device,
2169 VkDescriptorSetLayout descriptorSetLayout)
2170{
2171 NULLDRV_LOG_FUNC;
2172 return VK_SUCCESS;
2173}
2174
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002175ICD_EXPORT VkResult VKAPI vkCreatePipelineLayout(
2176 VkDevice device,
2177 const VkPipelineLayoutCreateInfo* pCreateInfo,
2178 VkPipelineLayout* pPipelineLayout)
Chia-I Wu7732cb22015-03-26 15:27:55 +08002179{
2180 NULLDRV_LOG_FUNC;
2181 struct nulldrv_dev *dev = nulldrv_dev(device);
2182
Mark Lobodzinski556f7212015-04-17 14:11:39 -05002183 return nulldrv_pipeline_layout_create(dev,
2184 pCreateInfo,
2185 (struct nulldrv_pipeline_layout **) pPipelineLayout);
Chia-I Wu7732cb22015-03-26 15:27:55 +08002186}
2187
Tony Barbourde4124d2015-07-03 10:33:54 -06002188ICD_EXPORT VkResult VKAPI vkDestroyPipelineLayout(
2189 VkDevice device,
2190 VkPipelineLayout pipelineLayout)
2191{
2192 NULLDRV_LOG_FUNC;
2193 return VK_SUCCESS;
2194}
2195
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002196ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
2197 VkDevice device,
2198 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002199 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002200 const VkDescriptorPoolCreateInfo* pCreateInfo,
2201 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002202{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002203 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002204 struct nulldrv_dev *dev = nulldrv_dev(device);
2205
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002206 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
2207 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07002208}
2209
Tony Barbourde4124d2015-07-03 10:33:54 -06002210ICD_EXPORT VkResult VKAPI vkDestroyDescriptorPool(
2211 VkDevice device,
2212 VkDescriptorPool descriptorPool)
2213{
2214 NULLDRV_LOG_FUNC;
2215 return VK_SUCCESS;
2216}
2217
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002218ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
Mike Stroyan230e6252015-04-17 12:36:38 -06002219 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002220 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07002221{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002222 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002223 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002224}
2225
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002226ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
Mike Stroyan230e6252015-04-17 12:36:38 -06002227 VkDevice device,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002228 VkDescriptorPool descriptorPool,
2229 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07002230 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002231 const VkDescriptorSetLayout* pSetLayouts,
2232 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07002233 uint32_t* pCount)
2234{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002235 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002236 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
2237 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002238 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002239 uint32_t i;
2240
2241 for (i = 0; i < count; i++) {
2242 const struct nulldrv_desc_layout *layout =
Tony Barbour8db65372015-07-10 18:32:33 -06002243 nulldrv_desc_layout(pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002244
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002245 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002246 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002247 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002248 break;
2249 }
2250
2251 if (pCount)
2252 *pCount = i;
2253
2254 return ret;
2255}
2256
Tony Barbourb857d312015-07-10 10:50:45 -06002257ICD_EXPORT VkResult VKAPI vkFreeDescriptorSets(
2258 VkDevice device,
2259 VkDescriptorPool descriptorPool,
2260 uint32_t count,
2261 const VkDescriptorSet* pDescriptorSets)
2262{
2263 NULLDRV_LOG_FUNC;
2264 return VK_SUCCESS;
2265}
2266
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002267ICD_EXPORT VkResult VKAPI vkUpdateDescriptorSets(
2268 VkDevice device,
2269 uint32_t writeCount,
2270 const VkWriteDescriptorSet* pDescriptorWrites,
2271 uint32_t copyCount,
2272 const VkCopyDescriptorSet* pDescriptorCopies)
David Pinedo0257fbf2015-02-02 18:02:40 -07002273{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002274 NULLDRV_LOG_FUNC;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +08002275 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002276}
2277
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002278ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2279 VkDevice device,
2280 const VkFramebufferCreateInfo* info,
2281 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002282{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002283 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002284 struct nulldrv_dev *dev = nulldrv_dev(device);
2285
2286 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2287}
2288
Tony Barbourde4124d2015-07-03 10:33:54 -06002289ICD_EXPORT VkResult VKAPI vkDestroyFramebuffer(
2290 VkDevice device,
2291 VkFramebuffer framebuffer)
2292{
2293 NULLDRV_LOG_FUNC;
2294 return VK_SUCCESS;
2295}
David Pinedo0257fbf2015-02-02 18:02:40 -07002296
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002297ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2298 VkDevice device,
2299 const VkRenderPassCreateInfo* info,
2300 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002301{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002302 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002303 struct nulldrv_dev *dev = nulldrv_dev(device);
2304
2305 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2306}
2307
Tony Barbourde4124d2015-07-03 10:33:54 -06002308ICD_EXPORT VkResult VKAPI vkDestroyRenderPass(
2309 VkDevice device,
2310 VkRenderPass renderPass)
2311{
2312 NULLDRV_LOG_FUNC;
2313 return VK_SUCCESS;
2314}
2315
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002316ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Chia-I Wuc278df82015-07-07 11:50:03 +08002317 VkCmdBuffer cmdBuffer,
2318 const VkRenderPassBeginInfo* pRenderPassBegin,
2319 VkRenderPassContents contents)
2320{
2321 NULLDRV_LOG_FUNC;
2322}
2323
2324ICD_EXPORT void VKAPI vkCmdNextSubpass(
2325 VkCmdBuffer cmdBuffer,
2326 VkRenderPassContents contents)
David Pinedo0257fbf2015-02-02 18:02:40 -07002327{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002328 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002329}
2330
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002331ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Chia-I Wu88eaa3b2015-06-26 15:34:39 +08002332 VkCmdBuffer cmdBuffer)
2333{
2334 NULLDRV_LOG_FUNC;
2335}
2336
2337ICD_EXPORT void VKAPI vkCmdExecuteCommands(
2338 VkCmdBuffer cmdBuffer,
2339 uint32_t cmdBuffersCount,
2340 const VkCmdBuffer* pCmdBuffers)
David Pinedo0257fbf2015-02-02 18:02:40 -07002341{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002342 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002343}
Ian Elliottf93069f2015-02-19 14:26:19 -07002344
2345ICD_EXPORT void* xcbCreateWindow(
2346 uint16_t width,
2347 uint16_t height)
2348{
2349 static uint32_t window; // Kludge to the max
2350 NULLDRV_LOG_FUNC;
2351 return &window;
2352}
2353
2354// May not be needed, if we stub out stuf in tri.c
2355ICD_EXPORT void xcbDestroyWindow()
2356{
2357 NULLDRV_LOG_FUNC;
2358}
2359
2360ICD_EXPORT int xcbGetMessage(void *msg)
2361{
2362 NULLDRV_LOG_FUNC;
2363 return 0;
2364}
2365
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002366ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002367{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002368 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002369}