Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
impeller
playground
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"
13
#include "
impeller/core/device_buffer.h
"
14
#include "
impeller/geometry/scalar.h
"
15
#include "
impeller/playground/playground.h
"
16
17
namespace
impeller
{
18
19
class
ComputePlaygroundTest
20
:
public
Playground
,
21
public
::testing::TestWithParam<PlaygroundBackend> {
22
public
:
23
ComputePlaygroundTest
();
24
25
virtual
~ComputePlaygroundTest
();
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) {
42
DeviceBufferDescriptor
desc;
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
53
ComputePlaygroundTest
(
const
ComputePlaygroundTest
&) =
delete
;
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_
fml::TimeDelta
Definition
time_delta.h:29
impeller::ComputePlaygroundTest
Definition
compute_playground_test.h:21
impeller::ComputePlaygroundTest::CreateHostVisibleDeviceBuffer
std::shared_ptr< DeviceBuffer > CreateHostVisibleDeviceBuffer(const std::shared_ptr< Context > &context, const std::string &label)
Definition
compute_playground_test.h:39
impeller::ComputePlaygroundTest::TearDown
void TearDown() override
Definition
compute_playground_test.cc:34
impeller::ComputePlaygroundTest::ComputePlaygroundTest
ComputePlaygroundTest()
Definition
compute_playground_test.cc:12
impeller::ComputePlaygroundTest::~ComputePlaygroundTest
virtual ~ComputePlaygroundTest()
impeller::ComputePlaygroundTest::GetWindowTitle
std::string GetWindowTitle() const override
Definition
compute_playground_test.cc:51
impeller::ComputePlaygroundTest::OpenAssetAsMapping
std::unique_ptr< fml::Mapping > OpenAssetAsMapping(std::string asset_name) const override
Definition
compute_playground_test.cc:39
impeller::ComputePlaygroundTest::SetUp
void SetUp() override
Definition
compute_playground_test.cc:17
impeller::Playground
Definition
playground.h:50
buffer
static const uint8_t buffer[]
Definition
fl_pixel_buffer_texture_test.cc:44
device_buffer.h
impeller
Definition
texture.h:18
impeller::StorageMode::kHostVisible
@ kHostVisible
playground.h
T
#define T
Definition
precompiler.cc:65
scalar.h
impeller::DeviceBufferDescriptor
Definition
device_buffer_descriptor.h:14
Generated on Fri Apr 26 2024 06:14:11 for Flutter Engine by
1.9.8