blob: 6f9895b4758988af2b611527b11c8f68e2b1182d [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
26#define NULLDRV_H
27#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
Chia-I Wu7732cb22015-03-26 15:27:55 +0800145struct nulldrv_desc_layout_chain {
146 struct nulldrv_obj obj;
147};
148
David Pinedo0257fbf2015-02-02 18:02:40 -0700149struct nulldrv_shader {
150 struct nulldrv_obj obj;
151
152};
153
154
155struct nulldrv_pipeline {
156 struct nulldrv_obj obj;
157 struct nulldrv_dev *dev;
158};
159
160struct nulldrv_dynamic_vp {
161 struct nulldrv_obj obj;
162};
163
164struct nulldrv_dynamic_rs {
165 struct nulldrv_obj obj;
166};
167
168struct nulldrv_dynamic_cb {
169 struct nulldrv_obj obj;
170};
171
172struct nulldrv_dynamic_ds {
173 struct nulldrv_obj obj;
174};
175
176struct nulldrv_cmd {
177 struct nulldrv_obj obj;
178};
179
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800180struct nulldrv_desc_pool {
David Pinedo0257fbf2015-02-02 18:02:40 -0700181 struct nulldrv_obj obj;
182 struct nulldrv_dev *dev;
183};
184
185struct nulldrv_desc_set {
186 struct nulldrv_obj obj;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800187 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700188 const struct nulldrv_desc_layout *layout;
189};
190
191struct nulldrv_framebuffer {
192 struct nulldrv_obj obj;
193};
194
195struct nulldrv_render_pass {
196 struct nulldrv_obj obj;
197};
198
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700199struct nulldrv_buf_view {
200 struct nulldrv_obj obj;
201
202 struct nulldrv_buf *buf;
203
204 /* SURFACE_STATE */
205 uint32_t cmd[8];
206 uint32_t fs_cmd[8];
207 uint32_t cmd_len;
208};
209
David Pinedo0257fbf2015-02-02 18:02:40 -0700210#endif /* NULLDRV_H */