Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/microsoft/compiler/dxil_signature.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_SIGNATURE_H
25
#define DXIL_SIGNATURE_H
26
27
#include "dxil_enums.h"
28
#include "nir.h"
29
#include "util/string_buffer.h"
30
31
#ifdef __cplusplus
32
extern "C" {
33
#endif
34
35
/* struct taken from DXILContainer
36
* Enums values were replaced by uint32_t since they must occupy 32 bit
37
*/
38
39
struct dxil_signature_element {
40
uint32_t stream; // Stream index (parameters must appear in non-decreasing stream order)
41
uint32_t semantic_name_offset; // Offset to char * stream from start of DxilProgramSignature.
42
uint32_t semantic_index; // Semantic Index
43
uint32_t system_value; // Semantic type. Similar to DxilSemantic::Kind, but a serialized rather than processing rep.
44
uint32_t comp_type; // Type of bits.
45
uint32_t reg; // Register Index (row index)
46
uint8_t mask; // Mask (column allocation)
47
union { // Unconditional cases useful for validation of shader linkage.
48
uint8_t never_writes_mask; // For an output signature, the shader the signature belongs to never
49
// writes the masked components of the output register.
50
uint8_t always_reads_mask; // For an input signature, the shader the signature belongs to always
51
// reads the masked components of the input register.
52
};
53
uint16_t pad;
54
uint32_t min_precision; // Minimum precision of input/output data
55
};
56
57
struct dxil_signature_record {
58
struct dxil_signature_element elements[32];
59
unsigned num_elements;
60
const char *sysvalue;
61
char *name;
62
};
63
64
struct dxil_psv_sem_index_table {
65
uint32_t data[80];
66
uint32_t size;
67
};
68
69
struct dxil_psv_signature_element {
70
uint32_t semantic_name_offset; // Offset into StringTable
71
uint32_t semantic_indexes_offset; // Offset into PSVSemanticIndexTable, count == Rows
72
uint8_t rows; // Number of rows this element occupies
73
uint8_t start_row; // Starting row of packing location if allocated
74
uint8_t cols_and_start; // 0:4 = Cols, 4:6 = StartCol, 6:7 == Allocated
75
uint8_t semantic_kind; // PSVSemanticKind
76
uint8_t component_type; // DxilProgramSigCompType
77
uint8_t interpolation_mode; // DXIL::InterpolationMode or D3D10_SB_INTERPOLATION_MODE
78
uint8_t dynamic_mask_and_stream; // 0:4 = DynamicIndexMask, 4:6 = OutputStream (0-3)
79
uint8_t reserved;
80
};
81
82
struct dxil_psv_runtime_info_0 {
83
union {
84
struct {
85
char output_position_present;
86
} vs;
87
88
struct {
89
uint32_t input_primitive;
90
uint32_t output_toplology;
91
uint32_t output_stream_mask;
92
char output_position_present;
93
} gs;
94
95
struct {
96
char depth_output;
97
char sample_frequency;
98
} ps;
99
100
/* Maximum sized defining the union size (MSInfo)*/
101
struct {
102
uint32_t dummy1[3];
103
uint16_t dummy2[2];
104
} dummy;
105
};
106
uint32_t min_expected_wave_lane_count; // minimum lane count required, 0 if unused
107
uint32_t max_expected_wave_lane_count; // maximum lane count required, 0xffffffff if unused
108
};
109
110
struct dxil_psv_runtime_info_1 {
111
struct dxil_psv_runtime_info_0 psv0;
112
uint8_t shader_stage; // PSVShaderKind
113
uint8_t uses_view_id;
114
union {
115
uint16_t max_vertex_count; // MaxVertexCount for GS only (max 1024)
116
uint8_t sig_patch_const_or_prim_vectors; // Output for HS; Input for DS; Primitive output for MS (overlaps MS1::SigPrimVectors)
117
// struct { uint8_t dummy[2]; } fill;
118
};
119
120
// PSVSignatureElement counts
121
uint8_t sig_input_elements;
122
uint8_t sig_output_elements;
123
uint8_t sig_patch_const_or_prim_elements;
124
125
// Number of packed vectors per signature
126
uint8_t sig_input_vectors;
127
uint8_t sig_output_vectors[4];
128
};
129
130
struct dxil_mdnode;
131
struct dxil_module;
132
133
const struct dxil_mdnode *
134
get_signatures(struct dxil_module *mod, nir_shader *s, bool vulkan);
135
136
#ifdef __cplusplus
137
}
138
#endif
139
140
#endif
141
142