707d31578c
Prior to this change, we were creating the SkSL variable and declaration immediately on DSLVar creation. This causes problems with function parameters, which are sometimes supposed to be tagged SK_MAIN_COORDS_BUILTIN. If we have already created the variable and inserted it into the symbol table, then by the time we determine the variable is supposed to be SK_MAIN_COORDS_BUILTIN, it is too late to modify the (now-const) variable. We are not yet doing this tagging, but refactoring the creation in this fashion paves the way to making it possible. Change-Id: I031170502c5e7c1fff5ecfac01bea470ff4e61ce Reviewed-on: https://skia-review.googlesource.com/c/skia/+/389216 Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: John Stiles <johnstiles@google.com>
53 lines
1.0 KiB
C++
53 lines
1.0 KiB
C++
/*
|
|
* 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/private/SkSLModifiers.h"
|
|
#include "include/private/SkTArray.h"
|
|
|
|
namespace SkSL {
|
|
|
|
namespace dsl {
|
|
|
|
class DSLField;
|
|
class DSLType;
|
|
|
|
enum Modifier {
|
|
kNo_Modifier = 0,
|
|
kConst_Modifier = 1 << 0,
|
|
kIn_Modifier = 1 << 1,
|
|
kOut_Modifier = 1 << 2,
|
|
kInOut_Modifier = kIn_Modifier | kOut_Modifier,
|
|
kUniform_Modifier = 1 << 3,
|
|
kFlat_Modifier = 1 << 4,
|
|
kNoPerspective_Modifier = 1 << 5,
|
|
};
|
|
|
|
class DSLModifiers {
|
|
public:
|
|
|
|
DSLModifiers() {}
|
|
|
|
DSLModifiers(int flags)
|
|
: fModifiers(SkSL::Layout(), flags) {}
|
|
|
|
private:
|
|
SkSL::Modifiers fModifiers;
|
|
|
|
friend DSLType Struct(const char* name, SkTArray<DSLField> fields);
|
|
friend class DSLVar;
|
|
friend class DSLWriter;
|
|
};
|
|
|
|
} // namespace dsl
|
|
|
|
} // namespace SkSL
|
|
|
|
#endif
|