diff options
author | Lei Zhang <antiagainst@google.com> | 2016-09-30 14:31:37 -0400 |
---|---|---|
committer | Lei Zhang <antiagainst@google.com> | 2016-09-30 16:59:45 -0400 |
commit | f514d8ea156e68591c444d1e5642877cce1cb257 (patch) | |
tree | 4496eb7a0bbec2edf35002b7dfb24dd2b011a98b /libshaderc/src/shaderc_test.cc | |
parent | 501a864298b6c66074366deb0a8b3256dd3f0b18 (diff) | |
download | shaderc-f514d8ea156e68591c444d1e5642877cce1cb257.tar.gz |
Sort out target environments used in different components.
SPIRV-Tools has its own target environment definition, and public
shaderc API has its own. A new one is added into Compiler in
shaderc_util, for better isolation.
Now shaderc_util::Compiler's interface accepts target environment,
not glslang messages anymore. All the conversion to glslang messages
are done in the implementation now.
Diffstat (limited to 'libshaderc/src/shaderc_test.cc')
-rw-r--r-- | libshaderc/src/shaderc_test.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libshaderc/src/shaderc_test.cc b/libshaderc/src/shaderc_test.cc index 6de7053..c14b9c3 100644 --- a/libshaderc/src/shaderc_test.cc +++ b/libshaderc/src/shaderc_test.cc @@ -266,11 +266,16 @@ class CompileStringTest : public testing::Test { // checking methods. Subclass tests can access the compiler object to set their // properties. class AssembleStringTest : public testing::Test { + public: + AssembleStringTest() : options_(shaderc_compile_options_initialize()) {} + ~AssembleStringTest() { shaderc_compile_options_release(options_); } + protected: // Assembles the given assembly and returns true on success. bool AssemblingSuccess(const std::string& assembly) { return CompilationResultIsSuccess( - Assembling(compiler_.get_compiler_handle(), assembly).result()); + Assembling(compiler_.get_compiler_handle(), assembly, options_) + .result()); } bool AssemblingValid(const std::string& assembly) { @@ -280,6 +285,7 @@ class AssembleStringTest : public testing::Test { } Compiler compiler_; + shaderc_compile_options_t options_; }; // Name holders so that we have test cases being grouped with only one real @@ -312,6 +318,16 @@ TEST_F(AssembleStringTest, GarbageString) { EXPECT_EQ(0u, shaderc_result_get_num_warnings(assembling.result())); } +// TODO(antiagainst): right now there is no assembling difference for all the +// target environments exposed by shaderc. So the following is just testing the +// target environment is accepted. +TEST_F(AssembleStringTest, AcceptTargetEnv) { + ASSERT_NE(nullptr, compiler_.get_compiler_handle()); + shaderc_compile_options_set_target_env(options_, shaderc_target_env_opengl, + /* version = */ 0); + EXPECT_TRUE(AssemblingSuccess("OpCapability Shader")); +} + TEST_F(CompileStringTest, ReallyLongShader) { ASSERT_NE(nullptr, compiler_.get_compiler_handle()); std::string minimal_shader = ""; |