Skip to content

Commit 5e35c99

Browse files
committed
Fix undefined enums
There are a few places where an enum value is purpoposly getting a value that is not one of the enum values. This is causing a problem when testing. I have a quick fix to make those values `int` instead of the enum type. The variables could contain `-1` as a special value to indicate that no storage class or builtin is used. We cannot change the enum class to add `-1` because it is defined in spirv headers.
1 parent d341b0e commit 5e35c99

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

common/output_stream.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ std::string ToStringShaderStage(SpvReflectShaderStageFlagBits stage) {
204204
return "???";
205205
}
206206

207-
std::string ToStringSpvStorageClass(SpvStorageClass storage_class) {
207+
std::string ToStringSpvStorageClass(int storage_class) {
208208
switch (storage_class) {
209209
case SpvStorageClassUniformConstant:
210210
return "UniformConstant";
@@ -343,7 +343,7 @@ std::string ToStringDescriptorType(SpvReflectDescriptorType value) {
343343
return "VK_DESCRIPTOR_TYPE_???";
344344
}
345345

346-
static std::string ToStringSpvBuiltIn(SpvBuiltIn built_in) {
346+
static std::string ToStringSpvBuiltIn(int built_in) {
347347
switch (built_in) {
348348
case SpvBuiltInPosition:
349349
return "Position";

common/output_stream.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
std::string ToStringSpvSourceLanguage(SpvSourceLanguage lang);
1111
std::string ToStringSpvExecutionModel(SpvExecutionModel model);
12-
std::string ToStringSpvStorageClass(SpvStorageClass storage_class);
12+
std::string ToStringSpvStorageClass(int storage_class);
1313
std::string ToStringSpvDim(SpvDim dim);
1414
std::string ToStringSpvBuiltIn(const SpvReflectInterfaceVariable& variable, bool preface);
1515
std::string ToStringSpvImageFormat(SpvImageFormat fmt);
@@ -66,4 +66,4 @@ class SpvReflectToYaml {
6666
std::map<const SpvReflectInterfaceVariable*, uint32_t> interface_variable_to_index_;
6767
};
6868

69-
#endif
69+
#endif

spirv_reflect.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ typedef struct SpvReflectTypeDescription {
393393
const char* type_name;
394394
// Non-NULL if type is member of a struct
395395
const char* struct_member_name;
396-
SpvStorageClass storage_class;
396+
int storage_class;
397397
SpvReflectTypeFlags type_flags;
398398
SpvReflectDecorationFlags decoration_flags;
399399

@@ -429,7 +429,7 @@ typedef struct SpvReflectInterfaceVariable {
429429
SpvStorageClass storage_class;
430430
const char* semantic;
431431
SpvReflectDecorationFlags decoration_flags;
432-
SpvBuiltIn built_in;
432+
int built_in;
433433
SpvReflectNumericTraits numeric;
434434
SpvReflectArrayTraits array;
435435

0 commit comments

Comments
 (0)