Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
sksl
ir
SkSLLayout.h
Go to the documentation of this file.
1
/*
2
* Copyright 2016 Google Inc.
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 SKSL_LAYOUT
9
#define SKSL_LAYOUT
10
11
#include "
src/base/SkEnumBitMask.h
"
12
13
#include <string>
14
15
namespace
SkSL
{
16
17
class
Context
;
18
class
Position;
19
20
enum class
LayoutFlag
:
int
{
21
kNone
= 0,
22
kAll
= ~0,
23
24
kOriginUpperLeft
= 1 << 0,
25
kPushConstant
= 1 << 1,
26
kBlendSupportAllEquations
= 1 << 2,
27
kColor
= 1 << 3,
28
29
// These flags indicate if the qualifier appeared, regardless of the accompanying value.
30
kLocation
= 1 << 4,
31
kOffset
= 1 << 5,
32
kBinding
= 1 << 6,
33
kTexture
= 1 << 7,
34
kSampler
= 1 << 8,
35
kIndex
= 1 << 9,
36
kSet
= 1 << 10,
37
kBuiltin
= 1 << 11,
38
kInputAttachmentIndex
= 1 << 12,
39
40
// These flags indicate the backend type; only one at most can be set.
41
kVulkan
= 1 << 13,
42
kMetal
= 1 << 14,
43
kWebGPU
= 1 << 15,
44
kDirect3D
= 1 << 16,
45
46
kAllBackends
=
kVulkan
|
kMetal
|
kWebGPU
|
kDirect3D
,
47
48
// These flags indicate the pixel format; only one at most can be set.
49
// (https://www.khronos.org/opengl/wiki/Layout_Qualifier_(GLSL)#Image_formats)
50
kRGBA8
= 1 << 17,
51
kRGBA32F
= 1 << 18,
52
kR32F
= 1 << 19,
53
54
kAllPixelFormats
=
kRGBA8
|
kRGBA32F
|
kR32F
,
55
56
// The local invocation size of a compute program.
57
kLocalSizeX
= 1 << 20,
58
kLocalSizeY
= 1 << 21,
59
kLocalSizeZ
= 1 << 22,
60
};
61
62
}
// namespace SkSL
63
64
SK_MAKE_BITMASK_OPS
(
SkSL::LayoutFlag
);
65
66
namespace
SkSL
{
67
68
using
LayoutFlags
=
SkEnumBitMask<SkSL::LayoutFlag>
;
69
70
/**
71
* Represents a layout block appearing before a variable declaration, as in:
72
*
73
* layout (location = 0) int x;
74
*/
75
struct
Layout
{
76
Layout
(
LayoutFlags
flags
,
int
location,
int
offset
,
int
binding,
int
index,
int
set,
77
int
builtin
,
int
inputAttachmentIndex)
78
:
fFlags
(
flags
)
79
,
fLocation
(location)
80
,
fOffset
(
offset
)
81
,
fBinding
(binding)
82
,
fIndex
(index)
83
,
fSet
(set)
84
,
fBuiltin
(
builtin
)
85
,
fInputAttachmentIndex
(inputAttachmentIndex) {}
86
87
constexpr
Layout
() =
default
;
88
89
static
Layout
builtin
(
int
builtin
) {
90
Layout
result
;
91
result
.
fBuiltin
=
builtin
;
92
return
result
;
93
}
94
95
std::string
description
()
const
;
96
std::string
paddedDescription
()
const
;
97
98
/**
99
* Verifies that only permitted layout flags are included. Reports errors and returns false in
100
* the event of a violation.
101
*/
102
bool
checkPermittedLayout
(
const
Context
& context,
103
Position
pos
,
104
LayoutFlags
permittedLayoutFlags)
const
;
105
106
bool
operator==
(
const
Layout
& other)
const
;
107
108
bool
operator!=
(
const
Layout
& other)
const
{
109
return
!(*
this
== other);
110
}
111
112
LayoutFlags
fFlags
=
LayoutFlag::kNone
;
113
int
fLocation
= -1;
114
int
fOffset
= -1;
115
int
fBinding
= -1;
116
int
fTexture
= -1;
117
int
fSampler
= -1;
118
int
fIndex
= -1;
119
int
fSet
= -1;
120
// builtin comes from SPIR-V and identifies which particular builtin value this object
121
// represents.
122
int
fBuiltin
= -1;
123
// input_attachment_index comes from Vulkan/SPIR-V to connect a shader variable to the a
124
// corresponding attachment on the subpass in which the shader is being used.
125
int
fInputAttachmentIndex
= -1;
126
127
// The local invocation size dimensions of a compute program.
128
int
fLocalSizeX
= -1;
129
int
fLocalSizeY
= -1;
130
int
fLocalSizeZ
= -1;
131
};
132
133
}
// namespace SkSL
134
135
#endif
pos
SkPoint pos
Definition
ImageShaderTest.cpp:27
SkEnumBitMask.h
SK_MAKE_BITMASK_OPS
#define SK_MAKE_BITMASK_OPS(E)
Definition
SkEnumBitMask.h:68
SkEnumBitMask< SkSL::LayoutFlag >
SkSL::Context
Definition
SkSLContext.h:24
SkSL::Position
Definition
SkSLPosition.h:18
flags
FlutterSemanticsFlag flags
Definition
fl_accessible_node.cc:105
result
GAsyncResult * result
Definition
fl_text_input_plugin.cc:106
SkSL
Definition
SkCapabilities.h:15
SkSL::LayoutFlag
LayoutFlag
Definition
SkSLLayout.h:20
SkSL::LayoutFlag::kInputAttachmentIndex
@ kInputAttachmentIndex
SkSL::LayoutFlag::kSet
@ kSet
SkSL::LayoutFlag::kR32F
@ kR32F
SkSL::LayoutFlag::kTexture
@ kTexture
SkSL::LayoutFlag::kAll
@ kAll
SkSL::LayoutFlag::kNone
@ kNone
SkSL::LayoutFlag::kOffset
@ kOffset
SkSL::LayoutFlag::kMetal
@ kMetal
SkSL::LayoutFlag::kAllPixelFormats
@ kAllPixelFormats
SkSL::LayoutFlag::kLocalSizeZ
@ kLocalSizeZ
SkSL::LayoutFlag::kBinding
@ kBinding
SkSL::LayoutFlag::kLocalSizeX
@ kLocalSizeX
SkSL::LayoutFlag::kDirect3D
@ kDirect3D
SkSL::LayoutFlag::kLocalSizeY
@ kLocalSizeY
SkSL::LayoutFlag::kWebGPU
@ kWebGPU
SkSL::LayoutFlag::kVulkan
@ kVulkan
SkSL::LayoutFlag::kPushConstant
@ kPushConstant
SkSL::LayoutFlag::kLocation
@ kLocation
SkSL::LayoutFlag::kSampler
@ kSampler
SkSL::LayoutFlag::kRGBA8
@ kRGBA8
SkSL::LayoutFlag::kBuiltin
@ kBuiltin
SkSL::LayoutFlag::kAllBackends
@ kAllBackends
SkSL::LayoutFlag::kOriginUpperLeft
@ kOriginUpperLeft
SkSL::LayoutFlag::kColor
@ kColor
SkSL::LayoutFlag::kRGBA32F
@ kRGBA32F
SkSL::LayoutFlag::kBlendSupportAllEquations
@ kBlendSupportAllEquations
SkSL::ExpressionKind::kIndex
@ kIndex
offset
Point offset
Definition
stroke_path_geometry.cc:256
Context
Definition
SerialProcsTest.cpp:126
SkSL::Layout
Definition
SkSLLayout.h:75
SkSL::Layout::fFlags
LayoutFlags fFlags
Definition
SkSLLayout.h:112
SkSL::Layout::description
std::string description() const
Definition
SkSLLayout.cpp:97
SkSL::Layout::fSet
int fSet
Definition
SkSLLayout.h:119
SkSL::Layout::fBinding
int fBinding
Definition
SkSLLayout.h:115
SkSL::Layout::fLocalSizeY
int fLocalSizeY
Definition
SkSLLayout.h:129
SkSL::Layout::fIndex
int fIndex
Definition
SkSLLayout.h:118
SkSL::Layout::Layout
constexpr Layout()=default
SkSL::Layout::fSampler
int fSampler
Definition
SkSLLayout.h:117
SkSL::Layout::paddedDescription
std::string paddedDescription() const
Definition
SkSLLayout.cpp:19
SkSL::Layout::checkPermittedLayout
bool checkPermittedLayout(const Context &context, Position pos, LayoutFlags permittedLayoutFlags) const
Definition
SkSLLayout.cpp:105
SkSL::Layout::fOffset
int fOffset
Definition
SkSLLayout.h:114
SkSL::Layout::fInputAttachmentIndex
int fInputAttachmentIndex
Definition
SkSLLayout.h:125
SkSL::Layout::operator==
bool operator==(const Layout &other) const
Definition
SkSLLayout.cpp:182
SkSL::Layout::builtin
static Layout builtin(int builtin)
Definition
SkSLLayout.h:89
SkSL::Layout::fTexture
int fTexture
Definition
SkSLLayout.h:116
SkSL::Layout::Layout
Layout(LayoutFlags flags, int location, int offset, int binding, int index, int set, int builtin, int inputAttachmentIndex)
Definition
SkSLLayout.h:76
SkSL::Layout::fLocation
int fLocation
Definition
SkSLLayout.h:113
SkSL::Layout::operator!=
bool operator!=(const Layout &other) const
Definition
SkSLLayout.h:108
SkSL::Layout::fLocalSizeZ
int fLocalSizeZ
Definition
SkSLLayout.h:130
SkSL::Layout::fLocalSizeX
int fLocalSizeX
Definition
SkSLLayout.h:128
SkSL::Layout::fBuiltin
int fBuiltin
Definition
SkSLLayout.h:122
Generated on Fri Apr 26 2024 06:17:31 for Flutter Engine by
1.9.8