blob: e40ada30fbe9940b4bb8a5053085c01a32068567 [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>
34#include <vkDbg.h>
35#include <vkIcd.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;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060046 VkResult (*get_info)(struct nulldrv_base *base, int type1,
David Pinedo0257fbf2015-02-02 18:02:40 -070047 size_t *size, void *data);
48};
49
50struct nulldrv_obj {
51 struct nulldrv_base base;
52};
53
David Pinedo0257fbf2015-02-02 18:02:40 -070054enum nulldrv_ext_type {
Chia-I Wu5b66aa52015-04-16 22:02:10 +080055 NULLDRV_EXT_WSI_LUNARG,
David Pinedo0257fbf2015-02-02 18:02:40 -070056 NULLDRV_EXT_COUNT,
57 NULLDRV_EXT_INVALID = NULLDRV_EXT_COUNT,
58};
59
60
61struct nulldrv_instance {
62 struct nulldrv_obj obj;
63};
64
65struct nulldrv_gpu {
66 void *loader_data;
67};
68
69struct nulldrv_dev {
70 struct nulldrv_base base;
71 bool exts[NULLDRV_EXT_COUNT];
Chia-I Wu8d24b3b2015-03-26 13:14:16 +080072 struct nulldrv_desc_ooxx *desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -070073 struct nulldrv_queue *queues[1];
74};
75
Chia-I Wu8d24b3b2015-03-26 13:14:16 +080076struct nulldrv_desc_ooxx {
David Pinedo0257fbf2015-02-02 18:02:40 -070077 uint32_t surface_desc_size;
78 uint32_t sampler_desc_size;
79};
80
81
82struct nulldrv_queue {
83 struct nulldrv_base base;
84 struct nulldrv_dev *dev;
85};
86
87struct nulldrv_rt_view {
88 struct nulldrv_obj obj;
89};
90
91struct nulldrv_fence {
92 struct nulldrv_obj obj;
93};
94
95struct nulldrv_img {
96 struct nulldrv_obj obj;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060097 VkImageType type;
David Pinedo0257fbf2015-02-02 18:02:40 -070098 int32_t depth;
99 uint32_t mip_levels;
100 uint32_t array_size;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600101 VkFlags usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700102 uint32_t samples;
103 size_t total_size;
104};
105
106struct nulldrv_mem {
107 struct nulldrv_base base;
108 struct nulldrv_bo *bo;
Tony Barbour8205d902015-04-16 15:59:00 -0600109 VkDeviceSize size;
David Pinedo0257fbf2015-02-02 18:02:40 -0700110};
111
112struct nulldrv_ds_view {
113 struct nulldrv_obj obj;
114 struct nulldrv_img *img;
115 uint32_t array_size;
116};
117
118struct nulldrv_sampler {
119 struct nulldrv_obj obj;
120};
121
122struct nulldrv_img_view {
123 struct nulldrv_obj obj;
124 struct nulldrv_img *img;
125 float min_lod;
126 uint32_t cmd_len;
127};
128
129struct nulldrv_buf {
130 struct nulldrv_obj obj;
Tony Barbour8205d902015-04-16 15:59:00 -0600131 VkDeviceSize size;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600132 VkFlags usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700133};
134
135struct nulldrv_desc_layout {
136 struct nulldrv_obj obj;
137};
138
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500139struct nulldrv_pipeline_layout {
Chia-I Wu7732cb22015-03-26 15:27:55 +0800140 struct nulldrv_obj obj;
141};
142
David Pinedo0257fbf2015-02-02 18:02:40 -0700143struct nulldrv_shader {
144 struct nulldrv_obj obj;
145
146};
147
David Pinedo0257fbf2015-02-02 18:02:40 -0700148struct nulldrv_pipeline {
149 struct nulldrv_obj obj;
150 struct nulldrv_dev *dev;
151};
152
153struct nulldrv_dynamic_vp {
154 struct nulldrv_obj obj;
155};
156
157struct nulldrv_dynamic_rs {
158 struct nulldrv_obj obj;
159};
160
161struct nulldrv_dynamic_cb {
162 struct nulldrv_obj obj;
163};
164
165struct nulldrv_dynamic_ds {
166 struct nulldrv_obj obj;
167};
168
169struct nulldrv_cmd {
170 struct nulldrv_obj obj;
171};
172
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800173struct nulldrv_desc_pool {
David Pinedo0257fbf2015-02-02 18:02:40 -0700174 struct nulldrv_obj obj;
175 struct nulldrv_dev *dev;
176};
177
178struct nulldrv_desc_set {
179 struct nulldrv_obj obj;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800180 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700181 const struct nulldrv_desc_layout *layout;
182};
183
184struct nulldrv_framebuffer {
185 struct nulldrv_obj obj;
186};
187
188struct nulldrv_render_pass {
189 struct nulldrv_obj obj;
190};
191
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700192struct nulldrv_buf_view {
193 struct nulldrv_obj obj;
194
195 struct nulldrv_buf *buf;
196
197 /* SURFACE_STATE */
198 uint32_t cmd[8];
199 uint32_t fs_cmd[8];
200 uint32_t cmd_len;
201};
202
Ian Elliott64a68e12015-04-16 11:57:46 -0600203struct nulldrv_swap_chain {
204 struct nulldrv_base base;
205 struct nulldrv_dev *dev;
206};
207
David Pinedo0257fbf2015-02-02 18:02:40 -0700208#endif /* NULLDRV_H */