}
-void LegacyConverter::apply(Stage &s, const Features &feat)
+void FeatureConverter::apply(Stage &s, const Features &feat)
{
stage = &s;
features = feat;
unsupported(format("Stage %s is not supported", Stage::get_stage_name(s.type)));
}
-void LegacyConverter::unsupported(const string &reason)
+void FeatureConverter::unsupported(const string &reason)
{
Diagnostic diagnostic;
diagnostic.severity = Diagnostic::ERR;
stage->diagnostics.push_back(diagnostic);
}
-void LegacyConverter::visit(Block &block)
+void FeatureConverter::visit(Block &block)
{
for(auto i=block.body.begin(); i!=block.body.end(); ++i)
{
}
}
-void LegacyConverter::visit(RefPtr<Expression> &expr)
+void FeatureConverter::visit(RefPtr<Expression> &expr)
{
r_replaced_reference = 0;
expr->visit(*this);
r_replaced_reference = 0;
}
-bool LegacyConverter::check_version(const Version &feature_version) const
+bool FeatureConverter::check_version(const Version &feature_version) const
{
if(features.glsl_version<feature_version)
return false;
return true;
}
-bool LegacyConverter::check_extension(bool Features::*extension) const
+bool FeatureConverter::check_extension(bool Features::*extension) const
{
if(!(features.*extension))
return false;
return true;
}
-bool LegacyConverter::supports_stage(Stage::Type st) const
+bool FeatureConverter::supports_stage(Stage::Type st) const
{
if(st==Stage::GEOMETRY)
{
return true;
}
-bool LegacyConverter::supports_unified_interface_syntax() const
+bool FeatureConverter::supports_unified_interface_syntax() const
{
if(features.target_api==OPENGL_ES)
return check_version(Version(3, 0));
return check_version(Version(1, 30));
}
-void LegacyConverter::visit(VariableReference &var)
+void FeatureConverter::visit(VariableReference &var)
{
if(var.declaration==frag_out && !supports_unified_interface_syntax())
{
}
}
-void LegacyConverter::visit(InterfaceBlockReference &iface)
+void FeatureConverter::visit(InterfaceBlockReference &iface)
{
r_flattened_interface = nodes_to_remove.count(iface.declaration);
}
-void LegacyConverter::visit(MemberAccess &memacc)
+void FeatureConverter::visit(MemberAccess &memacc)
{
r_flattened_interface = false;
visit(memacc.left);
}
}
-void LegacyConverter::visit(Assignment &assign)
+void FeatureConverter::visit(Assignment &assign)
{
TraversingVisitor::visit(assign);
if(assign.target.declaration==frag_out && !supports_unified_interface_syntax())
assign.target.declaration = 0;
}
-bool LegacyConverter::supports_unified_sampling_functions() const
+bool FeatureConverter::supports_unified_sampling_functions() const
{
if(features.target_api==OPENGL_ES)
return check_version(Version(3, 0));
return check_version(Version(1, 30));
}
-void LegacyConverter::visit(FunctionCall &call)
+void FeatureConverter::visit(FunctionCall &call)
{
if(call.declaration && call.declaration->source==BUILTIN_SOURCE)
{
TraversingVisitor::visit(call);
}
-bool LegacyConverter::supports_interface_layouts() const
+bool FeatureConverter::supports_interface_layouts() const
{
if(features.target_api==OPENGL_ES)
return check_version(Version(3, 0));
return false;
}
-bool LegacyConverter::supports_stage_interface_layouts() const
+bool FeatureConverter::supports_stage_interface_layouts() const
{
if(features.target_api==OPENGL_ES)
return check_version(Version(3, 10));
return check_extension(&Features::arb_separate_shader_objects);
}
-bool LegacyConverter::supports_centroid_sampling() const
+bool FeatureConverter::supports_centroid_sampling() const
{
if(features.target_api==OPENGL_ES)
return check_version(Version(3, 0));
return check_extension(&Features::ext_gpu_shader4);
}
-bool LegacyConverter::supports_sample_sampling() const
+bool FeatureConverter::supports_sample_sampling() const
{
if(features.target_api==OPENGL_ES)
return check_version(Version(3, 20));
return check_extension(&Features::arb_gpu_shader5);
}
-bool LegacyConverter::supports_uniform_location() const
+bool FeatureConverter::supports_uniform_location() const
{
if(features.target_api==OPENGL_ES)
return check_version(Version(3, 10));
return check_extension(&Features::arb_explicit_uniform_location);
}
-bool LegacyConverter::supports_binding() const
+bool FeatureConverter::supports_binding() const
{
if(features.target_api==OPENGL_ES)
return check_version(Version(3, 10));
return check_version(Version(4, 20));
}
-void LegacyConverter::visit(VariableDeclaration &var)
+void FeatureConverter::visit(VariableDeclaration &var)
{
if(var.layout)
{
TraversingVisitor::visit(var);
}
-bool LegacyConverter::supports_interface_blocks(const string &iface) const
+bool FeatureConverter::supports_interface_blocks(const string &iface) const
{
if(features.target_api==OPENGL_ES)
{
return false;
}
-bool LegacyConverter::supports_interface_block_location() const
+bool FeatureConverter::supports_interface_block_location() const
{
if(features.target_api==OPENGL_ES)
return check_version(Version(3, 20));
return check_extension(&Features::arb_enhanced_layouts);
}
-void LegacyConverter::visit(InterfaceBlock &iface)
+void FeatureConverter::visit(InterfaceBlock &iface)
{
bool push_constant = false;
if(iface.layout)