Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/microsoft/compiler/dxil_container.h
4564 views
1
/*
2
* Copyright © Microsoft Corporation
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining a
5
* copy of this software and associated documentation files (the "Software"),
6
* to deal in the Software without restriction, including without limitation
7
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
* and/or sell copies of the Software, and to permit persons to whom the
9
* Software is furnished to do so, subject to the following conditions:
10
*
11
* The above copyright notice and this permission notice (including the next
12
* paragraph) shall be included in all copies or substantial portions of the
13
* 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 DEALINGS
21
* IN THE SOFTWARE.
22
*/
23
24
#ifndef DXIL_CONTAINER_H
25
#define DXIL_CONTAINER_H
26
27
#ifdef __cplusplus
28
extern "C" {
29
#endif
30
31
#include "util/blob.h"
32
33
#include "dxil_signature.h"
34
35
#define DXIL_MAX_PARTS 8
36
struct dxil_container {
37
struct blob parts;
38
unsigned part_offsets[DXIL_MAX_PARTS];
39
unsigned num_parts;
40
};
41
42
enum dxil_resource_type {
43
DXIL_RES_INVALID = 0,
44
DXIL_RES_SAMPLER = 1,
45
DXIL_RES_CBV = 2,
46
DXIL_RES_SRV_TYPED = 3,
47
DXIL_RES_SRV_RAW = 4,
48
DXIL_RES_SRC_STRUCTURED = 5,
49
DXIL_RES_UAV_TYPED = 6,
50
DXIL_RES_UAV_RAW = 7,
51
DXIL_RES_UAV_STRUCTURED,
52
DXIL_RES_UAV_STRUCTURED_WITH_COUNTER,
53
DXIL_RES_NUM_ENTRIES /* should always be last */
54
};
55
56
#define DXIL_FOURCC(ch0, ch1, ch2, ch3) ( \
57
(uint32_t)(ch0) | (uint32_t)(ch1) << 8 | \
58
(uint32_t)(ch2) << 16 | (uint32_t)(ch3) << 24)
59
60
enum dxil_part_fourcc {
61
DXIL_RDEF = DXIL_FOURCC('R', 'D', 'E', 'F'),
62
DXIL_ISG1 = DXIL_FOURCC('I', 'S', 'G', '1'),
63
DXIL_OSG1 = DXIL_FOURCC('O', 'S', 'G', '1'),
64
DXIL_PSG1 = DXIL_FOURCC('P', 'S', 'G', '1'),
65
DXIL_STAT = DXIL_FOURCC('S', 'T', 'A', 'T'),
66
DXIL_ILDB = DXIL_FOURCC('I', 'L', 'D', 'B'),
67
DXIL_ILDN = DXIL_FOURCC('I', 'L', 'D', 'N'),
68
DXIL_SFI0 = DXIL_FOURCC('S', 'F', 'I', '0'),
69
DXIL_PRIV = DXIL_FOURCC('P', 'R', 'I', 'V'),
70
DXIL_RTS0 = DXIL_FOURCC('R', 'T', 'S', '0'),
71
DXIL_DXIL = DXIL_FOURCC('D', 'X', 'I', 'L'),
72
DXIL_PSV0 = DXIL_FOURCC('P', 'S', 'V', '0'),
73
DXIL_RDAT = DXIL_FOURCC('R', 'D', 'A', 'T'),
74
DXIL_HASH = DXIL_FOURCC('H', 'A', 'S', 'H'),
75
};
76
77
struct dxil_resource {
78
uint32_t resource_type;
79
uint32_t space;
80
uint32_t lower_bound;
81
uint32_t upper_bound;
82
};
83
84
struct dxil_validation_state {
85
struct dxil_psv_runtime_info_1 state;
86
const struct dxil_resource *resources;
87
uint32_t num_resources;
88
};
89
90
void
91
dxil_container_init(struct dxil_container *c);
92
93
void
94
dxil_container_finish(struct dxil_container *c);
95
96
struct dxil_features;
97
98
bool
99
dxil_container_add_features(struct dxil_container *c,
100
const struct dxil_features *features);
101
102
103
bool
104
dxil_container_add_io_signature(struct dxil_container *c,
105
enum dxil_part_fourcc part,
106
unsigned num_records,
107
struct dxil_signature_record *io);
108
109
bool
110
dxil_container_add_state_validation(struct dxil_container *c,
111
const struct dxil_module *m,
112
struct dxil_validation_state *state);
113
114
bool
115
dxil_container_add_module(struct dxil_container *c,
116
const struct dxil_module *m);
117
118
bool
119
dxil_container_write(struct dxil_container *c, struct blob *blob);
120
121
#ifdef __cplusplus
122
}
123
#endif
124
125
#endif
126
127