Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions impeller/compiler/compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -481,24 +481,13 @@ const std::vector<std::string>& Compiler::GetIncludedFileNames() const {
return included_file_names_;
}

// Escape `%` and `#` characters according to doc comment at
// https://github.com/ninja-build/ninja/blob/master/src/depfile_parser.cc#L28
static void EscapeString(std::string& str, std::stringstream& stream) {
for (auto it = str.begin(); it != str.end(); it++) {
if (*it == '%' || *it == '#') {
stream << '\\';
}
stream << *it;
}
}

static std::string JoinStrings(std::vector<std::string> items,
std::string separator) {
std::stringstream stream;
for (size_t i = 0, count = items.size(); i < count; i++) {
const auto is_last = (i == count - 1);

EscapeString(items[i], stream);
stream << items[i];
if (!is_last) {
stream << separator;
}
Expand Down
38 changes: 0 additions & 38 deletions impeller/compiler/compiler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,37 +58,6 @@ static std::string SLFileName(const char* fixture_name,
return stream.str();
}

static std::string DepfileName(const char* fixture_name) {
std::stringstream stream;
stream << fixture_name << ".d";
return stream.str();
}

bool CompilerTest::ValidateDepfileEscaped(const char* fixture_name) const {
auto depfile_name = DepfileName(fixture_name);
auto mapping = std::make_unique<fml::FileMapping>(
fml::OpenFile(intermediates_directory_, depfile_name.c_str(), false,
fml::FilePermission::kRead));

std::string contents(reinterpret_cast<char const*>(mapping->GetMapping()),
mapping->GetSize());
bool escaped = false;
for (auto it = contents.begin(); it != contents.end(); it++) {
if (*it == '\\') {
escaped = true;
} else if (*it == '%' || *it == '#') {
if (!escaped) {
VALIDATION_LOG << "Unescaped character " << *it << " in depfile.";
return false;
}
escaped = false;
} else {
escaped = false;
}
}
return true;
}

std::unique_ptr<fml::FileMapping> CompilerTest::GetReflectionJson(
const char* fixture_name) const {
auto filename = ReflectionJSONName(fixture_name);
Expand Down Expand Up @@ -197,13 +166,6 @@ bool CompilerTest::CanCompileAndReflect(const char* fixture_name,
return false;
}
}

auto mapping = compiler.CreateDepfileContents({fixture_name});
if (!fml::WriteAtomically(intermediates_directory_,
DepfileName(fixture_name).c_str(), *mapping)) {
VALIDATION_LOG << "Could not write depfile.";
return false;
}
return true;
}

Expand Down
2 changes: 0 additions & 2 deletions impeller/compiler/compiler_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class CompilerTest : public ::testing::TestWithParam<TargetPlatform> {
const char* fixture_name,
SourceType source_type = SourceType::kUnknown) const;

bool ValidateDepfileEscaped(const char* fixture_name) const;

private:
fml::UniqueFD intermediates_directory_;

Expand Down
5 changes: 0 additions & 5 deletions impeller/compiler/compiler_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ TEST_P(CompilerTest, MustFailDueToMultipleLocationPerStructMember) {
ASSERT_FALSE(CanCompileAndReflect("struct_def_bug.vert"));
}

TEST_P(CompilerTest, ShaderWithSpecialCharactersHasEscapedDepfile) {
ASSERT_TRUE(CanCompileAndReflect("sa\%m#ple.vert"));
ASSERT_TRUE(ValidateDepfileEscaped("sa\%m#ple.vert"));
}

TEST_P(CompilerTest, BindingBaseForFragShader) {
if (GetParam() == TargetPlatform::kFlutterSPIRV) {
// This is a failure of reflection which this target doesn't perform.
Expand Down
1 change: 0 additions & 1 deletion lib/ui/fixtures/shaders/general_shaders/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ if (enable_unittests) {
"blue_green_sampler.frag",
"children_and_uniforms.frag",
"functions.frag",
"functions%20with_space.frag",
"no_builtin_redefinition.frag",
"no_uniforms.frag",
"simple.frag",
Expand Down

This file was deleted.

10 changes: 0 additions & 10 deletions testing/dart/fragment_shader_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ void main() async {
_expectShaderRendersGreen(shader);
});

test('simple shader with space in key renders correctly', () async {
final FragmentProgram program = await FragmentProgram.fromAsset(
'functions with_space.frag.iplr',
);
final Shader shader = program.shader(
floatUniforms: Float32List.fromList(<double>[1]),
);
_expectShaderRendersGreen(shader);
});

test('blue-green image renders green', () async {
final FragmentProgram program = await FragmentProgram.fromAsset(
'blue_green_sampler.frag.iplr',
Expand Down