+#include <msp/core/algorithm.h>
#include <msp/core/raii.h>
+#include <msp/gl/extensions/arb_explicit_attrib_location.h>
+#include <msp/gl/extensions/arb_gpu_shader5.h>
+#include <msp/gl/extensions/arb_uniform_buffer_object.h>
#include <msp/gl/extensions/ext_gpu_shader4.h>
#include <msp/strings/format.h>
#include <msp/strings/utils.h>
formatted += '\n';
}
+ for(vector<const Extension *>::const_iterator i=s.required_extensions.begin(); i!=s.required_extensions.end(); ++i)
+ formatted += format("#extension %s: require\n", (*i)->get_name());
+ if(!s.required_extensions.empty())
+ formatted += '\n';
+
Visitor::apply(s);
}
return true;
}
+bool ProgramCompiler::LegacyConverter::check_extension(const Extension &extension) const
+{
+ if(!extension)
+ return false;
+
+ vector<const Extension *>::iterator i = find(stage->required_extensions, &extension);
+ if(i==stage->required_extensions.end())
+ stage->required_extensions.push_back(&extension);
+
+ return true;
+}
+
bool ProgramCompiler::LegacyConverter::supports_unified_interface_syntax() const
{
if(target_api==OPENGL_ES2)
{
if(target_api==OPENGL_ES2)
return check_version(Version(3, 0));
+ else if(check_version(Version(3, 30)))
+ return true;
else
- return check_version(Version(3, 30));
+ return check_extension(ARB_explicit_attrib_location);
}
bool ProgramCompiler::LegacyConverter::supports_centroid_sampling() const
{
if(target_api==OPENGL_ES2)
return check_version(Version(3, 0));
+ else if(check_version(Version(1, 20)))
+ return true;
else
- return check_version(Version(1, 20));
+ return check_extension(EXT_gpu_shader4);
}
bool ProgramCompiler::LegacyConverter::supports_sample_sampling() const
{
if(target_api==OPENGL_ES2)
return check_version(Version(3, 20));
+ else if(check_version(Version(4, 0)))
+ return true;
else
- return check_version(Version(4, 0));
+ return check_extension(ARB_gpu_shader5);
}
void ProgramCompiler::LegacyConverter::visit(VariableDeclaration &var)
else
return check_version(Version(3, 20));
}
+ else if(check_version(Version(1, 50)))
+ return true;
+ else if(iface=="uniform")
+ return check_extension(ARB_uniform_buffer_object);
else
- return check_version(Version(1, 50));
+ return false;
}
void ProgramCompiler::LegacyConverter::visit(InterfaceBlock &iface)