blob: 6d1ed15c4c8d151e29b4967e8d1576197a1dda07 [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] = {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060043 [NULLDRV_EXT_WSI_X11] = "VK_WSI_X11",
44 [NULLDRV_EXT_WSI_WINDOWS] = "VK_WSI_WINDOWS"
David Pinedo0257fbf2015-02-02 18:02:40 -070045};
46
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060047static struct nulldrv_base *nulldrv_base(VkBaseObject base)
David Pinedo0257fbf2015-02-02 18:02:40 -070048{
49 return (struct nulldrv_base *) base;
50}
51
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060052static VkResult nulldrv_base_get_info(struct nulldrv_base *base, int type,
David Pinedo0257fbf2015-02-02 18:02:40 -070053 size_t *size, void *data)
54{
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060055 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -070056 size_t s;
57 uint32_t *count;
58
59 switch (type) {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060060 case VK_INFO_TYPE_MEMORY_REQUIREMENTS:
David Pinedo0257fbf2015-02-02 18:02:40 -070061 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060062 s = sizeof(VkMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -070063 *size = s;
64 if (data == NULL)
65 return ret;
66 memset(data, 0, s);
David Pinedo0257fbf2015-02-02 18:02:40 -070067 break;
68 }
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060069 case VK_INFO_TYPE_MEMORY_ALLOCATION_COUNT:
David Pinedo0257fbf2015-02-02 18:02:40 -070070 *size = sizeof(uint32_t);
71 if (data == NULL)
72 return ret;
73 count = (uint32_t *) data;
74 *count = 1;
75 break;
David Pinedo0257fbf2015-02-02 18:02:40 -070076 default:
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060077 ret = VK_ERROR_INVALID_VALUE;
David Pinedo0257fbf2015-02-02 18:02:40 -070078 break;
79 }
80
81 return ret;
82}
83
84static struct nulldrv_base *nulldrv_base_create(struct nulldrv_dev *dev,
85 size_t obj_size,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060086 VK_DBG_OBJECT_TYPE type)
David Pinedo0257fbf2015-02-02 18:02:40 -070087{
88 struct nulldrv_base *base;
89
90 if (!obj_size)
91 obj_size = sizeof(*base);
92
93 assert(obj_size >= sizeof(*base));
94
Chia-I Wu493a1752015-02-22 14:40:25 +080095 base = (struct nulldrv_base*)malloc(obj_size);
David Pinedo0257fbf2015-02-02 18:02:40 -070096 if (!base)
97 return NULL;
98
99 memset(base, 0, obj_size);
100
101 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
102 set_loader_magic_value(base);
103
104 if (dev == NULL) {
105 /*
106 * dev is NULL when we are creating the base device object
107 * Set dev now so that debug setup happens correctly
108 */
109 dev = (struct nulldrv_dev *) base;
110 }
111
112
113 base->get_info = NULL;
114
115 return base;
116}
117
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600118static VkResult nulldrv_gpu_add(int devid, const char *primary_node,
David Pinedo0257fbf2015-02-02 18:02:40 -0700119 const char *render_node, struct nulldrv_gpu **gpu_ret)
120{
121 struct nulldrv_gpu *gpu;
122
Chia-I Wu493a1752015-02-22 14:40:25 +0800123 gpu = malloc(sizeof(*gpu));
David Pinedo0257fbf2015-02-02 18:02:40 -0700124 if (!gpu)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600125 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700126 memset(gpu, 0, sizeof(*gpu));
Mark Lobodzinski97dcd042015-04-16 08:52:00 -0500127
David Pinedo0257fbf2015-02-02 18:02:40 -0700128 // Initialize pointer to loader's dispatch table with ICD_LOADER_MAGIC
129 set_loader_magic_value(gpu);
130
131 *gpu_ret = gpu;
132
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600133 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700134}
135
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600136static VkResult nulldrv_queue_create(struct nulldrv_dev *dev,
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700137 uint32_t node_index,
David Pinedo0257fbf2015-02-02 18:02:40 -0700138 struct nulldrv_queue **queue_ret)
139{
140 struct nulldrv_queue *queue;
141
142 queue = (struct nulldrv_queue *) nulldrv_base_create(dev, sizeof(*queue),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600143 VK_DBG_OBJECT_QUEUE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700144 if (!queue)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600145 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700146
147 queue->dev = dev;
148
149 *queue_ret = queue;
150
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600151 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700152}
153
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600154static VkResult dev_create_queues(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600155 const VkDeviceQueueCreateInfo *queues,
David Pinedo0257fbf2015-02-02 18:02:40 -0700156 uint32_t count)
157{
158 uint32_t i;
159
160 if (!count)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600161 return VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700162
163 for (i = 0; i < count; i++) {
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600164 const VkDeviceQueueCreateInfo *q = &queues[i];
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600165 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700166
167 if (q->queueCount == 1 && !dev->queues[q->queueNodeIndex]) {
168 ret = nulldrv_queue_create(dev, q->queueNodeIndex,
169 &dev->queues[q->queueNodeIndex]);
170 }
171 else {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600172 ret = VK_ERROR_INVALID_POINTER;
David Pinedo0257fbf2015-02-02 18:02:40 -0700173 }
174
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600175 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700176 return ret;
177 }
178 }
179
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600180 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700181}
182
183static enum nulldrv_ext_type nulldrv_gpu_lookup_extension(const struct nulldrv_gpu *gpu,
184 const char *ext)
185{
186 enum nulldrv_ext_type type;
187
188 for (type = 0; type < ARRAY_SIZE(nulldrv_gpu_exts); type++) {
189 if (nulldrv_gpu_exts[type] && strcmp(nulldrv_gpu_exts[type], ext) == 0)
190 break;
191 }
192
193 assert(type < NULLDRV_EXT_COUNT || type == NULLDRV_EXT_INVALID);
194
195 return type;
196}
197
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600198static VkResult nulldrv_desc_ooxx_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800199 struct nulldrv_desc_ooxx **ooxx_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700200{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800201 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700202
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800203 ooxx = malloc(sizeof(*ooxx));
204 if (!ooxx)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600205 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700206
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800207 memset(ooxx, 0, sizeof(*ooxx));
David Pinedo0257fbf2015-02-02 18:02:40 -0700208
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800209 ooxx->surface_desc_size = 0;
210 ooxx->sampler_desc_size = 0;
David Pinedo0257fbf2015-02-02 18:02:40 -0700211
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800212 *ooxx_ret = ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700213
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600214 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700215}
216
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600217static VkResult nulldrv_dev_create(struct nulldrv_gpu *gpu,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600218 const VkDeviceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700219 struct nulldrv_dev **dev_ret)
220{
221 struct nulldrv_dev *dev;
222 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600223 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -0700224
225 dev = (struct nulldrv_dev *) nulldrv_base_create(NULL, sizeof(*dev),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600226 VK_DBG_OBJECT_DEVICE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700227 if (!dev)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600228 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700229
230 for (i = 0; i < info->extensionCount; i++) {
231 const enum nulldrv_ext_type ext = nulldrv_gpu_lookup_extension(gpu,
232 info->ppEnabledExtensionNames[i]);
233
234 if (ext == NULLDRV_EXT_INVALID)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600235 return VK_ERROR_INVALID_EXTENSION;
David Pinedo0257fbf2015-02-02 18:02:40 -0700236
237 dev->exts[ext] = true;
238 }
239
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800240 ret = nulldrv_desc_ooxx_create(dev, &dev->desc_ooxx);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600241 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700242 return ret;
243 }
244
245 ret = dev_create_queues(dev, info->pRequestedQueues,
246 info->queueRecordCount);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600247 if (ret != VK_SUCCESS) {
David Pinedo0257fbf2015-02-02 18:02:40 -0700248 return ret;
249 }
250
251 *dev_ret = dev;
252
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600253 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700254}
255
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600256static struct nulldrv_gpu *nulldrv_gpu(VkPhysicalGpu gpu)
David Pinedo0257fbf2015-02-02 18:02:40 -0700257{
258 return (struct nulldrv_gpu *) gpu;
259}
260
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600261static VkResult nulldrv_rt_view_create(struct nulldrv_dev *dev,
262 const VkColorAttachmentViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700263 struct nulldrv_rt_view **view_ret)
264{
265 struct nulldrv_rt_view *view;
266
267 view = (struct nulldrv_rt_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600268 VK_DBG_OBJECT_COLOR_TARGET_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700269 if (!view)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600270 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700271
272 *view_ret = view;
273
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600274 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700275}
276
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600277static VkResult nulldrv_fence_create(struct nulldrv_dev *dev,
278 const VkFenceCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700279 struct nulldrv_fence **fence_ret)
280{
281 struct nulldrv_fence *fence;
282
283 fence = (struct nulldrv_fence *) nulldrv_base_create(dev, sizeof(*fence),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600284 VK_DBG_OBJECT_FENCE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700285 if (!fence)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600286 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700287
288 *fence_ret = fence;
289
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600290 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700291}
292
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600293static struct nulldrv_dev *nulldrv_dev(VkDevice dev)
David Pinedo0257fbf2015-02-02 18:02:40 -0700294{
295 return (struct nulldrv_dev *) dev;
296}
297
298static struct nulldrv_img *nulldrv_img_from_base(struct nulldrv_base *base)
299{
300 return (struct nulldrv_img *) base;
301}
302
303
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600304static VkResult img_get_info(struct nulldrv_base *base, int type,
David Pinedo0257fbf2015-02-02 18:02:40 -0700305 size_t *size, void *data)
306{
307 struct nulldrv_img *img = nulldrv_img_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600308 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700309
310 switch (type) {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600311 case VK_INFO_TYPE_MEMORY_REQUIREMENTS:
David Pinedo0257fbf2015-02-02 18:02:40 -0700312 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600313 VkMemoryRequirements *mem_req = data;
David Pinedo0257fbf2015-02-02 18:02:40 -0700314
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600315 *size = sizeof(VkMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -0700316 if (data == NULL)
317 return ret;
318 mem_req->size = img->total_size;
319 mem_req->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700320 }
321 break;
322 default:
323 ret = nulldrv_base_get_info(base, type, size, data);
324 break;
325 }
326
327 return ret;
328}
329
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600330static VkResult nulldrv_img_create(struct nulldrv_dev *dev,
331 const VkImageCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700332 bool scanout,
333 struct nulldrv_img **img_ret)
334{
335 struct nulldrv_img *img;
336
337 img = (struct nulldrv_img *) nulldrv_base_create(dev, sizeof(*img),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600338 VK_DBG_OBJECT_IMAGE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700339 if (!img)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600340 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700341
342 img->type = info->imageType;
343 img->depth = info->extent.depth;
344 img->mip_levels = info->mipLevels;
345 img->array_size = info->arraySize;
346 img->usage = info->usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700347 img->samples = info->samples;
348
349 img->obj.base.get_info = img_get_info;
350
351 *img_ret = img;
352
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600353 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700354}
355
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600356static struct nulldrv_img *nulldrv_img(VkImage image)
David Pinedo0257fbf2015-02-02 18:02:40 -0700357{
358 return (struct nulldrv_img *) image;
359}
360
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600361static VkResult nulldrv_mem_alloc(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600362 const VkMemoryAllocInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700363 struct nulldrv_mem **mem_ret)
364{
365 struct nulldrv_mem *mem;
366
367 mem = (struct nulldrv_mem *) nulldrv_base_create(dev, sizeof(*mem),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600368 VK_DBG_OBJECT_GPU_MEMORY);
David Pinedo0257fbf2015-02-02 18:02:40 -0700369 if (!mem)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600370 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700371
Chia-I Wub5ed9e62015-03-05 14:26:54 -0700372 mem->bo = malloc(info->allocationSize);
David Pinedo0257fbf2015-02-02 18:02:40 -0700373 if (!mem->bo) {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600374 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700375 }
376
377 mem->size = info->allocationSize;
378
379 *mem_ret = mem;
380
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600381 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700382}
383
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600384static VkResult nulldrv_ds_view_create(struct nulldrv_dev *dev,
385 const VkDepthStencilViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700386 struct nulldrv_ds_view **view_ret)
387{
388 struct nulldrv_img *img = nulldrv_img(info->image);
389 struct nulldrv_ds_view *view;
390
391 view = (struct nulldrv_ds_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600392 VK_DBG_OBJECT_DEPTH_STENCIL_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700393 if (!view)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600394 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700395
396 view->img = img;
397
398 view->array_size = info->arraySize;
399
400 *view_ret = view;
401
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600402 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700403}
404
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600405static VkResult nulldrv_sampler_create(struct nulldrv_dev *dev,
406 const VkSamplerCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700407 struct nulldrv_sampler **sampler_ret)
408{
409 struct nulldrv_sampler *sampler;
410
411 sampler = (struct nulldrv_sampler *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600412 sizeof(*sampler), VK_DBG_OBJECT_SAMPLER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700413 if (!sampler)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600414 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700415
416 *sampler_ret = sampler;
417
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600418 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700419}
420
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600421static VkResult nulldrv_img_view_create(struct nulldrv_dev *dev,
422 const VkImageViewCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700423 struct nulldrv_img_view **view_ret)
424{
425 struct nulldrv_img *img = nulldrv_img(info->image);
426 struct nulldrv_img_view *view;
David Pinedo0257fbf2015-02-02 18:02:40 -0700427
428 view = (struct nulldrv_img_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600429 VK_DBG_OBJECT_IMAGE_VIEW);
David Pinedo0257fbf2015-02-02 18:02:40 -0700430 if (!view)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600431 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700432
433 view->img = img;
434 view->min_lod = info->minLod;
435
David Pinedo0257fbf2015-02-02 18:02:40 -0700436 view->cmd_len = 8;
437
438 *view_ret = view;
439
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600440 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700441}
442
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600443static void *nulldrv_mem_map(struct nulldrv_mem *mem, VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700444{
445 return mem->bo;
446}
447
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600448static struct nulldrv_mem *nulldrv_mem(VkGpuMemory mem)
David Pinedo0257fbf2015-02-02 18:02:40 -0700449{
450 return (struct nulldrv_mem *) mem;
451}
452
453static struct nulldrv_buf *nulldrv_buf_from_base(struct nulldrv_base *base)
454{
455 return (struct nulldrv_buf *) base;
456}
457
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600458static VkResult buf_get_info(struct nulldrv_base *base, int type,
David Pinedo0257fbf2015-02-02 18:02:40 -0700459 size_t *size, void *data)
460{
461 struct nulldrv_buf *buf = nulldrv_buf_from_base(base);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600462 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700463
464 switch (type) {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600465 case VK_INFO_TYPE_MEMORY_REQUIREMENTS:
David Pinedo0257fbf2015-02-02 18:02:40 -0700466 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600467 VkMemoryRequirements *mem_req = data;
David Pinedo0257fbf2015-02-02 18:02:40 -0700468
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600469 *size = sizeof(VkMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -0700470 if (data == NULL)
471 return ret;
472
473 mem_req->size = buf->size;
474 mem_req->alignment = 4096;
David Pinedo0257fbf2015-02-02 18:02:40 -0700475
476 }
477 break;
David Pinedo0257fbf2015-02-02 18:02:40 -0700478 default:
479 ret = nulldrv_base_get_info(base, type, size, data);
480 break;
481 }
482
483 return ret;
484}
485
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600486static VkResult nulldrv_buf_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600487 const VkBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700488 struct nulldrv_buf **buf_ret)
489{
490 struct nulldrv_buf *buf;
491
492 buf = (struct nulldrv_buf *) nulldrv_base_create(dev, sizeof(*buf),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600493 VK_DBG_OBJECT_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700494 if (!buf)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600495 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700496
497 buf->size = info->size;
498 buf->usage = info->usage;
499
500 buf->obj.base.get_info = buf_get_info;
501
502 *buf_ret = buf;
503
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600504 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700505}
506
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600507static VkResult nulldrv_desc_layout_create(struct nulldrv_dev *dev,
508 const VkDescriptorSetLayoutCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700509 struct nulldrv_desc_layout **layout_ret)
510{
511 struct nulldrv_desc_layout *layout;
512
513 layout = (struct nulldrv_desc_layout *)
514 nulldrv_base_create(dev, sizeof(*layout),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600515 VK_DBG_OBJECT_DESCRIPTOR_SET_LAYOUT);
David Pinedo0257fbf2015-02-02 18:02:40 -0700516 if (!layout)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600517 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700518
519 *layout_ret = layout;
520
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600521 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700522}
523
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600524static VkResult nulldrv_desc_layout_chain_create(struct nulldrv_dev *dev,
Chia-I Wu7732cb22015-03-26 15:27:55 +0800525 uint32_t setLayoutArrayCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600526 const VkDescriptorSetLayout *pSetLayoutArray,
Chia-I Wu7732cb22015-03-26 15:27:55 +0800527 struct nulldrv_desc_layout_chain **chain_ret)
528{
529 struct nulldrv_desc_layout_chain *chain;
530
531 chain = (struct nulldrv_desc_layout_chain *)
532 nulldrv_base_create(dev, sizeof(*chain),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600533 VK_DBG_OBJECT_DESCRIPTOR_SET_LAYOUT_CHAIN);
Chia-I Wu7732cb22015-03-26 15:27:55 +0800534 if (!chain)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600535 return VK_ERROR_OUT_OF_MEMORY;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800536
537 *chain_ret = chain;
538
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600539 return VK_SUCCESS;
Chia-I Wu7732cb22015-03-26 15:27:55 +0800540}
541
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600542static struct nulldrv_desc_layout *nulldrv_desc_layout(VkDescriptorSetLayout layout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700543{
544 return (struct nulldrv_desc_layout *) layout;
545}
546
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600547static VkResult shader_create(struct nulldrv_dev *dev,
548 const VkShaderCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700549 struct nulldrv_shader **sh_ret)
550{
David Pinedo0257fbf2015-02-02 18:02:40 -0700551 struct nulldrv_shader *sh;
552
553 sh = (struct nulldrv_shader *) nulldrv_base_create(dev, sizeof(*sh),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600554 VK_DBG_OBJECT_SHADER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700555 if (!sh)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600556 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700557
558 *sh_ret = sh;
559
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600560 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700561}
562
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600563static VkResult graphics_pipeline_create(struct nulldrv_dev *dev,
564 const VkGraphicsPipelineCreateInfo *info_,
David Pinedo0257fbf2015-02-02 18:02:40 -0700565 struct nulldrv_pipeline **pipeline_ret)
566{
567 struct nulldrv_pipeline *pipeline;
568
569 pipeline = (struct nulldrv_pipeline *)
570 nulldrv_base_create(dev, sizeof(*pipeline),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600571 VK_DBG_OBJECT_GRAPHICS_PIPELINE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700572 if (!pipeline)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600573 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700574
575 *pipeline_ret = pipeline;
576
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600577 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700578}
579
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600580static VkResult nulldrv_viewport_state_create(struct nulldrv_dev *dev,
581 const VkDynamicVpStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700582 struct nulldrv_dynamic_vp **state_ret)
583{
584 struct nulldrv_dynamic_vp *state;
585
586 state = (struct nulldrv_dynamic_vp *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600587 sizeof(*state), VK_DBG_OBJECT_VIEWPORT_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700588 if (!state)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600589 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700590
591 *state_ret = state;
592
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600593 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700594}
595
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600596static VkResult nulldrv_raster_state_create(struct nulldrv_dev *dev,
597 const VkDynamicRsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700598 struct nulldrv_dynamic_rs **state_ret)
599{
600 struct nulldrv_dynamic_rs *state;
601
602 state = (struct nulldrv_dynamic_rs *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600603 sizeof(*state), VK_DBG_OBJECT_RASTER_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700604 if (!state)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600605 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700606
607 *state_ret = state;
608
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600609 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700610}
611
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600612static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
613 const VkDynamicCbStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700614 struct nulldrv_dynamic_cb **state_ret)
615{
616 struct nulldrv_dynamic_cb *state;
617
618 state = (struct nulldrv_dynamic_cb *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600619 sizeof(*state), VK_DBG_OBJECT_COLOR_BLEND_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700620 if (!state)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600621 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700622
623 *state_ret = state;
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 VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
629 const VkDynamicDsStateCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700630 struct nulldrv_dynamic_ds **state_ret)
631{
632 struct nulldrv_dynamic_ds *state;
633
634 state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600635 sizeof(*state), VK_DBG_OBJECT_DEPTH_STENCIL_STATE);
David Pinedo0257fbf2015-02-02 18:02:40 -0700636 if (!state)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600637 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700638
639 *state_ret = state;
640
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600641 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700642}
643
644
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600645static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
646 const VkCmdBufferCreateInfo *info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700647 struct nulldrv_cmd **cmd_ret)
648{
David Pinedo0257fbf2015-02-02 18:02:40 -0700649 struct nulldrv_cmd *cmd;
650
David Pinedo0257fbf2015-02-02 18:02:40 -0700651 cmd = (struct nulldrv_cmd *) nulldrv_base_create(dev, sizeof(*cmd),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600652 VK_DBG_OBJECT_CMD_BUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700653 if (!cmd)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600654 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700655
656 *cmd_ret = cmd;
657
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600658 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700659}
660
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600661static VkResult nulldrv_desc_pool_create(struct nulldrv_dev *dev,
662 VkDescriptorPoolUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700663 uint32_t max_sets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600664 const VkDescriptorPoolCreateInfo *info,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800665 struct nulldrv_desc_pool **pool_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -0700666{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800667 struct nulldrv_desc_pool *pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700668
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800669 pool = (struct nulldrv_desc_pool *)
670 nulldrv_base_create(dev, sizeof(*pool),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600671 VK_DBG_OBJECT_DESCRIPTOR_POOL);
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800672 if (!pool)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600673 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700674
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800675 pool->dev = dev;
David Pinedo0257fbf2015-02-02 18:02:40 -0700676
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800677 *pool_ret = pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700678
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600679 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700680}
681
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600682static VkResult nulldrv_desc_set_create(struct nulldrv_dev *dev,
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800683 struct nulldrv_desc_pool *pool,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600684 VkDescriptorSetUsage usage,
David Pinedo0257fbf2015-02-02 18:02:40 -0700685 const struct nulldrv_desc_layout *layout,
686 struct nulldrv_desc_set **set_ret)
687{
688 struct nulldrv_desc_set *set;
689
690 set = (struct nulldrv_desc_set *)
691 nulldrv_base_create(dev, sizeof(*set),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600692 VK_DBG_OBJECT_DESCRIPTOR_SET);
David Pinedo0257fbf2015-02-02 18:02:40 -0700693 if (!set)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600694 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700695
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800696 set->ooxx = dev->desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700697 set->layout = layout;
698 *set_ret = set;
699
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600700 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700701}
702
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600703static struct nulldrv_desc_pool *nulldrv_desc_pool(VkDescriptorPool pool)
David Pinedo0257fbf2015-02-02 18:02:40 -0700704{
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800705 return (struct nulldrv_desc_pool *) pool;
David Pinedo0257fbf2015-02-02 18:02:40 -0700706}
707
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600708static VkResult nulldrv_fb_create(struct nulldrv_dev *dev,
709 const VkFramebufferCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700710 struct nulldrv_framebuffer ** fb_ret)
711{
712
713 struct nulldrv_framebuffer *fb;
714 fb = (struct nulldrv_framebuffer *) nulldrv_base_create(dev, sizeof(*fb),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600715 VK_DBG_OBJECT_FRAMEBUFFER);
David Pinedo0257fbf2015-02-02 18:02:40 -0700716 if (!fb)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600717 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700718
719 *fb_ret = fb;
720
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600721 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700722
723}
724
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600725static VkResult nulldrv_render_pass_create(struct nulldrv_dev *dev,
726 const VkRenderPassCreateInfo* info,
David Pinedo0257fbf2015-02-02 18:02:40 -0700727 struct nulldrv_render_pass** rp_ret)
728{
729 struct nulldrv_render_pass *rp;
730 rp = (struct nulldrv_render_pass *) nulldrv_base_create(dev, sizeof(*rp),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600731 VK_DBG_OBJECT_RENDER_PASS);
David Pinedo0257fbf2015-02-02 18:02:40 -0700732 if (!rp)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600733 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -0700734
735 *rp_ret = rp;
736
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600737 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700738}
739
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600740static struct nulldrv_buf *nulldrv_buf(VkBuffer buf)
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700741{
742 return (struct nulldrv_buf *) buf;
743}
744
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600745static VkResult nulldrv_buf_view_create(struct nulldrv_dev *dev,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600746 const VkBufferViewCreateInfo *info,
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700747 struct nulldrv_buf_view **view_ret)
748{
749 struct nulldrv_buf *buf = nulldrv_buf(info->buffer);
750 struct nulldrv_buf_view *view;
751
752 view = (struct nulldrv_buf_view *) nulldrv_base_create(dev, sizeof(*view),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600753 VK_DBG_OBJECT_BUFFER_VIEW);
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700754 if (!view)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600755 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700756
757 view->buf = buf;
758
759 *view_ret = view;
760
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600761 return VK_SUCCESS;
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700762}
763
David Pinedo0257fbf2015-02-02 18:02:40 -0700764
765//*********************************************
766// Driver entry points
767//*********************************************
768
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600769ICD_EXPORT VkResult VKAPI vkCreateBuffer(
770 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600771 const VkBufferCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600772 VkBuffer* pBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700773{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700774 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700775 struct nulldrv_dev *dev = nulldrv_dev(device);
776
777 return nulldrv_buf_create(dev, pCreateInfo, (struct nulldrv_buf **) pBuffer);
778}
779
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600780ICD_EXPORT VkResult VKAPI vkCreateCommandBuffer(
781 VkDevice device,
782 const VkCmdBufferCreateInfo* pCreateInfo,
783 VkCmdBuffer* pCmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700784{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700785 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700786 struct nulldrv_dev *dev = nulldrv_dev(device);
787
788 return nulldrv_cmd_create(dev, pCreateInfo,
789 (struct nulldrv_cmd **) pCmdBuffer);
790}
791
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600792ICD_EXPORT VkResult VKAPI vkBeginCommandBuffer(
793 VkCmdBuffer cmdBuffer,
794 const VkCmdBufferBeginInfo *info)
David Pinedo0257fbf2015-02-02 18:02:40 -0700795{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700796 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600797 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700798}
799
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600800ICD_EXPORT VkResult VKAPI vkEndCommandBuffer(
801 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700802{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700803 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600804 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700805}
806
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600807ICD_EXPORT VkResult VKAPI vkResetCommandBuffer(
808 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700809{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700810 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600811 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -0700812}
813
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600814ICD_EXPORT void VKAPI vkCmdInitAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600815 VkCmdBuffer cmdBuffer,
816 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700817 uint32_t startCounter,
818 uint32_t counterCount,
819 const uint32_t* pData)
820{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700821 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700822}
823
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600824ICD_EXPORT void VKAPI vkCmdLoadAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600825 VkCmdBuffer cmdBuffer,
826 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700827 uint32_t startCounter,
828 uint32_t counterCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600829 VkBuffer srcBuffer,
830 VkGpuSize srcOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700831{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700832 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700833}
834
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600835ICD_EXPORT void VKAPI vkCmdSaveAtomicCounters(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600836 VkCmdBuffer cmdBuffer,
837 VkPipelineBindPoint pipelineBindPoint,
David Pinedo0257fbf2015-02-02 18:02:40 -0700838 uint32_t startCounter,
839 uint32_t counterCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600840 VkBuffer destBuffer,
841 VkGpuSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -0700842{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700843 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700844}
845
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600846ICD_EXPORT void VKAPI vkCmdDbgMarkerBegin(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600847 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700848 const char* pMarker)
849{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700850 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700851}
852
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600853ICD_EXPORT void VKAPI vkCmdDbgMarkerEnd(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600854 VkCmdBuffer cmdBuffer)
David Pinedo0257fbf2015-02-02 18:02:40 -0700855{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700856 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700857}
858
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600859ICD_EXPORT void VKAPI vkCmdCopyBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600860 VkCmdBuffer cmdBuffer,
861 VkBuffer srcBuffer,
862 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700863 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600864 const VkBufferCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700865{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700866 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700867}
868
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600869ICD_EXPORT void VKAPI vkCmdCopyImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600870 VkCmdBuffer cmdBuffer,
871 VkImage srcImage,
872 VkImageLayout srcImageLayout,
873 VkImage destImage,
874 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700875 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600876 const VkImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700877{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700878 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700879}
880
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600881ICD_EXPORT void VKAPI vkCmdBlitImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600882 VkCmdBuffer cmdBuffer,
883 VkImage srcImage,
884 VkImageLayout srcImageLayout,
885 VkImage destImage,
886 VkImageLayout destImageLayout,
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600887 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600888 const VkImageBlit* pRegions)
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600889{
890 NULLDRV_LOG_FUNC;
891}
892
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600893ICD_EXPORT void VKAPI vkCmdCopyBufferToImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600894 VkCmdBuffer cmdBuffer,
895 VkBuffer srcBuffer,
896 VkImage destImage,
897 VkImageLayout destImageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700898 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600899 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700900{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700901 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700902}
903
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600904ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600905 VkCmdBuffer cmdBuffer,
906 VkImage srcImage,
907 VkImageLayout srcImageLayout,
908 VkBuffer destBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -0700909 uint32_t regionCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600910 const VkBufferImageCopy* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700911{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700912 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700913}
914
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600915ICD_EXPORT void VKAPI vkCmdCloneImageData(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600916 VkCmdBuffer cmdBuffer,
917 VkImage srcImage,
918 VkImageLayout srcImageLayout,
919 VkImage destImage,
920 VkImageLayout destImageLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -0700921{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700922 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700923}
924
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600925ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600926 VkCmdBuffer cmdBuffer,
927 VkBuffer destBuffer,
928 VkGpuSize destOffset,
929 VkGpuSize dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700930 const uint32_t* pData)
931{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700932 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700933}
934
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600935ICD_EXPORT void VKAPI vkCmdFillBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600936 VkCmdBuffer cmdBuffer,
937 VkBuffer destBuffer,
938 VkGpuSize destOffset,
939 VkGpuSize fillSize,
David Pinedo0257fbf2015-02-02 18:02:40 -0700940 uint32_t data)
941{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700942 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700943}
944
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600945ICD_EXPORT void VKAPI vkCmdClearColorImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600946 VkCmdBuffer cmdBuffer,
947 VkImage image,
948 VkImageLayout imageLayout,
949 VkClearColor color,
David Pinedo0257fbf2015-02-02 18:02:40 -0700950 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600951 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -0700952{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700953 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700954}
955
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600956ICD_EXPORT void VKAPI vkCmdClearDepthStencil(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600957 VkCmdBuffer cmdBuffer,
958 VkImage image,
959 VkImageLayout imageLayout,
David Pinedo0257fbf2015-02-02 18:02:40 -0700960 float depth,
961 uint32_t stencil,
962 uint32_t rangeCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600963 const VkImageSubresourceRange* pRanges)
David Pinedo0257fbf2015-02-02 18:02:40 -0700964{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700965 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700966}
967
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600968ICD_EXPORT void VKAPI vkCmdResolveImage(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600969 VkCmdBuffer cmdBuffer,
970 VkImage srcImage,
971 VkImageLayout srcImageLayout,
972 VkImage destImage,
973 VkImageLayout destImageLayout,
Tony Barbour11f74372015-04-13 15:02:52 -0600974 uint32_t regionCount,
975 const VkImageResolve* pRegions)
David Pinedo0257fbf2015-02-02 18:02:40 -0700976{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700977 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700978}
979
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600980ICD_EXPORT void VKAPI vkCmdBeginQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600981 VkCmdBuffer cmdBuffer,
982 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -0700983 uint32_t slot,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600984 VkFlags flags)
David Pinedo0257fbf2015-02-02 18:02:40 -0700985{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700986 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700987}
988
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600989ICD_EXPORT void VKAPI vkCmdEndQuery(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600990 VkCmdBuffer cmdBuffer,
991 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -0700992 uint32_t slot)
993{
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700994 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -0700995}
996
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600997ICD_EXPORT void VKAPI vkCmdResetQueryPool(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600998 VkCmdBuffer cmdBuffer,
999 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001000 uint32_t startQuery,
1001 uint32_t queryCount)
1002{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001003 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001004}
1005
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001006ICD_EXPORT void VKAPI vkCmdSetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001007 VkCmdBuffer cmdBuffer,
1008 VkEvent event_,
1009 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001010{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001011 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001012}
1013
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001014ICD_EXPORT void VKAPI vkCmdResetEvent(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001015 VkCmdBuffer cmdBuffer,
1016 VkEvent event_,
1017 VkPipeEvent pipeEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001018{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001019 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001020}
1021
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001022ICD_EXPORT void VKAPI vkCmdWriteTimestamp(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001023 VkCmdBuffer cmdBuffer,
1024 VkTimestampType timestampType,
1025 VkBuffer destBuffer,
1026 VkGpuSize destOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001027{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001028 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001029}
1030
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001031ICD_EXPORT void VKAPI vkCmdBindPipeline(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001032 VkCmdBuffer cmdBuffer,
1033 VkPipelineBindPoint pipelineBindPoint,
1034 VkPipeline pipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001035{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001036 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001037}
1038
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001039ICD_EXPORT void VKAPI vkCmdBindDynamicStateObject(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001040 VkCmdBuffer cmdBuffer,
1041 VkStateBindPoint stateBindPoint,
1042 VkDynamicStateObject state)
David Pinedo0257fbf2015-02-02 18:02:40 -07001043{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001044 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001045}
1046
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001047ICD_EXPORT void VKAPI vkCmdBindDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001048 VkCmdBuffer cmdBuffer,
1049 VkPipelineBindPoint pipelineBindPoint,
1050 VkDescriptorSetLayoutChain layoutChain,
Chia-I Wu862c5572015-03-28 15:23:55 +08001051 uint32_t layoutChainSlot,
1052 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001053 const VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07001054 const uint32_t* pUserData)
1055{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001056 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001057}
1058
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001059ICD_EXPORT void VKAPI vkCmdBindVertexBuffers(
1060 VkCmdBuffer cmdBuffer,
1061 uint32_t startBinding,
1062 uint32_t bindingCount,
1063 const VkBuffer* pBuffers,
1064 const VkGpuSize* pOffsets)
David Pinedo0257fbf2015-02-02 18:02:40 -07001065{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001066 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001067}
1068
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001069ICD_EXPORT void VKAPI vkCmdBindIndexBuffer(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001070 VkCmdBuffer cmdBuffer,
1071 VkBuffer buffer,
1072 VkGpuSize offset,
1073 VkIndexType indexType)
David Pinedo0257fbf2015-02-02 18:02:40 -07001074{
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 vkCmdDraw(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001079 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001080 uint32_t firstVertex,
1081 uint32_t vertexCount,
1082 uint32_t firstInstance,
1083 uint32_t instanceCount)
1084{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001085 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001086}
1087
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001088ICD_EXPORT void VKAPI vkCmdDrawIndexed(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001089 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001090 uint32_t firstIndex,
1091 uint32_t indexCount,
1092 int32_t vertexOffset,
1093 uint32_t firstInstance,
1094 uint32_t instanceCount)
1095{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001096 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001097}
1098
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001099ICD_EXPORT void VKAPI vkCmdDrawIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001100 VkCmdBuffer cmdBuffer,
1101 VkBuffer buffer,
1102 VkGpuSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001103 uint32_t count,
1104 uint32_t stride)
1105{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001106 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001107}
1108
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001109ICD_EXPORT void VKAPI vkCmdDrawIndexedIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001110 VkCmdBuffer cmdBuffer,
1111 VkBuffer buffer,
1112 VkGpuSize offset,
David Pinedo0257fbf2015-02-02 18:02:40 -07001113 uint32_t count,
1114 uint32_t stride)
1115{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001116 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001117}
1118
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001119ICD_EXPORT void VKAPI vkCmdDispatch(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001120 VkCmdBuffer cmdBuffer,
David Pinedo0257fbf2015-02-02 18:02:40 -07001121 uint32_t x,
1122 uint32_t y,
1123 uint32_t z)
1124{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001125 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001126}
1127
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001128ICD_EXPORT void VKAPI vkCmdDispatchIndirect(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001129 VkCmdBuffer cmdBuffer,
1130 VkBuffer buffer,
1131 VkGpuSize offset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001132{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001133 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001134}
1135
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001136ICD_EXPORT void VKAPI vkCmdWaitEvents(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001137 VkCmdBuffer cmdBuffer,
1138 const VkEventWaitInfo* pWaitInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001139{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001140 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001141}
1142
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001143ICD_EXPORT void VKAPI vkCmdPipelineBarrier(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001144 VkCmdBuffer cmdBuffer,
1145 const VkPipelineBarrier* pBarrier)
David Pinedo0257fbf2015-02-02 18:02:40 -07001146{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001147 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001148}
1149
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001150ICD_EXPORT VkResult VKAPI vkCreateDevice(
1151 VkPhysicalGpu gpu_,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001152 const VkDeviceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001153 VkDevice* pDevice)
David Pinedo0257fbf2015-02-02 18:02:40 -07001154{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001155 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001156 struct nulldrv_gpu *gpu = nulldrv_gpu(gpu_);
1157 return nulldrv_dev_create(gpu, pCreateInfo, (struct nulldrv_dev**)pDevice);
1158}
1159
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001160ICD_EXPORT VkResult VKAPI vkDestroyDevice(
1161 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001162{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001163 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001164 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001165}
1166
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001167ICD_EXPORT VkResult VKAPI vkGetDeviceQueue(
1168 VkDevice device,
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -07001169 uint32_t queueNodeIndex,
David Pinedo0257fbf2015-02-02 18:02:40 -07001170 uint32_t queueIndex,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001171 VkQueue* pQueue)
David Pinedo0257fbf2015-02-02 18:02:40 -07001172{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001173 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001174 struct nulldrv_dev *dev = nulldrv_dev(device);
1175 *pQueue = dev->queues[0];
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001176 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001177}
1178
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001179ICD_EXPORT VkResult VKAPI vkDeviceWaitIdle(
1180 VkDevice device)
David Pinedo0257fbf2015-02-02 18:02:40 -07001181{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001182 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001183 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001184}
1185
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001186ICD_EXPORT VkResult VKAPI vkDbgSetValidationLevel(
1187 VkDevice device,
1188 VkValidationLevel validationLevel)
David Pinedo0257fbf2015-02-02 18:02:40 -07001189{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001190 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001191 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001192}
1193
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001194ICD_EXPORT VkResult VKAPI vkDbgSetMessageFilter(
1195 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001196 int32_t msgCode,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001197 VK_DBG_MSG_FILTER filter)
David Pinedo0257fbf2015-02-02 18:02:40 -07001198{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001199 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001200 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001201}
1202
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001203ICD_EXPORT VkResult VKAPI vkDbgSetDeviceOption(
1204 VkDevice device,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001205 VK_DBG_DEVICE_OPTION dbgOption,
David Pinedo0257fbf2015-02-02 18:02:40 -07001206 size_t dataSize,
1207 const void* pData)
1208{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001209 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001210 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001211}
1212
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001213ICD_EXPORT VkResult VKAPI vkCreateEvent(
1214 VkDevice device,
1215 const VkEventCreateInfo* pCreateInfo,
1216 VkEvent* pEvent)
David Pinedo0257fbf2015-02-02 18:02:40 -07001217{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001218 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001219 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001220}
1221
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001222ICD_EXPORT VkResult VKAPI vkGetEventStatus(
1223 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001224{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001225 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001226 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001227}
1228
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001229ICD_EXPORT VkResult VKAPI vkSetEvent(
1230 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001231{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001232 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001233 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001234}
1235
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001236ICD_EXPORT VkResult VKAPI vkResetEvent(
1237 VkEvent event_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001238{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001239 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001240 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001241}
1242
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001243ICD_EXPORT VkResult VKAPI vkCreateFence(
1244 VkDevice device,
1245 const VkFenceCreateInfo* pCreateInfo,
1246 VkFence* pFence)
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 struct nulldrv_dev *dev = nulldrv_dev(device);
1250
1251 return nulldrv_fence_create(dev, pCreateInfo,
1252 (struct nulldrv_fence **) pFence);
1253}
1254
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001255ICD_EXPORT VkResult VKAPI vkGetFenceStatus(
1256 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001257{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001258 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001259 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001260}
1261
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001262ICD_EXPORT VkResult VKAPI vkResetFences(
1263 VkDevice device,
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001264 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001265 VkFence* pFences)
Courtney Goeltzenleuchter1042b472015-04-14 19:07:06 -06001266{
1267 NULLDRV_LOG_FUNC;
1268 return VK_SUCCESS;
1269}
1270
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001271ICD_EXPORT VkResult VKAPI vkWaitForFences(
1272 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001273 uint32_t fenceCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001274 const VkFence* pFences,
David Pinedo0257fbf2015-02-02 18:02:40 -07001275 bool32_t waitAll,
1276 uint64_t timeout)
1277{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001278 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001279 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001280}
1281
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001282ICD_EXPORT VkResult VKAPI vkGetFormatInfo(
1283 VkDevice device,
1284 VkFormat format,
1285 VkFormatInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001286 size_t* pDataSize,
1287 void* pData)
1288{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001289 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001290 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001291}
1292
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001293ICD_EXPORT VkResult VKAPI vkGetGpuInfo(
1294 VkPhysicalGpu gpu_,
1295 VkPhysicalGpuInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001296 size_t* pDataSize,
1297 void* pData)
1298{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001299 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001300 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001301}
1302
Jon Ashburneb2728b2015-04-10 14:33:07 -06001303ICD_EXPORT VkResult VKAPI vkGetGlobalExtensionInfo(
1304 VkExtensionInfoType infoType,
1305 uint32_t extensionIndex,
1306 size_t* pDataSize,
1307 void* pData)
1308{
1309 uint32_t *count;
1310
1311 if (pDataSize == NULL)
1312 return VK_ERROR_INVALID_POINTER;
1313
1314 switch (infoType) {
1315 case VK_EXTENSION_INFO_TYPE_COUNT:
1316 *pDataSize = sizeof(uint32_t);
1317 if (pData == NULL)
1318 return VK_SUCCESS;
1319 count = (uint32_t *) pData;
1320 *count = 0;
1321 break;
1322 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
1323 *pDataSize = 0;
1324 if (pData == NULL)
1325 return VK_SUCCESS;
1326 else
1327 return VK_ERROR_INVALID_EXTENSION;
1328 break;
1329 default:
1330 return VK_ERROR_INVALID_VALUE;
1331 };
1332
1333 return VK_SUCCESS;
1334}
1335
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001336VkResult VKAPI vkGetPhysicalDeviceExtensionInfo(
1337 VkPhysicalGpu gpu,
1338 VkExtensionInfoType infoType,
1339 uint32_t extensionIndex,
1340 size_t* pDataSize,
1341 void* pData)
David Pinedo0257fbf2015-02-02 18:02:40 -07001342{
Tobin Ehlis0ef6ec52015-04-16 12:51:37 -06001343 uint32_t *count;
1344
1345 if (pDataSize == NULL)
1346 return VK_ERROR_INVALID_POINTER;
1347
1348 switch (infoType) {
1349 case VK_EXTENSION_INFO_TYPE_COUNT:
1350 *pDataSize = sizeof(uint32_t);
1351 if (pData == NULL)
1352 return VK_SUCCESS;
1353 count = (uint32_t *) pData;
1354 *count = 0;
1355 break;
1356 case VK_EXTENSION_INFO_TYPE_PROPERTIES:
1357 *pDataSize = 0;
1358 if (pData == NULL)
1359 return VK_SUCCESS;
1360 return VK_ERROR_INVALID_EXTENSION;
1361 break;
1362 default:
1363 return VK_ERROR_INVALID_VALUE;
1364 };
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001365 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001366}
1367
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001368ICD_EXPORT VkResult VKAPI vkGetMultiGpuCompatibility(
1369 VkPhysicalGpu gpu0_,
1370 VkPhysicalGpu gpu1_,
1371 VkGpuCompatibilityInfo* pInfo)
David Pinedo0257fbf2015-02-02 18:02:40 -07001372{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001373 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001374 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001375}
1376
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001377ICD_EXPORT VkResult VKAPI vkOpenPeerImage(
1378 VkDevice device,
1379 const VkPeerImageOpenInfo* pOpenInfo,
1380 VkImage* pImage,
1381 VkGpuMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001382{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001383 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001384 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001385}
1386
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001387ICD_EXPORT VkResult VKAPI vkCreateImage(
1388 VkDevice device,
1389 const VkImageCreateInfo* pCreateInfo,
1390 VkImage* pImage)
David Pinedo0257fbf2015-02-02 18:02:40 -07001391{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001392 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001393 struct nulldrv_dev *dev = nulldrv_dev(device);
1394
1395 return nulldrv_img_create(dev, pCreateInfo, false,
1396 (struct nulldrv_img **) pImage);
1397}
1398
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001399ICD_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(
1400 VkImage image,
1401 const VkImageSubresource* pSubresource,
1402 VkSubresourceInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001403 size_t* pDataSize,
1404 void* pData)
1405{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001406 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001407 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001408
1409 switch (infoType) {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001410 case VK_INFO_TYPE_SUBRESOURCE_LAYOUT:
David Pinedo0257fbf2015-02-02 18:02:40 -07001411 {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001412 VkSubresourceLayout *layout = (VkSubresourceLayout *) pData;
David Pinedo0257fbf2015-02-02 18:02:40 -07001413
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001414 *pDataSize = sizeof(VkSubresourceLayout);
David Pinedo0257fbf2015-02-02 18:02:40 -07001415
1416 if (pData == NULL)
1417 return ret;
1418 layout->offset = 0;
1419 layout->size = 1;
1420 layout->rowPitch = 4;
1421 layout->depthPitch = 4;
1422 }
1423 break;
1424 default:
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001425 ret = VK_ERROR_INVALID_VALUE;
David Pinedo0257fbf2015-02-02 18:02:40 -07001426 break;
1427 }
1428
1429 return ret;
1430}
1431
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001432ICD_EXPORT VkResult VKAPI vkAllocMemory(
1433 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001434 const VkMemoryAllocInfo* pAllocInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001435 VkGpuMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001436{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001437 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001438 struct nulldrv_dev *dev = nulldrv_dev(device);
1439
1440 return nulldrv_mem_alloc(dev, pAllocInfo, (struct nulldrv_mem **) pMem);
1441}
1442
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001443ICD_EXPORT VkResult VKAPI vkFreeMemory(
1444 VkGpuMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001445{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001446 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001447 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001448}
1449
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001450ICD_EXPORT VkResult VKAPI vkSetMemoryPriority(
1451 VkGpuMemory mem_,
1452 VkMemoryPriority priority)
David Pinedo0257fbf2015-02-02 18:02:40 -07001453{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001454 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001455 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001456}
1457
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001458ICD_EXPORT VkResult VKAPI vkMapMemory(
1459 VkGpuMemory mem_,
1460 VkFlags flags,
David Pinedo0257fbf2015-02-02 18:02:40 -07001461 void** ppData)
1462{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001463 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001464 struct nulldrv_mem *mem = nulldrv_mem(mem_);
1465 void *ptr = nulldrv_mem_map(mem, flags);
1466
1467 *ppData = ptr;
1468
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001469 return (ptr) ? VK_SUCCESS : VK_ERROR_UNKNOWN;
David Pinedo0257fbf2015-02-02 18:02:40 -07001470}
1471
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001472ICD_EXPORT VkResult VKAPI vkUnmapMemory(
1473 VkGpuMemory mem_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001474{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001475 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001476 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001477}
1478
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001479ICD_EXPORT VkResult VKAPI vkPinSystemMemory(
1480 VkDevice device,
David Pinedo0257fbf2015-02-02 18:02:40 -07001481 const void* pSysMem,
1482 size_t memSize,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001483 VkGpuMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001484{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001485 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001486 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001487}
1488
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001489ICD_EXPORT VkResult VKAPI vkOpenSharedMemory(
1490 VkDevice device,
1491 const VkMemoryOpenInfo* pOpenInfo,
1492 VkGpuMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001493{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001494 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001495 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001496}
1497
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001498ICD_EXPORT VkResult VKAPI vkOpenPeerMemory(
1499 VkDevice device,
1500 const VkPeerMemoryOpenInfo* pOpenInfo,
1501 VkGpuMemory* pMem)
David Pinedo0257fbf2015-02-02 18:02:40 -07001502{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001503 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001504 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001505}
1506
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001507ICD_EXPORT VkResult VKAPI vkCreateInstance(
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001508 const VkInstanceCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001509 VkInstance* pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001510{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001511 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001512 struct nulldrv_instance *inst;
1513
1514 inst = (struct nulldrv_instance *) nulldrv_base_create(NULL, sizeof(*inst),
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001515 VK_DBG_OBJECT_INSTANCE);
David Pinedo0257fbf2015-02-02 18:02:40 -07001516 if (!inst)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001517 return VK_ERROR_OUT_OF_MEMORY;
David Pinedo0257fbf2015-02-02 18:02:40 -07001518
1519 inst->obj.base.get_info = NULL;
1520
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001521 *pInstance = (VkInstance*)inst;
David Pinedo0257fbf2015-02-02 18:02:40 -07001522
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001523 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001524}
1525
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001526ICD_EXPORT VkResult VKAPI vkDestroyInstance(
1527 VkInstance pInstance)
David Pinedo0257fbf2015-02-02 18:02:40 -07001528{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001529 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001530 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001531}
1532
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001533ICD_EXPORT VkResult VKAPI vkEnumerateGpus(
1534 VkInstance instance,
David Pinedo0257fbf2015-02-02 18:02:40 -07001535 uint32_t maxGpus,
1536 uint32_t* pGpuCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001537 VkPhysicalGpu* pGpus)
David Pinedo0257fbf2015-02-02 18:02:40 -07001538{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001539 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001540 VkResult ret;
David Pinedo0257fbf2015-02-02 18:02:40 -07001541 struct nulldrv_gpu *gpu;
1542 *pGpuCount = 1;
1543 ret = nulldrv_gpu_add(0, 0, 0, &gpu);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001544 if (ret == VK_SUCCESS)
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001545 pGpus[0] = (VkPhysicalGpu) gpu;
David Pinedo0257fbf2015-02-02 18:02:40 -07001546 return ret;
1547}
1548
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001549ICD_EXPORT VkResult VKAPI vkEnumerateLayers(
1550 VkPhysicalGpu gpu,
David Pinedo0257fbf2015-02-02 18:02:40 -07001551 size_t maxLayerCount,
1552 size_t maxStringSize,
1553 size_t* pOutLayerCount,
1554 char* const* pOutLayers,
1555 void* pReserved)
1556{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001557 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001558 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001559}
1560
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001561ICD_EXPORT VkResult VKAPI vkDbgRegisterMsgCallback(
1562 VkInstance instance,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001563 VK_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback,
David Pinedo0257fbf2015-02-02 18:02:40 -07001564 void* pUserData)
1565{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001566 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001567 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001568}
1569
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001570ICD_EXPORT VkResult VKAPI vkDbgUnregisterMsgCallback(
1571 VkInstance instance,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001572 VK_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback)
David Pinedo0257fbf2015-02-02 18:02:40 -07001573{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001574 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001575 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001576}
1577
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001578ICD_EXPORT VkResult VKAPI vkDbgSetGlobalOption(
1579 VkInstance instance,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001580 VK_DBG_GLOBAL_OPTION dbgOption,
David Pinedo0257fbf2015-02-02 18:02:40 -07001581 size_t dataSize,
1582 const void* pData)
1583{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001584 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001585 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001586}
1587
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001588ICD_EXPORT VkResult VKAPI vkDestroyObject(
1589 VkObject object)
David Pinedo0257fbf2015-02-02 18:02:40 -07001590{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001591 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001592 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001593}
1594
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001595ICD_EXPORT VkResult VKAPI vkGetObjectInfo(
1596 VkBaseObject object,
1597 VkObjectInfoType infoType,
David Pinedo0257fbf2015-02-02 18:02:40 -07001598 size_t* pDataSize,
1599 void* pData)
1600{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001601 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001602 struct nulldrv_base *base = nulldrv_base(object);
1603
1604 return base->get_info(base, infoType, pDataSize, pData);
1605}
1606
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001607ICD_EXPORT VkResult VKAPI vkQueueBindObjectMemory(
1608 VkQueue queue,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001609 VkObject object,
David Pinedo0257fbf2015-02-02 18:02:40 -07001610 uint32_t allocationIdx,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001611 VkGpuMemory mem_,
1612 VkGpuSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001613{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001614 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001615 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001616}
1617
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001618ICD_EXPORT VkResult VKAPI vkQueueBindObjectMemoryRange(
1619 VkQueue queue,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001620 VkObject object,
David Pinedo0257fbf2015-02-02 18:02:40 -07001621 uint32_t allocationIdx,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001622 VkGpuSize rangeOffset,
1623 VkGpuSize rangeSize,
1624 VkGpuMemory mem,
1625 VkGpuSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001626{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001627 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001628 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001629}
1630
Mark Lobodzinskicf26e072015-04-16 11:44:05 -05001631ICD_EXPORT VkResult VKAPI vkQueueBindImageMemoryRange(
1632 VkQueue queue,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001633 VkImage image,
David Pinedo0257fbf2015-02-02 18:02:40 -07001634 uint32_t allocationIdx,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001635 const VkImageMemoryBindInfo* bindInfo,
1636 VkGpuMemory mem,
1637 VkGpuSize memOffset)
David Pinedo0257fbf2015-02-02 18:02:40 -07001638{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001639 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001640 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001641}
1642
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001643ICD_EXPORT VkResult VKAPI vkDbgSetObjectTag(
1644 VkBaseObject object,
David Pinedo0257fbf2015-02-02 18:02:40 -07001645 size_t tagSize,
1646 const void* pTag)
1647{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001648 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001649 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001650}
1651
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001652ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(
1653 VkDevice device,
1654 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1655 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001656{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001657 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001658 struct nulldrv_dev *dev = nulldrv_dev(device);
1659
1660 return graphics_pipeline_create(dev, pCreateInfo,
1661 (struct nulldrv_pipeline **) pPipeline);
1662}
1663
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001664ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(
1665 VkDevice device,
1666 const VkGraphicsPipelineCreateInfo* pCreateInfo,
1667 VkPipeline basePipeline,
1668 VkPipeline* pPipeline)
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001669{
1670 NULLDRV_LOG_FUNC;
1671 struct nulldrv_dev *dev = nulldrv_dev(device);
1672
1673 return graphics_pipeline_create(dev, pCreateInfo,
1674 (struct nulldrv_pipeline **) pPipeline);
1675}
1676
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001677ICD_EXPORT VkResult VKAPI vkCreateComputePipeline(
1678 VkDevice device,
1679 const VkComputePipelineCreateInfo* pCreateInfo,
1680 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001681{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001682 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001683 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001684}
1685
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001686ICD_EXPORT VkResult VKAPI vkStorePipeline(
1687 VkPipeline pipeline,
David Pinedo0257fbf2015-02-02 18:02:40 -07001688 size_t* pDataSize,
1689 void* pData)
1690{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001691 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001692 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001693}
1694
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001695ICD_EXPORT VkResult VKAPI vkLoadPipeline(
1696 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001697 size_t dataSize,
David Pinedo0257fbf2015-02-02 18:02:40 -07001698 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001699 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001700{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001701 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001702 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001703}
1704
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001705ICD_EXPORT VkResult VKAPI vkLoadPipelineDerivative(
1706 VkDevice device,
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -06001707 size_t dataSize,
1708 const void* pData,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001709 VkPipeline basePipeline,
1710 VkPipeline* pPipeline)
David Pinedo0257fbf2015-02-02 18:02:40 -07001711{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001712 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001713 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001714}
1715
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001716ICD_EXPORT VkResult VKAPI vkCreateQueryPool(
1717 VkDevice device,
1718 const VkQueryPoolCreateInfo* pCreateInfo,
1719 VkQueryPool* pQueryPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001720{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001721 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001722 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001723}
1724
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001725ICD_EXPORT VkResult VKAPI vkGetQueryPoolResults(
1726 VkQueryPool queryPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07001727 uint32_t startQuery,
1728 uint32_t queryCount,
1729 size_t* pDataSize,
1730 void* pData)
1731{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001732 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001733 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001734}
1735
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001736ICD_EXPORT VkResult VKAPI vkQueueAddMemReferences(
1737 VkQueue queue,
1738 uint32_t count,
1739 const VkGpuMemory* pMems)
Courtney Goeltzenleuchtercfedf362015-04-02 13:39:07 -06001740{
1741 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001742 return VK_SUCCESS;
Courtney Goeltzenleuchtercfedf362015-04-02 13:39:07 -06001743}
1744
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -06001745ICD_EXPORT VkResult VKAPI vkQueueRemoveMemReferences(
1746 VkQueue queue,
1747 uint32_t count,
1748 const VkGpuMemory* pMems)
Courtney Goeltzenleuchtercfedf362015-04-02 13:39:07 -06001749{
1750 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001751 return VK_SUCCESS;
Courtney Goeltzenleuchtercfedf362015-04-02 13:39:07 -06001752}
1753
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001754ICD_EXPORT VkResult VKAPI vkQueueWaitIdle(
1755 VkQueue queue_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001756{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001757 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001758 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001759}
1760
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001761ICD_EXPORT VkResult VKAPI vkQueueSubmit(
1762 VkQueue queue_,
David Pinedo0257fbf2015-02-02 18:02:40 -07001763 uint32_t cmdBufferCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001764 const VkCmdBuffer* pCmdBuffers,
1765 VkFence fence_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001766{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001767 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001768 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001769}
1770
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001771ICD_EXPORT VkResult VKAPI vkOpenSharedSemaphore(
1772 VkDevice device,
1773 const VkSemaphoreOpenInfo* pOpenInfo,
1774 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001775{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001776 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001777 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001778}
1779
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001780ICD_EXPORT VkResult VKAPI vkCreateSemaphore(
1781 VkDevice device,
1782 const VkSemaphoreCreateInfo* pCreateInfo,
1783 VkSemaphore* pSemaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001784{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001785 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001786 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001787}
1788
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001789ICD_EXPORT VkResult VKAPI vkQueueSignalSemaphore(
1790 VkQueue queue,
1791 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001792{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001793 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001794 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001795}
1796
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001797ICD_EXPORT VkResult VKAPI vkQueueWaitSemaphore(
1798 VkQueue queue,
1799 VkSemaphore semaphore)
David Pinedo0257fbf2015-02-02 18:02:40 -07001800{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001801 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001802 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001803}
1804
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001805ICD_EXPORT VkResult VKAPI vkCreateSampler(
1806 VkDevice device,
1807 const VkSamplerCreateInfo* pCreateInfo,
1808 VkSampler* pSampler)
David Pinedo0257fbf2015-02-02 18:02:40 -07001809{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001810 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001811 struct nulldrv_dev *dev = nulldrv_dev(device);
1812
1813 return nulldrv_sampler_create(dev, pCreateInfo,
1814 (struct nulldrv_sampler **) pSampler);
1815}
1816
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001817ICD_EXPORT VkResult VKAPI vkCreateShader(
1818 VkDevice device,
1819 const VkShaderCreateInfo* pCreateInfo,
1820 VkShader* pShader)
David Pinedo0257fbf2015-02-02 18:02:40 -07001821{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001822 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001823 struct nulldrv_dev *dev = nulldrv_dev(device);
1824
1825 return shader_create(dev, pCreateInfo, (struct nulldrv_shader **) pShader);
1826}
1827
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001828ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
1829 VkDevice device,
1830 const VkDynamicVpStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001831 VkDynamicVpState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001832{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001833 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001834 struct nulldrv_dev *dev = nulldrv_dev(device);
1835
1836 return nulldrv_viewport_state_create(dev, pCreateInfo,
1837 (struct nulldrv_dynamic_vp **) pState);
1838}
1839
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001840ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
1841 VkDevice device,
1842 const VkDynamicRsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001843 VkDynamicRsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001844{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001845 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001846 struct nulldrv_dev *dev = nulldrv_dev(device);
1847
1848 return nulldrv_raster_state_create(dev, pCreateInfo,
1849 (struct nulldrv_dynamic_rs **) pState);
1850}
1851
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001852ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
1853 VkDevice device,
1854 const VkDynamicCbStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001855 VkDynamicCbState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001856{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001857 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001858 struct nulldrv_dev *dev = nulldrv_dev(device);
1859
1860 return nulldrv_blend_state_create(dev, pCreateInfo,
1861 (struct nulldrv_dynamic_cb **) pState);
1862}
1863
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001864ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
1865 VkDevice device,
1866 const VkDynamicDsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -06001867 VkDynamicDsState* pState)
David Pinedo0257fbf2015-02-02 18:02:40 -07001868{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001869 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001870 struct nulldrv_dev *dev = nulldrv_dev(device);
1871
1872 return nulldrv_ds_state_create(dev, pCreateInfo,
1873 (struct nulldrv_dynamic_ds **) pState);
1874}
1875
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001876ICD_EXPORT VkResult VKAPI vkCreateBufferView(
1877 VkDevice device,
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -06001878 const VkBufferViewCreateInfo* pCreateInfo,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001879 VkBufferView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001880{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001881 NULLDRV_LOG_FUNC;
1882 struct nulldrv_dev *dev = nulldrv_dev(device);
1883
1884 return nulldrv_buf_view_create(dev, pCreateInfo,
1885 (struct nulldrv_buf_view **) pView);
David Pinedo0257fbf2015-02-02 18:02:40 -07001886}
1887
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001888ICD_EXPORT VkResult VKAPI vkCreateImageView(
1889 VkDevice device,
1890 const VkImageViewCreateInfo* pCreateInfo,
1891 VkImageView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001892{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001893 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001894 struct nulldrv_dev *dev = nulldrv_dev(device);
1895
1896 return nulldrv_img_view_create(dev, pCreateInfo,
1897 (struct nulldrv_img_view **) pView);
1898}
1899
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001900ICD_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
1901 VkDevice device,
1902 const VkColorAttachmentViewCreateInfo* pCreateInfo,
1903 VkColorAttachmentView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001904{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001905 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001906 struct nulldrv_dev *dev = nulldrv_dev(device);
1907
1908 return nulldrv_rt_view_create(dev, pCreateInfo,
1909 (struct nulldrv_rt_view **) pView);
1910}
1911
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001912ICD_EXPORT VkResult VKAPI vkCreateDepthStencilView(
1913 VkDevice device,
1914 const VkDepthStencilViewCreateInfo* pCreateInfo,
1915 VkDepthStencilView* pView)
David Pinedo0257fbf2015-02-02 18:02:40 -07001916{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001917 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001918 struct nulldrv_dev *dev = nulldrv_dev(device);
1919
1920 return nulldrv_ds_view_create(dev, pCreateInfo,
1921 (struct nulldrv_ds_view **) pView);
1922
1923}
1924
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001925ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(
1926 VkDevice device,
1927 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
1928 VkDescriptorSetLayout* pSetLayout)
David Pinedo0257fbf2015-02-02 18:02:40 -07001929{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001930 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001931 struct nulldrv_dev *dev = nulldrv_dev(device);
David Pinedo0257fbf2015-02-02 18:02:40 -07001932
Chia-I Wu7732cb22015-03-26 15:27:55 +08001933 return nulldrv_desc_layout_create(dev, pCreateInfo,
David Pinedo0257fbf2015-02-02 18:02:40 -07001934 (struct nulldrv_desc_layout **) pSetLayout);
1935}
1936
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001937ICD_EXPORT VkResult VKAPI vkCreateDescriptorSetLayoutChain(
1938 VkDevice device,
Chia-I Wu7732cb22015-03-26 15:27:55 +08001939 uint32_t setLayoutArrayCount,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001940 const VkDescriptorSetLayout* pSetLayoutArray,
1941 VkDescriptorSetLayoutChain* pLayoutChain)
Chia-I Wu7732cb22015-03-26 15:27:55 +08001942{
1943 NULLDRV_LOG_FUNC;
1944 struct nulldrv_dev *dev = nulldrv_dev(device);
1945
1946 return nulldrv_desc_layout_chain_create(dev,
1947 setLayoutArrayCount, pSetLayoutArray,
1948 (struct nulldrv_desc_layout_chain **) pLayoutChain);
1949}
1950
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001951ICD_EXPORT VkResult VKAPI vkBeginDescriptorPoolUpdate(
1952 VkDevice device,
1953 VkDescriptorUpdateMode updateMode)
David Pinedo0257fbf2015-02-02 18:02:40 -07001954{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001955 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001956 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001957}
1958
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001959ICD_EXPORT VkResult VKAPI vkEndDescriptorPoolUpdate(
1960 VkDevice device,
1961 VkCmdBuffer cmd_)
David Pinedo0257fbf2015-02-02 18:02:40 -07001962{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001963 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001964 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001965}
1966
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001967ICD_EXPORT VkResult VKAPI vkCreateDescriptorPool(
1968 VkDevice device,
1969 VkDescriptorPoolUsage poolUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07001970 uint32_t maxSets,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001971 const VkDescriptorPoolCreateInfo* pCreateInfo,
1972 VkDescriptorPool* pDescriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001973{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001974 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07001975 struct nulldrv_dev *dev = nulldrv_dev(device);
1976
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001977 return nulldrv_desc_pool_create(dev, poolUsage, maxSets, pCreateInfo,
1978 (struct nulldrv_desc_pool **) pDescriptorPool);
David Pinedo0257fbf2015-02-02 18:02:40 -07001979}
1980
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001981ICD_EXPORT VkResult VKAPI vkResetDescriptorPool(
1982 VkDescriptorPool descriptorPool)
David Pinedo0257fbf2015-02-02 18:02:40 -07001983{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001984 NULLDRV_LOG_FUNC;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06001985 return VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07001986}
1987
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001988ICD_EXPORT VkResult VKAPI vkAllocDescriptorSets(
1989 VkDescriptorPool descriptorPool,
1990 VkDescriptorSetUsage setUsage,
David Pinedo0257fbf2015-02-02 18:02:40 -07001991 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001992 const VkDescriptorSetLayout* pSetLayouts,
1993 VkDescriptorSet* pDescriptorSets,
David Pinedo0257fbf2015-02-02 18:02:40 -07001994 uint32_t* pCount)
1995{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07001996 NULLDRV_LOG_FUNC;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08001997 struct nulldrv_desc_pool *pool = nulldrv_desc_pool(descriptorPool);
1998 struct nulldrv_dev *dev = pool->dev;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06001999 VkResult ret = VK_SUCCESS;
David Pinedo0257fbf2015-02-02 18:02:40 -07002000 uint32_t i;
2001
2002 for (i = 0; i < count; i++) {
2003 const struct nulldrv_desc_layout *layout =
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002004 nulldrv_desc_layout((VkDescriptorSetLayout) pSetLayouts[i]);
David Pinedo0257fbf2015-02-02 18:02:40 -07002005
Chia-I Wu8d24b3b2015-03-26 13:14:16 +08002006 ret = nulldrv_desc_set_create(dev, pool, setUsage, layout,
David Pinedo0257fbf2015-02-02 18:02:40 -07002007 (struct nulldrv_desc_set **) &pDescriptorSets[i]);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002008 if (ret != VK_SUCCESS)
David Pinedo0257fbf2015-02-02 18:02:40 -07002009 break;
2010 }
2011
2012 if (pCount)
2013 *pCount = i;
2014
2015 return ret;
2016}
2017
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002018ICD_EXPORT void VKAPI vkClearDescriptorSets(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002019 VkDescriptorPool descriptorPool,
David Pinedo0257fbf2015-02-02 18:02:40 -07002020 uint32_t count,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002021 const VkDescriptorSet* pDescriptorSets)
David Pinedo0257fbf2015-02-02 18:02:40 -07002022{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002023 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002024}
2025
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002026ICD_EXPORT void VKAPI vkUpdateDescriptors(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002027 VkDescriptorSet descriptorSet,
Chia-I Wu7732cb22015-03-26 15:27:55 +08002028 uint32_t updateCount,
2029 const void** ppUpdateArray)
David Pinedo0257fbf2015-02-02 18:02:40 -07002030{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002031 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002032}
2033
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002034ICD_EXPORT VkResult VKAPI vkCreateFramebuffer(
2035 VkDevice device,
2036 const VkFramebufferCreateInfo* info,
2037 VkFramebuffer* fb_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002038{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002039 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002040 struct nulldrv_dev *dev = nulldrv_dev(device);
2041
2042 return nulldrv_fb_create(dev, info, (struct nulldrv_framebuffer **) fb_ret);
2043}
2044
2045
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002046ICD_EXPORT VkResult VKAPI vkCreateRenderPass(
2047 VkDevice device,
2048 const VkRenderPassCreateInfo* info,
2049 VkRenderPass* rp_ret)
David Pinedo0257fbf2015-02-02 18:02:40 -07002050{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002051 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002052 struct nulldrv_dev *dev = nulldrv_dev(device);
2053
2054 return nulldrv_render_pass_create(dev, info, (struct nulldrv_render_pass **) rp_ret);
2055}
2056
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002057ICD_EXPORT void VKAPI vkCmdBeginRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002058 VkCmdBuffer cmdBuffer,
2059 const VkRenderPassBegin* pRenderPassBegin)
David Pinedo0257fbf2015-02-02 18:02:40 -07002060{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002061 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002062}
2063
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002064ICD_EXPORT void VKAPI vkCmdEndRenderPass(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002065 VkCmdBuffer cmdBuffer,
2066 VkRenderPass renderPass)
David Pinedo0257fbf2015-02-02 18:02:40 -07002067{
David Pinedo8e9cb3b2015-02-10 15:02:08 -07002068 NULLDRV_LOG_FUNC;
David Pinedo0257fbf2015-02-02 18:02:40 -07002069}
Ian Elliottf93069f2015-02-19 14:26:19 -07002070
2071ICD_EXPORT void* xcbCreateWindow(
2072 uint16_t width,
2073 uint16_t height)
2074{
2075 static uint32_t window; // Kludge to the max
2076 NULLDRV_LOG_FUNC;
2077 return &window;
2078}
2079
2080// May not be needed, if we stub out stuf in tri.c
2081ICD_EXPORT void xcbDestroyWindow()
2082{
2083 NULLDRV_LOG_FUNC;
2084}
2085
2086ICD_EXPORT int xcbGetMessage(void *msg)
2087{
2088 NULLDRV_LOG_FUNC;
2089 return 0;
2090}
2091
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -06002092ICD_EXPORT VkResult xcbQueuePresent(void *queue, void *image, void* fence)
Ian Elliottf93069f2015-02-19 14:26:19 -07002093{
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002094 return VK_SUCCESS;
Ian Elliottf93069f2015-02-19 14:26:19 -07002095}