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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
// AUTOMATICALLY GENERATED from the SPIR-V JSON grammar:
//   external/spirv.core.grammar.json.
// DO NOT MODIFY!

use spirv;
use std::{error, fmt};
#[doc = "Decoder Error"]
#[derive(Debug, PartialEq)]
pub enum Error {
    StreamExpected(usize),
    LimitReached(usize),
    ImageOperandsUnknown(usize, spirv::Word),
    FPFastMathModeUnknown(usize, spirv::Word),
    SelectionControlUnknown(usize, spirv::Word),
    LoopControlUnknown(usize, spirv::Word),
    FunctionControlUnknown(usize, spirv::Word),
    MemorySemanticsUnknown(usize, spirv::Word),
    MemoryAccessUnknown(usize, spirv::Word),
    KernelProfilingInfoUnknown(usize, spirv::Word),
    SourceLanguageUnknown(usize, spirv::Word),
    ExecutionModelUnknown(usize, spirv::Word),
    AddressingModelUnknown(usize, spirv::Word),
    MemoryModelUnknown(usize, spirv::Word),
    ExecutionModeUnknown(usize, spirv::Word),
    StorageClassUnknown(usize, spirv::Word),
    DimUnknown(usize, spirv::Word),
    SamplerAddressingModeUnknown(usize, spirv::Word),
    SamplerFilterModeUnknown(usize, spirv::Word),
    ImageFormatUnknown(usize, spirv::Word),
    ImageChannelOrderUnknown(usize, spirv::Word),
    ImageChannelDataTypeUnknown(usize, spirv::Word),
    FPRoundingModeUnknown(usize, spirv::Word),
    LinkageTypeUnknown(usize, spirv::Word),
    AccessQualifierUnknown(usize, spirv::Word),
    FunctionParameterAttributeUnknown(usize, spirv::Word),
    DecorationUnknown(usize, spirv::Word),
    BuiltInUnknown(usize, spirv::Word),
    ScopeUnknown(usize, spirv::Word),
    GroupOperationUnknown(usize, spirv::Word),
    KernelEnqueueFlagsUnknown(usize, spirv::Word),
    CapabilityUnknown(usize, spirv::Word),
    #[doc = r"Failed to decode a string."]
    #[doc = r""]
    #[doc = r"For structured error handling, the second element could be"]
    #[doc = r"`string::FromUtf8Error`, but the will prohibit the compiler"]
    #[doc = r"from generating `PartialEq` for this enum."]
    DecodeStringFailed(usize, String),
}
impl fmt::Display for Error {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match *self {
            Error::StreamExpected(index) => {
                write!(f, "expected more bytes in the stream at index {}", index)
            }
            Error::LimitReached(index) => write!(f, "reached word limit at index {}", index),
            Error::ImageOperandsUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind ImageOperands at index {}",
                word, index
            ),
            Error::FPFastMathModeUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind FPFastMathMode at index {}",
                word, index
            ),
            Error::SelectionControlUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind SelectionControl at index {}",
                word, index
            ),
            Error::LoopControlUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind LoopControl at index {}",
                word, index
            ),
            Error::FunctionControlUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind FunctionControl at index {}",
                word, index
            ),
            Error::MemorySemanticsUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind MemorySemantics at index {}",
                word, index
            ),
            Error::MemoryAccessUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind MemoryAccess at index {}",
                word, index
            ),
            Error::KernelProfilingInfoUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind KernelProfilingInfo at index {}",
                word, index
            ),
            Error::SourceLanguageUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind SourceLanguage at index {}",
                word, index
            ),
            Error::ExecutionModelUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind ExecutionModel at index {}",
                word, index
            ),
            Error::AddressingModelUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind AddressingModel at index {}",
                word, index
            ),
            Error::MemoryModelUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind MemoryModel at index {}",
                word, index
            ),
            Error::ExecutionModeUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind ExecutionMode at index {}",
                word, index
            ),
            Error::StorageClassUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind StorageClass at index {}",
                word, index
            ),
            Error::DimUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind Dim at index {}",
                word, index
            ),
            Error::SamplerAddressingModeUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind SamplerAddressingMode at index {}",
                word, index
            ),
            Error::SamplerFilterModeUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind SamplerFilterMode at index {}",
                word, index
            ),
            Error::ImageFormatUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind ImageFormat at index {}",
                word, index
            ),
            Error::ImageChannelOrderUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind ImageChannelOrder at index {}",
                word, index
            ),
            Error::ImageChannelDataTypeUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind ImageChannelDataType at index {}",
                word, index
            ),
            Error::FPRoundingModeUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind FPRoundingMode at index {}",
                word, index
            ),
            Error::LinkageTypeUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind LinkageType at index {}",
                word, index
            ),
            Error::AccessQualifierUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind AccessQualifier at index {}",
                word, index
            ),
            Error::FunctionParameterAttributeUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind FunctionParameterAttribute at index {}",
                word, index
            ),
            Error::DecorationUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind Decoration at index {}",
                word, index
            ),
            Error::BuiltInUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind BuiltIn at index {}",
                word, index
            ),
            Error::ScopeUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind Scope at index {}",
                word, index
            ),
            Error::GroupOperationUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind GroupOperation at index {}",
                word, index
            ),
            Error::KernelEnqueueFlagsUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind KernelEnqueueFlags at index {}",
                word, index
            ),
            Error::CapabilityUnknown(index, word) => write!(
                f,
                "unknown value {} for operand kind Capability at index {}",
                word, index
            ),
            Error::DecodeStringFailed(index, ref e) => {
                write!(f, "cannot decode string at index {}: {}", index, e)
            }
        }
    }
}
impl error::Error for Error {
    fn description(&self) -> &str {
        match *self {
            Error::StreamExpected(_) => "expected more bytes in the stream",
            _ => "unknown operand value for the given kind",
        }
    }
}