diff options
Diffstat (limited to 'gfx/skia/skia/include/sksl/DSLModifiers.h')
-rw-r--r-- | gfx/skia/skia/include/sksl/DSLModifiers.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/gfx/skia/skia/include/sksl/DSLModifiers.h b/gfx/skia/skia/include/sksl/DSLModifiers.h new file mode 100644 index 0000000000..c60b7b2c0c --- /dev/null +++ b/gfx/skia/skia/include/sksl/DSLModifiers.h @@ -0,0 +1,72 @@ +/* + * Copyright 2020 Google LLC + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SKSL_DSL_MODIFIERS +#define SKSL_DSL_MODIFIERS + +#include "include/core/SkSpan.h" +#include "include/private/SkSLModifiers.h" +#include "include/sksl/DSLLayout.h" + +namespace SkSL { + +namespace dsl { + +class DSLField; +class DSLType; + +enum Modifier { + kNo_Modifier = SkSL::Modifiers::kNo_Flag, + kConst_Modifier = SkSL::Modifiers::kConst_Flag, + kIn_Modifier = SkSL::Modifiers::kIn_Flag, + kOut_Modifier = SkSL::Modifiers::kOut_Flag, + kInOut_Modifier = SkSL::Modifiers::kIn_Flag | SkSL::Modifiers::kOut_Flag, + kUniform_Modifier = SkSL::Modifiers::kUniform_Flag, + kFlat_Modifier = SkSL::Modifiers::kFlat_Flag, + kNoPerspective_Modifier = SkSL::Modifiers::kNoPerspective_Flag, +}; + +class DSLModifiers { +public: + DSLModifiers(int flags = 0, Position pos = {}) + : DSLModifiers(DSLLayout(), flags, pos) {} + + DSLModifiers(DSLLayout layout, int flags = 0, Position pos = {}) + : fModifiers(layout.fSkSLLayout, flags) + , fPosition(pos) {} + + int& flags() { + return fModifiers.fFlags; + } + + const int& flags() const { + return fModifiers.fFlags; + } + + DSLLayout layout() const { + return DSLLayout(fModifiers.fLayout); + } + +private: + SkSL::Modifiers fModifiers; + Position fPosition; + + friend DSLType StructType(std::string_view name, + SkSpan<DSLField> fields, + bool interfaceBlock, + Position pos); + friend class DSLCore; + friend class DSLFunction; + friend class DSLType; + friend class DSLWriter; +}; + +} // namespace dsl + +} // namespace SkSL + +#endif |