X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=tests%2Fglsl%2Fglslcompiler.cpp;h=7deeb1f35190b403f8594e159562498e522e5b9e;hb=8f12c5d2527f61183b2ae36aab224eefbf52086a;hp=3debd721fb8a769f3dd6837a1d65bc995b65bcc9;hpb=d29b82596d6c21dd2b04fb2a24d3d3f3a1cc9b7b;p=libs%2Fgl.git diff --git a/tests/glsl/glslcompiler.cpp b/tests/glsl/glslcompiler.cpp index 3debd721..7deeb1f3 100644 --- a/tests/glsl/glslcompiler.cpp +++ b/tests/glsl/glslcompiler.cpp @@ -15,6 +15,7 @@ protected: { std::string name; std::string source; + Msp::GL::GraphicsApi target_api; Msp::GL::SL::Compiler::Mode compile_mode; std::map spec_values; std::map expected_output; @@ -91,6 +92,7 @@ const GlslCompilerHelper::TestCase &GlslCompilerHelper::load_test_case(const str 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()) @@ -127,6 +129,21 @@ const GlslCompilerHelper::TestCase &GlslCompilerHelper::load_test_case(const str 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) { @@ -251,7 +268,7 @@ GlslCompilerTest::GlslCompilerTest() void GlslCompilerTest::run_test_case(const TestCase *test_case) { - GL::SL::Compiler compiler(GL::SL::Features::opengl_latest()); + GL::SL::Compiler compiler(GL::SL::Features::latest(test_case->target_api)); try { compiler.set_source(test_case->source, ""); @@ -308,13 +325,13 @@ GlslCompilerIdempotence::GlslCompilerIdempotence() void GlslCompilerIdempotence::run_test_case(const TestCase *test_case) { - GL::SL::Compiler compiler(GL::SL::Features::opengl_latest()); + GL::SL::Compiler compiler(GL::SL::Features::latest(test_case->target_api)); compiler.set_source(test_case->source, ""); 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::opengl_latest()); + GL::SL::Compiler compiler2(GL::SL::Features::latest(test_case->target_api)); compiler2.set_source(compiler.get_combined_glsl(), ""); compiler2.compile(test_case->compile_mode); @@ -351,7 +368,7 @@ GlslCompilerSpirV::GlslCompilerSpirV(): void GlslCompilerSpirV::run_test_case(const TestCase *test_case) { - GL::SL::Compiler compiler(GL::SL::Features::opengl_latest()); + GL::SL::Compiler compiler(GL::SL::Features::latest(test_case->target_api)); compiler.set_source(test_case->source, ""); compiler.compile(GL::SL::Compiler::SPIRV);