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);
69 const char* fixture_name,
71 auto filename =
SLFileName(fixture_name, platform);
72 auto fd = fml::OpenFileReadOnly(intermediates_directory_, filename.c_str());
73 return fml::FileMapping::CreateReadOnly(fd);
79 const char* entry_point_name)
const {
80 std::shared_ptr<fml::Mapping> fixture =
81 flutter::testing::OpenFixtureAsMapping(fixture_name);
82 if (!fixture || !fixture->GetMapping()) {
83 VALIDATION_LOG <<
"Could not find shader in fixtures: " << fixture_name;
91 flutter::testing::OpenFixturesDirectory());
100 Compiler compiler(fixture, source_options, reflector_options);
107 if (!spirv_assembly) {
112 if (!fml::WriteAtomically(intermediates_directory_,
125 if (!fml::WriteAtomically(intermediates_directory_,
136 <<
"No reflector was found for target platform SL compiler.";
140 auto reflection_json = reflector->GetReflectionJSON();
141 auto reflection_header = reflector->GetReflectionHeader();
142 auto reflection_source = reflector->GetReflectionCC();
144 if (!reflection_json) {
149 if (!reflection_header) {
154 if (!reflection_source) {
159 if (!fml::WriteAtomically(intermediates_directory_,
161 *reflection_header)) {
162 VALIDATION_LOG <<
"Could not write reflection header intermediates.";
166 if (!fml::WriteAtomically(intermediates_directory_,
168 *reflection_source)) {
173 if (!fml::WriteAtomically(intermediates_directory_,
176 VALIDATION_LOG <<
"Could not write reflection json intermediates.";