Remove specific blend mode layout qualifiers
These were unused - we always enable the advanced blend equation
extension using "blend_support_all_equations" (if enabling the
extension is required at all).
Change-Id: I95fd6483ec54dfaf983290de95629fe0e86c22e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/373877
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
diff --git a/resources/sksl/glsl/LayoutQualifiers.sksl b/resources/sksl/glsl/LayoutQualifiers.sksl
index 13173e3..9ff07d1 100644
--- a/resources/sksl/glsl/LayoutQualifiers.sksl
+++ b/resources/sksl/glsl/LayoutQualifiers.sksl
@@ -1,18 +1,2 @@
layout(blend_support_all_equations) out;
-layout(blend_support_all_equations) out;
-layout(blend_support_multiply) out;
-layout(blend_support_screen) out;
-layout(blend_support_overlay) out;
-layout(blend_support_darken) out;
-layout(blend_support_lighten) out;
-layout(blend_support_colordodge) out;
-layout(blend_support_colorburn) out;
-layout(blend_support_hardlight) out;
-layout(blend_support_softlight) out;
-layout(blend_support_difference) out;
-layout(blend_support_exclusion) out;
-layout(blend_support_hsl_hue) out;
-layout(blend_support_hsl_saturation) out;
-layout(blend_support_hsl_color) out;
-layout(blend_support_hsl_luminosity) out;
void main() {}
diff --git a/src/gpu/GrShaderCaps.cpp b/src/gpu/GrShaderCaps.cpp
index 0a2ed9a..2f9c33b 100644
--- a/src/gpu/GrShaderCaps.cpp
+++ b/src/gpu/GrShaderCaps.cpp
@@ -95,12 +95,10 @@
"Not Supported",
"Automatic",
"General Enable",
- "Specific Enables",
};
static_assert(0 == kNotSupported_AdvBlendEqInteraction);
static_assert(1 == kAutomatic_AdvBlendEqInteraction);
static_assert(2 == kGeneralEnable_AdvBlendEqInteraction);
- static_assert(3 == kSpecificEnables_AdvBlendEqInteraction);
static_assert(SK_ARRAY_COUNT(kAdvBlendEqInteractionStr) == kLast_AdvBlendEqInteraction + 1);
writer->appendBool("FB Fetch Support", fFBFetchSupport);
diff --git a/src/gpu/GrShaderCaps.h b/src/gpu/GrShaderCaps.h
index 5444057..54df723 100644
--- a/src/gpu/GrShaderCaps.h
+++ b/src/gpu/GrShaderCaps.h
@@ -31,9 +31,8 @@
kNotSupported_AdvBlendEqInteraction, //<! No _blend_equation_advanced extension
kAutomatic_AdvBlendEqInteraction, //<! No interaction required
kGeneralEnable_AdvBlendEqInteraction, //<! layout(blend_support_all_equations) out
- kSpecificEnables_AdvBlendEqInteraction, //<! Specific layout qualifiers per equation
- kLast_AdvBlendEqInteraction = kSpecificEnables_AdvBlendEqInteraction
+ kLast_AdvBlendEqInteraction = kGeneralEnable_AdvBlendEqInteraction
};
GrShaderCaps(const GrContextOptions&);
@@ -97,10 +96,6 @@
return fAdvBlendEqInteraction >= kGeneralEnable_AdvBlendEqInteraction;
}
- bool mustEnableSpecificAdvBlendEqs() const {
- return fAdvBlendEqInteraction == kSpecificEnables_AdvBlendEqInteraction;
- }
-
bool mustDeclareFragmentShaderOutput() const { return fGLSLGeneration > k110_GrGLSLGeneration; }
bool usesPrecisionModifiers() const { return fUsesPrecisionModifiers; }
diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp
index 7735f18..c331860 100644
--- a/src/gpu/effects/GrCustomXfermode.cpp
+++ b/src/gpu/effects/GrCustomXfermode.cpp
@@ -127,7 +127,7 @@
key |= caps.advBlendEqInteraction();
static_assert(GrShaderCaps::kLast_AdvBlendEqInteraction < 4);
}
- if (!xp.hasHWBlendEquation() || caps.mustEnableSpecificAdvBlendEqs()) {
+ if (!xp.hasHWBlendEquation()) {
key |= (int)xp.mode() << 3;
}
b->add32(key);
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index ceef385..4901685 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -1102,8 +1102,6 @@
} else if (ctxInfo.hasExtension("GL_KHR_blend_equation_advanced") && layoutQualifierSupport) {
fBlendEquationSupport = kAdvanced_BlendEquationSupport;
shaderCaps->fAdvBlendEqInteraction = GrShaderCaps::kGeneralEnable_AdvBlendEqInteraction;
- // TODO: Use kSpecificEnables_AdvBlendEqInteraction if "blend_support_all_equations" is
- // slow on a particular platform.
}
}
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
index fe12fbd..bb9741d 100644
--- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
@@ -15,48 +15,6 @@
const char* GrGLSLFragmentShaderBuilder::kDstColorName = "_dstColor";
-static const char* specific_layout_qualifier_name(GrBlendEquation equation) {
- SkASSERT(GrBlendEquationIsAdvanced(equation));
-
- static const char* kLayoutQualifierNames[] = {
- "blend_support_screen",
- "blend_support_overlay",
- "blend_support_darken",
- "blend_support_lighten",
- "blend_support_colordodge",
- "blend_support_colorburn",
- "blend_support_hardlight",
- "blend_support_softlight",
- "blend_support_difference",
- "blend_support_exclusion",
- "blend_support_multiply",
- "blend_support_hsl_hue",
- "blend_support_hsl_saturation",
- "blend_support_hsl_color",
- "blend_support_hsl_luminosity"
- };
- return kLayoutQualifierNames[equation - kFirstAdvancedGrBlendEquation];
-
- static_assert(0 == kScreen_GrBlendEquation - kFirstAdvancedGrBlendEquation);
- static_assert(1 == kOverlay_GrBlendEquation - kFirstAdvancedGrBlendEquation);
- static_assert(2 == kDarken_GrBlendEquation - kFirstAdvancedGrBlendEquation);
- static_assert(3 == kLighten_GrBlendEquation - kFirstAdvancedGrBlendEquation);
- static_assert(4 == kColorDodge_GrBlendEquation - kFirstAdvancedGrBlendEquation);
- static_assert(5 == kColorBurn_GrBlendEquation - kFirstAdvancedGrBlendEquation);
- static_assert(6 == kHardLight_GrBlendEquation - kFirstAdvancedGrBlendEquation);
- static_assert(7 == kSoftLight_GrBlendEquation - kFirstAdvancedGrBlendEquation);
- static_assert(8 == kDifference_GrBlendEquation - kFirstAdvancedGrBlendEquation);
- static_assert(9 == kExclusion_GrBlendEquation - kFirstAdvancedGrBlendEquation);
- static_assert(10 == kMultiply_GrBlendEquation - kFirstAdvancedGrBlendEquation);
- static_assert(11 == kHSLHue_GrBlendEquation - kFirstAdvancedGrBlendEquation);
- static_assert(12 == kHSLSaturation_GrBlendEquation - kFirstAdvancedGrBlendEquation);
- static_assert(13 == kHSLColor_GrBlendEquation - kFirstAdvancedGrBlendEquation);
- static_assert(14 == kHSLLuminosity_GrBlendEquation - kFirstAdvancedGrBlendEquation);
- // There's an illegal GrBlendEquation at the end there, hence the -1.
- static_assert(SK_ARRAY_COUNT(kLayoutQualifierNames) ==
- kGrBlendEquationCnt - kFirstAdvancedGrBlendEquation - 1);
-}
-
uint8_t GrGLSLFragmentShaderBuilder::KeyForSurfaceOrigin(GrSurfaceOrigin origin) {
SkASSERT(kTopLeft_GrSurfaceOrigin == origin || kBottomLeft_GrSurfaceOrigin == origin);
return origin + 1;
@@ -223,16 +181,9 @@
void GrGLSLFragmentShaderBuilder::enableAdvancedBlendEquationIfNeeded(GrBlendEquation equation) {
SkASSERT(GrBlendEquationIsAdvanced(equation));
- const GrShaderCaps& caps = *fProgramBuilder->shaderCaps();
- if (!caps.mustEnableAdvBlendEqs()) {
- return;
- }
-
- this->addFeature(1 << kBlendEquationAdvanced_GLSLPrivateFeature,
- "GL_KHR_blend_equation_advanced");
- if (caps.mustEnableSpecificAdvBlendEqs()) {
- this->addLayoutQualifier(specific_layout_qualifier_name(equation), kOut_InterfaceQualifier);
- } else {
+ if (fProgramBuilder->shaderCaps()->mustEnableAdvBlendEqs()) {
+ this->addFeature(1 << kBlendEquationAdvanced_GLSLPrivateFeature,
+ "GL_KHR_blend_equation_advanced");
this->addLayoutQualifier("blend_support_all_equations", kOut_InterfaceQualifier);
}
}
diff --git a/src/sksl/SkSLIRGenerator.cpp b/src/sksl/SkSLIRGenerator.cpp
index 7177046..ee6e1c2 100644
--- a/src/sksl/SkSLIRGenerator.cpp
+++ b/src/sksl/SkSLIRGenerator.cpp
@@ -88,7 +88,6 @@
CAP(noperspectiveInterpolationSupport);
CAP(externalTextureSupport);
CAP(mustEnableAdvBlendEqs);
- CAP(mustEnableSpecificAdvBlendEqs);
CAP(mustDeclareFragmentShaderOutput);
CAP(mustDoOpBetweenFloorAndAbs);
CAP(mustGuardDivisionEvenAfterExplicitZeroCheck);
diff --git a/src/sksl/SkSLParser.cpp b/src/sksl/SkSLParser.cpp
index ca32e56..832546d 100644
--- a/src/sksl/SkSLParser.cpp
+++ b/src/sksl/SkSLParser.cpp
@@ -96,21 +96,6 @@
TOKEN(ORIGIN_UPPER_LEFT, "origin_upper_left");
TOKEN(OVERRIDE_COVERAGE, "override_coverage");
TOKEN(BLEND_SUPPORT_ALL_EQUATIONS, "blend_support_all_equations");
- TOKEN(BLEND_SUPPORT_MULTIPLY, "blend_support_multiply");
- TOKEN(BLEND_SUPPORT_SCREEN, "blend_support_screen");
- TOKEN(BLEND_SUPPORT_OVERLAY, "blend_support_overlay");
- TOKEN(BLEND_SUPPORT_DARKEN, "blend_support_darken");
- TOKEN(BLEND_SUPPORT_LIGHTEN, "blend_support_lighten");
- TOKEN(BLEND_SUPPORT_COLORDODGE, "blend_support_colordodge");
- TOKEN(BLEND_SUPPORT_COLORBURN, "blend_support_colorburn");
- TOKEN(BLEND_SUPPORT_HARDLIGHT, "blend_support_hardlight");
- TOKEN(BLEND_SUPPORT_SOFTLIGHT, "blend_support_softlight");
- TOKEN(BLEND_SUPPORT_DIFFERENCE, "blend_support_difference");
- TOKEN(BLEND_SUPPORT_EXCLUSION, "blend_support_exclusion");
- TOKEN(BLEND_SUPPORT_HSL_HUE, "blend_support_hsl_hue");
- TOKEN(BLEND_SUPPORT_HSL_SATURATION, "blend_support_hsl_saturation");
- TOKEN(BLEND_SUPPORT_HSL_COLOR, "blend_support_hsl_color");
- TOKEN(BLEND_SUPPORT_HSL_LUMINOSITY, "blend_support_hsl_luminosity");
TOKEN(PUSH_CONSTANT, "push_constant");
TOKEN(POINTS, "points");
TOKEN(LINES, "lines");
@@ -957,51 +942,6 @@
case LayoutToken::BLEND_SUPPORT_ALL_EQUATIONS:
flags |= Layout::kBlendSupportAllEquations_Flag;
break;
- case LayoutToken::BLEND_SUPPORT_MULTIPLY:
- flags |= Layout::kBlendSupportMultiply_Flag;
- break;
- case LayoutToken::BLEND_SUPPORT_SCREEN:
- flags |= Layout::kBlendSupportScreen_Flag;
- break;
- case LayoutToken::BLEND_SUPPORT_OVERLAY:
- flags |= Layout::kBlendSupportOverlay_Flag;
- break;
- case LayoutToken::BLEND_SUPPORT_DARKEN:
- flags |= Layout::kBlendSupportDarken_Flag;
- break;
- case LayoutToken::BLEND_SUPPORT_LIGHTEN:
- flags |= Layout::kBlendSupportLighten_Flag;
- break;
- case LayoutToken::BLEND_SUPPORT_COLORDODGE:
- flags |= Layout::kBlendSupportColorDodge_Flag;
- break;
- case LayoutToken::BLEND_SUPPORT_COLORBURN:
- flags |= Layout::kBlendSupportColorBurn_Flag;
- break;
- case LayoutToken::BLEND_SUPPORT_HARDLIGHT:
- flags |= Layout::kBlendSupportHardLight_Flag;
- break;
- case LayoutToken::BLEND_SUPPORT_SOFTLIGHT:
- flags |= Layout::kBlendSupportSoftLight_Flag;
- break;
- case LayoutToken::BLEND_SUPPORT_DIFFERENCE:
- flags |= Layout::kBlendSupportDifference_Flag;
- break;
- case LayoutToken::BLEND_SUPPORT_EXCLUSION:
- flags |= Layout::kBlendSupportExclusion_Flag;
- break;
- case LayoutToken::BLEND_SUPPORT_HSL_HUE:
- flags |= Layout::kBlendSupportHSLHue_Flag;
- break;
- case LayoutToken::BLEND_SUPPORT_HSL_SATURATION:
- flags |= Layout::kBlendSupportHSLSaturation_Flag;
- break;
- case LayoutToken::BLEND_SUPPORT_HSL_COLOR:
- flags |= Layout::kBlendSupportHSLColor_Flag;
- break;
- case LayoutToken::BLEND_SUPPORT_HSL_LUMINOSITY:
- flags |= Layout::kBlendSupportHSLLuminosity_Flag;
- break;
case LayoutToken::PUSH_CONSTANT:
flags |= Layout::kPushConstant_Flag;
break;
diff --git a/src/sksl/SkSLParser.h b/src/sksl/SkSLParser.h
index bb663ed..ceccec8 100644
--- a/src/sksl/SkSLParser.h
+++ b/src/sksl/SkSLParser.h
@@ -39,21 +39,6 @@
ORIGIN_UPPER_LEFT,
OVERRIDE_COVERAGE,
BLEND_SUPPORT_ALL_EQUATIONS,
- BLEND_SUPPORT_MULTIPLY,
- BLEND_SUPPORT_SCREEN,
- BLEND_SUPPORT_OVERLAY,
- BLEND_SUPPORT_DARKEN,
- BLEND_SUPPORT_LIGHTEN,
- BLEND_SUPPORT_COLORDODGE,
- BLEND_SUPPORT_COLORBURN,
- BLEND_SUPPORT_HARDLIGHT,
- BLEND_SUPPORT_SOFTLIGHT,
- BLEND_SUPPORT_DIFFERENCE,
- BLEND_SUPPORT_EXCLUSION,
- BLEND_SUPPORT_HSL_HUE,
- BLEND_SUPPORT_HSL_SATURATION,
- BLEND_SUPPORT_HSL_COLOR,
- BLEND_SUPPORT_HSL_LUMINOSITY,
PUSH_CONSTANT,
POINTS,
LINES,
diff --git a/src/sksl/SkSLUtil.h b/src/sksl/SkSLUtil.h
index 77d66a1..822b51ff 100644
--- a/src/sksl/SkSLUtil.h
+++ b/src/sksl/SkSLUtil.h
@@ -144,11 +144,6 @@
return fMustEnableAdvBlendEqs;
}
- bool fMustEnableSpecificAdvBlendEqs = false;
- bool mustEnableSpecificAdvBlendEqs() const {
- return fMustEnableSpecificAdvBlendEqs;
- }
-
bool fCanUseAnyFunctionInShader = true;
bool canUseAnyFunctionInShader() const {
return fCanUseAnyFunctionInShader;
diff --git a/src/sksl/ir/SkSLLayout.h b/src/sksl/ir/SkSLLayout.h
index d122712..4900c5e 100644
--- a/src/sksl/ir/SkSLLayout.h
+++ b/src/sksl/ir/SkSLLayout.h
@@ -24,23 +24,8 @@
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,
- kTracked_Flag = 1 << 19,
- kSRGBUnpremul_Flag = 1 << 20,
+ kTracked_Flag = 1 << 4,
+ kSRGBUnpremul_Flag = 1 << 5,
};
enum Primitive {
@@ -272,51 +257,6 @@
if (fFlags & kBlendSupportAllEquations_Flag) {
result += separator() + "blend_support_all_equations";
}
- if (fFlags & kBlendSupportMultiply_Flag) {
- result += separator() + "blend_support_multiply";
- }
- if (fFlags & kBlendSupportScreen_Flag) {
- result += separator() + "blend_support_screen";
- }
- if (fFlags & kBlendSupportOverlay_Flag) {
- result += separator() + "blend_support_overlay";
- }
- if (fFlags & kBlendSupportDarken_Flag) {
- result += separator() + "blend_support_darken";
- }
- if (fFlags & kBlendSupportLighten_Flag) {
- result += separator() + "blend_support_lighten";
- }
- if (fFlags & kBlendSupportColorDodge_Flag) {
- result += separator() + "blend_support_colordodge";
- }
- if (fFlags & kBlendSupportColorBurn_Flag) {
- result += separator() + "blend_support_colorburn";
- }
- if (fFlags & kBlendSupportHardLight_Flag) {
- result += separator() + "blend_support_hardlight";
- }
- if (fFlags & kBlendSupportSoftLight_Flag) {
- result += separator() + "blend_support_softlight";
- }
- if (fFlags & kBlendSupportDifference_Flag) {
- result += separator() + "blend_support_difference";
- }
- if (fFlags & kBlendSupportExclusion_Flag) {
- result += separator() + "blend_support_exclusion";
- }
- if (fFlags & kBlendSupportHSLHue_Flag) {
- result += separator() + "blend_support_hsl_hue";
- }
- if (fFlags & kBlendSupportHSLSaturation_Flag) {
- result += separator() + "blend_support_hsl_saturation";
- }
- if (fFlags & kBlendSupportHSLColor_Flag) {
- result += separator() + "blend_support_hsl_color";
- }
- if (fFlags & kBlendSupportHSLLuminosity_Flag) {
- result += separator() + "blend_support_hsl_luminosity";
- }
if (fFlags & kPushConstant_Flag) {
result += separator() + "push_constant";
}
diff --git a/tests/sksl/glsl/LayoutQualifiers.glsl b/tests/sksl/glsl/LayoutQualifiers.glsl
index a7547ae..817100e 100644
--- a/tests/sksl/glsl/LayoutQualifiers.glsl
+++ b/tests/sksl/glsl/LayoutQualifiers.glsl
@@ -1,20 +1,4 @@
layout (blend_support_all_equations) out ;
-layout (blend_support_all_equations) out ;
-layout (blend_support_multiply) out ;
-layout (blend_support_screen) out ;
-layout (blend_support_overlay) out ;
-layout (blend_support_darken) out ;
-layout (blend_support_lighten) out ;
-layout (blend_support_colordodge) out ;
-layout (blend_support_colorburn) out ;
-layout (blend_support_hardlight) out ;
-layout (blend_support_softlight) out ;
-layout (blend_support_difference) out ;
-layout (blend_support_exclusion) out ;
-layout (blend_support_hsl_hue) out ;
-layout (blend_support_hsl_saturation) out ;
-layout (blend_support_hsl_color) out ;
-layout (blend_support_hsl_luminosity) out ;
void main() {
}