Skip to content

Commit 400ed7c

Browse files
author
George Wright
committed
Revert "[shell tests] Integrate Vulkan with Shell Tests"
This reverts commit 594f660.
1 parent 594f660 commit 400ed7c

File tree

3 files changed

+10
-162
lines changed

3 files changed

+10
-162
lines changed

shell/common/shell_test_platform_view_vulkan.cc

Lines changed: 5 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// found in the LICENSE file.
44

55
#include "flutter/shell/common/shell_test_platform_view_vulkan.h"
6+
#include "flutter/shell/gpu/gpu_surface_vulkan.h"
67

78
namespace flutter {
89
namespace testing {
@@ -29,7 +30,7 @@ void ShellTestPlatformViewVulkan::SimulateVSync() {
2930

3031
// |PlatformView|
3132
std::unique_ptr<Surface> ShellTestPlatformViewVulkan::CreateRenderingSurface() {
32-
return std::make_unique<OffScreenSurface>(proc_table_);
33+
return std::make_unique<GPUSurfaceVulkan>(this, nullptr, true);
3334
}
3435

3536
// |PlatformView|
@@ -39,128 +40,9 @@ PointerDataDispatcherMaker ShellTestPlatformViewVulkan::GetDispatcherMaker() {
3940
};
4041
}
4142

42-
ShellTestPlatformViewVulkan::OffScreenSurface::OffScreenSurface(
43-
fml::RefPtr<vulkan::VulkanProcTable> vk)
44-
: valid_(false), vk_(std::move(vk)) {
45-
if (!vk_ || !vk_->HasAcquiredMandatoryProcAddresses()) {
46-
FML_DLOG(ERROR) << "Proc table has not acquired mandatory proc addresses.";
47-
return;
48-
}
49-
50-
// Create the application instance.
51-
std::vector<std::string> extensions = {};
52-
53-
application_ = std::make_unique<vulkan::VulkanApplication>(
54-
*vk_, "FlutterTest", std::move(extensions));
55-
56-
if (!application_->IsValid() || !vk_->AreInstanceProcsSetup()) {
57-
// Make certain the application instance was created and it setup the
58-
// instance proc table entries.
59-
FML_DLOG(ERROR) << "Instance proc addresses have not been setup.";
60-
return;
61-
}
62-
63-
// Create the device.
64-
65-
logical_device_ = application_->AcquireFirstCompatibleLogicalDevice();
66-
67-
if (logical_device_ == nullptr || !logical_device_->IsValid() ||
68-
!vk_->AreDeviceProcsSetup()) {
69-
// Make certain the device was created and it setup the device proc table
70-
// entries.
71-
FML_DLOG(ERROR) << "Device proc addresses have not been setup.";
72-
return;
73-
}
74-
75-
// Create the Skia GrContext.
76-
if (!CreateSkiaGrContext()) {
77-
FML_DLOG(ERROR) << "Could not create Skia context.";
78-
return;
79-
}
80-
81-
valid_ = true;
82-
}
83-
84-
bool ShellTestPlatformViewVulkan::OffScreenSurface::CreateSkiaGrContext() {
85-
GrVkBackendContext backend_context;
86-
87-
if (!CreateSkiaBackendContext(&backend_context)) {
88-
FML_DLOG(ERROR) << "Could not create Skia backend context.";
89-
return false;
90-
}
91-
92-
sk_sp<GrContext> context = GrContext::MakeVulkan(backend_context);
93-
94-
if (context == nullptr) {
95-
FML_DLOG(ERROR) << "Failed to create GrContext";
96-
return false;
97-
}
98-
99-
context->setResourceCacheLimits(vulkan::kGrCacheMaxCount,
100-
vulkan::kGrCacheMaxByteSize);
101-
102-
context_ = context;
103-
104-
return true;
105-
}
106-
107-
bool ShellTestPlatformViewVulkan::OffScreenSurface::CreateSkiaBackendContext(
108-
GrVkBackendContext* context) {
109-
auto getProc = vk_->CreateSkiaGetProc();
110-
111-
if (getProc == nullptr) {
112-
FML_DLOG(ERROR) << "GetProcAddress is null";
113-
return false;
114-
}
115-
116-
uint32_t skia_features = 0;
117-
if (!logical_device_->GetPhysicalDeviceFeaturesSkia(&skia_features)) {
118-
FML_DLOG(ERROR) << "Failed to get Physical Device features";
119-
return false;
120-
}
121-
122-
context->fInstance = application_->GetInstance();
123-
context->fPhysicalDevice = logical_device_->GetPhysicalDeviceHandle();
124-
context->fDevice = logical_device_->GetHandle();
125-
context->fQueue = logical_device_->GetQueueHandle();
126-
context->fGraphicsQueueIndex = logical_device_->GetGraphicsQueueIndex();
127-
context->fMinAPIVersion = application_->GetAPIVersion();
128-
context->fMaxAPIVersion = application_->GetAPIVersion();
129-
context->fFeatures = skia_features;
130-
context->fGetProc = std::move(getProc);
131-
context->fOwnsInstanceAndDevice = false;
132-
return true;
133-
}
134-
135-
ShellTestPlatformViewVulkan::OffScreenSurface::~OffScreenSurface() {}
136-
137-
bool ShellTestPlatformViewVulkan::OffScreenSurface::IsValid() {
138-
return valid_;
139-
}
140-
141-
std::unique_ptr<SurfaceFrame>
142-
ShellTestPlatformViewVulkan::OffScreenSurface::AcquireFrame(
143-
const SkISize& size) {
144-
auto image_info = SkImageInfo::Make(size, SkColorType::kRGBA_8888_SkColorType,
145-
SkAlphaType::kOpaque_SkAlphaType);
146-
auto surface = SkSurface::MakeRenderTarget(context_.get(), SkBudgeted::kNo,
147-
image_info, 0, nullptr);
148-
SurfaceFrame::SubmitCallback callback =
149-
[](const SurfaceFrame&, SkCanvas* canvas) -> bool { return true; };
150-
151-
return std::make_unique<SurfaceFrame>(std::move(surface), true,
152-
std::move(callback));
153-
}
154-
155-
GrContext* ShellTestPlatformViewVulkan::OffScreenSurface::GetContext() {
156-
return context_.get();
157-
}
158-
159-
SkMatrix ShellTestPlatformViewVulkan::OffScreenSurface::GetRootTransformation()
160-
const {
161-
SkMatrix matrix;
162-
matrix.reset();
163-
return matrix;
43+
// |GPUSurfaceVulkanDelegate|
44+
fml::RefPtr<vulkan::VulkanProcTable> ShellTestPlatformViewVulkan::vk() {
45+
return proc_table_;
16446
}
16547

16648
} // namespace testing

shell/common/shell_test_platform_view_vulkan.h

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77

88
#include "flutter/shell/common/shell_test_platform_view.h"
99
#include "flutter/shell/gpu/gpu_surface_vulkan_delegate.h"
10-
#include "flutter/vulkan/vulkan_application.h"
11-
#include "flutter/vulkan/vulkan_device.h"
1210

1311
namespace flutter {
1412
namespace testing {
1513

16-
class ShellTestPlatformViewVulkan : public ShellTestPlatformView {
14+
class ShellTestPlatformViewVulkan : public ShellTestPlatformView,
15+
public GPUSurfaceVulkanDelegate {
1716
public:
1817
ShellTestPlatformViewVulkan(PlatformView::Delegate& delegate,
1918
TaskRunners task_runners,
@@ -25,36 +24,6 @@ class ShellTestPlatformViewVulkan : public ShellTestPlatformView {
2524
void SimulateVSync() override;
2625

2726
private:
28-
class OffScreenSurface : public flutter::Surface {
29-
public:
30-
OffScreenSurface(fml::RefPtr<vulkan::VulkanProcTable> vk);
31-
32-
~OffScreenSurface() override;
33-
34-
// |Surface|
35-
bool IsValid() override;
36-
37-
// |Surface|
38-
std::unique_ptr<SurfaceFrame> AcquireFrame(const SkISize& size) override;
39-
40-
SkMatrix GetRootTransformation() const override;
41-
42-
// |Surface|
43-
GrContext* GetContext() override;
44-
45-
private:
46-
bool valid_;
47-
fml::RefPtr<vulkan::VulkanProcTable> vk_;
48-
std::unique_ptr<vulkan::VulkanApplication> application_;
49-
std::unique_ptr<vulkan::VulkanDevice> logical_device_;
50-
sk_sp<GrContext> context_;
51-
52-
bool CreateSkiaGrContext();
53-
bool CreateSkiaBackendContext(GrVkBackendContext* context);
54-
55-
FML_DISALLOW_COPY_AND_ASSIGN(OffScreenSurface);
56-
};
57-
5827
CreateVsyncWaiter create_vsync_waiter_;
5928

6029
std::shared_ptr<ShellTestVsyncClock> vsync_clock_;
@@ -70,6 +39,8 @@ class ShellTestPlatformViewVulkan : public ShellTestPlatformView {
7039
// |PlatformView|
7140
PointerDataDispatcherMaker GetDispatcherMaker() override;
7241

42+
// |GPUSurfaceVulkanDelegate|
43+
fml::RefPtr<vulkan::VulkanProcTable> vk() override;
7344

7445
FML_DISALLOW_COPY_AND_ASSIGN(ShellTestPlatformViewVulkan);
7546
};

testing/fuchsia/meta/fuchsia_test.cmx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@
99
],
1010
"services": [
1111
"fuchsia.accessibility.semantics.SemanticsManager",
12-
"fuchsia.process.Launcher",
13-
"fuchsia.deprecatedtimezone.Timezone",
14-
"fuchsia.netstack.Netstack",
15-
"fuchsia.vulkan.loader.Loader",
16-
"fuchsia.logger.LogSink",
17-
"fuchsia.tracing.provider.Registry"
12+
"fuchsia.process.Launcher"
1813
]
1914
}
2015
}

0 commit comments

Comments
 (0)