From b76838b4a6264697c5d4b999fbb8852cd6e5f166 Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Thu, 4 Aug 2022 12:25:05 -0400 Subject: [PATCH] Revert "[impeller] Set binding base for fragment shaders (#35052)" This reverts commit e771729efdde3cdbdf0404973c3e72dc15933ad0. --- impeller/compiler/compiler.cc | 15 --------------- impeller/compiler/compiler.h | 2 -- impeller/compiler/compiler_test.cc | 12 ------------ impeller/compiler/compiler_test.h | 3 --- impeller/compiler/compiler_unittests.cc | 23 ----------------------- impeller/fixtures/BUILD.gn | 1 - impeller/fixtures/sample.frag | 14 -------------- 7 files changed, 70 deletions(-) delete mode 100644 impeller/fixtures/sample.frag diff --git a/impeller/compiler/compiler.cc b/impeller/compiler/compiler.cc index e38aa14714555..e5b2018fd267f 100644 --- a/impeller/compiler/compiler.cc +++ b/impeller/compiler/compiler.cc @@ -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(ir); @@ -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(uniform_kind), kFragBindingBase); - } -} - Compiler::Compiler(const fml::Mapping& source_mapping, SourceOptions source_options, Reflector::Options reflector_options) @@ -226,7 +212,6 @@ Compiler::Compiler(const fml::Mapping& source_mapping, } spirv_options.SetAutoBindUniforms(true); - SetBindingBase(spirv_options); spirv_options.SetAutoMapLocations(true); std::vector included_file_names; diff --git a/impeller/compiler/compiler.h b/impeller/compiler/compiler.h index 379f610fd2286..9dd3d901c3dde 100644 --- a/impeller/compiler/compiler.h +++ b/impeller/compiler/compiler.h @@ -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); }; diff --git a/impeller/compiler/compiler_test.cc b/impeller/compiler/compiler_test.cc index 402d05fe7346f..85b3abaa5f9c5 100644 --- a/impeller/compiler/compiler_test.cc +++ b/impeller/compiler/compiler_test.cc @@ -6,11 +6,6 @@ #include -#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 { @@ -63,13 +58,6 @@ static std::string SLFileName(const char* fixture_name, return stream.str(); } -std::unique_ptr 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); diff --git a/impeller/compiler/compiler_test.h b/impeller/compiler/compiler_test.h index 0e4fd94fd3929..a7be1c688b198 100644 --- a/impeller/compiler/compiler_test.h +++ b/impeller/compiler/compiler_test.h @@ -25,9 +25,6 @@ class CompilerTest : public ::testing::TestWithParam { const char* fixture_name, SourceType source_type = SourceType::kUnknown) const; - std::unique_ptr GetReflectionJson( - const char* fixture_name) const; - private: fml::UniqueFD intermediates_directory_; diff --git a/impeller/compiler/compiler_unittests.cc b/impeller/compiler/compiler_unittests.cc index f46b745c81703..d19d9f00c98c0 100644 --- a/impeller/compiler/compiler_unittests.cc +++ b/impeller/compiler/compiler_unittests.cc @@ -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 { @@ -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(); - }; - - 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. diff --git a/impeller/fixtures/BUILD.gn b/impeller/fixtures/BUILD.gn index 635125cc1ecc9..d955a90bfa9df 100644 --- a/impeller/fixtures/BUILD.gn +++ b/impeller/fixtures/BUILD.gn @@ -43,7 +43,6 @@ test_fixtures("file_fixtures") { "embarcadero.jpg", "kalimba.jpg", "sample.comp", - "sample.frag", "sample.tesc", "sample.tese", "sample.vert", diff --git a/impeller/fixtures/sample.frag b/impeller/fixtures/sample.frag deleted file mode 100644 index 5d9c83604dd68..0000000000000 --- a/impeller/fixtures/sample.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -uniform FragInfo { - vec4 color; -} -frag_info; - -out vec4 frag_color; - -void main() { - frag_color = frag_info.color; -}