14 auto test_name = flutter::testing::GetCurrentTestName();
15 std::replace(test_name.begin(), test_name.end(),
'/',
'_');
16 std::replace(test_name.begin(), test_name.end(),
'.',
'_');
17 return fml::OpenDirectory(flutter::testing::OpenFixturesDirectory(),
20 fml::FilePermission::kReadWrite);
25 FML_CHECK(intermediates_directory_.is_valid());
31 std::stringstream stream;
32 stream << fixture_name <<
".h";
37 std::stringstream stream;
38 stream << fixture_name <<
".cc";
43 std::stringstream stream;
44 stream << fixture_name <<
".json";
49 std::stringstream stream;
50 stream << fixture_name <<
".spv";
56 std::stringstream stream;
62 const char* fixture_name)
const {
64 auto fd = fml::OpenFileReadOnly(intermediates_directory_, filename.c_str());
65 return fml::FileMapping::CreateReadOnly(fd);
71 const char* entry_point_name)
const {
72 std::shared_ptr<fml::Mapping> fixture =
73 flutter::testing::OpenFixtureAsMapping(fixture_name);
74 if (!fixture || !fixture->GetMapping()) {
75 VALIDATION_LOG <<
"Could not find shader in fixtures: " << fixture_name;
83 flutter::testing::OpenFixturesDirectory());
92 Compiler compiler(fixture, source_options, reflector_options);
99 if (!spirv_assembly) {
104 if (!fml::WriteAtomically(intermediates_directory_,
117 if (!fml::WriteAtomically(intermediates_directory_,
128 <<
"No reflector was found for target platform SL compiler.";
132 auto reflection_json = reflector->GetReflectionJSON();
133 auto reflection_header = reflector->GetReflectionHeader();
134 auto reflection_source = reflector->GetReflectionCC();
136 if (!reflection_json) {
141 if (!reflection_header) {
146 if (!reflection_source) {
151 if (!fml::WriteAtomically(intermediates_directory_,
153 *reflection_header)) {
154 VALIDATION_LOG <<
"Could not write reflection header intermediates.";
158 if (!fml::WriteAtomically(intermediates_directory_,
160 *reflection_source)) {
165 if (!fml::WriteAtomically(intermediates_directory_,
168 VALIDATION_LOG <<
"Could not write reflection json intermediates.";