Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
compute_playground_test.h
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#ifndef FLUTTER_IMPELLER_PLAYGROUND_COMPUTE_PLAYGROUND_TEST_H_
6#define FLUTTER_IMPELLER_PLAYGROUND_COMPUTE_PLAYGROUND_TEST_H_
7
8#include <memory>
9
10#include "flutter/fml/macros.h"
11#include "flutter/fml/time/time_delta.h"
12#include "flutter/testing/testing.h"
16
17namespace impeller {
18
20 : public Playground,
21 public ::testing::TestWithParam<PlaygroundBackend> {
22 public:
24
26
27 void SetUp() override;
28
29 void TearDown() override;
30
31 // |Playground|
32 std::unique_ptr<fml::Mapping> OpenAssetAsMapping(
33 std::string asset_name) const override;
34
35 // |Playground|
36 std::string GetWindowTitle() const override;
37
38 template <typename T>
39 std::shared_ptr<DeviceBuffer> CreateHostVisibleDeviceBuffer(
40 const std::shared_ptr<Context>& context,
41 const std::string& label) {
43 desc.storage_mode = StorageMode::kHostVisible;
44 desc.size = sizeof(T);
45 auto buffer = context->GetResourceAllocator()->CreateBuffer(desc);
46 buffer->SetLabel(label);
47 return buffer;
48 }
49
50 private:
51 fml::TimeDelta start_time_;
52
54
55 ComputePlaygroundTest& operator=(const ComputePlaygroundTest&) = delete;
56};
57
58#define INSTANTIATE_COMPUTE_SUITE(playground) \
59 INSTANTIATE_TEST_SUITE_P( \
60 Compute, playground, \
61 ::testing::Values(PlaygroundBackend::kMetal, \
62 PlaygroundBackend::kVulkan), \
63 [](const ::testing::TestParamInfo<ComputePlaygroundTest::ParamType>& \
64 info) { return PlaygroundBackendToString(info.param); });
65
66} // namespace impeller
67
68#endif // FLUTTER_IMPELLER_PLAYGROUND_COMPUTE_PLAYGROUND_TEST_H_
std::shared_ptr< DeviceBuffer > CreateHostVisibleDeviceBuffer(const std::shared_ptr< Context > &context, const std::string &label)
std::string GetWindowTitle() const override
std::unique_ptr< fml::Mapping > OpenAssetAsMapping(std::string asset_name) const override
static const uint8_t buffer[]
#define T