blob: 8b48bc5ba0386fb1ec20aad34d1d826bbc52081f [file] [log] [blame]
David Pinedo0257fbf2015-02-02 18:02:40 -07001/*
David Pinedo0257fbf2015-02-02 18:02:40 -07002 *
Courtney Goeltzenleuchter8a17da52015-10-29 13:50:34 -06003 * Copyright (C) 2015 Valve Corporation
David Pinedo0257fbf2015-02-02 18:02:40 -07004 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included
13 * in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24#ifndef NULLDRV_H
Mark Lobodzinski556f7212015-04-17 14:11:39 -050025#define NULLDRV_H
David Pinedo0257fbf2015-02-02 18:02:40 -070026#include <stdlib.h>
27#include <stdbool.h>
28#include <stdint.h>
29#include <string.h>
30#include <assert.h>
31
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060032#include <vulkan.h>
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060033#include <vk_debug_report_lunarg.h>
Tobin Ehlis2d1d9702015-07-03 09:42:57 -060034#include <vk_icd.h>
Ian Elliott338dedb2015-08-21 15:09:33 -060035#include "vk_ext_khr_swapchain.h"
36#include "vk_ext_khr_device_swapchain.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 {
Ian Elliott338dedb2015-08-21 15:09:33 -060054 NULLDRV_EXT_KHR_SWAPCHAIN,
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;
Chia-I Wu3138d6a2015-10-31 00:31:16 +0800101 VkSampleCountFlagBits samples;
David Pinedo0257fbf2015-02-02 18:02:40 -0700102 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
David Pinedo0257fbf2015-02-02 18:02:40 -0700111struct nulldrv_sampler {
112 struct nulldrv_obj obj;
113};
114
115struct nulldrv_img_view {
116 struct nulldrv_obj obj;
117 struct nulldrv_img *img;
118 float min_lod;
119 uint32_t cmd_len;
120};
121
122struct nulldrv_buf {
123 struct nulldrv_obj obj;
Tony Barbour8205d902015-04-16 15:59:00 -0600124 VkDeviceSize size;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600125 VkFlags usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700126};
127
128struct nulldrv_desc_layout {
129 struct nulldrv_obj obj;
130};
131
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500132struct nulldrv_pipeline_layout {
Chia-I Wu7732cb22015-03-26 15:27:55 +0800133 struct nulldrv_obj obj;
134};
135
David Pinedo0257fbf2015-02-02 18:02:40 -0700136struct nulldrv_shader {
137 struct nulldrv_obj obj;
138
139};
140
David Pinedo0257fbf2015-02-02 18:02:40 -0700141struct nulldrv_pipeline {
142 struct nulldrv_obj obj;
143 struct nulldrv_dev *dev;
144};
145
146struct nulldrv_dynamic_vp {
147 struct nulldrv_obj obj;
148};
149
Cody Northrope4bc6942015-08-26 10:01:32 -0600150struct nulldrv_dynamic_line_width {
Cody Northropf5bd2252015-08-17 11:10:49 -0600151 struct nulldrv_obj obj;
152};
153
Cody Northrope4bc6942015-08-26 10:01:32 -0600154struct nulldrv_dynamic_depth_bias {
David Pinedo0257fbf2015-02-02 18:02:40 -0700155 struct nulldrv_obj obj;
156};
157
Cody Northrope4bc6942015-08-26 10:01:32 -0600158struct nulldrv_dynamic_blend {
David Pinedo0257fbf2015-02-02 18:02:40 -0700159 struct nulldrv_obj obj;
160};
161
Cody Northrope4bc6942015-08-26 10:01:32 -0600162struct nulldrv_dynamic_depth_bounds {
Cody Northrop2605cb02015-08-18 15:21:16 -0600163 struct nulldrv_obj obj;
164};
165
166struct nulldrv_dynamic_stencil {
David Pinedo0257fbf2015-02-02 18:02:40 -0700167 struct nulldrv_obj obj;
168};
169
170struct nulldrv_cmd {
171 struct nulldrv_obj obj;
172};
173
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800174struct nulldrv_desc_pool {
David Pinedo0257fbf2015-02-02 18:02:40 -0700175 struct nulldrv_obj obj;
176 struct nulldrv_dev *dev;
177};
178
179struct nulldrv_desc_set {
180 struct nulldrv_obj obj;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800181 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700182 const struct nulldrv_desc_layout *layout;
183};
184
185struct nulldrv_framebuffer {
186 struct nulldrv_obj obj;
187};
188
189struct nulldrv_render_pass {
190 struct nulldrv_obj obj;
191};
192
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700193struct nulldrv_buf_view {
194 struct nulldrv_obj obj;
195
196 struct nulldrv_buf *buf;
197
198 /* SURFACE_STATE */
199 uint32_t cmd[8];
200 uint32_t fs_cmd[8];
201 uint32_t cmd_len;
202};
203
Ian Elliott32536f92015-04-21 16:41:02 -0600204struct nulldrv_display {
205 struct nulldrv_base base;
206 struct nulldrv_dev *dev;
207};
208
Ian Elliott64a68e12015-04-16 11:57:46 -0600209struct nulldrv_swap_chain {
210 struct nulldrv_base base;
211 struct nulldrv_dev *dev;
212};
213
David Pinedo0257fbf2015-02-02 18:02:40 -0700214#endif /* NULLDRV_H */