blob: 22af6c6c1738b2e0e7caaf304e48f61f7356251a [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 Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060051 VK_RESULT (*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 Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600103 VK_IMAGE_TYPE type;
David Pinedo0257fbf2015-02-02 18:02:40 -0700104 int32_t depth;
105 uint32_t mip_levels;
106 uint32_t array_size;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600107 VK_FLAGS usage;
108 VK_IMAGE_FORMAT_CLASS format_class;
David Pinedo0257fbf2015-02-02 18:02:40 -0700109 uint32_t samples;
110 size_t total_size;
111};
112
113struct nulldrv_mem {
114 struct nulldrv_base base;
115 struct nulldrv_bo *bo;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600116 VK_GPU_SIZE size;
David Pinedo0257fbf2015-02-02 18:02:40 -0700117};
118
119struct nulldrv_ds_view {
120 struct nulldrv_obj obj;
121 struct nulldrv_img *img;
122 uint32_t array_size;
123};
124
125struct nulldrv_sampler {
126 struct nulldrv_obj obj;
127};
128
129struct nulldrv_img_view {
130 struct nulldrv_obj obj;
131 struct nulldrv_img *img;
132 float min_lod;
133 uint32_t cmd_len;
134};
135
136struct nulldrv_buf {
137 struct nulldrv_obj obj;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600138 VK_GPU_SIZE size;
139 VK_FLAGS usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700140};
141
142struct nulldrv_desc_layout {
143 struct nulldrv_obj obj;
144};
145
Chia-I Wu7732cb22015-03-26 15:27:55 +0800146struct nulldrv_desc_layout_chain {
147 struct nulldrv_obj obj;
148};
149
David Pinedo0257fbf2015-02-02 18:02:40 -0700150struct nulldrv_shader {
151 struct nulldrv_obj obj;
152
153};
154
155
156struct nulldrv_pipeline {
157 struct nulldrv_obj obj;
158 struct nulldrv_dev *dev;
159};
160
161struct nulldrv_dynamic_vp {
162 struct nulldrv_obj obj;
163};
164
165struct nulldrv_dynamic_rs {
166 struct nulldrv_obj obj;
167};
168
169struct nulldrv_dynamic_cb {
170 struct nulldrv_obj obj;
171};
172
173struct nulldrv_dynamic_ds {
174 struct nulldrv_obj obj;
175};
176
177struct nulldrv_cmd {
178 struct nulldrv_obj obj;
179};
180
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800181struct nulldrv_desc_pool {
David Pinedo0257fbf2015-02-02 18:02:40 -0700182 struct nulldrv_obj obj;
183 struct nulldrv_dev *dev;
184};
185
186struct nulldrv_desc_set {
187 struct nulldrv_obj obj;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800188 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700189 const struct nulldrv_desc_layout *layout;
190};
191
192struct nulldrv_framebuffer {
193 struct nulldrv_obj obj;
194};
195
196struct nulldrv_render_pass {
197 struct nulldrv_obj obj;
198};
199
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700200struct nulldrv_buf_view {
201 struct nulldrv_obj obj;
202
203 struct nulldrv_buf *buf;
204
205 /* SURFACE_STATE */
206 uint32_t cmd[8];
207 uint32_t fs_cmd[8];
208 uint32_t cmd_len;
209};
210
David Pinedo0257fbf2015-02-02 18:02:40 -0700211#endif /* NULLDRV_H */