@@ -27,160 +27,15 @@ class Metadata;
2727
2828namespace hlsl {
2929namespace rootsig {
30-
31- template <typename T>
3230class RootSignatureValidationError
33- : public ErrorInfo<RootSignatureValidationError<T>> {
34- public:
35- static char ID;
36- StringRef ParamName;
37- T Value;
38-
39- RootSignatureValidationError (StringRef ParamName, T Value)
40- : ParamName(ParamName), Value(Value) {}
41-
42- void log (raw_ostream &OS) const override {
43- OS << " Invalid value for " << ParamName << " : " << Value;
44- }
45-
46- std::error_code convertToErrorCode () const override {
47- return llvm::inconvertibleErrorCode ();
48- }
49- };
50-
51- class OffsetAppendAfterOverflow : public ErrorInfo <OffsetAppendAfterOverflow> {
52- public:
53- static char ID;
54- dxil::ResourceClass Type;
55- uint32_t Register;
56- uint32_t Space;
57-
58- OffsetAppendAfterOverflow (dxil::ResourceClass Type, uint32_t Register,
59- uint32_t Space)
60- : Type(Type), Register(Register), Space(Space) {}
61-
62- void log (raw_ostream &OS) const override {
63- OS << " Range " << getResourceClassName (Type) << " (register=" << Register
64- << " , space=" << Space << " ) "
65- << " cannot be appended after an unbounded range " ;
66- }
67-
68- std::error_code convertToErrorCode () const override {
69- return llvm::inconvertibleErrorCode ();
70- }
71- };
72-
73- class ShaderRegisterOverflowError
74- : public ErrorInfo<ShaderRegisterOverflowError> {
75- public:
76- static char ID;
77- dxil::ResourceClass Type;
78- uint32_t Register;
79- uint32_t Space;
80-
81- ShaderRegisterOverflowError (dxil::ResourceClass Type, uint32_t Register,
82- uint32_t Space)
83- : Type(Type), Register(Register), Space(Space) {}
84-
85- void log (raw_ostream &OS) const override {
86- OS << " Overflow for shader register range: " << getResourceClassName (Type)
87- << " (register=" << Register << " , space=" << Space << " )." ;
88- }
89-
90- std::error_code convertToErrorCode () const override {
91- return llvm::inconvertibleErrorCode ();
92- }
93- };
94-
95- class OffsetOverflowError : public ErrorInfo <OffsetOverflowError> {
96- public:
97- static char ID;
98- dxil::ResourceClass Type;
99- uint32_t Register;
100- uint32_t Space;
101-
102- OffsetOverflowError (dxil::ResourceClass Type, uint32_t Register,
103- uint32_t Space)
104- : Type(Type), Register(Register), Space(Space) {}
105-
106- void log (raw_ostream &OS) const override {
107- OS << " Offset overflow for descriptor range: " << getResourceClassName (Type)
108- << " (register=" << Register << " , space=" << Space << " )." ;
109- }
110-
111- std::error_code convertToErrorCode () const override {
112- return llvm::inconvertibleErrorCode ();
113- }
114- };
115-
116- class TableSamplerMixinError : public ErrorInfo <TableSamplerMixinError> {
31+ : public ErrorInfo<RootSignatureValidationError> {
11732public:
11833 static char ID;
119- dxil::ResourceClass Type;
120- uint32_t Location;
121-
122- TableSamplerMixinError (dxil::ResourceClass Type, uint32_t Location)
123- : Type(Type), Location(Location) {}
124-
125- void log (raw_ostream &OS) const override {
126- OS << " Samplers cannot be mixed with other "
127- << " resource types in a descriptor table, " << getResourceClassName (Type)
128- << " (location=" << Location << " )" ;
129- }
130-
131- std::error_code convertToErrorCode () const override {
132- return llvm::inconvertibleErrorCode ();
133- }
134- };
135-
136- class GenericRSMetadataError : public ErrorInfo <GenericRSMetadataError> {
137- public:
138- LLVM_ABI static char ID;
139- StringRef Message;
140- MDNode *MD;
141-
142- GenericRSMetadataError (StringRef Message, MDNode *MD)
143- : Message(Message), MD(MD) {}
144-
145- void log (raw_ostream &OS) const override {
146- OS << Message;
147- if (MD) {
148- OS << " \n " ;
149- MD->printTree (OS);
150- }
151- }
152-
153- std::error_code convertToErrorCode () const override {
154- return llvm::inconvertibleErrorCode ();
155- }
156- };
157-
158- class InvalidRSMetadataFormat : public ErrorInfo <InvalidRSMetadataFormat> {
159- public:
160- LLVM_ABI static char ID;
161- StringRef ElementName;
34+ std::string Msg;
16235
163- InvalidRSMetadataFormat (StringRef ElementName) : ElementName(ElementName) {}
164-
165- void log (raw_ostream &OS) const override {
166- OS << " Invalid format for " << ElementName;
167- }
36+ RootSignatureValidationError (const Twine &Msg) : Msg(Msg.str()) {}
16837
169- std::error_code convertToErrorCode () const override {
170- return llvm::inconvertibleErrorCode ();
171- }
172- };
173-
174- class InvalidRSMetadataValue : public ErrorInfo <InvalidRSMetadataValue> {
175- public:
176- LLVM_ABI static char ID;
177- StringRef ParamName;
178-
179- InvalidRSMetadataValue (StringRef ParamName) : ParamName(ParamName) {}
180-
181- void log (raw_ostream &OS) const override {
182- OS << " Invalid value for " << ParamName;
183- }
38+ void log (raw_ostream &OS) const override { OS << Msg; }
18439
18540 std::error_code convertToErrorCode () const override {
18641 return llvm::inconvertibleErrorCode ();
0 commit comments