blob: eb8632d7d7e4e4317a3e2e1e55072293183afd77 [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>
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -060034#include <vk_debug_report_lunarg.h>
Tobin Ehlis2d1d9702015-07-03 09:42:57 -060035#include <vk_icd.h>
Ian Elliott338dedb2015-08-21 15:09:33 -060036#include "vk_ext_khr_swapchain.h"
37#include "vk_ext_khr_device_swapchain.h"
David Pinedo0257fbf2015-02-02 18:02:40 -070038
David Pinedo0257fbf2015-02-02 18:02:40 -070039#include "icd.h"
David Pinedo0257fbf2015-02-02 18:02:40 -070040
41#include "icd-format.h"
42#include "icd-utils.h"
43
44struct nulldrv_base {
45 void *loader_data;
46 uint32_t magic;
Tony Barbour426b9052015-06-24 16:06:58 -060047 VkResult (*get_memory_requirements)(struct nulldrv_base *base, VkMemoryRequirements *pMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -070048};
49
50struct nulldrv_obj {
51 struct nulldrv_base base;
52};
53
David Pinedo0257fbf2015-02-02 18:02:40 -070054enum nulldrv_ext_type {
Ian Elliott338dedb2015-08-21 15:09:33 -060055 NULLDRV_EXT_KHR_SWAPCHAIN,
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
David Pinedo0257fbf2015-02-02 18:02:40 -0700112struct nulldrv_sampler {
113 struct nulldrv_obj obj;
114};
115
116struct nulldrv_img_view {
117 struct nulldrv_obj obj;
118 struct nulldrv_img *img;
119 float min_lod;
120 uint32_t cmd_len;
121};
122
123struct nulldrv_buf {
124 struct nulldrv_obj obj;
Tony Barbour8205d902015-04-16 15:59:00 -0600125 VkDeviceSize size;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600126 VkFlags usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700127};
128
129struct nulldrv_desc_layout {
130 struct nulldrv_obj obj;
131};
132
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500133struct nulldrv_pipeline_layout {
Chia-I Wu7732cb22015-03-26 15:27:55 +0800134 struct nulldrv_obj obj;
135};
136
David Pinedo0257fbf2015-02-02 18:02:40 -0700137struct nulldrv_shader {
138 struct nulldrv_obj obj;
139
140};
141
David Pinedo0257fbf2015-02-02 18:02:40 -0700142struct nulldrv_pipeline {
143 struct nulldrv_obj obj;
144 struct nulldrv_dev *dev;
145};
146
147struct nulldrv_dynamic_vp {
148 struct nulldrv_obj obj;
149};
150
Cody Northrope4bc6942015-08-26 10:01:32 -0600151struct nulldrv_dynamic_line_width {
Cody Northropf5bd2252015-08-17 11:10:49 -0600152 struct nulldrv_obj obj;
153};
154
Cody Northrope4bc6942015-08-26 10:01:32 -0600155struct nulldrv_dynamic_depth_bias {
David Pinedo0257fbf2015-02-02 18:02:40 -0700156 struct nulldrv_obj obj;
157};
158
Cody Northrope4bc6942015-08-26 10:01:32 -0600159struct nulldrv_dynamic_blend {
David Pinedo0257fbf2015-02-02 18:02:40 -0700160 struct nulldrv_obj obj;
161};
162
Cody Northrope4bc6942015-08-26 10:01:32 -0600163struct nulldrv_dynamic_depth_bounds {
Cody Northrop2605cb02015-08-18 15:21:16 -0600164 struct nulldrv_obj obj;
165};
166
167struct nulldrv_dynamic_stencil {
David Pinedo0257fbf2015-02-02 18:02:40 -0700168 struct nulldrv_obj obj;
169};
170
171struct nulldrv_cmd {
172 struct nulldrv_obj obj;
173};
174
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800175struct nulldrv_desc_pool {
David Pinedo0257fbf2015-02-02 18:02:40 -0700176 struct nulldrv_obj obj;
177 struct nulldrv_dev *dev;
178};
179
180struct nulldrv_desc_set {
181 struct nulldrv_obj obj;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800182 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700183 const struct nulldrv_desc_layout *layout;
184};
185
186struct nulldrv_framebuffer {
187 struct nulldrv_obj obj;
188};
189
190struct nulldrv_render_pass {
191 struct nulldrv_obj obj;
192};
193
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700194struct nulldrv_buf_view {
195 struct nulldrv_obj obj;
196
197 struct nulldrv_buf *buf;
198
199 /* SURFACE_STATE */
200 uint32_t cmd[8];
201 uint32_t fs_cmd[8];
202 uint32_t cmd_len;
203};
204
Ian Elliott32536f92015-04-21 16:41:02 -0600205struct nulldrv_display {
206 struct nulldrv_base base;
207 struct nulldrv_dev *dev;
208};
209
Ian Elliott64a68e12015-04-16 11:57:46 -0600210struct nulldrv_swap_chain {
211 struct nulldrv_base base;
212 struct nulldrv_dev *dev;
213};
214
David Pinedo0257fbf2015-02-02 18:02:40 -0700215#endif /* NULLDRV_H */