Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
include
gpu
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
11
#include "
include/core/SkRefCnt.h
"
12
#include "
include/core/SkTypes.h
"
13
#include "
include/private/base/SkAnySubclass.h
"
14
15
#include <cstddef>
16
17
namespace
skgpu
{
18
enum class
BackendApi
:
unsigned
int
;
19
class
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
*/
30
class
SK_API
MutableTextureState
:
public
SkRefCnt
{
31
public
:
32
MutableTextureState
();
33
~MutableTextureState
()
override
;
34
35
MutableTextureState
(
const
MutableTextureState
& that);
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
46
private
:
47
friend
class
MutableTextureStateData
;
48
friend
class
MutableTextureStatePriv
;
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;
53
using
AnyStateData
=
SkAnySubclass<MutableTextureStateData, kMaxSubclassSize>
;
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
SK_API
#define SK_API
Definition
SkAPI.h:35
SkAnySubclass.h
SkRefCnt.h
SkTypes.h
int
Type::kYUV Type::kRGBA() int(0.7 *637)
SkAnySubclass< MutableTextureStateData, kMaxSubclassSize >
SkRefCnt
Definition
SkRefCnt.h:119
skgpu::MutableTextureStateData
Definition
MutableTextureStatePriv.h:17
skgpu::MutableTextureStatePriv
Definition
MutableTextureStatePriv.h:35
skgpu::MutableTextureState
Definition
MutableTextureState.h:30
skgpu::MutableTextureState::isValid
bool isValid() const
Definition
MutableTextureState.h:44
skgpu::MutableTextureState::~MutableTextureState
~MutableTextureState() override
skgpu::MutableTextureState::backend
BackendApi backend() const
Definition
MutableTextureState.h:41
skgpu
Definition
GpuTools.h:21
skgpu::BackendApi
BackendApi
Definition
GpuTypes.h:22
true
true
Definition
verylargebitmap.cpp:163
Generated on Fri Apr 26 2024 06:16:11 for Flutter Engine by
1.9.8