Begin wiring up render passes.

This commit is contained in:
Chinmay Garde 2021-06-02 15:18:44 -07:00 committed by Dan Field
parent 60ca2b8fbc
commit 68e0094f6f
9 changed files with 120 additions and 9 deletions

View File

@ -19,11 +19,12 @@ group("impeller") {
]
}
group("unittests") {
executable("impeller_unittests") {
testonly = true
deps = [
"compiler:compiler_unittests",
"compositor:compositor_unittests",
"//flutter/testing",
]
}

View File

@ -48,7 +48,7 @@ test_fixtures("compiler_test_fixtures") {
]
}
executable("compiler_unittests") {
source_set("compiler_unittests") {
testonly = true
output_name = "impellerc_unittests"
@ -58,6 +58,6 @@ executable("compiler_unittests") {
deps = [
":compiler_lib",
":compiler_test_fixtures",
"//flutter/testing",
"//flutter/testing:testing_lib",
]
}

View File

@ -53,10 +53,11 @@ TEST_F(CompilerTest, CanCompileSample) {
constexpr const char* kShaderFixtureName = "sample.vert";
auto fixture = flutter::testing::OpenFixtureAsMapping(kShaderFixtureName);
ASSERT_NE(fixture->GetMapping(), nullptr);
Compiler::SourceOptions options(kShaderFixtureName);
options.working_directory = std::make_shared<fml::UniqueFD>(
Compiler::SourceOptions compiler_options(kShaderFixtureName);
compiler_options.working_directory = std::make_shared<fml::UniqueFD>(
flutter::testing::OpenFixturesDirectory());
Compiler compiler(*fixture.get(), options);
Reflector::Options reflector_options;
Compiler compiler(*fixture.get(), compiler_options, reflector_options);
if (!compiler.IsValid()) {
FML_LOG(ERROR) << compiler.GetErrorMessages();
}

View File

@ -26,6 +26,8 @@ impeller_component("compositor") {
"pipeline_library.mm",
"range.cc",
"range.h",
"render_pass.h",
"render_pass.mm",
"renderer.h",
"renderer.mm",
"shader_function.h",
@ -34,6 +36,8 @@ impeller_component("compositor") {
"shader_library.mm",
"surface.h",
"surface.mm",
"texture.h",
"texture.mm",
"vertex_descriptor.h",
"vertex_descriptor.mm",
]
@ -44,6 +48,10 @@ impeller_component("compositor") {
]
}
executable("compositor_unittests") {
sources = [ "buffer_unittests.cc" ]
source_set("compositor_unittests") {
testonly = true
sources = []
deps = [ "//flutter/testing:testing_lib" ]
}

View File

@ -43,6 +43,17 @@ enum class BlendOperation {
kMax,
};
enum class LoadAction {
kDontCare,
kLoad,
kClear,
};
enum class StoreAction {
kDontCare,
kStore,
};
enum class ColorWriteMask : uint64_t {
kNone = 0,
kRed = 1 << 0,

View File

@ -0,0 +1,48 @@
// 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.
#pragma once
#include "flutter/fml/macros.h"
#include "impeller/compositor/formats.h"
#include "impeller/compositor/texture.h"
#include "impeller/entity/color.h"
namespace impeller {
struct RenderPassAttachment {
std::shared_ptr<Texture> texture;
LoadAction load_action = LoadAction::kDontCare;
StoreAction store_action = StoreAction::kDontCare;
};
struct ColorRenderPassAttachment : public RenderPassAttachment {
Color clear_color = Color::BlackTransparent();
};
struct DepthRenderPassAttachment : public RenderPassAttachment {
double clear_depth = 0.0;
};
struct StencilRenderPassAttachment : public RenderPassAttachment {
uint32_t clear_stencil = 0;
};
class RenderPassDescriptor {
public:
private:
FML_DISALLOW_COPY_AND_ASSIGN(RenderPassDescriptor);
};
class RenderPass {
public:
RenderPass();
~RenderPass();
private:
FML_DISALLOW_COPY_AND_ASSIGN(RenderPass);
};
} // namespace impeller

View File

@ -0,0 +1,13 @@
// 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.
#include "impeller/compositor/render_pass.h"
namespace impeller {
RenderPass::RenderPass() = default;
RenderPass::~RenderPass() = default;
} // namespace impeller

View File

@ -0,0 +1,21 @@
// 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.
#pragma once
#include "flutter/fml/macros.h"
namespace impeller {
class Texture {
public:
Texture();
~Texture();
private:
FML_DISALLOW_COPY_AND_ASSIGN(Texture);
};
} // namespace impeller

View File

@ -2,4 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "gtest/gtest.h"
#include "impeller/compositor/texture.h"
namespace impeller {
Texture::Texture() = default;
Texture::~Texture() = default;
} // namespace impeller