Flutter Engine
The Flutter Engine
MutableTextureState.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 Google LLC.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef skgpu_MutableTextureState_DEFINED
9#define skgpu_MutableTextureState_DEFINED
10
14
15#include <cstddef>
16
17namespace skgpu {
18enum class BackendApi : unsigned int;
19class MutableTextureStateData;
20
21/**
22 * Since Skia and clients can both modify gpu textures and their connected state, Skia needs a way
23 * for clients to inform us if they have modifiend any of this state. In order to not need setters
24 * for every single API and state, we use this class to be a generic wrapper around all the mutable
25 * state. This class is used for calls that inform Skia of these texture/image state changes by the
26 * client as well as for requesting state changes to be done by Skia. The backend specific state
27 * that is wrapped by this class are located in files like:
28 * - include/gpu/vk/VulkanMutableTextureState.h
29 */
31public:
34
36
37 MutableTextureState& operator=(const MutableTextureState& that);
38
39 void set(const MutableTextureState& that);
40
41 BackendApi backend() const { return fBackend; }
42
43 // Returns true if the backend mutable state has been initialized.
44 bool isValid() const { return fIsValid; }
45
46private:
49 // Size determined by looking at the MutableTextureStateData subclasses, then
50 // guessing-and-checking. Compiler will complain if this is too small - in that case,
51 // just increase the number.
52 inline constexpr static size_t kMaxSubclassSize = 16;
54
55 template <typename StateData>
56 MutableTextureState(BackendApi api, const StateData& data) : fBackend(api), fIsValid(true) {
57 fStateData.emplace<StateData>(data);
58 }
59
60 AnyStateData fStateData;
61
62 BackendApi fBackend;
63 bool fIsValid;
64};
65
66} // namespace skgpu
67
68#endif // skgpu_MutableTextureState_DEFINED
#define SK_API
Definition: SkAPI.h:35
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
Definition: switches.h:76
Definition: GpuTools.h:21
BackendApi
Definition: GpuTypes.h:22
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63