This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Enable shell_unittests on Fuchsia with Vulkan dependencies. #16376
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// 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 "flutter/shell/common/shell_test_platform_view_vulkan.h" | ||
#include "flutter/shell/gpu/gpu_surface_vulkan.h" | ||
|
||
namespace flutter { | ||
namespace testing { | ||
|
||
ShellTestPlatformViewVulkan::ShellTestPlatformViewVulkan( | ||
PlatformView::Delegate& delegate, | ||
TaskRunners task_runners, | ||
std::shared_ptr<ShellTestVsyncClock> vsync_clock, | ||
CreateVsyncWaiter create_vsync_waiter) | ||
: ShellTestPlatformView(delegate, std::move(task_runners)), | ||
create_vsync_waiter_(std::move(create_vsync_waiter)), | ||
vsync_clock_(vsync_clock), | ||
proc_table_(fml::MakeRefCounted<vulkan::VulkanProcTable>()) {} | ||
|
||
ShellTestPlatformViewVulkan::~ShellTestPlatformViewVulkan() = default; | ||
|
||
std::unique_ptr<VsyncWaiter> ShellTestPlatformViewVulkan::CreateVSyncWaiter() { | ||
return create_vsync_waiter_(); | ||
} | ||
|
||
void ShellTestPlatformViewVulkan::SimulateVSync() { | ||
vsync_clock_->SimulateVSync(); | ||
} | ||
|
||
// |PlatformView| | ||
std::unique_ptr<Surface> ShellTestPlatformViewVulkan::CreateRenderingSurface() { | ||
return std::make_unique<GPUSurfaceVulkan>(this, nullptr, true); | ||
} | ||
|
||
// |PlatformView| | ||
PointerDataDispatcherMaker ShellTestPlatformViewVulkan::GetDispatcherMaker() { | ||
return [](DefaultPointerDataDispatcher::Delegate& delegate) { | ||
return std::make_unique<SmoothPointerDataDispatcher>(delegate); | ||
}; | ||
} | ||
|
||
// |GPUSurfaceVulkanDelegate| | ||
fml::RefPtr<vulkan::VulkanProcTable> ShellTestPlatformViewVulkan::vk() { | ||
return proc_table_; | ||
} | ||
|
||
} // namespace testing | ||
} // namespace flutter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// 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. | ||
|
||
#ifndef FLUTTER_SHELL_COMMON_SHELL_TEST_PLATFORM_VIEW_VULKAN_H_ | ||
#define FLUTTER_SHELL_COMMON_SHELL_TEST_PLATFORM_VIEW_VULKAN_H_ | ||
|
||
#include "flutter/shell/common/shell_test_platform_view.h" | ||
#include "flutter/shell/gpu/gpu_surface_vulkan_delegate.h" | ||
|
||
namespace flutter { | ||
namespace testing { | ||
|
||
class ShellTestPlatformViewVulkan : public ShellTestPlatformView, | ||
public GPUSurfaceVulkanDelegate { | ||
public: | ||
ShellTestPlatformViewVulkan(PlatformView::Delegate& delegate, | ||
TaskRunners task_runners, | ||
std::shared_ptr<ShellTestVsyncClock> vsync_clock, | ||
CreateVsyncWaiter create_vsync_waiter); | ||
|
||
~ShellTestPlatformViewVulkan() override; | ||
|
||
void SimulateVSync() override; | ||
|
||
private: | ||
CreateVsyncWaiter create_vsync_waiter_; | ||
|
||
std::shared_ptr<ShellTestVsyncClock> vsync_clock_; | ||
|
||
fml::RefPtr<vulkan::VulkanProcTable> proc_table_; | ||
|
||
// |PlatformView| | ||
std::unique_ptr<Surface> CreateRenderingSurface() override; | ||
|
||
// |PlatformView| | ||
std::unique_ptr<VsyncWaiter> CreateVSyncWaiter() override; | ||
|
||
// |PlatformView| | ||
PointerDataDispatcherMaker GetDispatcherMaker() override; | ||
|
||
// |GPUSurfaceVulkanDelegate| | ||
fml::RefPtr<vulkan::VulkanProcTable> vk() override; | ||
|
||
FML_DISALLOW_COPY_AND_ASSIGN(ShellTestPlatformViewVulkan); | ||
}; | ||
|
||
} // namespace testing | ||
} // namespace flutter | ||
|
||
#endif // FLUTTER_SHELL_COMMON_SHELL_TEST_PLATFORM_VIEW_VULKAN_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even when using Vulkan, we never have to link with libVulkan.so. So we will never get into a situation where where the test harness fails to link if Vulkan is not used. The exact same logic applies for OpenGL as well. As written, we will need two variants of the test runner for OpenGL and Vulkan. I suggest we have just one which is both OpenGL and Vulkan capable. At runtime, if the test or fixture asks use to initialize an unsupported client rendering API, we can skip the test or trip an assertion.
This way, all platforms will be Vulkan capable and their ability to actually exercise the Vulkan backend will depend on whether that platform can provide a libVulkan.so for proc resolution.
While we will always use the libVulkan.so from SwiftShader, this scheme should give us the flexibility to run with an alternative Vulkan implemenation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spoke offline about this - tried this but due to compilation issues this can't be done easily right now, and it's not worth blocking enabling these tests for this. Filed flutter/flutter#50298 detailing the problems.