{
stage = &s;
features = feat;
- if(!supports_stage(s.type))
- throw unsupported_shader(format("Stage %s is not supported", Stage::get_stage_name(s.type)));
- s.content.visit(*this);
+ if(supports_stage(s.type))
+ s.content.visit(*this);
+ else
+ unsupported(format("Stage %s is not supported", Stage::get_stage_name(s.type)));
+}
+
+void LegacyConverter::unsupported(const string &reason)
+{
+ Diagnostic diagnostic;
+ diagnostic.severity = Diagnostic::ERR;
+ diagnostic.source = GENERATED_SOURCE;
+ diagnostic.line = 0;
+ diagnostic.message = reason;
+ stage->diagnostics.push_back(diagnostic);
}
void LegacyConverter::visit(Block &block)
}
else if(stage->type==Stage::FRAGMENT && var.interface=="out")
{
- if(i->value!=0 && !check_extension(&Features::ext_gpu_shader4))
- throw unsupported_shader("EXT_gpu_shader4 is required");
- stage->locations[var.name] = i->value;
- var.layout->qualifiers.erase(i);
+ if(check_extension(&Features::ext_gpu_shader4))
+ {
+ stage->locations[var.name] = i->value;
+ var.layout->qualifiers.erase(i);
+ }
+ else if(i->value!=0)
+ unsupported("EXT_gpu_shader4 required for multiple fragment shader outputs");
}
if(var.layout->qualifiers.empty())
virtual void apply(Stage &, const Features &);
private:
+ void unsupported(const std::string &);
+
virtual void visit(Block &);
bool check_version(const Version &) const;
bool check_extension(bool Features::*) const;
virtual ~parse_error() throw() { }
};
-class unsupported_shader: public std::runtime_error
-{
-public:
- unsupported_shader(const std::string &w): runtime_error(w) { }
- virtual ~unsupported_shader() throw() { }
-};
-
struct Diagnostic
{
enum Severity