Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 4 additions & 149 deletions llvm/include/llvm/Frontend/HLSL/RootSignatureMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,160 +27,15 @@ class Metadata;

namespace hlsl {
namespace rootsig {

template <typename T>
class RootSignatureValidationError
: public ErrorInfo<RootSignatureValidationError<T>> {
public:
static char ID;
StringRef ParamName;
T Value;

RootSignatureValidationError(StringRef ParamName, T Value)
: ParamName(ParamName), Value(Value) {}

void log(raw_ostream &OS) const override {
OS << "Invalid value for " << ParamName << ": " << Value;
}

std::error_code convertToErrorCode() const override {
return llvm::inconvertibleErrorCode();
}
};

class OffsetAppendAfterOverflow : public ErrorInfo<OffsetAppendAfterOverflow> {
public:
static char ID;
dxil::ResourceClass Type;
uint32_t Register;
uint32_t Space;

OffsetAppendAfterOverflow(dxil::ResourceClass Type, uint32_t Register,
uint32_t Space)
: Type(Type), Register(Register), Space(Space) {}

void log(raw_ostream &OS) const override {
OS << "Range " << getResourceClassName(Type) << "(register=" << Register
<< ", space=" << Space << ") "
<< "cannot be appended after an unbounded range ";
}

std::error_code convertToErrorCode() const override {
return llvm::inconvertibleErrorCode();
}
};

class ShaderRegisterOverflowError
: public ErrorInfo<ShaderRegisterOverflowError> {
public:
static char ID;
dxil::ResourceClass Type;
uint32_t Register;
uint32_t Space;

ShaderRegisterOverflowError(dxil::ResourceClass Type, uint32_t Register,
uint32_t Space)
: Type(Type), Register(Register), Space(Space) {}

void log(raw_ostream &OS) const override {
OS << "Overflow for shader register range: " << getResourceClassName(Type)
<< "(register=" << Register << ", space=" << Space << ").";
}

std::error_code convertToErrorCode() const override {
return llvm::inconvertibleErrorCode();
}
};

class OffsetOverflowError : public ErrorInfo<OffsetOverflowError> {
public:
static char ID;
dxil::ResourceClass Type;
uint32_t Register;
uint32_t Space;

OffsetOverflowError(dxil::ResourceClass Type, uint32_t Register,
uint32_t Space)
: Type(Type), Register(Register), Space(Space) {}

void log(raw_ostream &OS) const override {
OS << "Offset overflow for descriptor range: " << getResourceClassName(Type)
<< "(register=" << Register << ", space=" << Space << ").";
}

std::error_code convertToErrorCode() const override {
return llvm::inconvertibleErrorCode();
}
};

class TableSamplerMixinError : public ErrorInfo<TableSamplerMixinError> {
: public ErrorInfo<RootSignatureValidationError> {
public:
static char ID;
dxil::ResourceClass Type;
uint32_t Location;

TableSamplerMixinError(dxil::ResourceClass Type, uint32_t Location)
: Type(Type), Location(Location) {}

void log(raw_ostream &OS) const override {
OS << "Samplers cannot be mixed with other "
<< "resource types in a descriptor table, " << getResourceClassName(Type)
<< "(location=" << Location << ")";
}

std::error_code convertToErrorCode() const override {
return llvm::inconvertibleErrorCode();
}
};

class GenericRSMetadataError : public ErrorInfo<GenericRSMetadataError> {
public:
LLVM_ABI static char ID;
StringRef Message;
MDNode *MD;

GenericRSMetadataError(StringRef Message, MDNode *MD)
: Message(Message), MD(MD) {}

void log(raw_ostream &OS) const override {
OS << Message;
if (MD) {
OS << "\n";
MD->printTree(OS);
}
}

std::error_code convertToErrorCode() const override {
return llvm::inconvertibleErrorCode();
}
};

class InvalidRSMetadataFormat : public ErrorInfo<InvalidRSMetadataFormat> {
public:
LLVM_ABI static char ID;
StringRef ElementName;
std::string Msg;

InvalidRSMetadataFormat(StringRef ElementName) : ElementName(ElementName) {}

void log(raw_ostream &OS) const override {
OS << "Invalid format for " << ElementName;
}
RootSignatureValidationError(const Twine &Msg) : Msg(Msg.str()) {}

std::error_code convertToErrorCode() const override {
return llvm::inconvertibleErrorCode();
}
};

class InvalidRSMetadataValue : public ErrorInfo<InvalidRSMetadataValue> {
public:
LLVM_ABI static char ID;
StringRef ParamName;

InvalidRSMetadataValue(StringRef ParamName) : ParamName(ParamName) {}

void log(raw_ostream &OS) const override {
OS << "Invalid value for " << ParamName;
}
void log(raw_ostream &OS) const override { OS << Msg; }

std::error_code convertToErrorCode() const override {
return llvm::inconvertibleErrorCode();
Expand Down
Loading