Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
embedder_test_context_vulkan.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/shell/platform/embedder/tests/embedder_test_context_vulkan.h"
6
7#include <memory>
8#include <utility>
9
10#include "flutter/fml/logging.h"
11#include "flutter/shell/platform/embedder/tests/embedder_test_compositor_vulkan.h"
12#include "flutter/testing/test_vulkan_context.h"
13#include "flutter/testing/test_vulkan_surface.h"
14#include "flutter/vulkan/procs/vulkan_proc_table.h"
15#include "flutter/vulkan/vulkan_device.h"
17
18namespace flutter {
19namespace testing {
20
22 : EmbedderTestContext(std::move(assets_path)), surface_() {
23 vulkan_context_ = fml::MakeRefCounted<TestVulkanContext>();
24}
25
27
29 FML_CHECK(surface_size_.isEmpty());
30 surface_size_ = surface_size;
31 surface_ = TestVulkanSurface::Create(*vulkan_context_, surface_size_);
32}
33
35 return present_count_;
36}
37
39 return surface_->GetImage();
40}
41
44 [&]() { return surface_->GetSurfaceSnapshot(); });
45 present_count_++;
46 return true;
47}
48
52
54 FML_CHECK(!compositor_) << "Already set up a compositor in this context.";
55 FML_CHECK(surface_)
56 << "Set up the Vulkan surface before setting up a compositor.";
57 compositor_ = std::make_unique<EmbedderTestCompositorVulkan>(
58 surface_size_, vulkan_context_->GetGrDirectContext());
59}
60
62 void* user_data,
64 const char* name) {
65 auto proc_addr = reinterpret_cast<EmbedderTestContextVulkan*>(user_data)
66 ->vulkan_context_->vk_->GetInstanceProcAddr(
67 reinterpret_cast<VkInstance>(instance), name);
68 return reinterpret_cast<void*>(proc_addr);
69}
70
71} // namespace testing
72} // namespace flutter
static void * InstanceProcAddr(void *user_data, FlutterVulkanInstanceHandle instance, const char *name)
EmbedderTestContextType GetContextType() const override
std::unique_ptr< EmbedderTestCompositor > compositor_
void FireRootSurfacePresentCallbackIfPresent(const std::function< sk_sp< SkImage >(void)> &image_callback)
static std::unique_ptr< TestVulkanSurface > Create(const TestVulkanContext &context, const SkISize &surface_size)
void * FlutterVulkanInstanceHandle
Alias for VkInstance.
Definition embedder.h:706
VkInstance instance
Definition main.cc:48
sk_sp< SkImage > image
Definition examples.cpp:29
#define FML_CHECK(condition)
Definition logging.h:85
EGLSurface surface_
DEF_SWITCHES_START aot vmservice shared library name
Definition switches.h:32
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259
Definition ref_ptr.h:256
bool isEmpty() const
Definition SkSize.h:31