blob: 9931b39161084b8ce43421b138ae0a23ae756425 [file] [log] [blame]
David Pinedo0257fbf2015-02-02 18:02:40 -07001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan
David Pinedo0257fbf2015-02-02 18:02:40 -07003 *
4 * Copyright (C) 2014 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#ifndef NULLDRV_H
Mark Lobodzinski556f7212015-04-17 14:11:39 -050026#define NULLDRV_H
David Pinedo0257fbf2015-02-02 18:02:40 -070027#include <stdlib.h>
28#include <stdbool.h>
29#include <stdint.h>
30#include <string.h>
31#include <assert.h>
32
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060033#include <vulkan.h>
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060034#include <vk_debug_report_lunarg.h>
Tobin Ehlis2d1d9702015-07-03 09:42:57 -060035#include <vk_icd.h>
Chia-I Wu5b66aa52015-04-16 22:02:10 +080036#include <vk_wsi_lunarg.h>
David Pinedo0257fbf2015-02-02 18:02:40 -070037
David Pinedo0257fbf2015-02-02 18:02:40 -070038#include "icd.h"
David Pinedo0257fbf2015-02-02 18:02:40 -070039
40#include "icd-format.h"
41#include "icd-utils.h"
42
43struct nulldrv_base {
44 void *loader_data;
45 uint32_t magic;
Tony Barbour426b9052015-06-24 16:06:58 -060046 VkResult (*get_memory_requirements)(struct nulldrv_base *base, VkMemoryRequirements *pMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -070047};
48
49struct nulldrv_obj {
50 struct nulldrv_base base;
51};
52
David Pinedo0257fbf2015-02-02 18:02:40 -070053enum nulldrv_ext_type {
Chia-I Wu5b66aa52015-04-16 22:02:10 +080054 NULLDRV_EXT_WSI_LUNARG,
David Pinedo0257fbf2015-02-02 18:02:40 -070055 NULLDRV_EXT_COUNT,
56 NULLDRV_EXT_INVALID = NULLDRV_EXT_COUNT,
57};
58
59
60struct nulldrv_instance {
61 struct nulldrv_obj obj;
62};
63
64struct nulldrv_gpu {
65 void *loader_data;
66};
67
68struct nulldrv_dev {
69 struct nulldrv_base base;
70 bool exts[NULLDRV_EXT_COUNT];
Chia-I Wu8d24b3b2015-03-26 13:14:16 +080071 struct nulldrv_desc_ooxx *desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -070072 struct nulldrv_queue *queues[1];
73};
74
Chia-I Wu8d24b3b2015-03-26 13:14:16 +080075struct nulldrv_desc_ooxx {
David Pinedo0257fbf2015-02-02 18:02:40 -070076 uint32_t surface_desc_size;
77 uint32_t sampler_desc_size;
78};
79
80
81struct nulldrv_queue {
82 struct nulldrv_base base;
83 struct nulldrv_dev *dev;
84};
85
86struct nulldrv_rt_view {
87 struct nulldrv_obj obj;
88};
89
90struct nulldrv_fence {
91 struct nulldrv_obj obj;
92};
93
94struct nulldrv_img {
95 struct nulldrv_obj obj;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060096 VkImageType type;
David Pinedo0257fbf2015-02-02 18:02:40 -070097 int32_t depth;
98 uint32_t mip_levels;
99 uint32_t array_size;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600100 VkFlags usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700101 uint32_t samples;
102 size_t total_size;
103};
104
105struct nulldrv_mem {
106 struct nulldrv_base base;
107 struct nulldrv_bo *bo;
Tony Barbour8205d902015-04-16 15:59:00 -0600108 VkDeviceSize size;
David Pinedo0257fbf2015-02-02 18:02:40 -0700109};
110
111struct nulldrv_ds_view {
112 struct nulldrv_obj obj;
113 struct nulldrv_img *img;
114 uint32_t array_size;
115};
116
117struct nulldrv_sampler {
118 struct nulldrv_obj obj;
119};
120
121struct nulldrv_img_view {
122 struct nulldrv_obj obj;
123 struct nulldrv_img *img;
124 float min_lod;
125 uint32_t cmd_len;
126};
127
128struct nulldrv_buf {
129 struct nulldrv_obj obj;
Tony Barbour8205d902015-04-16 15:59:00 -0600130 VkDeviceSize size;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600131 VkFlags usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700132};
133
134struct nulldrv_desc_layout {
135 struct nulldrv_obj obj;
136};
137
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500138struct nulldrv_pipeline_layout {
Chia-I Wu7732cb22015-03-26 15:27:55 +0800139 struct nulldrv_obj obj;
140};
141
David Pinedo0257fbf2015-02-02 18:02:40 -0700142struct nulldrv_shader {
143 struct nulldrv_obj obj;
144
145};
146
David Pinedo0257fbf2015-02-02 18:02:40 -0700147struct nulldrv_pipeline {
148 struct nulldrv_obj obj;
149 struct nulldrv_dev *dev;
150};
151
152struct nulldrv_dynamic_vp {
153 struct nulldrv_obj obj;
154};
155
156struct nulldrv_dynamic_rs {
157 struct nulldrv_obj obj;
158};
159
160struct nulldrv_dynamic_cb {
161 struct nulldrv_obj obj;
162};
163
164struct nulldrv_dynamic_ds {
165 struct nulldrv_obj obj;
166};
167
168struct nulldrv_cmd {
169 struct nulldrv_obj obj;
170};
171
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800172struct nulldrv_desc_pool {
David Pinedo0257fbf2015-02-02 18:02:40 -0700173 struct nulldrv_obj obj;
174 struct nulldrv_dev *dev;
175};
176
177struct nulldrv_desc_set {
178 struct nulldrv_obj obj;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800179 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700180 const struct nulldrv_desc_layout *layout;
181};
182
183struct nulldrv_framebuffer {
184 struct nulldrv_obj obj;
185};
186
187struct nulldrv_render_pass {
188 struct nulldrv_obj obj;
189};
190
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700191struct nulldrv_buf_view {
192 struct nulldrv_obj obj;
193
194 struct nulldrv_buf *buf;
195
196 /* SURFACE_STATE */
197 uint32_t cmd[8];
198 uint32_t fs_cmd[8];
199 uint32_t cmd_len;
200};
201
Ian Elliott32536f92015-04-21 16:41:02 -0600202struct nulldrv_display {
203 struct nulldrv_base base;
204 struct nulldrv_dev *dev;
205};
206
Ian Elliott64a68e12015-04-16 11:57:46 -0600207struct nulldrv_swap_chain {
208 struct nulldrv_base base;
209 struct nulldrv_dev *dev;
210};
211
David Pinedo0257fbf2015-02-02 18:02:40 -0700212#endif /* NULLDRV_H */