blob: 06147dd004290ada7e536a7492147e1dcfb2efde [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>
David Pinedo0257fbf2015-02-02 18:02:40 -070036
37#if defined(PLATFORM_LINUX)
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060038#include <vkWsiX11Ext.h>
David Pinedo0257fbf2015-02-02 18:02:40 -070039#else
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060040#include <vkWsiWinExt.h>
David Pinedo0257fbf2015-02-02 18:02:40 -070041#endif
42
David Pinedo0257fbf2015-02-02 18:02:40 -070043#include "icd.h"
David Pinedo0257fbf2015-02-02 18:02:40 -070044
45#include "icd-format.h"
46#include "icd-utils.h"
47
48struct nulldrv_base {
49 void *loader_data;
50 uint32_t magic;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060051 VkResult (*get_info)(struct nulldrv_base *base, int type1,
David Pinedo0257fbf2015-02-02 18:02:40 -070052 size_t *size, void *data);
53};
54
55struct nulldrv_obj {
56 struct nulldrv_base base;
57};
58
David Pinedo0257fbf2015-02-02 18:02:40 -070059enum nulldrv_ext_type {
60 NULLDRV_EXT_WSI_X11,
61 NULLDRV_EXT_WSI_WINDOWS,
62 NULLDRV_EXT_COUNT,
63 NULLDRV_EXT_INVALID = NULLDRV_EXT_COUNT,
64};
65
66
67struct nulldrv_instance {
68 struct nulldrv_obj obj;
69};
70
71struct nulldrv_gpu {
72 void *loader_data;
73};
74
75struct nulldrv_dev {
76 struct nulldrv_base base;
77 bool exts[NULLDRV_EXT_COUNT];
Chia-I Wu8d24b3b2015-03-26 13:14:16 +080078 struct nulldrv_desc_ooxx *desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -070079 struct nulldrv_queue *queues[1];
80};
81
Chia-I Wu8d24b3b2015-03-26 13:14:16 +080082struct nulldrv_desc_ooxx {
David Pinedo0257fbf2015-02-02 18:02:40 -070083 uint32_t surface_desc_size;
84 uint32_t sampler_desc_size;
85};
86
87
88struct nulldrv_queue {
89 struct nulldrv_base base;
90 struct nulldrv_dev *dev;
91};
92
93struct nulldrv_rt_view {
94 struct nulldrv_obj obj;
95};
96
97struct nulldrv_fence {
98 struct nulldrv_obj obj;
99};
100
101struct nulldrv_img {
102 struct nulldrv_obj obj;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600103 VkImageType type;
David Pinedo0257fbf2015-02-02 18:02:40 -0700104 int32_t depth;
105 uint32_t mip_levels;
106 uint32_t array_size;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600107 VkFlags usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700108 uint32_t samples;
109 size_t total_size;
110};
111
112struct nulldrv_mem {
113 struct nulldrv_base base;
114 struct nulldrv_bo *bo;
Tony Barbour8205d902015-04-16 15:59:00 -0600115 VkDeviceSize size;
David Pinedo0257fbf2015-02-02 18:02:40 -0700116};
117
118struct nulldrv_ds_view {
119 struct nulldrv_obj obj;
120 struct nulldrv_img *img;
121 uint32_t array_size;
122};
123
124struct nulldrv_sampler {
125 struct nulldrv_obj obj;
126};
127
128struct nulldrv_img_view {
129 struct nulldrv_obj obj;
130 struct nulldrv_img *img;
131 float min_lod;
132 uint32_t cmd_len;
133};
134
135struct nulldrv_buf {
136 struct nulldrv_obj obj;
Tony Barbour8205d902015-04-16 15:59:00 -0600137 VkDeviceSize size;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600138 VkFlags usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700139};
140
141struct nulldrv_desc_layout {
142 struct nulldrv_obj obj;
143};
144
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500145struct nulldrv_pipeline_layout {
Chia-I Wu7732cb22015-03-26 15:27:55 +0800146 struct nulldrv_obj obj;
147};
148
David Pinedo0257fbf2015-02-02 18:02:40 -0700149struct nulldrv_shader {
150 struct nulldrv_obj obj;
151
152};
153
David Pinedo0257fbf2015-02-02 18:02:40 -0700154struct nulldrv_pipeline {
155 struct nulldrv_obj obj;
156 struct nulldrv_dev *dev;
157};
158
159struct nulldrv_dynamic_vp {
160 struct nulldrv_obj obj;
161};
162
163struct nulldrv_dynamic_rs {
164 struct nulldrv_obj obj;
165};
166
167struct nulldrv_dynamic_cb {
168 struct nulldrv_obj obj;
169};
170
171struct nulldrv_dynamic_ds {
172 struct nulldrv_obj obj;
173};
174
175struct nulldrv_cmd {
176 struct nulldrv_obj obj;
177};
178
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800179struct nulldrv_desc_pool {
David Pinedo0257fbf2015-02-02 18:02:40 -0700180 struct nulldrv_obj obj;
181 struct nulldrv_dev *dev;
182};
183
184struct nulldrv_desc_set {
185 struct nulldrv_obj obj;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800186 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700187 const struct nulldrv_desc_layout *layout;
188};
189
190struct nulldrv_framebuffer {
191 struct nulldrv_obj obj;
192};
193
194struct nulldrv_render_pass {
195 struct nulldrv_obj obj;
196};
197
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700198struct nulldrv_buf_view {
199 struct nulldrv_obj obj;
200
201 struct nulldrv_buf *buf;
202
203 /* SURFACE_STATE */
204 uint32_t cmd[8];
205 uint32_t fs_cmd[8];
206 uint32_t cmd_len;
207};
208
David Pinedo0257fbf2015-02-02 18:02:40 -0700209#endif /* NULLDRV_H */