blob: 5bb528fd863531ec84c90c4f51e224e83b6e0941 [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.
Courtney Goeltzenleuchter96cd7952015-10-30 11:14:30 -060022 *
23 * Author: Cody Northrop <cody@lunarg.com>
24 * Author: David Pinedo <david@lunarg.com>
David Pinedo0257fbf2015-02-02 18:02:40 -070025 */
26
27#ifndef NULLDRV_H
Mark Lobodzinski556f7212015-04-17 14:11:39 -050028#define NULLDRV_H
David Pinedo0257fbf2015-02-02 18:02:40 -070029#include <stdlib.h>
30#include <stdbool.h>
31#include <stdint.h>
32#include <string.h>
33#include <assert.h>
34
David Pinedo329ca9e2015-11-06 12:54:48 -070035#include <vulkan/vulkan.h>
36#include <vulkan/vk_debug_report_lunarg.h>
37#include <vulkan/vk_icd.h>
38#include "vulkan/vk_ext_khr_swapchain.h"
39#include "vulkan/vk_ext_khr_device_swapchain.h"
David Pinedo0257fbf2015-02-02 18:02:40 -070040
David Pinedo0257fbf2015-02-02 18:02:40 -070041#include "icd.h"
David Pinedo0257fbf2015-02-02 18:02:40 -070042
43#include "icd-format.h"
44#include "icd-utils.h"
45
46struct nulldrv_base {
47 void *loader_data;
48 uint32_t magic;
Tony Barbour426b9052015-06-24 16:06:58 -060049 VkResult (*get_memory_requirements)(struct nulldrv_base *base, VkMemoryRequirements *pMemoryRequirements);
David Pinedo0257fbf2015-02-02 18:02:40 -070050};
51
52struct nulldrv_obj {
53 struct nulldrv_base base;
54};
55
David Pinedo0257fbf2015-02-02 18:02:40 -070056enum nulldrv_ext_type {
Ian Elliott338dedb2015-08-21 15:09:33 -060057 NULLDRV_EXT_KHR_SWAPCHAIN,
David Pinedo0257fbf2015-02-02 18:02:40 -070058 NULLDRV_EXT_COUNT,
59 NULLDRV_EXT_INVALID = NULLDRV_EXT_COUNT,
60};
61
62
63struct nulldrv_instance {
64 struct nulldrv_obj obj;
65};
66
67struct nulldrv_gpu {
68 void *loader_data;
69};
70
71struct nulldrv_dev {
72 struct nulldrv_base base;
73 bool exts[NULLDRV_EXT_COUNT];
Chia-I Wu8d24b3b2015-03-26 13:14:16 +080074 struct nulldrv_desc_ooxx *desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -070075 struct nulldrv_queue *queues[1];
76};
77
Chia-I Wu8d24b3b2015-03-26 13:14:16 +080078struct nulldrv_desc_ooxx {
David Pinedo0257fbf2015-02-02 18:02:40 -070079 uint32_t surface_desc_size;
80 uint32_t sampler_desc_size;
81};
82
83
84struct nulldrv_queue {
85 struct nulldrv_base base;
86 struct nulldrv_dev *dev;
87};
88
89struct nulldrv_rt_view {
90 struct nulldrv_obj obj;
91};
92
93struct nulldrv_fence {
94 struct nulldrv_obj obj;
95};
96
97struct nulldrv_img {
98 struct nulldrv_obj obj;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060099 VkImageType type;
David Pinedo0257fbf2015-02-02 18:02:40 -0700100 int32_t depth;
101 uint32_t mip_levels;
102 uint32_t array_size;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600103 VkFlags usage;
Chia-I Wu3138d6a2015-10-31 00:31:16 +0800104 VkSampleCountFlagBits samples;
David Pinedo0257fbf2015-02-02 18:02:40 -0700105 size_t total_size;
106};
107
108struct nulldrv_mem {
109 struct nulldrv_base base;
110 struct nulldrv_bo *bo;
Tony Barbour8205d902015-04-16 15:59:00 -0600111 VkDeviceSize size;
David Pinedo0257fbf2015-02-02 18:02:40 -0700112};
113
David Pinedo0257fbf2015-02-02 18:02:40 -0700114struct nulldrv_sampler {
115 struct nulldrv_obj obj;
116};
117
118struct nulldrv_img_view {
119 struct nulldrv_obj obj;
120 struct nulldrv_img *img;
121 float min_lod;
122 uint32_t cmd_len;
123};
124
125struct nulldrv_buf {
126 struct nulldrv_obj obj;
Tony Barbour8205d902015-04-16 15:59:00 -0600127 VkDeviceSize size;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600128 VkFlags usage;
David Pinedo0257fbf2015-02-02 18:02:40 -0700129};
130
131struct nulldrv_desc_layout {
132 struct nulldrv_obj obj;
133};
134
Mark Lobodzinski556f7212015-04-17 14:11:39 -0500135struct nulldrv_pipeline_layout {
Chia-I Wu7732cb22015-03-26 15:27:55 +0800136 struct nulldrv_obj obj;
137};
138
David Pinedo0257fbf2015-02-02 18:02:40 -0700139struct nulldrv_shader {
140 struct nulldrv_obj obj;
141
142};
143
David Pinedo0257fbf2015-02-02 18:02:40 -0700144struct nulldrv_pipeline {
145 struct nulldrv_obj obj;
146 struct nulldrv_dev *dev;
147};
148
149struct nulldrv_dynamic_vp {
150 struct nulldrv_obj obj;
151};
152
Cody Northrope4bc6942015-08-26 10:01:32 -0600153struct nulldrv_dynamic_line_width {
Cody Northropf5bd2252015-08-17 11:10:49 -0600154 struct nulldrv_obj obj;
155};
156
Cody Northrope4bc6942015-08-26 10:01:32 -0600157struct nulldrv_dynamic_depth_bias {
David Pinedo0257fbf2015-02-02 18:02:40 -0700158 struct nulldrv_obj obj;
159};
160
Cody Northrope4bc6942015-08-26 10:01:32 -0600161struct nulldrv_dynamic_blend {
David Pinedo0257fbf2015-02-02 18:02:40 -0700162 struct nulldrv_obj obj;
163};
164
Cody Northrope4bc6942015-08-26 10:01:32 -0600165struct nulldrv_dynamic_depth_bounds {
Cody Northrop2605cb02015-08-18 15:21:16 -0600166 struct nulldrv_obj obj;
167};
168
169struct nulldrv_dynamic_stencil {
David Pinedo0257fbf2015-02-02 18:02:40 -0700170 struct nulldrv_obj obj;
171};
172
173struct nulldrv_cmd {
174 struct nulldrv_obj obj;
175};
176
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800177struct nulldrv_desc_pool {
David Pinedo0257fbf2015-02-02 18:02:40 -0700178 struct nulldrv_obj obj;
179 struct nulldrv_dev *dev;
180};
181
182struct nulldrv_desc_set {
183 struct nulldrv_obj obj;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800184 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700185 const struct nulldrv_desc_layout *layout;
186};
187
188struct nulldrv_framebuffer {
189 struct nulldrv_obj obj;
190};
191
192struct nulldrv_render_pass {
193 struct nulldrv_obj obj;
194};
195
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700196struct nulldrv_buf_view {
197 struct nulldrv_obj obj;
198
199 struct nulldrv_buf *buf;
200
201 /* SURFACE_STATE */
202 uint32_t cmd[8];
203 uint32_t fs_cmd[8];
204 uint32_t cmd_len;
205};
206
Ian Elliott32536f92015-04-21 16:41:02 -0600207struct nulldrv_display {
208 struct nulldrv_base base;
209 struct nulldrv_dev *dev;
210};
211
Ian Elliott64a68e12015-04-16 11:57:46 -0600212struct nulldrv_swap_chain {
213 struct nulldrv_base base;
214 struct nulldrv_dev *dev;
215};
216
David Pinedo0257fbf2015-02-02 18:02:40 -0700217#endif /* NULLDRV_H */