Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit e9adf67

Browse files
Merge branch 'main' into fix_barriers_vulkan
2 parents 8220ebf + afb29da commit e9adf67

13 files changed

+118
-23
lines changed

.ci.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ targets:
115115
timeout: 60
116116

117117
- name: Mac builder_cache
118+
bringup: true
118119
enabled_branches:
119120
- main
120121
recipe: engine_v2/cache
@@ -129,7 +130,8 @@ targets:
129130
]
130131
ignore_cache_paths: >-
131132
[
132-
"builder/src/flutter/prebuilts/SDKs"
133+
"builder/src/flutter/prebuilts/SDKs",
134+
"builder/src/flutter/prebuilts/Library"
133135
]
134136
gclient_variables: >-
135137
{

DEPS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ vars = {
6565
# Dart is: https://github.com/dart-lang/sdk/blob/main/DEPS
6666
# You can use //tools/dart/create_updated_flutter_deps.py to produce
6767
# updated revision list of existing dependencies.
68-
'dart_revision': '9470ea6b00a588cbd19713919979954403f1465a',
68+
'dart_revision': '5646ac9669f8b8b15651979875f9a8b8e6acc857',
6969

7070
# WARNING: DO NOT EDIT MANUALLY
7171
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
@@ -270,7 +270,7 @@ allowed_hosts = [
270270
]
271271

272272
deps = {
273-
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'a43582b52d361bc3da156a8e6eab6dd947ca339d',
273+
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'a2dfdefd9b1248689264bfe8b48e1c83b5e80039',
274274

275275
'src/flutter/third_party/rapidjson':
276276
Var('flutter_git') + '/third_party/rapidjson' + '@' + 'ef3564c5c8824989393b87df25355baf35ff544b',

ci/licenses_golden/licenses_dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Signature: b94327adc1096bd6bc6080a3345c0946
1+
Signature: 070d855e9daf0706a6209be7505b27e1
22

33
====================================================================================================
44
LIBRARY: dart
@@ -4707,7 +4707,7 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
47074707
This Source Code Form is "Incompatible With Secondary Licenses", as
47084708
defined by the Mozilla Public License, v. 2.0.
47094709

4710-
You may obtain a copy of this library's Source Code Form from: https://dart.googlesource.com/sdk/+/9470ea6b00a588cbd19713919979954403f1465a
4710+
You may obtain a copy of this library's Source Code Form from: https://dart.googlesource.com/sdk/+/5646ac9669f8b8b15651979875f9a8b8e6acc857
47114711
/third_party/fallback_root_certificates/
47124712

47134713
====================================================================================================

impeller/entity/contents/content_context.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,26 @@ void ContentContextOptions::ApplyToPipelineDescriptor(
142142
}
143143

144144
auto maybe_stencil = desc.GetFrontStencilAttachmentDescriptor();
145+
auto maybe_depth = desc.GetDepthStencilAttachmentDescriptor();
146+
FML_DCHECK(has_depth_stencil_attachments == maybe_depth.has_value())
147+
<< "Depth attachment doesn't match expected pipeline state. "
148+
"has_depth_stencil_attachments="
149+
<< has_depth_stencil_attachments;
150+
FML_DCHECK(has_depth_stencil_attachments == maybe_stencil.has_value())
151+
<< "Stencil attachment doesn't match expected pipeline state. "
152+
"has_depth_stencil_attachments="
153+
<< has_depth_stencil_attachments;
145154
if (maybe_stencil.has_value()) {
146155
StencilAttachmentDescriptor stencil = maybe_stencil.value();
147156
stencil.stencil_compare = stencil_compare;
148157
stencil.depth_stencil_pass = stencil_operation;
149158
desc.SetStencilAttachmentDescriptors(stencil);
150159
}
160+
if (maybe_depth.has_value()) {
161+
DepthAttachmentDescriptor depth = maybe_depth.value();
162+
depth.depth_compare = CompareFunction::kAlways;
163+
depth.depth_write_enabled = false;
164+
}
151165

152166
desc.SetPrimitiveType(primitive_type);
153167

impeller/entity/contents/runtime_effect_contents.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ bool RuntimeEffectContents::Render(const ContentContext& renderer,
141141

142142
const std::shared_ptr<const Capabilities>& caps = context->GetCapabilities();
143143
const auto color_attachment_format = caps->GetDefaultColorFormat();
144-
const auto stencil_attachment_format = caps->GetDefaultStencilFormat();
144+
const auto stencil_attachment_format = caps->GetDefaultDepthStencilFormat();
145145

146146
using VS = RuntimeEffectVertexShader;
147147

@@ -303,11 +303,12 @@ bool RuntimeEffectContents::Render(const ContentContext& renderer,
303303
desc.SetColorAttachmentDescriptor(
304304
0u, {.format = color_attachment_format, .blending_enabled = true});
305305

306-
StencilAttachmentDescriptor stencil0;
307-
stencil0.stencil_compare = CompareFunction::kEqual;
308-
desc.SetStencilAttachmentDescriptors(stencil0);
306+
desc.SetStencilAttachmentDescriptors(StencilAttachmentDescriptor{});
309307
desc.SetStencilPixelFormat(stencil_attachment_format);
310308

309+
desc.SetDepthStencilAttachmentDescriptor(DepthAttachmentDescriptor{});
310+
desc.SetDepthPixelFormat(stencil_attachment_format);
311+
311312
options.ApplyToPipelineDescriptor(desc);
312313
auto pipeline = context->GetPipelineLibrary()->GetPipeline(desc).Get();
313314
if (!pipeline) {

impeller/entity/entity_pass.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,12 @@ bool EntityPass::Render(ContentContext& renderer,
328328
VALIDATION_LOG << "The root RenderTarget must have a color attachment.";
329329
return false;
330330
}
331+
if (root_render_target.GetDepthAttachment().has_value() !=
332+
root_render_target.GetStencilAttachment().has_value()) {
333+
VALIDATION_LOG << "The root RenderTarget should have a stencil attachment "
334+
"iff it has a depth attachment.";
335+
return false;
336+
}
331337

332338
capture.AddRect("Coverage",
333339
Rect::MakeSize(root_render_target.GetRenderTargetSize()),

impeller/entity/entity_unittests.cc

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,6 +2200,53 @@ TEST_P(EntityTest, RuntimeEffect) {
22002200
ASSERT_TRUE(OpenPlaygroundHere(callback));
22012201
}
22022202

2203+
TEST_P(EntityTest, RuntimeEffectCanSuccessfullyRender) {
2204+
auto runtime_stages =
2205+
OpenAssetAsRuntimeStage("runtime_stage_example.frag.iplr");
2206+
auto runtime_stage =
2207+
runtime_stages[PlaygroundBackendToRuntimeStageBackend(GetBackend())];
2208+
ASSERT_TRUE(runtime_stage);
2209+
ASSERT_TRUE(runtime_stage->IsDirty());
2210+
2211+
auto contents = std::make_shared<RuntimeEffectContents>();
2212+
contents->SetGeometry(Geometry::MakeCover());
2213+
2214+
contents->SetRuntimeStage(runtime_stage);
2215+
2216+
struct FragUniforms {
2217+
Vector2 iResolution;
2218+
Scalar iTime;
2219+
} frag_uniforms = {
2220+
.iResolution = Vector2(GetWindowSize().width, GetWindowSize().height),
2221+
.iTime = static_cast<Scalar>(GetSecondsElapsed()),
2222+
};
2223+
auto uniform_data = std::make_shared<std::vector<uint8_t>>();
2224+
uniform_data->resize(sizeof(FragUniforms));
2225+
memcpy(uniform_data->data(), &frag_uniforms, sizeof(FragUniforms));
2226+
contents->SetUniformData(uniform_data);
2227+
2228+
Entity entity;
2229+
entity.SetContents(contents);
2230+
2231+
// Create a render target with a depth-stencil, similar to how EntityPass
2232+
// does.
2233+
RenderTarget target = RenderTarget::CreateOffscreenMSAA(
2234+
*GetContext(), *GetContentContext()->GetRenderTargetCache(),
2235+
{GetWindowSize().width, GetWindowSize().height}, 1,
2236+
"RuntimeEffect Texture");
2237+
testing::MockRenderPass pass(GetContext(), target);
2238+
2239+
ASSERT_TRUE(contents->Render(*GetContentContext(), entity, pass));
2240+
ASSERT_EQ(pass.GetCommands().size(), 1u);
2241+
const auto& command = pass.GetCommands()[0];
2242+
ASSERT_TRUE(command.pipeline->GetDescriptor()
2243+
.GetDepthStencilAttachmentDescriptor()
2244+
.has_value());
2245+
ASSERT_TRUE(command.pipeline->GetDescriptor()
2246+
.GetFrontStencilAttachmentDescriptor()
2247+
.has_value());
2248+
}
2249+
22032250
TEST_P(EntityTest, RuntimeEffectSetsRightSizeWhenUniformIsStruct) {
22042251
if (GetBackend() != PlaygroundBackend::kVulkan) {
22052252
GTEST_SKIP() << "Test only applies to Vulkan";

impeller/golden_tests/golden_playground_test_mac.cc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ static const std::vector<std::string> kSkipTests = {
6060
"impeller_Play_AiksTest_CaptureContext_Vulkan",
6161
};
6262

63+
/// TODO(https://github.com/flutter/flutter/issues/142017): Turn on validation
64+
/// for all vulkan tests.
65+
static const std::vector<std::string> kVulkanValidationTests = {
66+
"impeller_Play_AiksTest_CanRenderTextFrame_Vulkan",
67+
};
68+
6369
namespace {
6470
std::string GetTestName() {
6571
std::string suite_name =
@@ -127,13 +133,20 @@ void GoldenPlaygroundTest::SetUp() {
127133
return;
128134
}
129135

136+
bool enable_vulkan_validations = false;
137+
std::string test_name = GetTestName();
138+
if (std::find(kVulkanValidationTests.begin(), kVulkanValidationTests.end(),
139+
test_name) != kVulkanValidationTests.end()) {
140+
enable_vulkan_validations = true;
141+
}
142+
130143
if (GetParam() == PlaygroundBackend::kMetal) {
131144
pimpl_->screenshotter = std::make_unique<testing::MetalScreenshotter>();
132145
} else if (GetParam() == PlaygroundBackend::kVulkan) {
133-
pimpl_->screenshotter = std::make_unique<testing::VulkanScreenshotter>();
146+
pimpl_->screenshotter = std::make_unique<testing::VulkanScreenshotter>(
147+
enable_vulkan_validations);
134148
}
135149

136-
std::string test_name = GetTestName();
137150
if (std::find(kSkipTests.begin(), kSkipTests.end(), test_name) !=
138151
kSkipTests.end()) {
139152
GTEST_SKIP_(

impeller/golden_tests/vulkan_screenshotter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace testing {
1818
/// playground backend.
1919
class VulkanScreenshotter : public Screenshotter {
2020
public:
21-
VulkanScreenshotter();
21+
explicit VulkanScreenshotter(bool enable_validations);
2222

2323
std::unique_ptr<Screenshot> MakeScreenshot(
2424
AiksContext& aiks_context,

impeller/golden_tests/vulkan_screenshotter.mm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,12 @@
6464
}
6565
} // namespace
6666

67-
VulkanScreenshotter::VulkanScreenshotter() {
67+
VulkanScreenshotter::VulkanScreenshotter(bool enable_validations) {
6868
FML_CHECK(::glfwInit() == GLFW_TRUE);
69+
PlaygroundSwitches playground_switches;
70+
playground_switches.enable_vulkan_validation = enable_validations;
6971
playground_ =
70-
PlaygroundImpl::Create(PlaygroundBackend::kVulkan, PlaygroundSwitches{});
72+
PlaygroundImpl::Create(PlaygroundBackend::kVulkan, playground_switches);
7173
}
7274

7375
std::unique_ptr<Screenshot> VulkanScreenshotter::MakeScreenshot(

shell/platform/android/surface_texture_external_texture.cc

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,17 @@ void SurfaceTextureExternalTexture::Paint(PaintContext& context,
5858
if (dl_image_) {
5959
DlAutoCanvasRestore autoRestore(context.canvas, true);
6060

61-
// The incoming texture is vertically flipped, so we flip it
62-
// back. OpenGL's coordinate system has Positive Y equivalent to up, while
63-
// Skia's coordinate system has Negative Y equvalent to up.
64-
context.canvas->Translate(bounds.x(), bounds.y() + bounds.height());
65-
context.canvas->Scale(bounds.width(), -bounds.height());
61+
// The incoming texture is vertically flipped, so we flip it back.
62+
//
63+
// OpenGL's coordinate system has Positive Y equivalent to up, while Skia's
64+
// coordinate system (as well as Impeller's) has Negative Y equvalent to up.
65+
{
66+
// Move (translate) the origin to the bottom-left corner of the image.
67+
context.canvas->Translate(bounds.x(), bounds.y() + bounds.height());
68+
69+
// No change in the X axis, but we need to flip the Y axis.
70+
context.canvas->Scale(1, -1);
71+
}
6672

6773
if (!transform_.isIdentity()) {
6874
DlImageColorSource source(dl_image_, DlTileMode::kRepeat,
@@ -73,7 +79,8 @@ void SurfaceTextureExternalTexture::Paint(PaintContext& context,
7379
paintWithShader = *context.paint;
7480
}
7581
paintWithShader.setColorSource(&source);
76-
context.canvas->DrawRect(SkRect::MakeWH(1, 1), paintWithShader);
82+
context.canvas->DrawRect(SkRect::MakeWH(bounds.width(), bounds.height()),
83+
paintWithShader);
7784
} else {
7885
context.canvas->DrawImage(dl_image_, {0, 0}, sampling, context.paint);
7986
}

shell/platform/android/surface_texture_external_texture_gl.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ void SurfaceTextureExternalTextureGL::ProcessFrame(PaintContext& context,
4848
// Create a
4949
GrGLTextureInfo textureInfo = {GL_TEXTURE_EXTERNAL_OES, texture_name_,
5050
GL_RGBA8_OES};
51-
auto backendTexture =
52-
GrBackendTextures::MakeGL(1, 1, skgpu::Mipmapped::kNo, textureInfo);
51+
auto backendTexture = GrBackendTextures::MakeGL(
52+
/*width=*/bounds.width(),
53+
/*height=*/bounds.height(),
54+
/*Mipmapped=*/skgpu::Mipmapped::kNo,
55+
/*glInfo=*/textureInfo);
5356
dl_image_ = DlImage::Make(SkImages::BorrowTextureFrom(
5457
context.gr_context, backendTexture, kTopLeft_GrSurfaceOrigin,
5558
kRGBA_8888_SkColorType, kPremul_SkAlphaType, nullptr));

sky/packages/sky_engine/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31236,7 +31236,7 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
3123631236
This Source Code Form is "Incompatible With Secondary Licenses", as
3123731237
defined by the Mozilla Public License, v. 2.0.
3123831238

31239-
You may obtain a copy of this library's Source Code Form from: https://dart.googlesource.com/sdk/+/9470ea6b00a588cbd19713919979954403f1465a
31239+
You may obtain a copy of this library's Source Code Form from: https://dart.googlesource.com/sdk/+/5646ac9669f8b8b15651979875f9a8b8e6acc857
3124031240
/third_party/fallback_root_certificates/
3124131241

3124231242
--------------------------------------------------------------------------------

0 commit comments

Comments
 (0)