mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Begin wiring up render passes.
This commit is contained in:
parent
60ca2b8fbc
commit
68e0094f6f
@ -19,11 +19,12 @@ group("impeller") {
|
||||
]
|
||||
}
|
||||
|
||||
group("unittests") {
|
||||
executable("impeller_unittests") {
|
||||
testonly = true
|
||||
|
||||
deps = [
|
||||
"compiler:compiler_unittests",
|
||||
"compositor:compositor_unittests",
|
||||
"//flutter/testing",
|
||||
]
|
||||
}
|
||||
|
||||
@ -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",
|
||||
]
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -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" ]
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
48
engine/src/flutter/impeller/compositor/render_pass.h
Normal file
48
engine/src/flutter/impeller/compositor/render_pass.h
Normal 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
|
||||
13
engine/src/flutter/impeller/compositor/render_pass.mm
Normal file
13
engine/src/flutter/impeller/compositor/render_pass.mm
Normal 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
|
||||
21
engine/src/flutter/impeller/compositor/texture.h
Normal file
21
engine/src/flutter/impeller/compositor/texture.h
Normal 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
|
||||
@ -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
|
||||
Loading…
x
Reference in New Issue
Block a user