diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2017-11-27 13:12:30 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-27 18:39:26 +0000 |
commit | 39204fd5dd289864973d151fc08d6f7985cecbf8 (patch) | |
tree | fc8b17451acac4135b149ecc697a98f9d678a96d /src/sksl/ir/SkSLLayout.h | |
parent | a475afd840fde33183dd3d0c91eb71d371435ceb (diff) |
added SkSL support for all blend mode layouts
Bug: skia:
Change-Id: Id39c068b15d0ae51520dc2169cdbf21402a43f69
Reviewed-on: https://skia-review.googlesource.com/76200
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/sksl/ir/SkSLLayout.h')
-rw-r--r-- | src/sksl/ir/SkSLLayout.h | 146 |
1 files changed, 108 insertions, 38 deletions
diff --git a/src/sksl/ir/SkSLLayout.h b/src/sksl/ir/SkSLLayout.h index 9c4fcb1889..3082b34133 100644 --- a/src/sksl/ir/SkSLLayout.h +++ b/src/sksl/ir/SkSLLayout.h @@ -19,6 +19,28 @@ namespace SkSL { * layout (location = 0) int x; */ struct Layout { + enum Flag { + kOriginUpperLeft_Flag = 1 << 0, + kOverrideCoverage_Flag = 1 << 1, + kPushConstant_Flag = 1 << 2, + kBlendSupportAllEquations_Flag = 1 << 3, + kBlendSupportMultiply_Flag = 1 << 4, + kBlendSupportScreen_Flag = 1 << 5, + kBlendSupportOverlay_Flag = 1 << 6, + kBlendSupportDarken_Flag = 1 << 7, + kBlendSupportLighten_Flag = 1 << 8, + kBlendSupportColorDodge_Flag = 1 << 9, + kBlendSupportColorBurn_Flag = 1 << 10, + kBlendSupportHardLight_Flag = 1 << 11, + kBlendSupportSoftLight_Flag = 1 << 12, + kBlendSupportDifference_Flag = 1 << 13, + kBlendSupportExclusion_Flag = 1 << 14, + kBlendSupportHSLHue_Flag = 1 << 15, + kBlendSupportHSLSaturation_Flag = 1 << 16, + kBlendSupportHSLColor_Flag = 1 << 17, + kBlendSupportHSLLuminosity_Flag = 1 << 18 + }; + enum Primitive { kUnspecified_Primitive = -1, kPoints_Primitive, @@ -97,22 +119,18 @@ struct Layout { return false; } - Layout(int location, int offset, int binding, int index, int set, int builtin, - int inputAttachmentIndex, bool originUpperLeft, bool overrideCoverage, - bool blendSupportAllEquations, Format format, bool pushconstant, Primitive primitive, - int maxVertices, int invocations, String when, Key key, StringFragment ctype) - : fLocation(location) + Layout(int flags, int location, int offset, int binding, int index, int set, int builtin, + int inputAttachmentIndex, Format format, Primitive primitive, int maxVertices, + int invocations, String when, Key key, StringFragment ctype) + : fFlags(flags) + , fLocation(location) , fOffset(offset) , fBinding(binding) , fIndex(index) , fSet(set) , fBuiltin(builtin) , fInputAttachmentIndex(inputAttachmentIndex) - , fOriginUpperLeft(originUpperLeft) - , fOverrideCoverage(overrideCoverage) - , fBlendSupportAllEquations(blendSupportAllEquations) , fFormat(format) - , fPushConstant(pushconstant) , fPrimitive(primitive) , fMaxVertices(maxVertices) , fInvocations(invocations) @@ -121,18 +139,15 @@ struct Layout { , fCType(ctype) {} Layout() - : fLocation(-1) + : fFlags(0) + , fLocation(-1) , fOffset(-1) , fBinding(-1) , fIndex(-1) , fSet(-1) , fBuiltin(-1) , fInputAttachmentIndex(-1) - , fOriginUpperLeft(false) - , fOverrideCoverage(false) - , fBlendSupportAllEquations(false) , fFormat(Format::kUnspecified) - , fPushConstant(false) , fPrimitive(kUnspecified_Primitive) , fMaxVertices(-1) , fInvocations(-1) @@ -169,23 +184,83 @@ struct Layout { result += separator + "input_attachment_index = " + to_string(fBuiltin); separator = ", "; } - if (fOriginUpperLeft) { + if (Format::kUnspecified != fFormat) { + result += separator + FormatToStr(fFormat); + separator = ", "; + } + if (fFlags & kOriginUpperLeft_Flag) { result += separator + "origin_upper_left"; separator = ", "; } - if (fOverrideCoverage) { + if (fFlags & kOverrideCoverage_Flag) { result += separator + "override_coverage"; separator = ", "; } - if (fBlendSupportAllEquations) { + if (fFlags & kBlendSupportAllEquations_Flag) { result += separator + "blend_support_all_equations"; separator = ", "; } - if (Format::kUnspecified != fFormat) { - result += separator + FormatToStr(fFormat); + if (fFlags & kBlendSupportMultiply_Flag) { + result += separator + "blend_support_multiply"; + separator = ", "; + } + if (fFlags & kBlendSupportScreen_Flag) { + result += separator + "blend_support_screen"; + separator = ", "; + } + if (fFlags & kBlendSupportOverlay_Flag) { + result += separator + "blend_support_overlay"; + separator = ", "; + } + if (fFlags & kBlendSupportDarken_Flag) { + result += separator + "blend_support_darken"; + separator = ", "; + } + if (fFlags & kBlendSupportLighten_Flag) { + result += separator + "blend_support_lighten"; + separator = ", "; + } + if (fFlags & kBlendSupportColorDodge_Flag) { + result += separator + "blend_support_colordodge"; + separator = ", "; + } + if (fFlags & kBlendSupportColorBurn_Flag) { + result += separator + "blend_support_colorburn"; + separator = ", "; + } + if (fFlags & kBlendSupportHardLight_Flag) { + result += separator + "blend_support_hardlight"; + separator = ", "; + } + if (fFlags & kBlendSupportSoftLight_Flag) { + result += separator + "blend_support_softlight"; + separator = ", "; + } + if (fFlags & kBlendSupportDifference_Flag) { + result += separator + "blend_support_difference"; + separator = ", "; + } + if (fFlags & kBlendSupportExclusion_Flag) { + result += separator + "blend_support_exclusion"; + separator = ", "; + } + if (fFlags & kBlendSupportHSLHue_Flag) { + result += separator + "blend_support_hsl_hue"; + separator = ", "; + } + if (fFlags & kBlendSupportHSLSaturation_Flag) { + result += separator + "blend_support_hsl_saturation"; + separator = ", "; + } + if (fFlags & kBlendSupportHSLColor_Flag) { + result += separator + "blend_support_hsl_color"; + separator = ", "; + } + if (fFlags & kBlendSupportHSLLuminosity_Flag) { + result += separator + "blend_support_hsl_luminosity"; separator = ", "; } - if (fPushConstant) { + if (fFlags & kPushConstant_Flag) { result += separator + "push_constant"; separator = ", "; } @@ -240,26 +315,25 @@ struct Layout { } bool operator==(const Layout& other) const { - return fLocation == other.fLocation && - fOffset == other.fOffset && - fBinding == other.fBinding && - fIndex == other.fIndex && - fSet == other.fSet && - fBuiltin == other.fBuiltin && - fInputAttachmentIndex == other.fInputAttachmentIndex && - fOriginUpperLeft == other.fOriginUpperLeft && - fOverrideCoverage == other.fOverrideCoverage && - fBlendSupportAllEquations == other.fBlendSupportAllEquations && - fFormat == other.fFormat && - fPrimitive == other.fPrimitive && - fMaxVertices == other.fMaxVertices && - fInvocations == other.fInvocations; + return fFlags == other.fFlags && + fLocation == other.fLocation && + fOffset == other.fOffset && + fBinding == other.fBinding && + fIndex == other.fIndex && + fSet == other.fSet && + fBuiltin == other.fBuiltin && + fInputAttachmentIndex == other.fInputAttachmentIndex && + fFormat == other.fFormat && + fPrimitive == other.fPrimitive && + fMaxVertices == other.fMaxVertices && + fInvocations == other.fInvocations; } bool operator!=(const Layout& other) const { return !(*this == other); } + int fFlags; int fLocation; int fOffset; int fBinding; @@ -271,11 +345,7 @@ struct Layout { // input_attachment_index comes from Vulkan/SPIR-V to connect a shader variable to the a // corresponding attachment on the subpass in which the shader is being used. int fInputAttachmentIndex; - bool fOriginUpperLeft; - bool fOverrideCoverage; - bool fBlendSupportAllEquations; Format fFormat; - bool fPushConstant; Primitive fPrimitive; int fMaxVertices; int fInvocations; |