-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspirv_executable_def.fbs
149 lines (129 loc) · 5.43 KB
/
spirv_executable_def.fbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
namespace iree;
// 'SPIR-V Executable'.
file_identifier "SPVE";
file_extension "spve";
// Structure specifying a descriptor set layout binding.
//
// VkDescriptorSetLayoutBinding:
// https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkDescriptorSetLayoutBinding.html
table VkDescriptorSetLayoutBindingDef {
// The binding number of this entry. Corresponds to a resource of the same
// binding number in the shader stages.
binding:uint32;
// VkDescriptorType specifying which type of resource descriptors are used for
// this binding.
//
// VkDescriptorType:
// https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkDescriptorType.html
descriptor_type:uint32;
// The number of descriptors contained in the binding. Accessed in a shader as
// an array.
descriptor_count:uint32;
// A bitmask of VkShaderStageFlagBits specifying which pipeline shader stages
// can access a resource for this binding.
//
// VkShaderStageFlagBits:
// https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkShaderStageFlagBits.html
//
// Assume 'VK_SHADER_STAGE_ALL' as a good default.
stage_flags:uint32;
}
// A descriptor set layout defined by an array of zero or more descriptor
// bindings.
//
// VkDescriptorSetLayout:
// https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkDescriptorSetLayout.html
table VkDescriptorSetLayoutDef {
// A set of serialized VkDescriptorSetLayoutBindings.
bindings:[VkDescriptorSetLayoutBindingDef];
}
// Structure specifying a push constant range.
//
// VkPushConstantRange:
// https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkPushConstantRange.html
table VkPushConstantRangeDef {
// A set of stage flags describing the shader stages that will access a range
// of push constants.
//
// VkShaderStageFlagBits:
// https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkShaderStageFlagBits.html
//
// Assume 'VK_SHADER_STAGE_ALL' as a good default.
stage_flags:uint32;
// The start offset and size, respectively, consumed by the range. Both offset
// and size are in units of bytes and must be a multiple of 4.
offset:uint32;
size:uint32;
}
// Zero or more descriptor set layouts and zero or more push constant ranges are
// combined to form a pipeline layout object which describes the complete set of
// resources that can be accessed by a pipeline.
//
// VkPipelineLayout:
// https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkPipelineLayout.html
table VkPipelineLayoutDef {
// An array of serialized VkDescriptorSetLayout objects.
descriptor_set_layouts:[VkDescriptorSetLayoutDef];
// An array of serialized VkPushConstantRange structures defining a set of
// push constant ranges for use in a single pipeline layout.
//
// Note that some implementations support as few as 128 bytes of push
// constants:
// https://vulkan.gpuinfo.org/displaydevicelimit.php?name=maxPushConstantsSize
push_constant_ranges:[VkPushConstantRangeDef];
// Index into the pipeline layout descriptor sets used for I/O buffer binding.
buffer_binding_set:uint32;
}
// VkSpecializationMapEntry:
// https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkSpecializationMapEntry.html
//
// Instead of a packed byte buffer we encode each value in its typed form. This
// ensures we don't have endianness or data type size mismatch issues.
//
// Right now we only encode uint32s (or other 4-byte values) as that's the most
// common, however we could add other types (including composite structs like
// vec4). We can also specify well-known system values to substitute such as
// required alignment or shared workspace size.
table VkSpecializationMapEntryDef {
// ID of the specialization constant in SPIR-V.
constant_id:uint32;
// Value of the constant as a 4-byte integer.
uint32_value:uint32;
}
// VkSpecializationInfo:
// https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkSpecializationInfo.html
table VkSpecializationInfoDef {
// A list of specialization constants and their values.
map_entries:[VkSpecializationMapEntryDef];
}
// A SPIR-V shader module and runtime pipeline layout description.
// This information is used to create the VkShaderModule, VkPipelineLayout, and
// any required VkDescriptorSetLayouts.
table SpirVExecutableDef {
// Reserved implementation-specific value that can be passed from compiler to
// runtime.
tag:string;
// A map of entry point ordinals to string names as used in the shader module.
entry_points:[string];
// SPIR-V code words.
code:[uint32];
// A serialized VkPipelineLayout object describing the bindings and push
// constants used by the shader.
pipeline_layout:VkPipelineLayoutDef;
// Optional specialization constants.
specialization_info:VkSpecializationInfoDef;
}
root_type SpirVExecutableDef;