{
std::string name;
std::string source;
+ Msp::GL::GraphicsApi target_api;
Msp::GL::SL::Compiler::Mode compile_mode;
std::map<std::string, int> spec_values;
std::map<Msp::GL::SL::Stage::Type, std::string> expected_output;
IO::BufferedFile file(fn);
TestCase test_case;
test_case.name = FS::basename(fn);
+ test_case.target_api = GL::OPENGL;
test_case.compile_mode = GL::SL::Compiler::PROGRAM;
string *target = &test_case.source;
while(!file.eof())
continue;
}
+ pos = line.find("Target API:");
+ if(pos!=string::npos)
+ {
+ string api = strip(line.substr(pos+11));
+ if(api=="OpenGL")
+ test_case.target_api = GL::OPENGL;
+ else if(api=="OpenGL ES")
+ test_case.target_api = GL::OPENGL_ES;
+ else if(api=="Vulkan")
+ test_case.target_api = GL::VULKAN;
+ else
+ throw runtime_error("Unknown API "+api);
+ continue;
+ }
+
pos = line.find("Compile mode:");
if(pos!=string::npos)
{
void GlslCompilerTest::run_test_case(const TestCase *test_case)
{
- GL::SL::Compiler compiler(GL::SL::Features::latest(GL::OPENGL));
+ GL::SL::Compiler compiler(GL::SL::Features::latest(test_case->target_api));
try
{
compiler.set_source(test_case->source, "<test>");
void GlslCompilerIdempotence::run_test_case(const TestCase *test_case)
{
- GL::SL::Compiler compiler(GL::SL::Features::latest(GL::OPENGL));
+ GL::SL::Compiler compiler(GL::SL::Features::latest(test_case->target_api));
compiler.set_source(test_case->source, "<test>");
if(test_case->compile_mode==GL::SL::Compiler::PROGRAM)
compiler.specialize(test_case->spec_values);
compiler.compile(test_case->compile_mode);
- GL::SL::Compiler compiler2(GL::SL::Features::latest(GL::OPENGL));
+ GL::SL::Compiler compiler2(GL::SL::Features::latest(test_case->target_api));
compiler2.set_source(compiler.get_combined_glsl(), "<loopback>");
compiler2.compile(test_case->compile_mode);
void GlslCompilerSpirV::run_test_case(const TestCase *test_case)
{
- GL::SL::Compiler compiler(GL::SL::Features::latest(GL::OPENGL));
+ GL::SL::Compiler compiler(GL::SL::Features::latest(test_case->target_api));
compiler.set_source(test_case->source, "<test>");
compiler.compile(GL::SL::Compiler::SPIRV);