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
15 changes: 0 additions & 15 deletions impeller/compiler/compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,10 @@
#include "impeller/compiler/compiler_backend.h"
#include "impeller/compiler/includer.h"
#include "impeller/compiler/logger.h"
#include "impeller/compiler/types.h"

namespace impeller {
namespace compiler {

const uint32_t kFragBindingBase = 128;
const size_t kNumUniformKinds =
int(shaderc_uniform_kind::shaderc_uniform_kind_buffer) + 1;

static CompilerBackend CreateMSLCompiler(const spirv_cross::ParsedIR& ir,
const SourceOptions& source_options) {
auto sl_compiler = std::make_shared<spirv_cross::CompilerMSL>(ir);
Expand Down Expand Up @@ -109,15 +104,6 @@ static CompilerBackend CreateCompiler(const spirv_cross::ParsedIR& ir,
return compiler;
}

void Compiler::SetBindingBase(shaderc::CompileOptions& compiler_opts) const {
for (size_t uniform_kind = 0; uniform_kind < kNumUniformKinds;
uniform_kind++) {
compiler_opts.SetBindingBaseForStage(
ToShaderCShaderKind(SourceType::kFragmentShader),
static_cast<shaderc_uniform_kind>(uniform_kind), kFragBindingBase);
}
}

Compiler::Compiler(const fml::Mapping& source_mapping,
SourceOptions source_options,
Reflector::Options reflector_options)
Expand Down Expand Up @@ -226,7 +212,6 @@ Compiler::Compiler(const fml::Mapping& source_mapping,
}

spirv_options.SetAutoBindUniforms(true);
SetBindingBase(spirv_options);
spirv_options.SetAutoMapLocations(true);

std::vector<std::string> included_file_names;
Expand Down
2 changes: 0 additions & 2 deletions impeller/compiler/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ class Compiler {

std::string GetDependencyNames(std::string separator) const;

void SetBindingBase(shaderc::CompileOptions& compiler_opts) const;

FML_DISALLOW_COPY_AND_ASSIGN(Compiler);
};

Expand Down
12 changes: 0 additions & 12 deletions impeller/compiler/compiler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

#include <algorithm>

#include "flutter/fml/file.h"
#include "flutter/fml/logging.h"
#include "flutter/fml/mapping.h"
#include "flutter/fml/unique_fd.h"

namespace impeller {
namespace compiler {
namespace testing {
Expand Down Expand Up @@ -63,13 +58,6 @@ static std::string SLFileName(const char* fixture_name,
return stream.str();
}

std::unique_ptr<fml::FileMapping> CompilerTest::GetReflectionJson(
const char* fixture_name) const {
auto filename = ReflectionJSONName(fixture_name);
auto fd = fml::OpenFileReadOnly(intermediates_directory_, filename.c_str());
return fml::FileMapping::CreateReadOnly(fd);
}

bool CompilerTest::CanCompileAndReflect(const char* fixture_name,
SourceType source_type) const {
auto fixture = flutter::testing::OpenFixtureAsMapping(fixture_name);
Expand Down
3 changes: 0 additions & 3 deletions impeller/compiler/compiler_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ class CompilerTest : public ::testing::TestWithParam<TargetPlatform> {
const char* fixture_name,
SourceType source_type = SourceType::kUnknown) const;

std::unique_ptr<fml::FileMapping> GetReflectionJson(
const char* fixture_name) const;

private:
fml::UniqueFD intermediates_directory_;

Expand Down
23 changes: 0 additions & 23 deletions impeller/compiler/compiler_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include "impeller/compiler/source_options.h"
#include "impeller/compiler/types.h"

#include "nlohmann/json.hpp"

namespace impeller {
namespace compiler {
namespace testing {
Expand Down Expand Up @@ -52,27 +50,6 @@ TEST_P(CompilerTest, CanCompileComputeShader) {
ASSERT_TRUE(CanCompileAndReflect("sample.comp", SourceType::kComputeShader));
}

TEST_P(CompilerTest, BindingBaseForFragShader) {
if (GetParam() == TargetPlatform::kFlutterSPIRV) {
// This is a failure of reflection which this target doesn't perform.
GTEST_SKIP();
}

ASSERT_TRUE(CanCompileAndReflect("sample.vert", SourceType::kVertexShader));
ASSERT_TRUE(CanCompileAndReflect("sample.frag", SourceType::kFragmentShader));

auto get_binding = [&](const char* fixture) -> uint32_t {
auto json_fd = GetReflectionJson(fixture);
nlohmann::json shader_json = nlohmann::json::parse(json_fd->GetMapping());
return shader_json["buffers"][0]["binding"].get<uint32_t>();
};

auto vert_uniform_binding = get_binding("sample.vert");
auto frag_uniform_binding = get_binding("sample.frag");

ASSERT_GT(frag_uniform_binding, vert_uniform_binding);
}

TEST_P(CompilerTest, MustFailDueToMultipleLocationPerStructMember) {
if (GetParam() == TargetPlatform::kFlutterSPIRV) {
// This is a failure of reflection which this target doesn't perform.
Expand Down
1 change: 0 additions & 1 deletion impeller/fixtures/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ test_fixtures("file_fixtures") {
"embarcadero.jpg",
"kalimba.jpg",
"sample.comp",
"sample.frag",
"sample.tesc",
"sample.tese",
"sample.vert",
Expand Down
14 changes: 0 additions & 14 deletions impeller/fixtures/sample.frag

This file was deleted.