• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 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 SKSL_DSL_MODIFIERS
9 #define SKSL_DSL_MODIFIERS
10 
11 #include "include/private/SkSLModifiers.h"
12 #include "include/private/SkTArray.h"
13 #include "include/sksl/DSLLayout.h"
14 
15 namespace SkSL {
16 
17 namespace dsl {
18 
19 class DSLField;
20 class DSLType;
21 
22 enum Modifier {
23     kNo_Modifier            =       0,
24     kConst_Modifier         = 1 <<  0,
25     kIn_Modifier            = 1 <<  1,
26     kOut_Modifier           = 1 <<  2,
27     kInOut_Modifier         = kIn_Modifier | kOut_Modifier,
28     kUniform_Modifier       = 1 <<  3,
29     kFlat_Modifier          = 1 <<  4,
30     kNoPerspective_Modifier = 1 <<  5,
31 };
32 
33 class DSLModifiers {
34 public:
35     DSLModifiers(int flags = 0)
DSLModifiers(DSLLayout (),flags)36         : DSLModifiers(DSLLayout(), flags) {}
37 
38     DSLModifiers(DSLLayout layout, int flags = 0)
39         : fModifiers(layout.fSkSLLayout, flags) {}
40 
flags()41     int flags() const {
42         return fModifiers.fFlags;
43     }
44 
45 private:
46     SkSL::Modifiers fModifiers;
47 
48     friend DSLType Struct(const char* name, SkTArray<DSLField> fields);
49     friend class DSLFunction;
50     friend class DSLVar;
51     friend class DSLWriter;
52 };
53 
54 } // namespace dsl
55 
56 } // namespace SkSL
57 
58 #endif
59