wren
Vulkan-based game engine
Loading...
Searching...
No Matches
spirv_reflect.h
Go to the documentation of this file.
1/*
2 Copyright 2017-2022 Google Inc.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 implied. See the License for the specific language governing
14 permissions and limitations under the License.
15*/
16
17/*
18
19VERSION HISTORY
20
21 1.0 (2018-03-27) Initial public release
22
23*/
24
25// clang-format off
31#ifndef SPIRV_REFLECT_H
32#define SPIRV_REFLECT_H
33
34#include <spirv/unified1/spirv.h>
35
36#include <stdint.h>
37#include <string.h>
38
39#ifdef _MSC_VER
40 #define SPV_REFLECT_DEPRECATED(msg_str) __declspec(deprecated("This symbol is deprecated. Details: " msg_str))
41#elif defined(__clang__)
42 #define SPV_REFLECT_DEPRECATED(msg_str) __attribute__((deprecated(msg_str)))
43#elif defined(__GNUC__)
44 #if GCC_VERSION >= 40500
45 #define SPV_REFLECT_DEPRECATED(msg_str) __attribute__((deprecated(msg_str)))
46 #else
47 #define SPV_REFLECT_DEPRECATED(msg_str) __attribute__((deprecated))
48 #endif
49#else
50 #define SPV_REFLECT_DEPRECATED(msg_str)
51#endif
52
80
97
98typedef uint32_t SpvReflectModuleFlags;
99
121
122typedef uint32_t SpvReflectTypeFlags;
123
155
157
158// Based of SPV_GOOGLE_user_type
159typedef enum SpvReflectUserType {
201
212
216typedef enum SpvReflectFormat {
217 SPV_REFLECT_FORMAT_UNDEFINED = 0, // = VK_FORMAT_UNDEFINED
218 SPV_REFLECT_FORMAT_R16_UINT = 74, // = VK_FORMAT_R16_UINT
219 SPV_REFLECT_FORMAT_R16_SINT = 75, // = VK_FORMAT_R16_SINT
220 SPV_REFLECT_FORMAT_R16_SFLOAT = 76, // = VK_FORMAT_R16_SFLOAT
221 SPV_REFLECT_FORMAT_R16G16_UINT = 81, // = VK_FORMAT_R16G16_UINT
222 SPV_REFLECT_FORMAT_R16G16_SINT = 82, // = VK_FORMAT_R16G16_SINT
223 SPV_REFLECT_FORMAT_R16G16_SFLOAT = 83, // = VK_FORMAT_R16G16_SFLOAT
224 SPV_REFLECT_FORMAT_R16G16B16_UINT = 88, // = VK_FORMAT_R16G16B16_UINT
225 SPV_REFLECT_FORMAT_R16G16B16_SINT = 89, // = VK_FORMAT_R16G16B16_SINT
226 SPV_REFLECT_FORMAT_R16G16B16_SFLOAT = 90, // = VK_FORMAT_R16G16B16_SFLOAT
227 SPV_REFLECT_FORMAT_R16G16B16A16_UINT = 95, // = VK_FORMAT_R16G16B16A16_UINT
228 SPV_REFLECT_FORMAT_R16G16B16A16_SINT = 96, // = VK_FORMAT_R16G16B16A16_SINT
229 SPV_REFLECT_FORMAT_R16G16B16A16_SFLOAT = 97, // = VK_FORMAT_R16G16B16A16_SFLOAT
230 SPV_REFLECT_FORMAT_R32_UINT = 98, // = VK_FORMAT_R32_UINT
231 SPV_REFLECT_FORMAT_R32_SINT = 99, // = VK_FORMAT_R32_SINT
232 SPV_REFLECT_FORMAT_R32_SFLOAT = 100, // = VK_FORMAT_R32_SFLOAT
233 SPV_REFLECT_FORMAT_R32G32_UINT = 101, // = VK_FORMAT_R32G32_UINT
234 SPV_REFLECT_FORMAT_R32G32_SINT = 102, // = VK_FORMAT_R32G32_SINT
235 SPV_REFLECT_FORMAT_R32G32_SFLOAT = 103, // = VK_FORMAT_R32G32_SFLOAT
236 SPV_REFLECT_FORMAT_R32G32B32_UINT = 104, // = VK_FORMAT_R32G32B32_UINT
237 SPV_REFLECT_FORMAT_R32G32B32_SINT = 105, // = VK_FORMAT_R32G32B32_SINT
238 SPV_REFLECT_FORMAT_R32G32B32_SFLOAT = 106, // = VK_FORMAT_R32G32B32_SFLOAT
239 SPV_REFLECT_FORMAT_R32G32B32A32_UINT = 107, // = VK_FORMAT_R32G32B32A32_UINT
240 SPV_REFLECT_FORMAT_R32G32B32A32_SINT = 108, // = VK_FORMAT_R32G32B32A32_SINT
241 SPV_REFLECT_FORMAT_R32G32B32A32_SFLOAT = 109, // = VK_FORMAT_R32G32B32A32_SFLOAT
242 SPV_REFLECT_FORMAT_R64_UINT = 110, // = VK_FORMAT_R64_UINT
243 SPV_REFLECT_FORMAT_R64_SINT = 111, // = VK_FORMAT_R64_SINT
244 SPV_REFLECT_FORMAT_R64_SFLOAT = 112, // = VK_FORMAT_R64_SFLOAT
245 SPV_REFLECT_FORMAT_R64G64_UINT = 113, // = VK_FORMAT_R64G64_UINT
246 SPV_REFLECT_FORMAT_R64G64_SINT = 114, // = VK_FORMAT_R64G64_SINT
247 SPV_REFLECT_FORMAT_R64G64_SFLOAT = 115, // = VK_FORMAT_R64G64_SFLOAT
248 SPV_REFLECT_FORMAT_R64G64B64_UINT = 116, // = VK_FORMAT_R64G64B64_UINT
249 SPV_REFLECT_FORMAT_R64G64B64_SINT = 117, // = VK_FORMAT_R64G64B64_SINT
250 SPV_REFLECT_FORMAT_R64G64B64_SFLOAT = 118, // = VK_FORMAT_R64G64B64_SFLOAT
251 SPV_REFLECT_FORMAT_R64G64B64A64_UINT = 119, // = VK_FORMAT_R64G64B64A64_UINT
252 SPV_REFLECT_FORMAT_R64G64B64A64_SINT = 120, // = VK_FORMAT_R64G64B64A64_SINT
253 SPV_REFLECT_FORMAT_R64G64B64A64_SFLOAT = 121, // = VK_FORMAT_R64G64B64A64_SFLOAT
255
262 // If variable points to a copy of the PhysicalStorageBuffer struct
264};
265
266typedef uint32_t SpvReflectVariableFlags;
267
272 SPV_REFLECT_DESCRIPTOR_TYPE_SAMPLER = 0, // = VK_DESCRIPTOR_TYPE_SAMPLER
273 SPV_REFLECT_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1, // = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
274 SPV_REFLECT_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 2, // = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
275 SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_IMAGE = 3, // = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
276 SPV_REFLECT_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 4, // = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
277 SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 5, // = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
278 SPV_REFLECT_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 6, // = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
279 SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7, // = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
280 SPV_REFLECT_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8, // = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
281 SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9, // = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
282 SPV_REFLECT_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10, // = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT
283 SPV_REFLECT_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR = 1000150000 // = VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
285
290 SPV_REFLECT_SHADER_STAGE_VERTEX_BIT = 0x00000001, // = VK_SHADER_STAGE_VERTEX_BIT
291 SPV_REFLECT_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002, // = VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT
292 SPV_REFLECT_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004, // = VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT
293 SPV_REFLECT_SHADER_STAGE_GEOMETRY_BIT = 0x00000008, // = VK_SHADER_STAGE_GEOMETRY_BIT
294 SPV_REFLECT_SHADER_STAGE_FRAGMENT_BIT = 0x00000010, // = VK_SHADER_STAGE_FRAGMENT_BIT
295 SPV_REFLECT_SHADER_STAGE_COMPUTE_BIT = 0x00000020, // = VK_SHADER_STAGE_COMPUTE_BIT
296 SPV_REFLECT_SHADER_STAGE_TASK_BIT_NV = 0x00000040, // = VK_SHADER_STAGE_TASK_BIT_NV
298 SPV_REFLECT_SHADER_STAGE_MESH_BIT_NV = 0x00000080, // = VK_SHADER_STAGE_MESH_BIT_NV
300 SPV_REFLECT_SHADER_STAGE_RAYGEN_BIT_KHR = 0x00000100, // = VK_SHADER_STAGE_RAYGEN_BIT_KHR
301 SPV_REFLECT_SHADER_STAGE_ANY_HIT_BIT_KHR = 0x00000200, // = VK_SHADER_STAGE_ANY_HIT_BIT_KHR
302 SPV_REFLECT_SHADER_STAGE_CLOSEST_HIT_BIT_KHR = 0x00000400, // = VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR
303 SPV_REFLECT_SHADER_STAGE_MISS_BIT_KHR = 0x00000800, // = VK_SHADER_STAGE_MISS_BIT_KHR
304 SPV_REFLECT_SHADER_STAGE_INTERSECTION_BIT_KHR = 0x00001000, // = VK_SHADER_STAGE_INTERSECTION_BIT_KHR
305 SPV_REFLECT_SHADER_STAGE_CALLABLE_BIT_KHR = 0x00002000, // = VK_SHADER_STAGE_CALLABLE_BIT_KHR
306
308
324
325enum {
328};
329
330enum {
334
351
352typedef struct SpvReflectImageTraits {
353 SpvDim dim;
354 uint32_t depth;
355 uint32_t arrayed;
356 uint32_t ms; // 0: single-sampled; 1: multisampled
357 uint32_t sampled;
358 SpvImageFormat image_format;
360
364
365typedef struct SpvReflectArrayTraits {
366 uint32_t dims_count;
367 // Each entry is either:
368 // - specialization constant dimension
369 // - OpTypeRuntimeArray
370 // - the array length otherwise
372 // Stores Ids for dimensions that are specialization constants
374 uint32_t stride; // Measured in bytes
376
381
386 uint32_t id;
387 SpvOp op;
388 const char* type_name;
389 // Non-NULL if type is member of a struct
391 SpvStorageClass storage_class;
394
400
401 // If underlying type is a struct (ex. array of structs)
402 // this gives access to the OpTypeStruct
404
405 // Some pointers to SpvReflectTypeDescription are really
406 // just copies of another reference to the same OpType
407 uint32_t copied;
408
409 // @deprecated use struct_type_description instead
410 uint32_t member_count;
411 // @deprecated use struct_type_description instead
414
415
420 uint32_t spirv_id;
421 const char* name;
422 uint32_t location;
423 uint32_t component;
424 SpvStorageClass storage_class;
425 const char* semantic;
427 SpvBuiltIn built_in;
430
431 uint32_t member_count;
433
435
436 // NOTE: SPIR-V shares type references for variables
437 // that have the same underlying type. This means
438 // that the same type name will appear for multiple
439 // variables.
441
442 struct {
443 uint32_t location;
446
451 uint32_t spirv_id;
452 const char* name;
453 // For Push Constants, this is the lowest offset of all memebers
454 uint32_t offset; // Measured in bytes
455 uint32_t absolute_offset; // Measured in bytes
456 uint32_t size; // Measured in bytes
457 uint32_t padded_size; // Measured in bytes
462
463 uint32_t member_count;
465
467
468 struct {
469 uint32_t offset;
471
473
506
515
519
556
560typedef struct SpvReflectCapability {
561 SpvCapability value;
562 uint32_t word_offset;
564
565
574
580 const char* entry_point_name;
584 SpvSourceLanguage source_language;
586 const char* source_file;
587 const char* source_source;
590 SpvExecutionModel spirv_execution_model; // Uses value(s) from first entry point
591 SpvReflectShaderStageFlagBits shader_stage; // Uses value(s) from first entry point
592 uint32_t descriptor_binding_count; // Uses value(s) from first entry point
593 SpvReflectDescriptorBinding* descriptor_bindings; // Uses value(s) from first entry point
594 uint32_t descriptor_set_count; // Uses value(s) from first entry point
596 uint32_t input_variable_count; // Uses value(s) from first entry point
597 SpvReflectInterfaceVariable** input_variables; // Uses value(s) from first entry point
598 uint32_t output_variable_count; // Uses value(s) from first entry point
599 SpvReflectInterfaceVariable** output_variables; // Uses value(s) from first entry point
600 uint32_t interface_variable_count; // Uses value(s) from first entry point
601 SpvReflectInterfaceVariable* interface_variables; // Uses value(s) from first entry point
602 uint32_t push_constant_block_count; // Uses value(s) from first entry point
603 SpvReflectBlockVariable* push_constant_blocks; // Uses value(s) from first entry point
604 uint32_t spec_constant_count; // Uses value(s) from first entry point
605 SpvReflectSpecializationConstant* spec_constants; // Uses value(s) from first entry point
606
616
618
619#if defined(__cplusplus)
620extern "C" {
621#endif
622
632 size_t size,
633 const void* p_code,
634 SpvReflectShaderModule* p_module
635);
636
648 size_t size,
649 const void* p_code,
650 SpvReflectShaderModule* p_module
651);
652
653SPV_REFLECT_DEPRECATED("renamed to spvReflectCreateShaderModule")
655 size_t size,
656 const void* p_code,
657 SpvReflectShaderModule* p_module
658);
659
660
667
668
675uint32_t spvReflectGetCodeSize(const SpvReflectShaderModule* p_module);
676
677
684const uint32_t* spvReflectGetCode(const SpvReflectShaderModule* p_module);
685
694 const SpvReflectShaderModule* p_module,
695 const char* entry_point
696);
697
717 const SpvReflectShaderModule* p_module,
718 uint32_t* p_count,
719 SpvReflectDescriptorBinding** pp_bindings
720);
721
743 const SpvReflectShaderModule* p_module,
744 const char* entry_point,
745 uint32_t* p_count,
746 SpvReflectDescriptorBinding** pp_bindings
747);
748
768 const SpvReflectShaderModule* p_module,
769 uint32_t* p_count,
771);
772
794 const SpvReflectShaderModule* p_module,
795 const char* entry_point,
796 uint32_t* p_count,
798);
799
800
821 const SpvReflectShaderModule* p_module,
822 uint32_t* p_count,
823 SpvReflectInterfaceVariable** pp_variables
824);
825
846 const SpvReflectShaderModule* p_module,
847 const char* entry_point,
848 uint32_t* p_count,
849 SpvReflectInterfaceVariable** pp_variables
850);
851
852
873 const SpvReflectShaderModule* p_module,
874 uint32_t* p_count,
875 SpvReflectInterfaceVariable** pp_variables
876);
877
898 const SpvReflectShaderModule* p_module,
899 const char* entry_point,
900 uint32_t* p_count,
901 SpvReflectInterfaceVariable** pp_variables
902);
903
904
925 const SpvReflectShaderModule* p_module,
926 uint32_t* p_count,
927 SpvReflectInterfaceVariable** pp_variables
928);
929
950 const SpvReflectShaderModule* p_module,
951 const char* entry_point,
952 uint32_t* p_count,
953 SpvReflectInterfaceVariable** pp_variables
954);
955
956
978 const SpvReflectShaderModule* p_module,
979 uint32_t* p_count,
980 SpvReflectBlockVariable** pp_blocks
981);
982SPV_REFLECT_DEPRECATED("renamed to spvReflectEnumeratePushConstantBlocks")
984 const SpvReflectShaderModule* p_module,
985 uint32_t* p_count,
986 SpvReflectBlockVariable** pp_blocks
987);
988
1010 const SpvReflectShaderModule* p_module,
1011 const char* entry_point,
1012 uint32_t* p_count,
1013 SpvReflectBlockVariable** pp_blocks
1014);
1015
1016
1031 const SpvReflectShaderModule* p_module,
1032 uint32_t* p_count,
1034);
1035
1059 const SpvReflectShaderModule* p_module,
1060 uint32_t binding_number,
1061 uint32_t set_number,
1062 SpvReflectResult* p_result
1063);
1064
1091 const SpvReflectShaderModule* p_module,
1092 const char* entry_point,
1093 uint32_t binding_number,
1094 uint32_t set_number,
1095 SpvReflectResult* p_result
1096);
1097
1098
1116 const SpvReflectShaderModule* p_module,
1117 uint32_t set_number,
1118 SpvReflectResult* p_result
1119);
1120
1139 const SpvReflectShaderModule* p_module,
1140 const char* entry_point,
1141 uint32_t set_number,
1142 SpvReflectResult* p_result
1143);
1144
1145
1146/* @fn spvReflectGetInputVariableByLocation
1147
1148 @param p_module Pointer to an instance of SpvReflectShaderModule.
1149 @param location The "location" value of the requested input variable.
1150 A location of 0xFFFFFFFF will always return NULL
1151 with *p_result == ELEMENT_NOT_FOUND.
1152 @param p_result If successful, SPV_REFLECT_RESULT_SUCCESS will be
1153 written to *p_result. Otherwise, a error code
1154 indicating the cause of the failure will be stored
1155 here.
1156 @return If the module contains an input interface variable
1157 with the provided location value, a pointer to that
1158 variable is returned. The caller must not free this
1159 pointer.
1160 If no match can be found, or if an unrelated error
1161 occurs, the return value will be NULL. Detailed
1162 error results are written to *pResult.
1163@note
1164
1165*/
1167 const SpvReflectShaderModule* p_module,
1168 uint32_t location,
1169 SpvReflectResult* p_result
1170);
1171SPV_REFLECT_DEPRECATED("renamed to spvReflectGetInputVariableByLocation")
1173 const SpvReflectShaderModule* p_module,
1174 uint32_t location,
1175 SpvReflectResult* p_result
1176);
1177
1178/* @fn spvReflectGetEntryPointInputVariableByLocation
1179
1180 @param p_module Pointer to an instance of SpvReflectShaderModule.
1181 @param entry_point The entry point to get the input variable from.
1182 @param location The "location" value of the requested input variable.
1183 A location of 0xFFFFFFFF will always return NULL
1184 with *p_result == ELEMENT_NOT_FOUND.
1185 @param p_result If successful, SPV_REFLECT_RESULT_SUCCESS will be
1186 written to *p_result. Otherwise, a error code
1187 indicating the cause of the failure will be stored
1188 here.
1189 @return If the entry point contains an input interface variable
1190 with the provided location value, a pointer to that
1191 variable is returned. The caller must not free this
1192 pointer.
1193 If no match can be found, or if an unrelated error
1194 occurs, the return value will be NULL. Detailed
1195 error results are written to *pResult.
1196@note
1197
1198*/
1200 const SpvReflectShaderModule* p_module,
1201 const char* entry_point,
1202 uint32_t location,
1203 SpvReflectResult* p_result
1204);
1205
1206/* @fn spvReflectGetInputVariableBySemantic
1207
1208 @param p_module Pointer to an instance of SpvReflectShaderModule.
1209 @param semantic The "semantic" value of the requested input variable.
1210 A semantic of NULL will return NULL.
1211 A semantic of "" will always return NULL with
1212 *p_result == ELEMENT_NOT_FOUND.
1213 @param p_result If successful, SPV_REFLECT_RESULT_SUCCESS will be
1214 written to *p_result. Otherwise, a error code
1215 indicating the cause of the failure will be stored
1216 here.
1217 @return If the module contains an input interface variable
1218 with the provided semantic, a pointer to that
1219 variable is returned. The caller must not free this
1220 pointer.
1221 If no match can be found, or if an unrelated error
1222 occurs, the return value will be NULL. Detailed
1223 error results are written to *pResult.
1224@note
1225
1226*/
1228 const SpvReflectShaderModule* p_module,
1229 const char* semantic,
1230 SpvReflectResult* p_result
1231);
1232
1233/* @fn spvReflectGetEntryPointInputVariableBySemantic
1234
1235 @param p_module Pointer to an instance of SpvReflectShaderModule.
1236 @param entry_point The entry point to get the input variable from.
1237 @param semantic The "semantic" value of the requested input variable.
1238 A semantic of NULL will return NULL.
1239 A semantic of "" will always return NULL with
1240 *p_result == ELEMENT_NOT_FOUND.
1241 @param p_result If successful, SPV_REFLECT_RESULT_SUCCESS will be
1242 written to *p_result. Otherwise, a error code
1243 indicating the cause of the failure will be stored
1244 here.
1245 @return If the entry point contains an input interface variable
1246 with the provided semantic, a pointer to that
1247 variable is returned. The caller must not free this
1248 pointer.
1249 If no match can be found, or if an unrelated error
1250 occurs, the return value will be NULL. Detailed
1251 error results are written to *pResult.
1252@note
1253
1254*/
1256 const SpvReflectShaderModule* p_module,
1257 const char* entry_point,
1258 const char* semantic,
1259 SpvReflectResult* p_result
1260);
1261
1262/* @fn spvReflectGetOutputVariableByLocation
1263
1264 @param p_module Pointer to an instance of SpvReflectShaderModule.
1265 @param location The "location" value of the requested output variable.
1266 A location of 0xFFFFFFFF will always return NULL
1267 with *p_result == ELEMENT_NOT_FOUND.
1268 @param p_result If successful, SPV_REFLECT_RESULT_SUCCESS will be
1269 written to *p_result. Otherwise, a error code
1270 indicating the cause of the failure will be stored
1271 here.
1272 @return If the module contains an output interface variable
1273 with the provided location value, a pointer to that
1274 variable is returned. The caller must not free this
1275 pointer.
1276 If no match can be found, or if an unrelated error
1277 occurs, the return value will be NULL. Detailed
1278 error results are written to *pResult.
1279@note
1280
1281*/
1283 const SpvReflectShaderModule* p_module,
1284 uint32_t location,
1285 SpvReflectResult* p_result
1286);
1287SPV_REFLECT_DEPRECATED("renamed to spvReflectGetOutputVariableByLocation")
1289 const SpvReflectShaderModule* p_module,
1290 uint32_t location,
1291 SpvReflectResult* p_result
1292);
1293
1294/* @fn spvReflectGetEntryPointOutputVariableByLocation
1295
1296 @param p_module Pointer to an instance of SpvReflectShaderModule.
1297 @param entry_point The entry point to get the output variable from.
1298 @param location The "location" value of the requested output variable.
1299 A location of 0xFFFFFFFF will always return NULL
1300 with *p_result == ELEMENT_NOT_FOUND.
1301 @param p_result If successful, SPV_REFLECT_RESULT_SUCCESS will be
1302 written to *p_result. Otherwise, a error code
1303 indicating the cause of the failure will be stored
1304 here.
1305 @return If the entry point contains an output interface variable
1306 with the provided location value, a pointer to that
1307 variable is returned. The caller must not free this
1308 pointer.
1309 If no match can be found, or if an unrelated error
1310 occurs, the return value will be NULL. Detailed
1311 error results are written to *pResult.
1312@note
1313
1314*/
1316 const SpvReflectShaderModule* p_module,
1317 const char* entry_point,
1318 uint32_t location,
1319 SpvReflectResult* p_result
1320);
1321
1322/* @fn spvReflectGetOutputVariableBySemantic
1323
1324 @param p_module Pointer to an instance of SpvReflectShaderModule.
1325 @param semantic The "semantic" value of the requested output variable.
1326 A semantic of NULL will return NULL.
1327 A semantic of "" will always return NULL with
1328 *p_result == ELEMENT_NOT_FOUND.
1329 @param p_result If successful, SPV_REFLECT_RESULT_SUCCESS will be
1330 written to *p_result. Otherwise, a error code
1331 indicating the cause of the failure will be stored
1332 here.
1333 @return If the module contains an output interface variable
1334 with the provided semantic, a pointer to that
1335 variable is returned. The caller must not free this
1336 pointer.
1337 If no match can be found, or if an unrelated error
1338 occurs, the return value will be NULL. Detailed
1339 error results are written to *pResult.
1340@note
1341
1342*/
1344 const SpvReflectShaderModule* p_module,
1345 const char* semantic,
1346 SpvReflectResult* p_result
1347);
1348
1349/* @fn spvReflectGetEntryPointOutputVariableBySemantic
1350
1351 @param p_module Pointer to an instance of SpvReflectShaderModule.
1352 @param entry_point The entry point to get the output variable from.
1353 @param semantic The "semantic" value of the requested output variable.
1354 A semantic of NULL will return NULL.
1355 A semantic of "" will always return NULL with
1356 *p_result == ELEMENT_NOT_FOUND.
1357 @param p_result If successful, SPV_REFLECT_RESULT_SUCCESS will be
1358 written to *p_result. Otherwise, a error code
1359 indicating the cause of the failure will be stored
1360 here.
1361 @return If the entry point contains an output interface variable
1362 with the provided semantic, a pointer to that
1363 variable is returned. The caller must not free this
1364 pointer.
1365 If no match can be found, or if an unrelated error
1366 occurs, the return value will be NULL. Detailed
1367 error results are written to *pResult.
1368@note
1369
1370*/
1372 const SpvReflectShaderModule* p_module,
1373 const char* entry_point,
1374 const char* semantic,
1375 SpvReflectResult* p_result
1376);
1377
1396 const SpvReflectShaderModule* p_module,
1397 uint32_t index,
1398 SpvReflectResult* p_result
1399);
1400SPV_REFLECT_DEPRECATED("renamed to spvReflectGetPushConstantBlock")
1402 const SpvReflectShaderModule* p_module,
1403 uint32_t index,
1404 SpvReflectResult* p_result
1405);
1406
1427 const SpvReflectShaderModule* p_module,
1428 const char* entry_point,
1429 SpvReflectResult* p_result
1430);
1431
1432
1457 SpvReflectShaderModule* p_module,
1458 const SpvReflectDescriptorBinding* p_binding,
1459 uint32_t new_binding_number,
1460 uint32_t new_set_number
1461);
1462SPV_REFLECT_DEPRECATED("Renamed to spvReflectChangeDescriptorBindingNumbers")
1464 SpvReflectShaderModule* p_module,
1465 const SpvReflectDescriptorBinding* p_descriptor_binding,
1466 uint32_t new_binding_number,
1467 uint32_t optional_new_set_number
1468);
1469
1493 SpvReflectShaderModule* p_module,
1494 const SpvReflectDescriptorSet* p_set,
1495 uint32_t new_set_number
1496);
1497
1516 SpvReflectShaderModule* p_module,
1517 const SpvReflectInterfaceVariable* p_input_variable,
1518 uint32_t new_location
1519);
1520
1521
1540 SpvReflectShaderModule* p_module,
1541 const SpvReflectInterfaceVariable* p_output_variable,
1542 uint32_t new_location
1543);
1544
1545
1552const char* spvReflectSourceLanguage(SpvSourceLanguage source_lang);
1553
1561 const SpvReflectBlockVariable* p_var
1562);
1563
1564#if defined(__cplusplus)
1565};
1566#endif
1567
1568#if defined(__cplusplus) && !defined(SPIRV_REFLECT_DISABLE_CPP_BINDINGS)
1569#include <cstdlib>
1570#include <string>
1571#include <vector>
1572
1573namespace spv_reflect {
1574
1578class ShaderModule {
1579public:
1580 ShaderModule();
1581 ShaderModule(size_t size, const void* p_code, SpvReflectModuleFlags flags = SPV_REFLECT_MODULE_FLAG_NONE);
1582 ShaderModule(const std::vector<uint8_t>& code, SpvReflectModuleFlags flags = SPV_REFLECT_MODULE_FLAG_NONE);
1583 ShaderModule(const std::vector<uint32_t>& code, SpvReflectModuleFlags flags = SPV_REFLECT_MODULE_FLAG_NONE);
1584 ~ShaderModule();
1585
1586 ShaderModule(ShaderModule&& other);
1587 ShaderModule& operator=(ShaderModule&& other);
1588
1589 SpvReflectResult GetResult() const;
1590
1591 const SpvReflectShaderModule& GetShaderModule() const;
1592
1593 uint32_t GetCodeSize() const;
1594 const uint32_t* GetCode() const;
1595
1596 const char* GetEntryPointName() const;
1597
1598 const char* GetSourceFile() const;
1599
1600 uint32_t GetEntryPointCount() const;
1601 const char* GetEntryPointName(uint32_t index) const;
1602 SpvReflectShaderStageFlagBits GetEntryPointShaderStage(uint32_t index) const;
1603
1604 SpvReflectShaderStageFlagBits GetShaderStage() const;
1605 SPV_REFLECT_DEPRECATED("Renamed to GetShaderStage")
1606 SpvReflectShaderStageFlagBits GetVulkanShaderStage() const {
1607 return GetShaderStage();
1608 }
1609
1610 SpvReflectResult EnumerateDescriptorBindings(uint32_t* p_count, SpvReflectDescriptorBinding** pp_bindings) const;
1611 SpvReflectResult EnumerateEntryPointDescriptorBindings(const char* entry_point, uint32_t* p_count, SpvReflectDescriptorBinding** pp_bindings) const;
1612 SpvReflectResult EnumerateDescriptorSets( uint32_t* p_count, SpvReflectDescriptorSet** pp_sets) const ;
1613 SpvReflectResult EnumerateEntryPointDescriptorSets(const char* entry_point, uint32_t* p_count, SpvReflectDescriptorSet** pp_sets) const ;
1614 SpvReflectResult EnumerateInterfaceVariables(uint32_t* p_count, SpvReflectInterfaceVariable** pp_variables) const;
1615 SpvReflectResult EnumerateEntryPointInterfaceVariables(const char* entry_point, uint32_t* p_count, SpvReflectInterfaceVariable** pp_variables) const;
1616 SpvReflectResult EnumerateInputVariables(uint32_t* p_count,SpvReflectInterfaceVariable** pp_variables) const;
1617 SpvReflectResult EnumerateEntryPointInputVariables(const char* entry_point, uint32_t* p_count, SpvReflectInterfaceVariable** pp_variables) const;
1618 SpvReflectResult EnumerateOutputVariables(uint32_t* p_count,SpvReflectInterfaceVariable** pp_variables) const;
1619 SpvReflectResult EnumerateEntryPointOutputVariables(const char* entry_point, uint32_t* p_count, SpvReflectInterfaceVariable** pp_variables) const;
1620 SpvReflectResult EnumeratePushConstantBlocks(uint32_t* p_count, SpvReflectBlockVariable** pp_blocks) const;
1621 SpvReflectResult EnumerateEntryPointPushConstantBlocks(const char* entry_point, uint32_t* p_count, SpvReflectBlockVariable** pp_blocks) const;
1622 SPV_REFLECT_DEPRECATED("Renamed to EnumeratePushConstantBlocks")
1623 SpvReflectResult EnumeratePushConstants(uint32_t* p_count, SpvReflectBlockVariable** pp_blocks) const {
1624 return EnumeratePushConstantBlocks(p_count, pp_blocks);
1625 }
1626 SpvReflectResult EnumerateSpecializationConstants(uint32_t* p_count, SpvReflectSpecializationConstant** pp_constants) const;
1627
1628 const SpvReflectDescriptorBinding* GetDescriptorBinding(uint32_t binding_number, uint32_t set_number, SpvReflectResult* p_result = nullptr) const;
1629 const SpvReflectDescriptorBinding* GetEntryPointDescriptorBinding(const char* entry_point, uint32_t binding_number, uint32_t set_number, SpvReflectResult* p_result = nullptr) const;
1630 const SpvReflectDescriptorSet* GetDescriptorSet(uint32_t set_number, SpvReflectResult* p_result = nullptr) const;
1631 const SpvReflectDescriptorSet* GetEntryPointDescriptorSet(const char* entry_point, uint32_t set_number, SpvReflectResult* p_result = nullptr) const;
1632 const SpvReflectInterfaceVariable* GetInputVariableByLocation(uint32_t location, SpvReflectResult* p_result = nullptr) const;
1633 SPV_REFLECT_DEPRECATED("Renamed to GetInputVariableByLocation")
1634 const SpvReflectInterfaceVariable* GetInputVariable(uint32_t location, SpvReflectResult* p_result = nullptr) const {
1635 return GetInputVariableByLocation(location, p_result);
1636 }
1637 const SpvReflectInterfaceVariable* GetEntryPointInputVariableByLocation(const char* entry_point, uint32_t location, SpvReflectResult* p_result = nullptr) const;
1638 const SpvReflectInterfaceVariable* GetInputVariableBySemantic(const char* semantic, SpvReflectResult* p_result = nullptr) const;
1639 const SpvReflectInterfaceVariable* GetEntryPointInputVariableBySemantic(const char* entry_point, const char* semantic, SpvReflectResult* p_result = nullptr) const;
1640 const SpvReflectInterfaceVariable* GetOutputVariableByLocation(uint32_t location, SpvReflectResult* p_result = nullptr) const;
1641 SPV_REFLECT_DEPRECATED("Renamed to GetOutputVariableByLocation")
1642 const SpvReflectInterfaceVariable* GetOutputVariable(uint32_t location, SpvReflectResult* p_result = nullptr) const {
1643 return GetOutputVariableByLocation(location, p_result);
1644 }
1645 const SpvReflectInterfaceVariable* GetEntryPointOutputVariableByLocation(const char* entry_point, uint32_t location, SpvReflectResult* p_result = nullptr) const;
1646 const SpvReflectInterfaceVariable* GetOutputVariableBySemantic(const char* semantic, SpvReflectResult* p_result = nullptr) const;
1647 const SpvReflectInterfaceVariable* GetEntryPointOutputVariableBySemantic(const char* entry_point, const char* semantic, SpvReflectResult* p_result = nullptr) const;
1648 const SpvReflectBlockVariable* GetPushConstantBlock(uint32_t index, SpvReflectResult* p_result = nullptr) const;
1649 SPV_REFLECT_DEPRECATED("Renamed to GetPushConstantBlock")
1650 const SpvReflectBlockVariable* GetPushConstant(uint32_t index, SpvReflectResult* p_result = nullptr) const {
1651 return GetPushConstantBlock(index, p_result);
1652 }
1653 const SpvReflectBlockVariable* GetEntryPointPushConstantBlock(const char* entry_point, SpvReflectResult* p_result = nullptr) const;
1654
1655 SpvReflectResult ChangeDescriptorBindingNumbers(const SpvReflectDescriptorBinding* p_binding,
1656 uint32_t new_binding_number = SPV_REFLECT_BINDING_NUMBER_DONT_CHANGE,
1657 uint32_t optional_new_set_number = SPV_REFLECT_SET_NUMBER_DONT_CHANGE);
1658 SPV_REFLECT_DEPRECATED("Renamed to ChangeDescriptorBindingNumbers")
1659 SpvReflectResult ChangeDescriptorBindingNumber(const SpvReflectDescriptorBinding* p_binding, uint32_t new_binding_number = SPV_REFLECT_BINDING_NUMBER_DONT_CHANGE,
1660 uint32_t new_set_number = SPV_REFLECT_SET_NUMBER_DONT_CHANGE) {
1661 return ChangeDescriptorBindingNumbers(p_binding, new_binding_number, new_set_number);
1662 }
1663 SpvReflectResult ChangeDescriptorSetNumber(const SpvReflectDescriptorSet* p_set, uint32_t new_set_number = SPV_REFLECT_SET_NUMBER_DONT_CHANGE);
1664 SpvReflectResult ChangeInputVariableLocation(const SpvReflectInterfaceVariable* p_input_variable, uint32_t new_location);
1665 SpvReflectResult ChangeOutputVariableLocation(const SpvReflectInterfaceVariable* p_output_variable, uint32_t new_location);
1666
1667private:
1668 // Make noncopyable
1669 ShaderModule(const ShaderModule&);
1670 ShaderModule& operator=(const ShaderModule&);
1671
1672private:
1674 SpvReflectShaderModule m_module = {};
1675};
1676
1677
1678// =================================================================================================
1679// ShaderModule
1680// =================================================================================================
1681
1685inline ShaderModule::ShaderModule() {}
1686
1687
1694inline ShaderModule::ShaderModule(size_t size, const void* p_code, SpvReflectModuleFlags flags) {
1696 flags,
1697 size,
1698 p_code,
1699 &m_module);
1700}
1701
1707inline ShaderModule::ShaderModule(const std::vector<uint8_t>& code, SpvReflectModuleFlags flags) {
1709 flags,
1710 code.size(),
1711 code.data(),
1712 &m_module);
1713}
1714
1720inline ShaderModule::ShaderModule(const std::vector<uint32_t>& code, SpvReflectModuleFlags flags) {
1722 flags,
1723 code.size() * sizeof(uint32_t),
1724 code.data(),
1725 &m_module);
1726}
1727
1731inline ShaderModule::~ShaderModule() {
1733}
1734
1735
1736inline ShaderModule::ShaderModule(ShaderModule&& other)
1737{
1738 *this = std::move(other);
1739}
1740
1741inline ShaderModule& ShaderModule::operator=(ShaderModule&& other)
1742{
1743 m_result = std::move(other.m_result);
1744 m_module = std::move(other.m_module);
1745
1746 other.m_module = {};
1747 return *this;
1748}
1749
1755inline SpvReflectResult ShaderModule::GetResult() const {
1756 return m_result;
1757}
1758
1759
1765inline const SpvReflectShaderModule& ShaderModule::GetShaderModule() const {
1766 return m_module;
1767}
1768
1769
1775inline uint32_t ShaderModule::GetCodeSize() const {
1776 return spvReflectGetCodeSize(&m_module);
1777}
1778
1779
1785inline const uint32_t* ShaderModule::GetCode() const {
1786 return spvReflectGetCode(&m_module);
1787}
1788
1789
1795inline const char* ShaderModule::GetEntryPointName() const {
1796 return this->GetEntryPointName(0);
1797}
1798
1804inline const char* ShaderModule::GetSourceFile() const {
1805 return m_module.source_file;
1806}
1807
1813inline uint32_t ShaderModule::GetEntryPointCount() const {
1814 return m_module.entry_point_count;
1815}
1816
1822inline const char* ShaderModule::GetEntryPointName(uint32_t index) const {
1823 return m_module.entry_points[index].name;
1824}
1825
1831inline SpvReflectShaderStageFlagBits ShaderModule::GetEntryPointShaderStage(uint32_t index) const {
1832 return m_module.entry_points[index].shader_stage;
1833}
1834
1840inline SpvReflectShaderStageFlagBits ShaderModule::GetShaderStage() const {
1841 return m_module.shader_stage;
1842}
1843
1852inline SpvReflectResult ShaderModule::EnumerateDescriptorBindings(
1853 uint32_t* p_count,
1854 SpvReflectDescriptorBinding** pp_bindings
1855) const
1856{
1858 &m_module,
1859 p_count,
1860 pp_bindings);
1861 return m_result;
1862}
1863
1872inline SpvReflectResult ShaderModule::EnumerateEntryPointDescriptorBindings(
1873 const char* entry_point,
1874 uint32_t* p_count,
1875 SpvReflectDescriptorBinding** pp_bindings
1876) const
1877{
1879 &m_module,
1880 entry_point,
1881 p_count,
1882 pp_bindings);
1883 return m_result;
1884}
1885
1886
1894inline SpvReflectResult ShaderModule::EnumerateDescriptorSets(
1895 uint32_t* p_count,
1896 SpvReflectDescriptorSet** pp_sets
1897) const
1898{
1900 &m_module,
1901 p_count,
1902 pp_sets);
1903 return m_result;
1904}
1905
1914inline SpvReflectResult ShaderModule::EnumerateEntryPointDescriptorSets(
1915 const char* entry_point,
1916 uint32_t* p_count,
1917 SpvReflectDescriptorSet** pp_sets
1918) const
1919{
1921 &m_module,
1922 entry_point,
1923 p_count,
1924 pp_sets);
1925 return m_result;
1926}
1927
1928
1936inline SpvReflectResult ShaderModule::EnumerateInterfaceVariables(
1937 uint32_t* p_count,
1938 SpvReflectInterfaceVariable** pp_variables
1939) const
1940{
1942 &m_module,
1943 p_count,
1944 pp_variables);
1945 return m_result;
1946}
1947
1956inline SpvReflectResult ShaderModule::EnumerateEntryPointInterfaceVariables(
1957 const char* entry_point,
1958 uint32_t* p_count,
1959 SpvReflectInterfaceVariable** pp_variables
1960) const
1961{
1963 &m_module,
1964 entry_point,
1965 p_count,
1966 pp_variables);
1967 return m_result;
1968}
1969
1970
1978inline SpvReflectResult ShaderModule::EnumerateInputVariables(
1979 uint32_t* p_count,
1980 SpvReflectInterfaceVariable** pp_variables
1981) const
1982{
1984 &m_module,
1985 p_count,
1986 pp_variables);
1987 return m_result;
1988}
1989
1998inline SpvReflectResult ShaderModule::EnumerateEntryPointInputVariables(
1999 const char* entry_point,
2000 uint32_t* p_count,
2001 SpvReflectInterfaceVariable** pp_variables
2002) const
2003{
2005 &m_module,
2006 entry_point,
2007 p_count,
2008 pp_variables);
2009 return m_result;
2010}
2011
2012
2020inline SpvReflectResult ShaderModule::EnumerateOutputVariables(
2021 uint32_t* p_count,
2022 SpvReflectInterfaceVariable** pp_variables
2023) const
2024{
2026 &m_module,
2027 p_count,
2028 pp_variables);
2029 return m_result;
2030}
2031
2040inline SpvReflectResult ShaderModule::EnumerateEntryPointOutputVariables(
2041 const char* entry_point,
2042 uint32_t* p_count,
2043 SpvReflectInterfaceVariable** pp_variables
2044) const
2045{
2047 &m_module,
2048 entry_point,
2049 p_count,
2050 pp_variables);
2051 return m_result;
2052}
2053
2054
2062inline SpvReflectResult ShaderModule::EnumeratePushConstantBlocks(
2063 uint32_t* p_count,
2064 SpvReflectBlockVariable** pp_blocks
2065) const
2066{
2068 &m_module,
2069 p_count,
2070 pp_blocks);
2071 return m_result;
2072}
2073
2079inline SpvReflectResult ShaderModule::EnumerateSpecializationConstants(
2080 uint32_t* p_count,
2082) const
2083{
2085 &m_module,
2086 p_count,
2087 pp_constants
2088 );
2089 return m_result;
2090}
2091
2100inline SpvReflectResult ShaderModule::EnumerateEntryPointPushConstantBlocks(
2101 const char* entry_point,
2102 uint32_t* p_count,
2103 SpvReflectBlockVariable** pp_blocks
2104) const
2105{
2107 &m_module,
2108 entry_point,
2109 p_count,
2110 pp_blocks);
2111 return m_result;
2112}
2113
2114
2123inline const SpvReflectDescriptorBinding* ShaderModule::GetDescriptorBinding(
2124 uint32_t binding_number,
2125 uint32_t set_number,
2126 SpvReflectResult* p_result
2127) const
2128{
2130 &m_module,
2131 binding_number,
2132 set_number,
2133 p_result);
2134}
2135
2145inline const SpvReflectDescriptorBinding* ShaderModule::GetEntryPointDescriptorBinding(
2146 const char* entry_point,
2147 uint32_t binding_number,
2148 uint32_t set_number,
2149 SpvReflectResult* p_result
2150) const
2151{
2153 &m_module,
2154 entry_point,
2155 binding_number,
2156 set_number,
2157 p_result);
2158}
2159
2160
2168inline const SpvReflectDescriptorSet* ShaderModule::GetDescriptorSet(
2169 uint32_t set_number,
2170 SpvReflectResult* p_result
2171) const
2172{
2174 &m_module,
2175 set_number,
2176 p_result);
2177}
2178
2187inline const SpvReflectDescriptorSet* ShaderModule::GetEntryPointDescriptorSet(
2188 const char* entry_point,
2189 uint32_t set_number,
2190 SpvReflectResult* p_result
2191) const
2192{
2194 &m_module,
2195 entry_point,
2196 set_number,
2197 p_result);
2198}
2199
2200
2208inline const SpvReflectInterfaceVariable* ShaderModule::GetInputVariableByLocation(
2209 uint32_t location,
2210 SpvReflectResult* p_result
2211) const
2212{
2214 &m_module,
2215 location,
2216 p_result);
2217}
2218inline const SpvReflectInterfaceVariable* ShaderModule::GetInputVariableBySemantic(
2219 const char* semantic,
2220 SpvReflectResult* p_result
2221) const
2222{
2224 &m_module,
2225 semantic,
2226 p_result);
2227}
2228
2237inline const SpvReflectInterfaceVariable* ShaderModule::GetEntryPointInputVariableByLocation(
2238 const char* entry_point,
2239 uint32_t location,
2240 SpvReflectResult* p_result
2241) const
2242{
2244 &m_module,
2245 entry_point,
2246 location,
2247 p_result);
2248}
2249inline const SpvReflectInterfaceVariable* ShaderModule::GetEntryPointInputVariableBySemantic(
2250 const char* entry_point,
2251 const char* semantic,
2252 SpvReflectResult* p_result
2253) const
2254{
2256 &m_module,
2257 entry_point,
2258 semantic,
2259 p_result);
2260}
2261
2262
2270inline const SpvReflectInterfaceVariable* ShaderModule::GetOutputVariableByLocation(
2271 uint32_t location,
2272 SpvReflectResult* p_result
2273) const
2274{
2276 &m_module,
2277 location,
2278 p_result);
2279}
2280inline const SpvReflectInterfaceVariable* ShaderModule::GetOutputVariableBySemantic(
2281 const char* semantic,
2282 SpvReflectResult* p_result
2283) const
2284{
2286 semantic,
2287 p_result);
2288}
2289
2298inline const SpvReflectInterfaceVariable* ShaderModule::GetEntryPointOutputVariableByLocation(
2299 const char* entry_point,
2300 uint32_t location,
2301 SpvReflectResult* p_result
2302) const
2303{
2305 &m_module,
2306 entry_point,
2307 location,
2308 p_result);
2309}
2310inline const SpvReflectInterfaceVariable* ShaderModule::GetEntryPointOutputVariableBySemantic(
2311 const char* entry_point,
2312 const char* semantic,
2313 SpvReflectResult* p_result
2314) const
2315{
2317 &m_module,
2318 entry_point,
2319 semantic,
2320 p_result);
2321}
2322
2323
2331inline const SpvReflectBlockVariable* ShaderModule::GetPushConstantBlock(
2332 uint32_t index,
2333 SpvReflectResult* p_result
2334) const
2335{
2337 &m_module,
2338 index,
2339 p_result);
2340}
2341
2350inline const SpvReflectBlockVariable* ShaderModule::GetEntryPointPushConstantBlock(
2351 const char* entry_point,
2352 SpvReflectResult* p_result
2353) const
2354{
2356 &m_module,
2357 entry_point,
2358 p_result);
2359}
2360
2361
2370inline SpvReflectResult ShaderModule::ChangeDescriptorBindingNumbers(
2371 const SpvReflectDescriptorBinding* p_binding,
2372 uint32_t new_binding_number,
2373 uint32_t new_set_number
2374)
2375{
2377 &m_module,
2378 p_binding,
2379 new_binding_number,
2380 new_set_number);
2381}
2382
2383
2391inline SpvReflectResult ShaderModule::ChangeDescriptorSetNumber(
2392 const SpvReflectDescriptorSet* p_set,
2393 uint32_t new_set_number
2394)
2395{
2397 &m_module,
2398 p_set,
2399 new_set_number);
2400}
2401
2402
2410inline SpvReflectResult ShaderModule::ChangeInputVariableLocation(
2411 const SpvReflectInterfaceVariable* p_input_variable,
2412 uint32_t new_location)
2413{
2415 &m_module,
2416 p_input_variable,
2417 new_location);
2418}
2419
2420
2428inline SpvReflectResult ShaderModule::ChangeOutputVariableLocation(
2429 const SpvReflectInterfaceVariable* p_output_variable,
2430 uint32_t new_location)
2431{
2433 &m_module,
2434 p_output_variable,
2435 new_location);
2436}
2437
2438} // namespace spv_reflect
2439#endif // defined(__cplusplus) && !defined(SPIRV_REFLECT_DISABLE_CPP_WRAPPER)
2440#endif // SPIRV_REFLECT_H
2441
2442// clang-format on
@ SPV_REFLECT_MAX_DESCRIPTOR_SETS
Definition spirv_reflect.h:327
@ SPV_REFLECT_MAX_ARRAY_DIMS
Definition spirv_reflect.h:326
SpvReflectExecutionModeValue
Definition spirv_reflect.h:516
@ SPV_REFLECT_EXECUTION_MODE_SPEC_CONSTANT
Definition spirv_reflect.h:517
SpvReflectResult spvReflectEnumerateEntryPointOutputVariables(const SpvReflectShaderModule *p_module, const char *entry_point, uint32_t *p_count, SpvReflectInterfaceVariable **pp_variables)
Definition spirv_reflect.cpp:5568
struct SpvReflectDescriptorBinding SpvReflectDescriptorBinding
SpvReflectResult spvReflectEnumeratePushConstantBlocks(const SpvReflectShaderModule *p_module, uint32_t *p_count, SpvReflectBlockVariable **pp_blocks)
Definition spirv_reflect.cpp:5601
SpvReflectResult spvReflectEnumerateInputVariables(const SpvReflectShaderModule *p_module, uint32_t *p_count, SpvReflectInterfaceVariable **pp_variables)
Definition spirv_reflect.cpp:5481
const SpvReflectBlockVariable * spvReflectGetPushConstantBlock(const SpvReflectShaderModule *p_module, uint32_t index, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:6162
SpvReflectFormat
Definition spirv_reflect.h:216
@ SPV_REFLECT_FORMAT_R16_UINT
Definition spirv_reflect.h:218
@ SPV_REFLECT_FORMAT_R16_SFLOAT
Definition spirv_reflect.h:220
@ SPV_REFLECT_FORMAT_UNDEFINED
Definition spirv_reflect.h:217
@ SPV_REFLECT_FORMAT_R32G32B32_UINT
Definition spirv_reflect.h:236
@ SPV_REFLECT_FORMAT_R32G32B32A32_UINT
Definition spirv_reflect.h:239
@ SPV_REFLECT_FORMAT_R16G16B16_SFLOAT
Definition spirv_reflect.h:226
@ SPV_REFLECT_FORMAT_R64G64B64_SINT
Definition spirv_reflect.h:249
@ SPV_REFLECT_FORMAT_R16G16B16A16_SINT
Definition spirv_reflect.h:228
@ SPV_REFLECT_FORMAT_R16G16_SFLOAT
Definition spirv_reflect.h:223
@ SPV_REFLECT_FORMAT_R32G32_UINT
Definition spirv_reflect.h:233
@ SPV_REFLECT_FORMAT_R32G32_SFLOAT
Definition spirv_reflect.h:235
@ SPV_REFLECT_FORMAT_R64G64B64_UINT
Definition spirv_reflect.h:248
@ SPV_REFLECT_FORMAT_R16G16B16A16_UINT
Definition spirv_reflect.h:227
@ SPV_REFLECT_FORMAT_R32_SFLOAT
Definition spirv_reflect.h:232
@ SPV_REFLECT_FORMAT_R64G64B64A64_SFLOAT
Definition spirv_reflect.h:253
@ SPV_REFLECT_FORMAT_R64_SFLOAT
Definition spirv_reflect.h:244
@ SPV_REFLECT_FORMAT_R16G16B16_SINT
Definition spirv_reflect.h:225
@ SPV_REFLECT_FORMAT_R16_SINT
Definition spirv_reflect.h:219
@ SPV_REFLECT_FORMAT_R64G64B64A64_UINT
Definition spirv_reflect.h:251
@ SPV_REFLECT_FORMAT_R16G16B16_UINT
Definition spirv_reflect.h:224
@ SPV_REFLECT_FORMAT_R16G16_SINT
Definition spirv_reflect.h:222
@ SPV_REFLECT_FORMAT_R64_SINT
Definition spirv_reflect.h:243
@ SPV_REFLECT_FORMAT_R32G32B32_SINT
Definition spirv_reflect.h:237
@ SPV_REFLECT_FORMAT_R64G64B64A64_SINT
Definition spirv_reflect.h:252
@ SPV_REFLECT_FORMAT_R32G32B32_SFLOAT
Definition spirv_reflect.h:238
@ SPV_REFLECT_FORMAT_R64G64B64_SFLOAT
Definition spirv_reflect.h:250
@ SPV_REFLECT_FORMAT_R64G64_UINT
Definition spirv_reflect.h:245
@ SPV_REFLECT_FORMAT_R32_SINT
Definition spirv_reflect.h:231
@ SPV_REFLECT_FORMAT_R32G32_SINT
Definition spirv_reflect.h:234
@ SPV_REFLECT_FORMAT_R16G16_UINT
Definition spirv_reflect.h:221
@ SPV_REFLECT_FORMAT_R64G64_SFLOAT
Definition spirv_reflect.h:247
@ SPV_REFLECT_FORMAT_R32_UINT
Definition spirv_reflect.h:230
@ SPV_REFLECT_FORMAT_R32G32B32A32_SFLOAT
Definition spirv_reflect.h:241
@ SPV_REFLECT_FORMAT_R32G32B32A32_SINT
Definition spirv_reflect.h:240
@ SPV_REFLECT_FORMAT_R64G64_SINT
Definition spirv_reflect.h:246
@ SPV_REFLECT_FORMAT_R16G16B16A16_SFLOAT
Definition spirv_reflect.h:229
@ SPV_REFLECT_FORMAT_R64_UINT
Definition spirv_reflect.h:242
SpvReflectResult
Definition spirv_reflect.h:56
@ SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_ID_REFERENCE
Definition spirv_reflect.h:69
@ SPV_REFLECT_RESULT_ERROR_SPIRV_RECURSION
Definition spirv_reflect.h:72
@ SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_ENTRY_POINT
Definition spirv_reflect.h:76
@ SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_BLOCK_MEMBER_REFERENCE
Definition spirv_reflect.h:75
@ SPV_REFLECT_RESULT_ERROR_PARSE_FAILED
Definition spirv_reflect.h:59
@ SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_MAGIC_NUMBER
Definition spirv_reflect.h:67
@ SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_INSTRUCTION
Definition spirv_reflect.h:73
@ SPV_REFLECT_RESULT_ERROR_SPIRV_SET_NUMBER_OVERFLOW
Definition spirv_reflect.h:70
@ SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED
Definition spirv_reflect.h:60
@ SPV_REFLECT_RESULT_NOT_READY
Definition spirv_reflect.h:58
@ SPV_REFLECT_RESULT_SUCCESS
Definition spirv_reflect.h:57
@ SPV_REFLECT_RESULT_ERROR_SPIRV_MAX_RECURSIVE_EXCEEDED
Definition spirv_reflect.h:78
@ SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_EXECUTION_MODE
Definition spirv_reflect.h:77
@ SPV_REFLECT_RESULT_ERROR_SPIRV_UNEXPECTED_EOF
Definition spirv_reflect.h:68
@ SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_STORAGE_CLASS
Definition spirv_reflect.h:71
@ SPV_REFLECT_RESULT_ERROR_SPIRV_UNEXPECTED_BLOCK_DATA
Definition spirv_reflect.h:74
@ SPV_REFLECT_RESULT_ERROR_RANGE_EXCEEDED
Definition spirv_reflect.h:61
@ SPV_REFLECT_RESULT_ERROR_INTERNAL_ERROR
Definition spirv_reflect.h:63
@ SPV_REFLECT_RESULT_ERROR_COUNT_MISMATCH
Definition spirv_reflect.h:64
@ SPV_REFLECT_RESULT_ERROR_NULL_POINTER
Definition spirv_reflect.h:62
@ SPV_REFLECT_RESULT_ERROR_ELEMENT_NOT_FOUND
Definition spirv_reflect.h:65
@ SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_CODE_SIZE
Definition spirv_reflect.h:66
const SpvReflectDescriptorSet * spvReflectGetEntryPointDescriptorSet(const SpvReflectShaderModule *p_module, const char *entry_point, uint32_t set_number, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:5799
SpvReflectResult spvReflectCreateShaderModule(size_t size, const void *p_code, SpvReflectShaderModule *p_module)
Definition spirv_reflect.cpp:5111
const char * spvReflectSourceLanguage(SpvSourceLanguage source_lang)
Definition spirv_reflect.cpp:6382
struct SpvReflectDescriptorSet SpvReflectDescriptorSet
const SpvReflectInterfaceVariable * spvReflectGetEntryPointInputVariableByLocation(const SpvReflectShaderModule *p_module, const char *entry_point, uint32_t location, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:5871
const SpvReflectInterfaceVariable * spvReflectGetEntryPointInputVariableBySemantic(const SpvReflectShaderModule *p_module, const char *entry_point, const char *semantic, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:5951
const SpvReflectDescriptorBinding * spvReflectGetEntryPointDescriptorBinding(const SpvReflectShaderModule *p_module, const char *entry_point, uint32_t binding_number, uint32_t set_number, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:5735
SpvReflectGenerator
Definition spirv_reflect.h:312
@ SPV_REFLECT_GENERATOR_KHRONOS_SPIRV_TOOLS_ASSEMBLER
Definition spirv_reflect.h:314
@ SPV_REFLECT_GENERATOR_GOOGLE_RSPIRV
Definition spirv_reflect.h:318
@ SPV_REFLECT_GENERATOR_WINE_VKD3D_SHADER_COMPILER
Definition spirv_reflect.h:321
@ SPV_REFLECT_GENERATOR_KHRONOS_GLSLANG_REFERENCE_FRONT_END
Definition spirv_reflect.h:315
@ SPV_REFLECT_GENERATOR_KHRONOS_SPIRV_TOOLS_LINKER
Definition spirv_reflect.h:320
@ SPV_REFLECT_GENERATOR_CLAY_CLAY_SHADER_COMPILER
Definition spirv_reflect.h:322
@ SPV_REFLECT_GENERATOR_GOOGLE_SHADERC_OVER_GLSLANG
Definition spirv_reflect.h:316
@ SPV_REFLECT_GENERATOR_GOOGLE_SPIREGG
Definition spirv_reflect.h:317
@ SPV_REFLECT_GENERATOR_KHRONOS_LLVM_SPIRV_TRANSLATOR
Definition spirv_reflect.h:313
@ SPV_REFLECT_GENERATOR_X_LEGEND_MESA_MESAIR_SPIRV_TRANSLATOR
Definition spirv_reflect.h:319
SpvReflectResult spvReflectChangeOutputVariableLocation(SpvReflectShaderModule *p_module, const SpvReflectInterfaceVariable *p_output_variable, uint32_t new_location)
Definition spirv_reflect.cpp:6362
SpvReflectResult spvReflectEnumerateEntryPointDescriptorSets(const SpvReflectShaderModule *p_module, const char *entry_point, uint32_t *p_count, SpvReflectDescriptorSet **pp_sets)
Definition spirv_reflect.cpp:5388
struct SpvReflectCapability SpvReflectCapability
uint32_t SpvReflectTypeFlags
Definition spirv_reflect.h:122
const SpvReflectInterfaceVariable * spvReflectGetEntryPointOutputVariableByLocation(const SpvReflectShaderModule *p_module, const char *entry_point, uint32_t location, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:6036
uint32_t SpvReflectModuleFlags
Definition spirv_reflect.h:98
SpvReflectModuleFlagBits
Definition spirv_reflect.h:93
@ SPV_REFLECT_MODULE_FLAG_NO_COPY
Definition spirv_reflect.h:95
@ SPV_REFLECT_MODULE_FLAG_NONE
Definition spirv_reflect.h:94
SpvReflectResourceType
Definition spirv_reflect.h:205
@ SPV_REFLECT_RESOURCE_FLAG_SRV
Definition spirv_reflect.h:209
@ SPV_REFLECT_RESOURCE_FLAG_SAMPLER
Definition spirv_reflect.h:207
@ SPV_REFLECT_RESOURCE_FLAG_UAV
Definition spirv_reflect.h:210
@ SPV_REFLECT_RESOURCE_FLAG_CBV
Definition spirv_reflect.h:208
@ SPV_REFLECT_RESOURCE_FLAG_UNDEFINED
Definition spirv_reflect.h:206
const SpvReflectDescriptorSet * spvReflectGetDescriptorSet(const SpvReflectShaderModule *p_module, uint32_t set_number, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:5774
const SpvReflectInterfaceVariable * spvReflectGetInputVariableBySemantic(const SpvReflectShaderModule *p_module, const char *semantic, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:5912
const char * spvReflectBlockVariableTypeName(const SpvReflectBlockVariable *p_var)
Definition spirv_reflect.cpp:6411
uint32_t spvReflectGetCodeSize(const SpvReflectShaderModule *p_module)
Definition spirv_reflect.cpp:5258
SpvReflectResult spvReflectEnumerateEntryPointInputVariables(const SpvReflectShaderModule *p_module, const char *entry_point, uint32_t *p_count, SpvReflectInterfaceVariable **pp_variables)
Definition spirv_reflect.cpp:5508
struct SpvReflectTypeDescription SpvReflectTypeDescription
struct SpvReflectShaderModule SpvReflectShaderModule
const SpvReflectInterfaceVariable * spvReflectGetInputVariableByLocation(const SpvReflectShaderModule *p_module, uint32_t location, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:5833
struct SpvReflectBlockVariable SpvReflectBlockVariable
SpvReflectResult spvReflectEnumerateDescriptorSets(const SpvReflectShaderModule *p_module, uint32_t *p_count, SpvReflectDescriptorSet **pp_sets)
Definition spirv_reflect.cpp:5361
const SpvReflectInterfaceVariable * spvReflectGetInputVariable(const SpvReflectShaderModule *p_module, uint32_t location, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:5863
uint32_t SpvReflectDecorationFlags
Definition spirv_reflect.h:156
SpvReflectResult spvReflectEnumerateInterfaceVariables(const SpvReflectShaderModule *p_module, uint32_t *p_count, SpvReflectInterfaceVariable **pp_variables)
Definition spirv_reflect.cpp:5421
const uint32_t * spvReflectGetCode(const SpvReflectShaderModule *p_module)
Definition spirv_reflect.cpp:5267
SpvReflectResult spvReflectEnumerateEntryPointPushConstantBlocks(const SpvReflectShaderModule *p_module, const char *entry_point, uint32_t *p_count, SpvReflectBlockVariable **pp_blocks)
Definition spirv_reflect.cpp:5635
const SpvReflectInterfaceVariable * spvReflectGetEntryPointOutputVariableBySemantic(const SpvReflectShaderModule *p_module, const char *entry_point, const char *semantic, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:6116
SpvReflectTypeFlagBits
Definition spirv_reflect.h:103
@ SPV_REFLECT_TYPE_FLAG_VOID
Definition spirv_reflect.h:105
@ SPV_REFLECT_TYPE_FLAG_MATRIX
Definition spirv_reflect.h:110
@ SPV_REFLECT_TYPE_FLAG_EXTERNAL_SAMPLER
Definition spirv_reflect.h:112
@ SPV_REFLECT_TYPE_FLAG_ARRAY
Definition spirv_reflect.h:118
@ SPV_REFLECT_TYPE_FLAG_BOOL
Definition spirv_reflect.h:106
@ SPV_REFLECT_TYPE_FLAG_EXTERNAL_ACCELERATION_STRUCTURE
Definition spirv_reflect.h:115
@ SPV_REFLECT_TYPE_FLAG_VECTOR
Definition spirv_reflect.h:109
@ SPV_REFLECT_TYPE_FLAG_INT
Definition spirv_reflect.h:107
@ SPV_REFLECT_TYPE_FLAG_REF
Definition spirv_reflect.h:119
@ SPV_REFLECT_TYPE_FLAG_EXTERNAL_SAMPLED_IMAGE
Definition spirv_reflect.h:113
@ SPV_REFLECT_TYPE_FLAG_FLOAT
Definition spirv_reflect.h:108
@ SPV_REFLECT_TYPE_FLAG_UNDEFINED
Definition spirv_reflect.h:104
@ SPV_REFLECT_TYPE_FLAG_EXTERNAL_IMAGE
Definition spirv_reflect.h:111
@ SPV_REFLECT_TYPE_FLAG_EXTERNAL_BLOCK
Definition spirv_reflect.h:114
@ SPV_REFLECT_TYPE_FLAG_STRUCT
Definition spirv_reflect.h:117
@ SPV_REFLECT_TYPE_FLAG_EXTERNAL_MASK
Definition spirv_reflect.h:116
struct SpvReflectBindingArrayTraits SpvReflectBindingArrayTraits
SpvReflectShaderStageFlagBits
Definition spirv_reflect.h:289
@ SPV_REFLECT_SHADER_STAGE_COMPUTE_BIT
Definition spirv_reflect.h:295
@ SPV_REFLECT_SHADER_STAGE_ANY_HIT_BIT_KHR
Definition spirv_reflect.h:301
@ SPV_REFLECT_SHADER_STAGE_VERTEX_BIT
Definition spirv_reflect.h:290
@ SPV_REFLECT_SHADER_STAGE_CALLABLE_BIT_KHR
Definition spirv_reflect.h:305
@ SPV_REFLECT_SHADER_STAGE_MESH_BIT_EXT
Definition spirv_reflect.h:299
@ SPV_REFLECT_SHADER_STAGE_MESH_BIT_NV
Definition spirv_reflect.h:298
@ SPV_REFLECT_SHADER_STAGE_TESSELLATION_CONTROL_BIT
Definition spirv_reflect.h:291
@ SPV_REFLECT_SHADER_STAGE_MISS_BIT_KHR
Definition spirv_reflect.h:303
@ SPV_REFLECT_SHADER_STAGE_TESSELLATION_EVALUATION_BIT
Definition spirv_reflect.h:292
@ SPV_REFLECT_SHADER_STAGE_FRAGMENT_BIT
Definition spirv_reflect.h:294
@ SPV_REFLECT_SHADER_STAGE_GEOMETRY_BIT
Definition spirv_reflect.h:293
@ SPV_REFLECT_SHADER_STAGE_TASK_BIT_NV
Definition spirv_reflect.h:296
@ SPV_REFLECT_SHADER_STAGE_CLOSEST_HIT_BIT_KHR
Definition spirv_reflect.h:302
@ SPV_REFLECT_SHADER_STAGE_RAYGEN_BIT_KHR
Definition spirv_reflect.h:300
@ SPV_REFLECT_SHADER_STAGE_INTERSECTION_BIT_KHR
Definition spirv_reflect.h:304
@ SPV_REFLECT_SHADER_STAGE_TASK_BIT_EXT
Definition spirv_reflect.h:297
SpvReflectResult spvReflectEnumerateOutputVariables(const SpvReflectShaderModule *p_module, uint32_t *p_count, SpvReflectInterfaceVariable **pp_variables)
Definition spirv_reflect.cpp:5541
SpvReflectDescriptorType
Definition spirv_reflect.h:271
@ SPV_REFLECT_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
Definition spirv_reflect.h:280
@ SPV_REFLECT_DESCRIPTOR_TYPE_UNIFORM_BUFFER
Definition spirv_reflect.h:278
@ SPV_REFLECT_DESCRIPTOR_TYPE_SAMPLED_IMAGE
Definition spirv_reflect.h:274
@ SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_BUFFER
Definition spirv_reflect.h:279
@ SPV_REFLECT_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
Definition spirv_reflect.h:273
@ SPV_REFLECT_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
Definition spirv_reflect.h:276
@ SPV_REFLECT_DESCRIPTOR_TYPE_INPUT_ATTACHMENT
Definition spirv_reflect.h:282
@ SPV_REFLECT_DESCRIPTOR_TYPE_SAMPLER
Definition spirv_reflect.h:272
@ SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
Definition spirv_reflect.h:281
@ SPV_REFLECT_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR
Definition spirv_reflect.h:283
@ SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
Definition spirv_reflect.h:277
@ SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_IMAGE
Definition spirv_reflect.h:275
const SpvReflectEntryPoint * spvReflectGetEntryPoint(const SpvReflectShaderModule *p_module, const char *entry_point)
Definition spirv_reflect.cpp:5276
uint32_t SpvReflectVariableFlags
Definition spirv_reflect.h:266
struct SpvReflectSpecializationConstant SpvReflectSpecializationConstant
SpvReflectResult spvReflectEnumeratePushConstants(const SpvReflectShaderModule *p_module, uint32_t *p_count, SpvReflectBlockVariable **pp_blocks)
Definition spirv_reflect.cpp:5628
#define SPV_REFLECT_DEPRECATED(msg_str)
Definition spirv_reflect.h:50
SpvReflectResult spvReflectChangeInputVariableLocation(SpvReflectShaderModule *p_module, const SpvReflectInterfaceVariable *p_input_variable, uint32_t new_location)
Definition spirv_reflect.cpp:6342
SpvReflectResult spvReflectChangeDescriptorBindingNumber(SpvReflectShaderModule *p_module, const SpvReflectDescriptorBinding *p_descriptor_binding, uint32_t new_binding_number, uint32_t optional_new_set_number)
Definition spirv_reflect.cpp:6274
SpvReflectResult spvReflectEnumerateEntryPointInterfaceVariables(const SpvReflectShaderModule *p_module, const char *entry_point, uint32_t *p_count, SpvReflectInterfaceVariable **pp_variables)
Definition spirv_reflect.cpp:5448
const SpvReflectBlockVariable * spvReflectGetPushConstant(const SpvReflectShaderModule *p_module, uint32_t index, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:6181
const SpvReflectInterfaceVariable * spvReflectGetOutputVariable(const SpvReflectShaderModule *p_module, uint32_t location, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:6028
const SpvReflectBlockVariable * spvReflectGetEntryPointPushConstantBlock(const SpvReflectShaderModule *p_module, const char *entry_point, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:6188
SpvReflectUserType
Definition spirv_reflect.h:159
@ SPV_REFLECT_USER_TYPE_RW_TEXTURE_2D_ARRAY
Definition spirv_reflect.h:185
@ SPV_REFLECT_USER_TYPE_RW_STRUCTURED_BUFFER
Definition spirv_reflect.h:181
@ SPV_REFLECT_USER_TYPE_RW_TEXTURE_1D_ARRAY
Definition spirv_reflect.h:183
@ SPV_REFLECT_USER_TYPE_RASTERIZER_ORDERED_TEXTURE_1D_ARRAY
Definition spirv_reflect.h:174
@ SPV_REFLECT_USER_TYPE_TEXTURE_2D_ARRAY
Definition spirv_reflect.h:193
@ SPV_REFLECT_USER_TYPE_TEXTURE_CUBE_ARRAY
Definition spirv_reflect.h:199
@ SPV_REFLECT_USER_TYPE_RASTERIZER_ORDERED_BUFFER
Definition spirv_reflect.h:170
@ SPV_REFLECT_USER_TYPE_RW_TEXTURE_2D
Definition spirv_reflect.h:184
@ SPV_REFLECT_USER_TYPE_INVALID
Definition spirv_reflect.h:160
@ SPV_REFLECT_USER_TYPE_TEXTURE_3D
Definition spirv_reflect.h:196
@ SPV_REFLECT_USER_TYPE_SUBPASS_INPUT_MS
Definition spirv_reflect.h:189
@ SPV_REFLECT_USER_TYPE_BUFFER
Definition spirv_reflect.h:164
@ SPV_REFLECT_USER_TYPE_RASTERIZER_ORDERED_TEXTURE_1D
Definition spirv_reflect.h:173
@ SPV_REFLECT_USER_TYPE_APPEND_STRUCTURED_BUFFER
Definition spirv_reflect.h:163
@ SPV_REFLECT_USER_TYPE_TEXTURE_2DMS_ARRAY
Definition spirv_reflect.h:195
@ SPV_REFLECT_USER_TYPE_OUTPUT_PATCH
Definition spirv_reflect.h:169
@ SPV_REFLECT_USER_TYPE_TEXTURE_1D_ARRAY
Definition spirv_reflect.h:191
@ SPV_REFLECT_USER_TYPE_TBUFFER
Definition spirv_reflect.h:162
@ SPV_REFLECT_USER_TYPE_TEXTURE_2D
Definition spirv_reflect.h:192
@ SPV_REFLECT_USER_TYPE_RASTERIZER_ORDERED_TEXTURE_3D
Definition spirv_reflect.h:177
@ SPV_REFLECT_USER_TYPE_RASTERIZER_ORDERED_BYTE_ADDRESS_BUFFER
Definition spirv_reflect.h:171
@ SPV_REFLECT_USER_TYPE_RASTERIZER_ORDERED_TEXTURE_2D
Definition spirv_reflect.h:175
@ SPV_REFLECT_USER_TYPE_TEXTURE_BUFFER
Definition spirv_reflect.h:197
@ SPV_REFLECT_USER_TYPE_RW_TEXTURE_3D
Definition spirv_reflect.h:186
@ SPV_REFLECT_USER_TYPE_INPUT_PATCH
Definition spirv_reflect.h:168
@ SPV_REFLECT_USER_TYPE_CONSUME_STRUCTURED_BUFFER
Definition spirv_reflect.h:167
@ SPV_REFLECT_USER_TYPE_RW_BYTE_ADDRESS_BUFFER
Definition spirv_reflect.h:180
@ SPV_REFLECT_USER_TYPE_TEXTURE_1D
Definition spirv_reflect.h:190
@ SPV_REFLECT_USER_TYPE_RAYTRACING_ACCELERATION_STRUCTURE
Definition spirv_reflect.h:178
@ SPV_REFLECT_USER_TYPE_CONSTANT_BUFFER
Definition spirv_reflect.h:166
@ SPV_REFLECT_USER_TYPE_CBUFFER
Definition spirv_reflect.h:161
@ SPV_REFLECT_USER_TYPE_RASTERIZER_ORDERED_TEXTURE_2D_ARRAY
Definition spirv_reflect.h:176
@ SPV_REFLECT_USER_TYPE_TEXTURE_CUBE
Definition spirv_reflect.h:198
@ SPV_REFLECT_USER_TYPE_RW_TEXTURE_1D
Definition spirv_reflect.h:182
@ SPV_REFLECT_USER_TYPE_TEXTURE_2DMS
Definition spirv_reflect.h:194
@ SPV_REFLECT_USER_TYPE_STRUCTURED_BUFFER
Definition spirv_reflect.h:187
@ SPV_REFLECT_USER_TYPE_BYTE_ADDRESS_BUFFER
Definition spirv_reflect.h:165
@ SPV_REFLECT_USER_TYPE_RASTERIZER_ORDERED_STRUCTURED_BUFFER
Definition spirv_reflect.h:172
@ SPV_REFLECT_USER_TYPE_RW_BUFFER
Definition spirv_reflect.h:179
@ SPV_REFLECT_USER_TYPE_SUBPASS_INPUT
Definition spirv_reflect.h:188
SpvReflectResult spvReflectGetShaderModule(size_t size, const void *p_code, SpvReflectShaderModule *p_module)
Definition spirv_reflect.cpp:5123
struct SpvReflectImageTraits SpvReflectImageTraits
void spvReflectDestroyShaderModule(SpvReflectShaderModule *p_module)
Definition spirv_reflect.cpp:5186
const SpvReflectDescriptorBinding * spvReflectGetDescriptorBinding(const SpvReflectShaderModule *p_module, uint32_t binding_number, uint32_t set_number, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:5707
const SpvReflectInterfaceVariable * spvReflectGetOutputVariableBySemantic(const SpvReflectShaderModule *p_module, const char *semantic, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:6077
struct SpvReflectNumericTraits SpvReflectNumericTraits
struct SpvReflectArrayTraits SpvReflectArrayTraits
SpvReflectVariableFlagBits
Definition spirv_reflect.h:259
@ SPV_REFLECT_VARIABLE_FLAGS_PHYSICAL_POINTER_COPY
Definition spirv_reflect.h:263
@ SPV_REFLECT_VARIABLE_FLAGS_UNUSED
Definition spirv_reflect.h:261
@ SPV_REFLECT_VARIABLE_FLAGS_NONE
Definition spirv_reflect.h:260
@ SPV_REFLECT_BINDING_NUMBER_DONT_CHANGE
Definition spirv_reflect.h:331
@ SPV_REFLECT_SET_NUMBER_DONT_CHANGE
Definition spirv_reflect.h:332
SpvReflectResult spvReflectEnumerateEntryPointDescriptorBindings(const SpvReflectShaderModule *p_module, const char *entry_point, uint32_t *p_count, SpvReflectDescriptorBinding **pp_bindings)
Definition spirv_reflect.cpp:5318
SpvReflectResult spvReflectChangeDescriptorSetNumber(SpvReflectShaderModule *p_module, const SpvReflectDescriptorSet *p_set, uint32_t new_set_number)
Definition spirv_reflect.cpp:6283
SpvReflectResult spvReflectCreateShaderModule2(SpvReflectModuleFlags flags, size_t size, const void *p_code, SpvReflectShaderModule *p_module)
Definition spirv_reflect.cpp:5117
SpvReflectDecorationFlagBits
Definition spirv_reflect.h:137
@ SPV_REFLECT_DECORATION_ROW_MAJOR
Definition spirv_reflect.h:141
@ SPV_REFLECT_DECORATION_COLUMN_MAJOR
Definition spirv_reflect.h:142
@ SPV_REFLECT_DECORATION_NOPERSPECTIVE
Definition spirv_reflect.h:144
@ SPV_REFLECT_DECORATION_WEIGHT_TEXTURE
Definition spirv_reflect.h:152
@ SPV_REFLECT_DECORATION_BUFFER_BLOCK
Definition spirv_reflect.h:140
@ SPV_REFLECT_DECORATION_BUILT_IN
Definition spirv_reflect.h:143
@ SPV_REFLECT_DECORATION_NON_READABLE
Definition spirv_reflect.h:148
@ SPV_REFLECT_DECORATION_PER_VERTEX
Definition spirv_reflect.h:150
@ SPV_REFLECT_DECORATION_PATCH
Definition spirv_reflect.h:149
@ SPV_REFLECT_DECORATION_BLOCK
Definition spirv_reflect.h:139
@ SPV_REFLECT_DECORATION_RELAXED_PRECISION
Definition spirv_reflect.h:147
@ SPV_REFLECT_DECORATION_PER_TASK
Definition spirv_reflect.h:151
@ SPV_REFLECT_DECORATION_FLAT
Definition spirv_reflect.h:145
@ SPV_REFLECT_DECORATION_NONE
Definition spirv_reflect.h:138
@ SPV_REFLECT_DECORATION_BLOCK_MATCH_TEXTURE
Definition spirv_reflect.h:153
@ SPV_REFLECT_DECORATION_NON_WRITABLE
Definition spirv_reflect.h:146
SpvReflectResult spvReflectChangeDescriptorBindingNumbers(SpvReflectShaderModule *p_module, const SpvReflectDescriptorBinding *p_binding, uint32_t new_binding_number, uint32_t new_set_number)
Definition spirv_reflect.cpp:6224
SpvReflectResult spvReflectEnumerateDescriptorBindings(const SpvReflectShaderModule *p_module, uint32_t *p_count, SpvReflectDescriptorBinding **pp_bindings)
Definition spirv_reflect.cpp:5290
struct SpvReflectInterfaceVariable SpvReflectInterfaceVariable
const SpvReflectInterfaceVariable * spvReflectGetOutputVariableByLocation(const SpvReflectShaderModule *p_module, uint32_t location, SpvReflectResult *p_result)
Definition spirv_reflect.cpp:5998
struct SpvReflectEntryPoint SpvReflectEntryPoint
SpvReflectArrayDimType
Definition spirv_reflect.h:361
@ SPV_REFLECT_ARRAY_DIM_RUNTIME
Definition spirv_reflect.h:362
SpvReflectResult spvReflectEnumerateSpecializationConstants(const SpvReflectShaderModule *p_module, uint32_t *p_count, SpvReflectSpecializationConstant **pp_constants)
Definition spirv_reflect.cpp:5679
Definition spirv_reflect.h:365
uint32_t dims[SPV_REFLECT_MAX_ARRAY_DIMS]
Definition spirv_reflect.h:371
uint32_t dims_count
Definition spirv_reflect.h:366
uint32_t spec_constant_op_ids[SPV_REFLECT_MAX_ARRAY_DIMS]
Definition spirv_reflect.h:373
uint32_t stride
Definition spirv_reflect.h:374
Definition spirv_reflect.h:377
uint32_t dims_count
Definition spirv_reflect.h:378
uint32_t dims[SPV_REFLECT_MAX_ARRAY_DIMS]
Definition spirv_reflect.h:379
Definition spirv_reflect.h:450
uint32_t size
Definition spirv_reflect.h:456
struct SpvReflectBlockVariable::@3 word_offset
SpvReflectNumericTraits numeric
Definition spirv_reflect.h:459
const char * name
Definition spirv_reflect.h:452
SpvReflectTypeDescription * type_description
Definition spirv_reflect.h:466
struct SpvReflectBlockVariable * members
Definition spirv_reflect.h:464
SpvReflectVariableFlags flags
Definition spirv_reflect.h:461
uint32_t member_count
Definition spirv_reflect.h:463
uint32_t absolute_offset
Definition spirv_reflect.h:455
uint32_t padded_size
Definition spirv_reflect.h:457
uint32_t spirv_id
Definition spirv_reflect.h:451
SpvReflectDecorationFlags decoration_flags
Definition spirv_reflect.h:458
uint32_t offset
Definition spirv_reflect.h:454
SpvReflectArrayTraits array
Definition spirv_reflect.h:460
Definition spirv_reflect.h:560
SpvCapability value
Definition spirv_reflect.h:561
uint32_t word_offset
Definition spirv_reflect.h:562
Definition spirv_reflect.h:477
uint32_t accessed
Definition spirv_reflect.h:489
uint32_t set
Definition spirv_reflect.h:482
const char * name
Definition spirv_reflect.h:479
SpvReflectImageTraits image
Definition spirv_reflect.h:485
SpvReflectDecorationFlags decoration_flags
Definition spirv_reflect.h:502
SpvReflectTypeDescription * type_description
Definition spirv_reflect.h:495
SpvReflectBlockVariable block
Definition spirv_reflect.h:486
SpvReflectBindingArrayTraits array
Definition spirv_reflect.h:487
uint32_t uav_counter_id
Definition spirv_reflect.h:490
SpvReflectResourceType resource_type
Definition spirv_reflect.h:484
SpvReflectUserType user_type
Definition spirv_reflect.h:504
SpvReflectDescriptorType descriptor_type
Definition spirv_reflect.h:483
struct SpvReflectDescriptorBinding::@4 word_offset
uint32_t byte_address_buffer_offset_count
Definition spirv_reflect.h:492
uint32_t spirv_id
Definition spirv_reflect.h:478
uint32_t count
Definition spirv_reflect.h:488
uint32_t binding
Definition spirv_reflect.h:480
struct SpvReflectDescriptorBinding * uav_counter_binding
Definition spirv_reflect.h:491
uint32_t input_attachment_index
Definition spirv_reflect.h:481
uint32_t * byte_address_buffer_offsets
Definition spirv_reflect.h:493
Definition spirv_reflect.h:510
SpvReflectDescriptorBinding ** bindings
Definition spirv_reflect.h:513
uint32_t set
Definition spirv_reflect.h:511
uint32_t binding_count
Definition spirv_reflect.h:512
Definition spirv_reflect.h:548
uint32_t z
Definition spirv_reflect.h:551
uint32_t x
Definition spirv_reflect.h:549
uint32_t y
Definition spirv_reflect.h:550
Definition spirv_reflect.h:523
struct SpvReflectEntryPoint::LocalSize local_size
uint32_t input_variable_count
Definition spirv_reflect.h:530
const char * name
Definition spirv_reflect.h:524
SpvReflectInterfaceVariable * interface_variables
Definition spirv_reflect.h:535
SpvExecutionMode * execution_modes
Definition spirv_reflect.h:546
uint32_t * used_uniforms
Definition spirv_reflect.h:541
SpvReflectDescriptorSet * descriptor_sets
Definition spirv_reflect.h:538
uint32_t used_push_constant_count
Definition spirv_reflect.h:542
uint32_t output_variable_count
Definition spirv_reflect.h:532
SpvExecutionModel spirv_execution_model
Definition spirv_reflect.h:527
uint32_t used_uniform_count
Definition spirv_reflect.h:540
uint32_t * used_push_constants
Definition spirv_reflect.h:543
SpvReflectInterfaceVariable ** output_variables
Definition spirv_reflect.h:533
uint32_t execution_mode_count
Definition spirv_reflect.h:545
uint32_t descriptor_set_count
Definition spirv_reflect.h:537
uint32_t id
Definition spirv_reflect.h:525
uint32_t output_vertices
Definition spirv_reflect.h:554
uint32_t invocations
Definition spirv_reflect.h:553
SpvReflectShaderStageFlagBits shader_stage
Definition spirv_reflect.h:528
uint32_t interface_variable_count
Definition spirv_reflect.h:534
SpvReflectInterfaceVariable ** input_variables
Definition spirv_reflect.h:531
Definition spirv_reflect.h:352
uint32_t depth
Definition spirv_reflect.h:354
uint32_t arrayed
Definition spirv_reflect.h:355
uint32_t sampled
Definition spirv_reflect.h:357
SpvDim dim
Definition spirv_reflect.h:353
uint32_t ms
Definition spirv_reflect.h:356
SpvImageFormat image_format
Definition spirv_reflect.h:358
The OpVariable that is either an Input or Output to the module.
Definition spirv_reflect.h:419
SpvReflectArrayTraits array
Definition spirv_reflect.h:429
uint32_t location
Definition spirv_reflect.h:422
uint32_t member_count
Definition spirv_reflect.h:431
struct SpvReflectInterfaceVariable::@2 word_offset
uint32_t spirv_id
Definition spirv_reflect.h:420
uint32_t component
Definition spirv_reflect.h:423
SpvReflectNumericTraits numeric
Definition spirv_reflect.h:428
SpvStorageClass storage_class
Definition spirv_reflect.h:424
SpvReflectDecorationFlags decoration_flags
Definition spirv_reflect.h:426
const char * semantic
Definition spirv_reflect.h:425
SpvBuiltIn built_in
Definition spirv_reflect.h:427
SpvReflectTypeDescription * type_description
Definition spirv_reflect.h:440
SpvReflectFormat format
Definition spirv_reflect.h:434
struct SpvReflectInterfaceVariable * members
Definition spirv_reflect.h:432
const char * name
Definition spirv_reflect.h:421
Definition spirv_reflect.h:345
uint32_t column_count
Definition spirv_reflect.h:346
uint32_t stride
Definition spirv_reflect.h:348
uint32_t row_count
Definition spirv_reflect.h:347
Definition spirv_reflect.h:336
uint32_t signedness
Definition spirv_reflect.h:338
uint32_t width
Definition spirv_reflect.h:337
Definition spirv_reflect.h:341
uint32_t component_count
Definition spirv_reflect.h:342
Definition spirv_reflect.h:335
struct SpvReflectNumericTraits::Matrix matrix
struct SpvReflectNumericTraits::Scalar scalar
struct SpvReflectNumericTraits::Vector vector
Definition spirv_reflect.h:607
SpvReflectModuleFlags module_flags
Definition spirv_reflect.h:608
SpvReflectTypeDescription * type_descriptions
Definition spirv_reflect.h:614
uint32_t * spirv_code
Definition spirv_reflect.h:610
size_t spirv_size
Definition spirv_reflect.h:609
uint32_t spirv_word_count
Definition spirv_reflect.h:611
size_t type_description_count
Definition spirv_reflect.h:613
Definition spirv_reflect.h:578
uint32_t push_constant_block_count
Definition spirv_reflect.h:602
uint32_t descriptor_set_count
Definition spirv_reflect.h:594
SpvReflectGenerator generator
Definition spirv_reflect.h:579
SpvExecutionModel spirv_execution_model
Definition spirv_reflect.h:590
const char * entry_point_name
Definition spirv_reflect.h:580
SpvReflectDescriptorBinding * descriptor_bindings
Definition spirv_reflect.h:593
uint32_t input_variable_count
Definition spirv_reflect.h:596
SpvReflectBlockVariable * push_constant_blocks
Definition spirv_reflect.h:603
SpvReflectEntryPoint * entry_points
Definition spirv_reflect.h:583
uint32_t spec_constant_count
Definition spirv_reflect.h:604
SpvReflectShaderStageFlagBits shader_stage
Definition spirv_reflect.h:591
SpvReflectDescriptorSet descriptor_sets[SPV_REFLECT_MAX_DESCRIPTOR_SETS]
Definition spirv_reflect.h:595
uint32_t entry_point_id
Definition spirv_reflect.h:581
SpvReflectInterfaceVariable ** output_variables
Definition spirv_reflect.h:599
uint32_t output_variable_count
Definition spirv_reflect.h:598
SpvSourceLanguage source_language
Definition spirv_reflect.h:584
SpvReflectCapability * capabilities
Definition spirv_reflect.h:589
uint32_t entry_point_count
Definition spirv_reflect.h:582
SpvReflectInterfaceVariable * interface_variables
Definition spirv_reflect.h:601
const char * source_file
Definition spirv_reflect.h:586
uint32_t source_language_version
Definition spirv_reflect.h:585
SpvReflectSpecializationConstant * spec_constants
Definition spirv_reflect.h:605
SpvReflectInterfaceVariable ** input_variables
Definition spirv_reflect.h:597
uint32_t interface_variable_count
Definition spirv_reflect.h:600
uint32_t descriptor_binding_count
Definition spirv_reflect.h:592
const char * source_source
Definition spirv_reflect.h:587
struct SpvReflectShaderModule::Internal * _internal
uint32_t capability_count
Definition spirv_reflect.h:588
Definition spirv_reflect.h:569
const char * name
Definition spirv_reflect.h:572
uint32_t constant_id
Definition spirv_reflect.h:571
uint32_t spirv_id
Definition spirv_reflect.h:570
Definition spirv_reflect.h:395
SpvReflectImageTraits image
Definition spirv_reflect.h:397
SpvReflectNumericTraits numeric
Definition spirv_reflect.h:396
SpvReflectArrayTraits array
Definition spirv_reflect.h:398
Information about an OpType* instruction.
Definition spirv_reflect.h:385
uint32_t id
Definition spirv_reflect.h:386
SpvReflectTypeFlags type_flags
Definition spirv_reflect.h:392
uint32_t copied
Definition spirv_reflect.h:407
struct SpvReflectTypeDescription::Traits traits
SpvReflectDecorationFlags decoration_flags
Definition spirv_reflect.h:393
struct SpvReflectTypeDescription * struct_type_description
Definition spirv_reflect.h:403
SpvStorageClass storage_class
Definition spirv_reflect.h:391
struct SpvReflectTypeDescription * members
Definition spirv_reflect.h:412
const char * struct_member_name
Definition spirv_reflect.h:390
uint32_t member_count
Definition spirv_reflect.h:410
SpvOp op
Definition spirv_reflect.h:387
const char * type_name
Definition spirv_reflect.h:388